From 9153a3ef059a37796dceea555785b695ecbd4189 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Thu, 7 Mar 2019 08:33:01 +0100 Subject: [PATCH] cmd/cgo: adjust comment about ignored pragma warnings The warnings are not strictly tied to FreeBSD but to the clang version. People could still be building with an old version of clang even if not on FreeBSD. The -Wpragmas and -Waddress-of-packed-member warnings were introduced in clang 4.0, so also adjust the comment accordingly. This was discussed as part of CL 160777 which introduced these comments. Updates #27619 Change-Id: I4988ffd08797dcc72cdc264d4abd20a114f70473 Reviewed-on: https://go-review.googlesource.com/c/go/+/165800 Run-TryBot: Tobias Klauser TryBot-Result: Gobot Gobot Reviewed-by: Yuval Pavel Zholkover Reviewed-by: Ian Lance Taylor --- src/cmd/cgo/out.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/cmd/cgo/out.go b/src/cmd/cgo/out.go index bb0d016fa5..d00c990d63 100644 --- a/src/cmd/cgo/out.go +++ b/src/cmd/cgo/out.go @@ -777,8 +777,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. - // remove as part of #27619 (all: drop support for FreeBSD 10). + // The pragmas and address-of-packed-member are only recognized as + // warning groups in clang 4.0+, 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") @@ -1480,10 +1480,11 @@ __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). */ - +/* + We use packed structs, but they are always aligned. + The pragmas and address-of-packed-member are only recognized as warning + groups in clang 4.0+, 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