On 20.03.2025 21:05, Martin Storsjö wrote:
On Thu, 20 Mar 2025, Pali Rohár wrote:

Hello, I started getting new compile warnings during compilation of
mingw-w64 runtime.

In file included from math/modfl.c:6:
.../mingw-w64-headers/crt/fenv.h:64:39: warning: ‘__mingw_fe_dfl_env’ initialized and declared ‘extern’
extern const __MINGW_SELECTANY fenv_t __mingw_fe_dfl_env = { 0, 0 };
                                      ^~~~~~~~~~~~~~~~~~
.../mingw-w64-headers/crt/fenv.h:72:39: warning: ‘__mingw_fe_pc64_env’ initialized and declared ‘extern’ extern const __MINGW_SELECTANY fenv_t __mingw_fe_pc64_env = { 0x3f3f003f, 0 };
                                      ^~~~~~~~~~~~~~~~~~~
.../mingw-w64-headers/crt/fenv.h:76:39: warning: ‘__mingw_fe_pc53_env’ initialized and declared ‘extern’ extern const __MINGW_SELECTANY fenv_t __mingw_fe_pc53_env = { 0x3f3f103f, 0 };
                                      ^~~~~~~~~~~~~~~~~~~

To make this clearer and more actionable, let's repeat a couple relevant bits of context here:

By default, both GCC and Clang ignore and suppress warnings in files in what they consider "system header" directories. When most people build mingw-w64-crt using what would be considered the default way to build it - by installing mingw-w64-headers into the toolchain's system header directory, then building mingw-w64-crt so that it finds those headers implicitly, these warnings are not visible.

Pali builds his mingw-w64-crt in a way that the compiler doesn't consider mingw-w64-headers as system headers, and thus gets warnings that nobody else runs into.


Hmm, this is supposed to work with __declspec(selectany). Clang and GCC for C++ get it right, it's only GCC that complains.


We have more similar declarations with EXTERN_C DECLSPEC_SELECTANY in headers already, for example DEFINE_GUID. Maybe it would be better to fix GCC.


Jacek



_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to