Skip to content

Commit da59c01

Browse files
paulzholnebulabox
authored andcommitted
cmd/cgo: ignore unrecognized GCC warning group pragmas
CL 159859 causes build failure with old clang versions (3.4.1) on FreeBSD 10.3/10.4. Update golang#29962 Update golang#27619 Change-Id: I78264ac5d8d17eeae89a982e89aac988eb22b286 Reviewed-on: https://go-review.googlesource.com/c/160777 Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent a960df7 commit da59c01

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/cmd/cgo/out.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,9 @@ func (p *Package) writeExports(fgo2, fm, fgcc, fgcch io.Writer) {
777777
fmt.Fprintf(fgcc, "#include \"_cgo_export.h\"\n\n")
778778

779779
// We use packed structs, but they are always aligned.
780+
// The pragmas and address-of-packed-member are not recognized as warning groups in clang 3.4.1, so ignore unknown pragmas first.
781+
// remove as part of #27619 (all: drop support for FreeBSD 10).
782+
fmt.Fprintf(fgcc, "#pragma GCC diagnostic ignored \"-Wunknown-pragmas\"\n")
780783
fmt.Fprintf(fgcc, "#pragma GCC diagnostic ignored \"-Wpragmas\"\n")
781784
fmt.Fprintf(fgcc, "#pragma GCC diagnostic ignored \"-Waddress-of-packed-member\"\n")
782785

@@ -1478,6 +1481,10 @@ __cgo_size_assert(double, 8)
14781481
extern char* _cgo_topofstack(void);
14791482
14801483
/* We use packed structs, but they are always aligned. */
1484+
/* The pragmas and address-of-packed-member are not recognized as warning groups in clang 3.4.1, so ignore unknown pragmas first. */
1485+
/* remove as part of #27619 (all: drop support for FreeBSD 10). */
1486+
1487+
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
14811488
#pragma GCC diagnostic ignored "-Wpragmas"
14821489
#pragma GCC diagnostic ignored "-Waddress-of-packed-member"
14831490

0 commit comments

Comments
 (0)