Skip to content

Commit 9153a3e

Browse files
committed
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Yuval Pavel Zholkover <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 055f16a commit 9153a3e

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/cmd/cgo/out.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -777,8 +777,8 @@ func (p *Package) writeExports(fgo2, fm, fgcc, fgcch io.Writer) {
777777
fmt.Fprintf(fgcc, "#include \"_cgo_export.h\"\n\n")
778778

779779
// We use packed structs, but they are always aligned.
780-
// The pragmas and address-of-packed-member are not recognized as warning groups in clang 3.4.1, so ignore unknown pragmas first.
781-
// remove as part of #27619 (all: drop support for FreeBSD 10).
780+
// The pragmas and address-of-packed-member are only recognized as
781+
// warning groups in clang 4.0+, so ignore unknown pragmas first.
782782
fmt.Fprintf(fgcc, "#pragma GCC diagnostic ignored \"-Wunknown-pragmas\"\n")
783783
fmt.Fprintf(fgcc, "#pragma GCC diagnostic ignored \"-Wpragmas\"\n")
784784
fmt.Fprintf(fgcc, "#pragma GCC diagnostic ignored \"-Waddress-of-packed-member\"\n")
@@ -1480,10 +1480,11 @@ __cgo_size_assert(double, 8)
14801480
14811481
extern char* _cgo_topofstack(void);
14821482
1483-
/* We use packed structs, but they are always aligned. */
1484-
/* The pragmas and address-of-packed-member are not recognized as warning groups in clang 3.4.1, so ignore unknown pragmas first. */
1485-
/* remove as part of #27619 (all: drop support for FreeBSD 10). */
1486-
1483+
/*
1484+
We use packed structs, but they are always aligned.
1485+
The pragmas and address-of-packed-member are only recognized as warning
1486+
groups in clang 4.0+, so ignore unknown pragmas first.
1487+
*/
14871488
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
14881489
#pragma GCC diagnostic ignored "-Wpragmas"
14891490
#pragma GCC diagnostic ignored "-Waddress-of-packed-member"

0 commit comments

Comments
 (0)