]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/cgo/internal/test: use (syntactic) constant for C array bound
authorCherry Mui <cherryyz@google.com>
Sat, 2 Aug 2025 22:13:19 +0000 (18:13 -0400)
committerCherry Mui <cherryyz@google.com>
Mon, 4 Aug 2025 16:11:25 +0000 (09:11 -0700)
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 <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
src/cmd/cgo/internal/test/test.go

index 844b2dd42c8cbf1a14bbe9c1db1bf8ce5772cd74..fb4a8250a2666f98ead6ac2ca08e083efb5bb753 100644 (file)
@@ -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++) {