<preamble>
#line 1 "not-declared"
- void __cgo_f_xxx_1(void) { typeof(foo) *__cgo_undefined__; }
+ void __cgo_f_xxx_1(void) { __typeof__(foo) *__cgo_undefined__; }
#line 1 "not-type"
void __cgo_f_xxx_2(void) { foo *__cgo_undefined__; }
#line 1 "not-const"
void __cgo_f_xxx_3(void) { enum { __cgo_undefined__ = (foo)*1 }; }
#line 2 "not-declared"
- void __cgo_f_xxx_1(void) { typeof(bar) *__cgo_undefined__; }
+ void __cgo_f_xxx_1(void) { __typeof__(bar) *__cgo_undefined__; }
#line 2 "not-type"
void __cgo_f_xxx_2(void) { bar *__cgo_undefined__; }
#line 2 "not-const"
and c6 are constants, it generates:
<preamble>
- typeof(t1) *__cgo__1;
- typeof(v2) *__cgo__2;
- typeof(v3) *__cgo__3;
- typeof(c4) *__cgo__4;
+ __typeof__(t1) *__cgo__1;
+ __typeof__(v2) *__cgo__2;
+ __typeof__(v3) *__cgo__3;
+ __typeof__(c4) *__cgo__4;
enum { __cgo_enum__4 = c4 };
- typeof(c5) *__cgo__5;
+ __typeof__(c5) *__cgo__5;
enum { __cgo_enum__5 = c5 };
- typeof(c6) *__cgo__6;
+ __typeof__(c6) *__cgo__6;
enum { __cgo_enum__6 = c6 };
long long __cgo_debug_data[] = {
// For each name, we generate these lines, where xxx is the index in toSniff plus one.
//
// #line xxx "not-declared"
- // void __cgo_f_xxx_1(void) { typeof(name) *__cgo_undefined__; }
+ // void __cgo_f_xxx_1(void) { __typeof__(name) *__cgo_undefined__; }
// #line xxx "not-type"
// void __cgo_f_xxx_2(void) { name *__cgo_undefined__; }
// #line xxx "not-const"
for i, n := range names {
fmt.Fprintf(&b, "#line %d \"not-declared\"\n"+
- "void __cgo_f_%d_1(void) { typeof(%s) *__cgo_undefined__; }\n"+
+ "void __cgo_f_%d_1(void) { __typeof__(%s) *__cgo_undefined__; }\n"+
"#line %d \"not-type\"\n"+
"void __cgo_f_%d_2(void) { %s *__cgo_undefined__; }\n"+
"#line %d \"not-const\"\n"+
// for symbols in the object file, so it is not enough to print the
// preamble and hope the symbols we care about will be there.
// Instead, emit
- // typeof(names[i]) *__cgo__i;
+ // __typeof__(names[i]) *__cgo__i;
// for each entry in names and then dereference the type we
// learn for __cgo__i.
var b bytes.Buffer
b.WriteString(f.Preamble)
b.WriteString(builtinProlog)
for i, n := range names {
- fmt.Fprintf(&b, "typeof(%s) *__cgo__%d;\n", n.C, i)
+ fmt.Fprintf(&b, "__typeof__(%s) *__cgo__%d;\n", n.C, i)
if n.Kind == "const" {
fmt.Fprintf(&b, "enum { __cgo_enum__%d = %s };\n", i, n.C)
}
// the input.
func (p *Package) gccCmd() []string {
c := append(p.gccBaseCmd(),
- "-Wno-all", // no warnings
+ "-w", // no warnings
"-Wno-error", // warnings are not errors
"-o"+gccTmp(), // write object to tmp
"-gdwarf-2", // generate DWARF v2 debugging symbols
sub := c.Type(dt.Type, pos)
t.Align = sub.Align
gt.Elt = sub.Go
- t.C.Set("typeof(%s[%d])", sub.C, dt.Count)
+ t.C.Set("__typeof__(%s[%d])", sub.C, dt.Count)
case *dwarf.BoolType:
t.Go = c.bool
case "class", "union":
t.Go = c.Opaque(t.Size)
if t.C.Empty() {
- t.C.Set("typeof(unsigned char[%d])", t.Size)
+ t.C.Set("__typeof__(unsigned char[%d])", t.Size)
}
t.Align = 1 // TODO: should probably base this on field alignment.
typedef[name.Name] = t