skeeto / w64devkit

Portable C and C++ Development Kit for x64 (and x86) Windows
The Unlicense
2.66k stars 185 forks source link

No GCC warnings while using -pedantic, =stdc99 and strnlen() #136

Closed not-kaz closed 3 weeks ago

not-kaz commented 3 weeks ago

While using -Wall, -Wextra, -pedantic/-pedantic-errors and std=c99, expected behavior when using strnlen() would be a warning but it compiles without issue.

skeeto commented 3 weeks ago

Yup, this is an upstream issue with Mingw-w64. Non-standard declarations in standard headers are not behind preprocessor conditions to hide them in such cases. (In general this sort of detail isn't so consistent outside of the Linux ecosystem.) I imagine there are some difficulties with doing so in conjunction with non-standard headers. If this was fixed, as of GCC 14 this wouldn't even be a warning but an error.

Unfortunately not much I can do in w64devkit aside from maintaining a huge patch to fix up the headers. (Besides, I personally don't think it's that important, and so not worth much effort.)

not-kaz commented 3 weeks ago

Fair enough, it's definitely not worth that kind of hassle. Thank you for the great explanation.