Skip to content
This repository has been archived by the owner on May 18, 2024. It is now read-only.

Commit

Permalink
aliasType __int128_t/__uint128_t
Browse files Browse the repository at this point in the history
  • Loading branch information
xushiwei committed Sep 30, 2023
1 parent a24eeaa commit 8aa376b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 21 deletions.
43 changes: 23 additions & 20 deletions cl/blockctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -502,27 +502,27 @@ func (p *bfType) String() string {
}

/*
func (p *blockCtx) initCTypes() {
pkg := p.pkg.Types
scope := pkg.Scope()
p.tyI128 = ctypes.NotImpl
p.tyU128 = ctypes.NotImpl
c := p.pkg.Import("github.com/goplus/c2go/clang")
aliasType(scope, pkg, "__int128", p.tyI128)
aliasType(scope, pkg, "void", ctypes.Void)
aliasCType(scope, pkg, "char", c, "Char")
aliasCType(scope, pkg, "float", c, "Float")
aliasCType(scope, pkg, "double", c, "Double")
aliasCType(scope, pkg, "_Bool", c, "Bool")
decl_builtin(p)
}
func (p *blockCtx) initCTypes() {
pkg := p.pkg.Types
scope := pkg.Scope()
p.tyI128 = ctypes.NotImpl
p.tyU128 = ctypes.NotImpl
c := p.pkg.Import("github.com/goplus/c2go/clang")
aliasType(scope, pkg, "__int128", p.tyI128)
aliasType(scope, pkg, "void", ctypes.Void)
aliasCType(scope, pkg, "char", c, "Char")
aliasCType(scope, pkg, "float", c, "Float")
aliasCType(scope, pkg, "double", c, "Double")
aliasCType(scope, pkg, "_Bool", c, "Bool")
decl_builtin(p)
}
func aliasCType(scope *types.Scope, pkg *types.Package, name string, c *gox.PkgRef, cname string) {
aliasType(scope, pkg, name, c.Ref(cname).Type())
}
func aliasCType(scope *types.Scope, pkg *types.Package, name string, c *gox.PkgRef, cname string) {
aliasType(scope, pkg, name, c.Ref(cname).Type())
}
*/
func (p *blockCtx) initCTypes() {
pkg := p.pkg.Types
Expand All @@ -531,6 +531,9 @@ func (p *blockCtx) initCTypes() {
p.tyU128 = ctypes.NotImpl

aliasType(scope, pkg, "__int128", p.tyI128)
aliasType(scope, pkg, "__int128_t", p.tyI128)
aliasType(scope, pkg, "__uint128_t", p.tyU128)

aliasType(scope, pkg, "void", ctypes.Void)

aliasType(scope, pkg, "char", types.Typ[types.Int8])
Expand Down
2 changes: 1 addition & 1 deletion cl/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ func compileFunc(ctx *blockCtx, fn *ast.Node) {
ast.AlwaysInlineAttr, ast.WarnUnusedResultAttr, ast.NoThrowAttr, ast.NoInlineAttr, ast.AllocSizeAttr,
ast.NonNullAttr, ast.ConstAttr, ast.PureAttr, ast.GNUInlineAttr, ast.ReturnsTwiceAttr, ast.NoSanitizeAttr,
ast.RestrictAttr, ast.MSAllocatorAttr, ast.VisibilityAttr, ast.C11NoReturnAttr, ast.StrictFPAttr,
ast.AllocAlignAttr, ast.DisableTailCallsAttr:
ast.AllocAlignAttr, ast.DisableTailCallsAttr, ast.FormatArgAttr:
default:
log.Panicln("compileFunc: unknown kind =", item.Kind)
}
Expand Down
1 change: 1 addition & 0 deletions clang/ast/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const (
DeprecatedAttr Kind = "DeprecatedAttr"
BuiltinAttr Kind = "BuiltinAttr"
FormatAttr Kind = "FormatAttr"
FormatArgAttr Kind = "FormatArgAttr"
ColdAttr Kind = "ColdAttr"
ConstAttr Kind = "ConstAttr"
PureAttr Kind = "PureAttr"
Expand Down

0 comments on commit 8aa376b

Please sign in to comment.