Commit 3819907a authored by Shenghou Ma's avatar Shenghou Ma Committed by Minux Ma

cmd/cgo: detect misuse of generated _cgo_export.h

Fixes #9742.

Change-Id: Ifedf7ff9465bc49534b708d414c8e435ee9ce6cd
Reviewed-on: https://go-review.googlesource.com/3970Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent 8581d48c
...@@ -636,7 +636,7 @@ func (p *Package) writeExports(fgo2, fm io.Writer) { ...@@ -636,7 +636,7 @@ func (p *Package) writeExports(fgo2, fm io.Writer) {
fgcc := creat(*objDir + "_cgo_export.c") fgcc := creat(*objDir + "_cgo_export.c")
fgcch := creat(*objDir + "_cgo_export.h") fgcch := creat(*objDir + "_cgo_export.h")
fmt.Fprintf(fgcch, "/* Created by cgo - DO NOT EDIT. */\n") fmt.Fprintf(fgcch, "/* Created by cgo - DO NOT EDIT. */\n/* This file is arch-specific. */\n")
fmt.Fprintf(fgcch, "%s\n", p.Preamble) fmt.Fprintf(fgcch, "%s\n", p.Preamble)
fmt.Fprintf(fgcch, "%s\n", p.gccExportHeaderProlog()) fmt.Fprintf(fgcch, "%s\n", p.gccExportHeaderProlog())
...@@ -1310,6 +1310,10 @@ typedef double GoFloat64; ...@@ -1310,6 +1310,10 @@ typedef double GoFloat64;
typedef __complex float GoComplex64; typedef __complex float GoComplex64;
typedef __complex double GoComplex128; typedef __complex double GoComplex128;
// static assertion to make sure the file is being used on architecture
// at least with matching size of GoInt.
typedef char _check_for_GOINTBITS_bit_pointer_matching_GoInt[sizeof(void*)==GOINTBITS/8 ? 1:-1];
typedef struct { char *p; GoInt n; } GoString; typedef struct { char *p; GoInt n; } GoString;
typedef void *GoMap; typedef void *GoMap;
typedef void *GoChan; typedef void *GoChan;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment