This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH OBV] Add nowarnings in gdb.base/fileio.exp
- From: Pedro Alves <palves at redhat dot com>
- To: Yao Qi <qiyaoltc at gmail dot com>, gdb-patches at sourceware dot org
- Date: Wed, 17 May 2017 15:17:32 +0100
- Subject: Re: [PATCH OBV] Add nowarnings in gdb.base/fileio.exp
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=palves at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 4C03B80478
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4C03B80478
- References: <1495028758-13982-1-git-send-email-yao.qi@linaro.org>
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.
Thanks,
Pedro Alves
On 05/17/2017 02:45 PM, Yao Qi wrote:
> I see the following warning in gdb.base/fileio.c,
>
> testsuite/gdb.base/fileio.c:297:3: warning: null argument where non-null required (argument 1) [-Wnonnull]
> ret = stat (NULL, &st);
> ^
>
> This patch adds "nowarnings" to the list passed to gdb_compile.
>
> It is obvious, patch is pushed in.
>
> gdb/testsuite:
>
> 2017-05-17 Yao Qi <yao.qi@linaro.org>
>
> * gdb.base/fileio.exp: Pass nowarnings to gdb_compile.
> ---
> gdb/testsuite/ChangeLog | 4 ++++
> gdb/testsuite/gdb.base/fileio.exp | 2 +-
> 2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
> index 91712e2..6f877da 100644
> --- a/gdb/testsuite/ChangeLog
> +++ b/gdb/testsuite/ChangeLog
> @@ -1,3 +1,7 @@
> +2017-05-17 Yao Qi <yao.qi@linaro.org>
> +
> + * gdb.base/fileio.exp: Pass nowarnings to gdb_compile.
> +
> 2017-05-17 Simon Marchi <simon.marchi@ericsson.com>
>
> * gdb.base/set-inferior-tty.exp (test_set_inferior_tty): Add
> diff --git a/gdb/testsuite/gdb.base/fileio.exp b/gdb/testsuite/gdb.base/fileio.exp
> index 6bb7141..14aaa0d 100644
> --- a/gdb/testsuite/gdb.base/fileio.exp
> +++ b/gdb/testsuite/gdb.base/fileio.exp
> @@ -31,7 +31,7 @@ if {[is_remote host]} {
>
> if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
> executable \
> - [list debug "additional_flags=-DOUTDIR=\"$outdir/\""]] != "" } {
> + [list debug nowarnings "additional_flags=-DOUTDIR=\"$outdir/\""]] != "" } {
> untested "failed to compile"
> return -1
> }
>