Re: [PATCH v2] gdb/i387-tdep.c: Avoid warning for "-Werror=strict-overflow"

Chen Gang
2014-10-14T21:31:02Z

On 10/14/2014 12:05 AM, Chen Gang wrote:
> On 10/13/14 23:16, Mark Kettenis wrote:
>>> Date: Sun, 12 Oct 2014 21:28:40 +0800
>>> From: Chen Gang <gang.chen.5i5j@gmail.com>
>>>
>>> gdb requires "-Werror", and I387_ST0_REGNUM (tdep) is 'variable', then
>>> compiler can think that I387_ST0_REGNUM (tdep) may be a large number,
>>> which may cause issue, so report warning.
>>>
>>> Need fix this warning, and still keep the code clear enough for readers.
>>> The related warning under Darwin with gnu built gcc:
>>
>> Sorry, I disagree with this approach. I think your compiler is really
>> being unhelpful here. See if a newer GCC version of the compiler
>> still triggers that warning. If so, complain to the GCC people.
>>
>
> Excuse me, I do not dare to complain it to gcc members, because for me,
> the compiler's printing is obviously, and proofs itself is correct. If I
> ask a quite obvious question to them, I guess, I will be complained.
>
> Hmm... But I may have an additional trying: Use original gcc and provide
> "-Werror=strict-overflow" to see what will happen.
>
> - If it will report warning too, I can ask gcc members why integrate
> "-Wstrict-overflow" to -Wall.
>
> - If it will not report warning, it means original gcc also integrate
> "-Wstrict-overflow" or have no this option. And for me, I prefer to
> use "#pragma GCC diagnostic ignored ... " for our code.

After use "gcc version 4.8.3 20140624 (Red Hat 4.8.3-1) (GCC)" with
"-Wstrict-overflow", it supports this flag, and does not report warning.

For me, either "$pragma GCC diagnostic ignored ..." or continuing this
patch. At present, I don't know any other ways for it.

Thanks.
--
Chen Gang

Open share and attitude like air water and life which God blessed