On Wednesday 26 March 2025 10:09:10 LIU Hao wrote: > 在 2025-3-26 05:13, Pali Rohár 写道: > > On Thursday 20 March 2025 20:38:57 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 }; > > > ^~~~~~~~~~~~~~~~~~ > > > ... ... > > > I think that it is related to commit 9c27617e016f ("headers: Use > > > selectany fenv_t pointers for FE_*_ENV macros."). > > > > > > For me it looks really a bad idea to define a global variable in public > > > header file with value and also with extern keyword. > > > > Hello, have you looked at this? I think that the "extern" keyword should > > be removed here as it is not needed and also cause those gcc warnings. > > > > In C++ `const` without `extern` or `volatile` implies internal linkage (same > as `static const`) so `extern` is required. Maybe we can try splitting the > definitions: > > extern const fenv_t __mingw_fe_dfl_env; > const __MINGW_SELECTANY fenv_t __mingw_fe_dfl_env = { 0, 0 }; > > > This should have the same effect as a c++17 `constexpr inline` variable. > > > -- > Best regards, > LIU Hao
Thanks for looking at this. With your change, the warning is not emitted during compiling of mingw-w64 (by C compiler). If it is fine, would you commit your change? _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public