mity / acutest

Simple header-only C/C++ unit testing facility.
MIT License
346 stars 96 forks source link

Warning `warning: variable length array folded to constant array as an extension` on Clang 10 #67

Closed johnoneil closed 3 years ago

johnoneil commented 3 years ago

Using this header and liking its simplicity and usability. Saved me a lot of time.

Seeing a warning when building C language tests with clang 10, with general warnings enabled.

I will probably silence this in the short term, but it looks like a fix wouldn't be too hard. I think.

clang -Iinclude -pedantic -Wall -Wextra -g -O0 -D_DEBUG_ xxx...
In file included from xxx.c:3:
include/acutest.h:1598:14: warning: variable length array folded to constant array as an extension [-Wgnu-folding-constant]
    char buf[256+OVERLAP+1];

clang --version
clang version 10.0.0-4ubuntu1 
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
mity commented 3 years ago

I'm not sitting at a Linux box to try it right now, but hopefully the fix is clear enough not to break anything.

johnoneil commented 3 years ago

I can confirm this quietens the warning for my configuration.