1
0
mirror of https://github.com/golang/go synced 2024-11-23 10:50:09 -07:00

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 #29962
Update #27619

Change-Id: I78264ac5d8d17eeae89a982e89aac988eb22b286
Reviewed-on: https://go-review.googlesource.com/c/160777
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Yuval Pavel Zholkover 2019-02-01 13:51:31 +02:00 committed by Ian Lance Taylor
parent faf187fb8e
commit 6f4dc1ccf9

View File

@ -777,6 +777,9 @@ func (p *Package) writeExports(fgo2, fm, fgcc, fgcch io.Writer) {
fmt.Fprintf(fgcc, "#include \"_cgo_export.h\"\n\n")
// We use packed structs, but they are always aligned.
// The pragmas and address-of-packed-member are not recognized as warning groups in clang 3.4.1, so ignore unknown pragmas first.
// remove as part of #27619 (all: drop support for FreeBSD 10).
fmt.Fprintf(fgcc, "#pragma GCC diagnostic ignored \"-Wunknown-pragmas\"\n")
fmt.Fprintf(fgcc, "#pragma GCC diagnostic ignored \"-Wpragmas\"\n")
fmt.Fprintf(fgcc, "#pragma GCC diagnostic ignored \"-Waddress-of-packed-member\"\n")
@ -1478,6 +1481,10 @@ __cgo_size_assert(double, 8)
extern char* _cgo_topofstack(void);
/* We use packed structs, but they are always aligned. */
/* The pragmas and address-of-packed-member are not recognized as warning groups in clang 3.4.1, so ignore unknown pragmas first. */
/* remove as part of #27619 (all: drop support for FreeBSD 10). */
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
#pragma GCC diagnostic ignored "-Wpragmas"
#pragma GCC diagnostic ignored "-Waddress-of-packed-member"