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

Jouni Malinen j at w1.fi
Tue Jul 28 07:16:55 PDT 2026


On Mon, Jul 27, 2026 at 11:47:10PM +0300, Heikki Vatiainen wrote:
> On the latest macOS the compiler that comes with Xcode now triggers a
> warning, which is treated as an error, when compiling eapol_test.

> Apple clang version 21.0.0 (clang-2100.1.1.101)

> ../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];

>     826                 const int MAX_ARG = 30;
>     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.

That's a bit unfortunate, but well, it is is easy to work around this
with #define for now at the location that is included in macOS-relevant
areas, so:
https://git.w1.fi/cgit/hostap/commit/?id=c2e5b9b8891b6c7d7025a32c9092814928adf74a

-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list