cc on macOS warns with -Wgnu-folding-constant when compiling eapol_test

Heikki Vatiainen hvn at radiatorsoftware.com
Mon Jul 27 13:47:10 PDT 2026


On the latest macOS the compiler that comes with Xcode now triggers a
warning, which is treated as an error, when compiling eapol_test.

System information:

 % uname -a
Darwin hostname 25.5.0 Darwin Kernel Version 25.5.0: Tue Jun  9
22:28:17 PDT 2026; root:xnu-12377.121.10~1/RELEASE_ARM64_T8142 arm64

% ls -l =cc
-rwxr-xr-x  78 root  wheel  118928 Jun 25 05:29 /usr/bin/cc

% cc --version
Apple clang version 21.0.0 (clang-2100.1.1.101)
Target: arm64-apple-darwin25.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Running 'V=1 make eapol_test' shows that this is the CC that's used.

The warning that is turned to an error, because of -Werror that's set
with eapol_test compilation, is:

../src/utils/os_unix.c:828:14: error: variable length array folded to
constant array as an extension [-Werror,-Wgnu-folding-constant]
  828 |                 char *argv[MAX_ARG + 1];
      |                            ^~~~~~~~~~~
1 error generated.

The code is:

    826                 const int MAX_ARG = 30;
    827                 char *_program, *_arg, *pos;
    828                 char *argv[MAX_ARG + 1];

It appears that a const qualified integer is no longer sufficient for
this compiler. An anonymous enum, for example, 'enum { MAX_ARG = 30
};', or a #define seems to work as a replacement.

File src/utils/os_internal.c also has a similar MAX_ARG construct but
that doesn't get compiled on macOS.

--
Heikki Vatiainen
hvn at radiatorsoftware.com



More information about the Hostap mailing list