On 29.03.2025 20:53, Martin Storsjö wrote:
On Sun, 30 Mar 2025, LIU Hao wrote:

This eliminates such warnings in C:

   .../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 };
                                          ^~~~~~~~~~~~~~~~~~

Only if compiling in a way where the headers aren't considered system headers, right - afaik that's the only case where this warning actually is visible?


That's my understanding too. There are more cases like this, see grep for DECLSPEC_SELECTANY in headers. I don’t mind changing this particular case, so that’s fine with me.

However, more generally, I don’t think we should change all headers. Ideally, GCC would silence the warning for extern const, as both Clang and MSVC do.



It would be really valuable if you could figure out why you're getting such warnings. This kind of header inline comdat definition with __MINGW_SELECTANY should work, and is used elsewhere, so we should try to figure out why that doesn't work as expected here.

+const fenv_t __mingw_fe_dfl_env = { 0, 0 };
+const fenv_t __mingw_fe_pc64_env = { 0x3f3f003f, 0 };
+const fenv_t __mingw_fe_pc53_env = { 0x3f3f103f, 0 };

_If_ we go ahead with the patch, I would appreciate if you'd bring along the comments from the header here - they're intended to explain the constant values here.


Also, pc53 and pc64 variants should be defined only on x86 targets.


Thanks,

Jacek



_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to