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 <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Yuval Pavel Zholkover <paulzhol@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Tobias Klauser 2019-03-07 08:33:01 +01:00 committed by Tobias Klauser
parent 055f16a9e9
commit 9153a3ef05

View file

@ -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"