From 4ae9e7f1667d0a7df157b47d9d2d1f4a3c67849d Mon Sep 17 00:00:00 2001 From: Yuval Pavel Zholkover Date: Fri, 1 Feb 2019 13:51:31 +0200 Subject: [PATCH] [release-branch.go1.11] 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 TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor (cherry picked from commit 6f4dc1ccf9735013fdb7cd044bda29d19bebb906) Change-Id: Ie78d552ea6494fe3c4059847b26c2a6e206f9515 Reviewed-on: https://go-review.googlesource.com/c/160780 Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- src/cmd/cgo/out.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cmd/cgo/out.go b/src/cmd/cgo/out.go index bbed5d598f..1c36b80088 100644 --- a/src/cmd/cgo/out.go +++ b/src/cmd/cgo/out.go @@ -741,6 +741,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") @@ -1345,6 +1347,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" -- 2.48.1