This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Unsure about a new warning in mainline


Hi Roger

and thanks for your explanations. Just a couple of additional remarks.

I agree with Paolo that this is a change for C++, and should at least be
documented in changes.html, and probably be tweaked to avoid warning in
system headers.


Note that, AFAICS, the issue would boil down to fixing pragma system_headers to work with templates. I don't think it's trivial and / or someone is already working on it. In any case, if we agree that the warning is meaningful, our (v3) policy asks for avoiding it in the code, whenever possible: in short, I mean to change v3 in any case.

Specifically, for PR 30465 "((T)1 << 31) - 1" is potentially undefined
when T is a 32-bit signed type, but well-defined if T is unsigned or
wider than 32-bits.


FYI: this specific issue arises from std::numeric_limits<wchar_t> on x86-linux: in particular from the __glibcxx_max macro at the beginning of the header. Luckily, since we are dealing with template specializations, the pragma is sufficient to suppress the warning, but if you can figure out a better way to compute the max itself, just speak...

Thanks,
Paolo.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]