* [testsuite] fix C tests to use correct dg-error or dg-warning directive
@ 2007-05-15 18:34 Janis Johnson
2007-05-16 3:03 ` Mike Stump
0 siblings, 1 reply; 7+ messages in thread
From: Janis Johnson @ 2007-05-15 18:34 UTC (permalink / raw)
To: gcc-patches; +Cc: lopezibanez
Several C compiler tests use dg-error for warnings and vice versa.
This currently makes no difference because the DejaGnu support doesn't
pay attention to the message prefix, but Manuel and I are working on a
patch to change that within the GCC testsuite support; see PR 25241.
I've looked at the options used to compile these tests and the behavior
of earlier versions of GCC, and the changes look reasonable to me.
Tested on powerpc64-linux with -m32/-m64. Unless there are objections
in the next couple of days, I'll check them in.
* gcc.target/powerpc/pr18096-1.c: Change dg-warning to dg-error.
* gcc.dg/cpp/include2.c: Ditto.
* gcc.dg/cpp/mac-dir-2.c: Ditto.
* gcc.dg/cpp/paste5.c: Ditto.
* gcc.dg/cpp/paste6.c: Ditto.
* gcc.dg/cpp/paste8.c: Ditto.
* gcc.dg/cpp/paste11.c: Ditto.
* gcc.dg/cpp/paste13.c: Ditto.
* gcc.dg/cpp/skipping2.c: Ditto.
* gcc.dg/reg-vol-struct-1.c: Ditto.
* gcc.dg/Wshadow-1.c: Ditto.
* gcc.dg/cpp/trad/comment.c: Ditto.
* gcc.dg/cpp/trad/literals-2.c: Change dg-error to dg-warning.
* gcc.dg/cpp/if-2.c: Ditto.
* gcc.dg/array-5.c: Ditto.
* gcc.dg/inline-15.c: Ditto.
* gcc.dg/pr27953.c: Ditto.
* gcc.dg/Wno-c++-compat.c: Ditto.
Index: gcc/testsuite/gcc.dg/cpp/if-2.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/if-2.c (revision 124532)
+++ gcc/testsuite/gcc.dg/cpp/if-2.c (working copy)
@@ -21,7 +21,7 @@
#if 'abcd' /* { dg-warning "(multi-character character constant)|(character constant (is )?too long)" "multi-character charconst" } */
#endif
-#if 'abcdefghi' /* { dg-error "character constant (is )?too long" "charconst too long" } */
+#if 'abcdefghi' /* { dg-warning "character constant (is )?too long" "charconst too long" } */
#endif
#if '' /* { dg-error "empty character constant" "empty charconst" } */
Index: gcc/testsuite/gcc.dg/cpp/include2.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/include2.c (revision 124532)
+++ gcc/testsuite/gcc.dg/cpp/include2.c (working copy)
@@ -7,8 +7,8 @@
/* Source: Neil Booth, 4 Nov 2000. */
-#include <silly\>> /* { dg-warning "extra tokens" "" } */
-#include "silly\"" /* { dg-warning "extra tokens" "" } */
+#include <silly\>> /* { dg-error "extra tokens" "" } */
+#include "silly\"" /* { dg-error "extra tokens" "" } */
/* These error is No such file or directory, just once. However, this
message is locale-dependent, so don't test for it. */
Index: gcc/testsuite/gcc.dg/cpp/mac-dir-2.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/mac-dir-2.c (revision 124532)
+++ gcc/testsuite/gcc.dg/cpp/mac-dir-2.c (working copy)
@@ -11,6 +11,6 @@
#define f(x) x
f (
-#if 1 /* { dg-warning "not portable" } */
+#if 1 /* { dg-error "not portable" } */
1)
#endif
Index: gcc/testsuite/gcc.dg/cpp/paste5.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/paste5.c (revision 124532)
+++ gcc/testsuite/gcc.dg/cpp/paste5.c (working copy)
@@ -18,7 +18,7 @@
void foo(void)
{
- E(glue(F,*)) dummy; /* { dg-warning "valid preprocessing token" } */
+ E(glue(F,*)) dummy; /* { dg-error "valid preprocessing token" } */
E(glue(F,G)) ;
}
Index: gcc/testsuite/gcc.dg/cpp/paste6.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/paste6.c (revision 124532)
+++ gcc/testsuite/gcc.dg/cpp/paste6.c (working copy)
@@ -9,4 +9,4 @@
#define bar(x) foo(x)
#define baz(x) bar(##x)
-int quux(int y) { return baz(y); } /* { dg-warning "valid preprocessing" } */
+int quux(int y) { return baz(y); } /* { dg-error "valid preprocessing" } */
Index: gcc/testsuite/gcc.dg/cpp/paste8.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/paste8.c (revision 124532)
+++ gcc/testsuite/gcc.dg/cpp/paste8.c (working copy)
@@ -7,9 +7,9 @@
a(1)
a(1, 2, 3)
#define b(x, y, z...) foo(x, ##y)
-b(1, 2, 3) /* { dg-warning "valid preprocessing token" } */
+b(1, 2, 3) /* { dg-error "valid preprocessing token" } */
#define c(x, y, z...) foo(x, ##z)
c(1, 2)
c(1, 2, 3)
#define d(x) fo(##x)
-d(1) /* { dg-warning "valid preprocessing token" } */
+d(1) /* { dg-error "valid preprocessing token" } */
Index: gcc/testsuite/gcc.dg/cpp/paste11.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/paste11.c (revision 124532)
+++ gcc/testsuite/gcc.dg/cpp/paste11.c (working copy)
@@ -9,7 +9,7 @@
glue (ident, 12) /* OK. */
glue (ident, 12e3) /* OK. */
-glue (ident, 12e+3) /* { dg-warning "valid preprocessing tok" } */
-glue (ident, 12e-3) /* { dg-warning "valid preprocessing tok" } */
-glue (ident, 1.2) /* { dg-warning "valid preprocessing tok" } */
-glue (ident, .12) /* { dg-warning "valid preprocessing tok" } */
+glue (ident, 12e+3) /* { dg-error "valid preprocessing tok" } */
+glue (ident, 12e-3) /* { dg-error "valid preprocessing tok" } */
+glue (ident, 1.2) /* { dg-error "valid preprocessing tok" } */
+glue (ident, .12) /* { dg-error "valid preprocessing tok" } */
Index: gcc/testsuite/gcc.dg/cpp/paste13.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/paste13.c (revision 124532)
+++ gcc/testsuite/gcc.dg/cpp/paste13.c (working copy)
@@ -6,4 +6,4 @@
spellings. Neil Booth, 9 Oct 2002. */
#define a /##/=
-a /* { dg-warning "valid preprocessing tok" } */
+a /* { dg-error "valid preprocessing tok" } */
Index: gcc/testsuite/gcc.dg/cpp/skipping2.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/skipping2.c (revision 124532)
+++ gcc/testsuite/gcc.dg/cpp/skipping2.c (working copy)
@@ -10,5 +10,5 @@
#if foo
#else foo /* { dg-bogus "extra tokens" "extra tokens in skipped block" } */
#endif foo /* { dg-bogus "extra tokens" "extra tokens in skipped block" } */
-#endif bar /* { dg-warning "extra tokens" "tokens after #endif" } */
+#endif bar /* { dg-error "extra tokens" "tokens after #endif" } */
Index: gcc/testsuite/gcc.dg/cpp/trad/comment.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/trad/comment.c (revision 124532)
+++ gcc/testsuite/gcc.dg/cpp/trad/comment.c (working copy)
@@ -2,4 +2,4 @@
/* { dg-do preprocess } */
-/* { dg-warning "unterminated comment" }
+/* { dg-error "unterminated comment" }
Index: gcc/testsuite/gcc.dg/cpp/trad/literals-2.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/trad/literals-2.c (revision 124532)
+++ gcc/testsuite/gcc.dg/cpp/trad/literals-2.c (working copy)
@@ -2,7 +2,7 @@
recognized. */
/* { dg-do preprocess } */
-/* { dg-error "missing terminating" "bad charconst" { target *-*-* } 7 } */
+/* { dg-warning "missing terminating" "bad charconst" { target *-*-* } 7 } */
/* { dg-error "not valid" "bad charconst" { target *-*-* } 7 } */
#if 'x
#endif
Index: gcc/testsuite/gcc.dg/array-5.c
===================================================================
--- gcc/testsuite/gcc.dg/array-5.c (revision 124532)
+++ gcc/testsuite/gcc.dg/array-5.c (working copy)
@@ -24,7 +24,7 @@
/* Invalid: not compatible because 4 != 6. */
int a[n][6][m];
int (*p)[4][n+1];
- p = a; /* { dg-error "incompatible" } */
+ p = a; /* { dg-warning "incompatible" } */
}
{
/* Compatible, but defined behavior only if n == 6 and m == n+1. */
Index: gcc/testsuite/gcc.dg/inline-15.c
===================================================================
--- gcc/testsuite/gcc.dg/inline-15.c (revision 124532)
+++ gcc/testsuite/gcc.dg/inline-15.c (working copy)
@@ -3,5 +3,5 @@
/* { dg-do compile } */
/* { dg-options "-std=c99" } */
-extern inline int func1 (void); /* { dg-error "never defined" } */
-inline int func2 (void); /* { dg-error "never defined" } */
+extern inline int func1 (void); /* { dg-warning "never defined" } */
+inline int func2 (void); /* { dg-warning "never defined" } */
Index: gcc/testsuite/gcc.dg/pr27953.c
===================================================================
--- gcc/testsuite/gcc.dg/pr27953.c (revision 124532)
+++ gcc/testsuite/gcc.dg/pr27953.c (working copy)
@@ -1,4 +1,4 @@
/* PR c/27953 */
-void foo(struct A a) {} /* { dg-error "parameter list|definition|incomplete type" } */
+void foo(struct A a) {} /* { dg-warning "parameter list|definition|incomplete type" } */
void foo() {} /* { dg-error "redefinition" } */
Index: gcc/testsuite/gcc.dg/reg-vol-struct-1.c
===================================================================
--- gcc/testsuite/gcc.dg/reg-vol-struct-1.c (revision 124532)
+++ gcc/testsuite/gcc.dg/reg-vol-struct-1.c (working copy)
@@ -13,6 +13,6 @@
register struct S a;
register struct S b[2];
register struct S c __asm__("nosuchreg"); /* { dg-error "object with volatile field" "explicit reg name" } */
- &a; /* { dg-warning "address of register" "explicit address" } */
- b; /* { dg-warning "address of register" "implicit address" } */
+ &a; /* { dg-error "address of register" "explicit address" } */
+ b; /* { dg-error "address of register" "implicit address" } */
}
Index: gcc/testsuite/gcc.dg/Wno-c++-compat.c
===================================================================
--- gcc/testsuite/gcc.dg/Wno-c++-compat.c (revision 124532)
+++ gcc/testsuite/gcc.dg/Wno-c++-compat.c (working copy)
@@ -5,5 +5,5 @@
/* { dg-do compile } */
/* { dg-options "-Wno-c++-compat" } */
-extern const int foo = 42; /* { dg-error "initialized and declared" } */
+extern const int foo = 42; /* { dg-warning "initialized and declared" } */
Index: gcc/testsuite/gcc.dg/Wshadow-1.c
===================================================================
--- gcc/testsuite/gcc.dg/Wshadow-1.c (revision 124532)
+++ gcc/testsuite/gcc.dg/Wshadow-1.c (working copy)
@@ -10,7 +10,7 @@
{
}
-void foo1 (int d) /* { dg-warning "previous definition" } */
+void foo1 (int d) /* { dg-error "previous definition" } */
{
double d; /* { dg-bogus "warning" "warning in place of error" } */
/* { dg-error "redeclared as different" "" { target *-*-* } 15 } */
Index: gcc/testsuite/gcc.target/powerpc/pr18096-1.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/pr18096-1.c (revision 124532)
+++ gcc/testsuite/gcc.target/powerpc/pr18096-1.c (working copy)
@@ -5,7 +5,7 @@
void f(char*);
void mkcatdefs(char *fname)
-{ /* { dg-warning "too large" "stack frame too large" } */
+{ /* { dg-error "too large" "stack frame too large" } */
char line [2147483647];
f(line);
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [testsuite] fix C tests to use correct dg-error or dg-warning directive
2007-05-15 18:34 [testsuite] fix C tests to use correct dg-error or dg-warning directive Janis Johnson
@ 2007-05-16 3:03 ` Mike Stump
2007-05-16 4:40 ` Ian Lance Taylor
2007-05-16 13:35 ` Manuel López-Ibáñez
0 siblings, 2 replies; 7+ messages in thread
From: Mike Stump @ 2007-05-16 3:03 UTC (permalink / raw)
To: Janis Johnson; +Cc: gcc-patches, lopezibanez
On May 15, 2007, at 11:34 AM, Janis Johnson wrote:
> Several C compiler tests use dg-error for warnings and vice versa.
Sounds about right. Kinda surprising we get as close as your patch
suggests.
> This currently makes no difference because the DejaGnu support
> doesn't pay attention to the message prefix, but Manuel and I are
> working on a patch to change that within the GCC testsuite support;
> see PR 25241.
Wonderful. I'd vote against dg-gcc-warning, once done, it would
never be undone. :-( What's your current thinking, one language at
a time and not doing dg-gcc-warning?
> I've looked at the options used to compile these tests and the
> behavior of earlier versions of GCC, and the changes look
> reasonable to me.
I reviewed them all, and I'd say that I think they are ok.
Does anyone remember the testsuite code before the expect code? Did
it handle the difference between warnings and errors? For some
strange reason I was thinking this was a regression when we switched
to expect? Rob or Julia might remember.
Thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [testsuite] fix C tests to use correct dg-error or dg-warning directive
2007-05-16 3:03 ` Mike Stump
@ 2007-05-16 4:40 ` Ian Lance Taylor
2007-05-16 5:25 ` Mike Stump
2007-05-16 13:35 ` Manuel López-Ibáñez
1 sibling, 1 reply; 7+ messages in thread
From: Ian Lance Taylor @ 2007-05-16 4:40 UTC (permalink / raw)
To: Mike Stump; +Cc: Janis Johnson, gcc-patches, lopezibanez
Mike Stump <mrs@apple.com> writes:
> Does anyone remember the testsuite code before the expect code? Did
> it handle the difference between warnings and errors? For some
> strange reason I was thinking this was a regression when we switched
> to expect? Rob or Julia might remember.
My recollection of the testsuite code before we switched to DejaGNU
was that it did not test for errors or warnings at all. Before
DejaGNU we just had Torbjorn's torture test (which became
gcc/testsuite/gcc.c-torture), and it just tested for success or
failure when compiling and, optionally, executing.
Ian
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [testsuite] fix C tests to use correct dg-error or dg-warning directive
2007-05-16 4:40 ` Ian Lance Taylor
@ 2007-05-16 5:25 ` Mike Stump
2007-05-16 14:36 ` Ian Lance Taylor
0 siblings, 1 reply; 7+ messages in thread
From: Mike Stump @ 2007-05-16 5:25 UTC (permalink / raw)
To: Ian Lance Taylor; +Cc: Janis Johnson, gcc-patches, lopezibanez
On May 15, 2007, at 9:40 PM, Ian Lance Taylor wrote:
> My recollection of the testsuite code before we switched to DejaGNU
> was that it did not test for errors or warnings at all. Before
> DejaGNU we just had Torbjorn's torture test
Ah, you don't recall the framework that Julia worked on and what Rob
started with when he recoded it in tcl/expect to create dejagnu?
Ok. :-)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [testsuite] fix C tests to use correct dg-error or dg-warning directive
2007-05-16 3:03 ` Mike Stump
2007-05-16 4:40 ` Ian Lance Taylor
@ 2007-05-16 13:35 ` Manuel López-Ibáñez
2007-05-17 21:07 ` Janis Johnson
1 sibling, 1 reply; 7+ messages in thread
From: Manuel López-Ibáñez @ 2007-05-16 13:35 UTC (permalink / raw)
To: Mike Stump; +Cc: Janis Johnson, gcc-patches
On 16/05/07, Mike Stump <mrs@apple.com> wrote:
> On May 15, 2007, at 11:34 AM, Janis Johnson wrote:
> > This currently makes no difference because the DejaGnu support
> > doesn't pay attention to the message prefix, but Manuel and I are
> > working on a patch to change that within the GCC testsuite support;
> > see PR 25241.
>
> Wonderful. I'd vote against dg-gcc-warning, once done, it would
> never be undone. :-( What's your current thinking, one language at
> a time and not doing dg-gcc-warning?
>
The current plan is to fix dg-warning and dg-error for the C
front-end. (Actually, we already have patches for all C tests
"failing" at i686).
We are not going to use a new dg-gcc-warning. Check the comments at
PR25241 for the complete discussion. There is a small risk that we
miss some flawed tests in some targets. We hope people will test
Janis's patch for target-specific tests. If you have any question
about this, please ask Janis or me.
Some tips for new tests until we check-in the patch:
1) Don't be afraid to use { dg-warning "warning: whatever" }. This
currently ensures that we actually emit a warning and it can be fixed
automatically just before committing Janis's patch.
2) If you want to match a "note:" message, please use { dg-warning
"note: whatever" } or at least { dg-warning "note" }. We can detect
this pattern and fix it automatically. Otherwise, we will have to fix
it manually.
3) Use several dg-* for several messages. The current test framework
allows to match:
warning: foo
error: bar
with a single dg-warning "foo". But that hopefully will break in the
future. So please use { dg-warning "foo" } { dg-error "bar" }. This
also applies for 2 warnings or 2 errors.
I hope this helps.
Manuel.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [testsuite] fix C tests to use correct dg-error or dg-warning directive
2007-05-16 5:25 ` Mike Stump
@ 2007-05-16 14:36 ` Ian Lance Taylor
0 siblings, 0 replies; 7+ messages in thread
From: Ian Lance Taylor @ 2007-05-16 14:36 UTC (permalink / raw)
To: Mike Stump; +Cc: Janis Johnson, gcc-patches, lopezibanez
Mike Stump <mrs@apple.com> writes:
> On May 15, 2007, at 9:40 PM, Ian Lance Taylor wrote:
> > My recollection of the testsuite code before we switched to DejaGNU
> > was that it did not test for errors or warnings at all. Before
> > DejaGNU we just had Torbjorn's torture test
>
> Ah, you don't recall the framework that Julia worked on and what Rob
> started with when he recoded it in tcl/expect to create dejagnu? Ok.
I don't recall that we ever used it with gcc proper. But it's true
that I never looked at C++ at that time, and I don't know what y'all
you were using for a C++ testsuite.
Ian
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [testsuite] fix C tests to use correct dg-error or dg-warning directive
2007-05-16 13:35 ` Manuel López-Ibáñez
@ 2007-05-17 21:07 ` Janis Johnson
0 siblings, 0 replies; 7+ messages in thread
From: Janis Johnson @ 2007-05-17 21:07 UTC (permalink / raw)
To: Manuel López-Ibáñez; +Cc: Mike Stump, Janis Johnson, gcc-patches
On Wed, May 16, 2007 at 02:34:32PM +0100, Manuel López-Ibáñez wrote:
> On 16/05/07, Mike Stump <mrs@apple.com> wrote:
> >On May 15, 2007, at 11:34 AM, Janis Johnson wrote:
> >> This currently makes no difference because the DejaGnu support
> >> doesn't pay attention to the message prefix, but Manuel and I are
> >> working on a patch to change that within the GCC testsuite support;
> >> see PR 25241.
> >
> >Wonderful. I'd vote against dg-gcc-warning, once done, it would
> >never be undone. :-( What's your current thinking, one language at
> >a time and not doing dg-gcc-warning?
> >
>
> The current plan is to fix dg-warning and dg-error for the C
> front-end. (Actually, we already have patches for all C tests
> "failing" at i686).
>
> We are not going to use a new dg-gcc-warning. Check the comments at
> PR25241 for the complete discussion. There is a small risk that we
> miss some flawed tests in some targets. We hope people will test
> Janis's patch for target-specific tests. If you have any question
> about this, please ask Janis or me.
I checked in the changes to use the correct one of dg-error or dg-warning
in several C tests, adding Manuel to the ChangeLog entry.
For the changes to the gcc-error and gcc-warning test directives, we'll
probably check in the changes and test fixes for C after testing them on
i686-linux and powerpc64-linux. Tests that fail on other platforms can
be fixed as we notice the failures; I'm sure there will be some. Next
we'll fix the tests for other languages and enable the new support for
those languages.
Janis
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-05-17 21:07 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-15 18:34 [testsuite] fix C tests to use correct dg-error or dg-warning directive Janis Johnson
2007-05-16 3:03 ` Mike Stump
2007-05-16 4:40 ` Ian Lance Taylor
2007-05-16 5:25 ` Mike Stump
2007-05-16 14:36 ` Ian Lance Taylor
2007-05-16 13:35 ` Manuel López-Ibáñez
2007-05-17 21:07 ` Janis Johnson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).