[release-branch.go1.10] 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

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>
(cherry picked from commit 6f4dc1ccf9735013fdb7cd044bda29d19bebb906)

Change-Id: Ia9e7fced5f0ae43fdad05c03ce14d37f23ff984c
Reviewed-on: https://go-review.googlesource.com/c/160779
Run-TryBot: Brad Fitzpatrick <bradfitz@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 396ff0df0a
commit ad7c32dc3b

View File

@ -744,6 +744,8 @@ 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.
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")
@ -1339,6 +1341,9 @@ __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. */
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
#pragma GCC diagnostic ignored "-Wpragmas"
#pragma GCC diagnostic ignored "-Waddress-of-packed-member"