From: Cherry Mui Date: Sat, 2 Aug 2025 22:13:19 +0000 (-0400) Subject: cmd/cgo/internal/test: use (syntactic) constant for C array bound X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=4b6cbc377f9b3d2598b0d30a37c9cf3797ba6e12;p=gostls13.git cmd/cgo/internal/test: use (syntactic) constant for C array bound A test in C has an array bound defined as a "const int", which is technically a variable. The new version of C compiler in Xcode 26 beta emits a warning "variable length array folded to constant array as an extension" for this (as an error since we build the test with -Werror). Work around this by using an enum, which is syntactically a constant. Change-Id: Icfa943f293f6eac8f41d0615da40c126330d7d11 Reviewed-on: https://go-review.googlesource.com/c/go/+/692877 LUCI-TryBot-Result: Go LUCI Reviewed-by: Michael Pratt --- diff --git a/src/cmd/cgo/internal/test/test.go b/src/cmd/cgo/internal/test/test.go index 844b2dd42c..fb4a8250a2 100644 --- a/src/cmd/cgo/internal/test/test.go +++ b/src/cmd/cgo/internal/test/test.go @@ -245,7 +245,7 @@ static void *thread(void *p) { return NULL; } void testSendSIG() { - const int N = 20; + enum { N = 20 }; int i; pthread_t tid[N]; for (i = 0; i < N; i++) {