This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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: [PATCH OBV] Add nowarnings in gdb.base/fileio.exp


On 05/18/2017 09:34 AM, Yao Qi wrote:
> Pedro Alves <palves@redhat.com> writes:
> 
>> FWIW, I think that wrapping the offending code with
>>
>>  #pragma diagnostics push
>>  #pragma diagnostics ignored "-Wnonnull"
>>  ... stat (NULL, ...);
>>  #pragma diagnostics pop
>>
>> would be appropriate in this case.  This testcase is checking that the syscalls
>> on the target map back to host I/O on the gdb side, and some targets have
>> slightly non-POSIX-like system calls APIs; IMHO, it's better to see warnings
>> due to such mismatches instead of potentially silently miscompiling.
> 
> The diagnostic was added in gcc 4.6.  Do we require gcc 4.6 to run
> testsuite?  I am OK with this requirement.

I don't think so.  I think that'd be the equivalent of saying that we
don't support debugging target code built with gcc versions earlier
than 4.6.  That's a totally different discussion from the discussion
about requirements for building gdb.

How about an even simpler fix: pass a global pointer variable that
happens to be NULL to stat, instead of a NULL literal.  The compiler can't
prove (without LTO) that the variable may still be NULL, so it doesn't
warn.  Works on all compilers I tried it on: gcc 3.4/5.3/7, clang 3.7.

Let me send a mini series in reply to this email, which does that,
and also fixes a few other warnings that compiling the fileio.c with
-Wall exposes.

Thanks,
Pedro Alves


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