[PATCH c/c++] use explicit locations for some warnings in c-pragma.c

Mike Stump mrs@mrs.kithrup.com
Wed Nov 4 09:46:00 GMT 2015


On Sep 20, 2015, at 2:40 PM, Manuel López-Ibáñez <lopezibanez@gmail.com> wrote:
> On 20 September 2015 at 22:32, Christophe Lyon
> <christophe.lyon@linaro.org> wrote:
>> On 25 May 2015 at 22:16, Manuel López-Ibáñez <lopezibanez@gmail.com> wrote:
>>> On 25 May 2015 at 21:56, Marek Polacek <polacek@redhat.com> wrote:
>>>> Perhaps we should introduce GCC_BAD_LOC with a location_t argument and use it
>>>> here.
>>> 
>>> Why would we want to obfuscate code like that? I would propose to
>>> actually remove GCC_BAD completely.
>>> 
>> Hi
>> It looks like this patch has finally been committed on 2015-09-18
>> (r227923), right?
> 
> Yes, I had almost forgotten about it.
> 
>> I'm not sure why, since the 1st warning is xfail.
> 
> Strange that I missed this, but I can see it now. (Well, not so
> strange, contrib/compare_tests sometimes produces nonsense)
> 
> Could you try with this patch? It seems to work for me. I'll commit it
> as obvious if it works for you too.
> 
> Index: gcc/testsuite/gcc.dg/pragma-diag-5.c
> ===================================================================
> --- gcc/testsuite/gcc.dg/pragma-diag-5.c        (revision 227932)
> +++ gcc/testsuite/gcc.dg/pragma-diag-5.c        (working copy)
> @@ -1,6 +1,7 @@
> /* { dg-do compile } */
> -#pragma GCC diagnostic /* { dg-warning "24:missing" "missing" { xfail
> *-*-* } } */
> +#pragma GCC diagnostic /* { dg-warning "missing" "missing" } */
> +/* { dg-warning "24:missing" "missing" { xfail *-*-* }  2 } */
> 
> #pragma GCC diagnostic warn /* { dg-warning "24:expected" } */
> 
> #pragma GCC diagnostic ignored "-Wfoo" /* { dg-warning "32:unknown" } */

I see:

gcc/gcc/testsuite/gcc.dg/pragma-diag-5.c:2:64: warning: missing [error|warning|ignored|push|pop] after '#pragma GCC diagnostic' [-Wpragmas]
gcc/gcc/testsuite/gcc.dg/pragma-diag-5.c:5:24: warning: expected [error|warning|ignored|push|pop] after '#pragma GCC diagnostic' [-Wpragmas]
gcc/gcc/testsuite/gcc.dg/pragma-diag-5.c:7:32: warning: unknown option after '#pragma GCC diagnostic' kind [-Wpragmas]
output is:
gcc/gcc/testsuite/gcc.dg/pragma-diag-5.c:2:64: warning: missing [error|warning|ignored|push|pop] after '#pragma GCC diagnostic' [-Wpragmas]
gcc/gcc/testsuite/gcc.dg/pragma-diag-5.c:5:24: warning: expected [error|warning|ignored|push|pop] after '#pragma GCC diagnostic' [-Wpragmas]
gcc/gcc/testsuite/gcc.dg/pragma-diag-5.c:7:32: warning: unknown option after '#pragma GCC diagnostic' kind [-Wpragmas]

PASS: gcc.dg/pragma-diag-5.c missing (test for warnings, line 2)
XFAIL: gcc.dg/pragma-diag-5.c missing (test for warnings, line 2)
PASS: gcc.dg/pragma-diag-5.c  (test for warnings, line 5)
PASS: gcc.dg/pragma-diag-5.c  (test for warnings, line 7)
PASS: gcc.dg/pragma-diag-5.c (test for excess errors)

in the top of the tree.  This is bad as the same line appears in a PASS: and an XFAIL:.  Each test case should be unique.  Should it be updated to 64?


More information about the Gcc-patches mailing list