From b1b8a1855f9f9c4e0462a647fe2b085d0132c03e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20L=C3=B3pez-Ib=C3=A1=C3=B1ez?= Date: Sun, 8 Jul 2007 14:50:37 +0000 Subject: re PR testsuite/25241 ([C++] DejaGNU does not distinguish between errors and warnings) 2007-07-08 Manuel Lopez-Ibanez PR testsuite/25241 testsuite/ * gcc.dg/20041213-1.c: Don't use default -pedantic-errors to allow discern pedantic diagnostics and errors. * gcc.dg/empty2.c: Add -pedantic, so it actually produces a warning and not an error. * gcc.dg/20050121-1.c: This is an error and not a warning. * gcc.target/i386/sseregparm-2.c: Likewise. * gcc.target/i386/20060512-4.c: This is a warning and not an error. * gcc.dg/charset/attribute2.c: Likewise. * gcc.dg/bitfld-1.c: Likewise. * gcc.dg/pack-test-2.c: Likewise. * gcc.dg/940510-1.c: Match separately error and warning. * gcc.dg/array-2.c: Match separately multiple messages. The second diagnostic is a pedantic warning and not an error. * gcc.dg/pr14475.c: Match separately multiple messages. * gcc.dg/pr18809-1.c: Likewise. * gcc.dg/pr27953.c: Likewise. * gcc.dg/vla-init-1.c: Likewise. * gcc.dg/redecl-1.c: Fix wrong use of dg-error and dg-warning. From-SVN: r126461 --- gcc/testsuite/ChangeLog | 22 +++++++++++++++++++++ gcc/testsuite/gcc.dg/20041213-1.c | 29 ++++++++++++++-------------- gcc/testsuite/gcc.dg/20050121-1.c | 2 +- gcc/testsuite/gcc.dg/940510-1.c | 4 +++- gcc/testsuite/gcc.dg/array-2.c | 7 ++++--- gcc/testsuite/gcc.dg/bitfld-1.c | 2 +- gcc/testsuite/gcc.dg/charset/attribute2.c | 2 +- gcc/testsuite/gcc.dg/empty2.c | 4 ++-- gcc/testsuite/gcc.dg/pack-test-2.c | 10 +++++----- gcc/testsuite/gcc.dg/pr14475.c | 6 ++++-- gcc/testsuite/gcc.dg/pr18809-1.c | 5 ++++- gcc/testsuite/gcc.dg/pr27953.c | 6 +++++- gcc/testsuite/gcc.dg/redecl-1.c | 25 ++++++++++++------------ gcc/testsuite/gcc.dg/vla-init-1.c | 4 +++- gcc/testsuite/gcc.target/i386/20060512-4.c | 2 +- gcc/testsuite/gcc.target/i386/sseregparm-2.c | 12 ++++++------ 16 files changed, 90 insertions(+), 52 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 076eb9e..1eb39df 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,25 @@ +2007-07-08 Manuel Lopez-Ibanez + + PR testsuite/25241 + * gcc.dg/20041213-1.c: Don't use default -pedantic-errors to allow + discern pedantic diagnostics and errors. + * gcc.dg/empty2.c: Add -pedantic, so it actually produces a warning + and not an error. + * gcc.dg/20050121-1.c: This is an error and not a warning. + * gcc.target/i386/sseregparm-2.c: Likewise. + * gcc.target/i386/20060512-4.c: This is a warning and not an error. + * gcc.dg/charset/attribute2.c: Likewise. + * gcc.dg/bitfld-1.c: Likewise. + * gcc.dg/pack-test-2.c: Likewise. + * gcc.dg/940510-1.c: Match separately error and warning. + * gcc.dg/array-2.c: Match separately multiple messages. The second + diagnostic is a pedantic warning and not an error. + * gcc.dg/pr14475.c: Match separately multiple messages. + * gcc.dg/pr18809-1.c: Likewise. + * gcc.dg/pr27953.c: Likewise. + * gcc.dg/vla-init-1.c: Likewise. + * gcc.dg/redecl-1.c: Fix wrong use of dg-error and dg-warning. + 2007-07-07 Jerry DeLisle PR fortran/32644 diff --git a/gcc/testsuite/gcc.dg/20041213-1.c b/gcc/testsuite/gcc.dg/20041213-1.c index 9902737..f7ef30a 100644 --- a/gcc/testsuite/gcc.dg/20041213-1.c +++ b/gcc/testsuite/gcc.dg/20041213-1.c @@ -1,28 +1,29 @@ /* { dg-do compile } */ +/* { dg-options "" } */ /* test redeclarations with void and implicit int */ -extern foo1(); /* { dg-error "error: previous declaration" } */ -extern void foo1(); /* { dg-error "error: conflicting types" } */ +extern foo1(); /* { dg-error "previous declaration" } */ +extern void foo1(); /* { dg-error "conflicting types" } */ -extern void foo2(); /* { dg-error "error: previous declaration" } */ -extern foo2(); /* { dg-error "error: conflicting types" } */ +extern void foo2(); /* { dg-error "previous declaration" } */ +extern foo2(); /* { dg-error "conflicting types" } */ -void foo3() {} /* { dg-error "error: previous definition" } */ -extern foo3(); /* { dg-error "error: conflicting types" } */ +void foo3() {} /* { dg-error "previous definition" } */ +extern foo3(); /* { dg-error "conflicting types" } */ -extern foo4(); /* { dg-error "error: previous declaration" } */ -void foo4() {} /* { dg-error "error: conflicting types" } */ +extern foo4(); /* { dg-error "previous declaration" } */ +void foo4() {} /* { dg-error "conflicting types" } */ extern void foo5(); /* { dg-warning "previous declaration" } */ foo5() {} /* { dg-warning "conflicting types" } */ -foo6() {} /* { dg-error "error: previous definition" } */ -extern void foo6(); /* { dg-error "error: conflicting types" } */ +foo6() {} /* { dg-error "previous definition" } */ +extern void foo6(); /* { dg-error "conflicting types" } */ -foo7() {} /* { dg-error "error: previous definition" } */ -void foo7() {} /* { dg-error "error: conflicting types" } */ +foo7() {} /* { dg-error "previous definition" } */ +void foo7() {} /* { dg-error "conflicting types" } */ -void foo8() {} /* { dg-error "error: previous definition" } */ -foo8() {} /* { dg-error "error: conflicting types" } */ +void foo8() {} /* { dg-error "previous definition" } */ +foo8() {} /* { dg-error "conflicting types" } */ int use9() { foo9(); } /* { dg-warning "previous implicit declaration" } */ extern void foo9(); /* { dg-warning "conflicting types" } */ diff --git a/gcc/testsuite/gcc.dg/20050121-1.c b/gcc/testsuite/gcc.dg/20050121-1.c index a0b717e..3fe299a 100644 --- a/gcc/testsuite/gcc.dg/20050121-1.c +++ b/gcc/testsuite/gcc.dg/20050121-1.c @@ -5,5 +5,5 @@ void foo() { return; - break; /* { dg-warning "break statement not within" } */ + break; /* { dg-error "break statement not within" } */ } diff --git a/gcc/testsuite/gcc.dg/940510-1.c b/gcc/testsuite/gcc.dg/940510-1.c index a734c8f..2c27e00 100644 --- a/gcc/testsuite/gcc.dg/940510-1.c +++ b/gcc/testsuite/gcc.dg/940510-1.c @@ -1,3 +1,5 @@ /* { dg-do compile } */ /* { dg-options "-std=c89 -pedantic" } */ -struct { int a[]; } x = { 0 }; /* { dg-error "(flexible array member)|(near initialization)" } */ +struct { int a[]; } x = { 0 }; /* { dg-warning "ISO C90 does not support flexible array members" } */ +/* { dg-error "flexible array member in otherwise empty struct" "" { target *-*-* } 3 } */ + diff --git a/gcc/testsuite/gcc.dg/array-2.c b/gcc/testsuite/gcc.dg/array-2.c index 06c753f..497c586 100644 --- a/gcc/testsuite/gcc.dg/array-2.c +++ b/gcc/testsuite/gcc.dg/array-2.c @@ -7,7 +7,8 @@ struct f { int w; int x[]; }; struct g { struct f f; }; struct g g1 = { { 0, { } } }; -struct g g2 = { { 0, { 1 } } }; /* { dg-error "(nested context)|(near initialization)" "nested" } */ - +struct g g2 = { { 0, { 1 } } }; /* { dg-error "nested context" "nested" } */ + /* { dg-error "near init" "near" { target *-*-* } 10 } */ struct h { int x[0]; int y; }; -struct h h1 = { { 0 }, 1 }; /* { dg-error "(excess elements)|(near initialization)" "before end" } */ +struct h h1 = { { 0 }, 1 }; /* { dg-warning "excess elements" "excess" } */ + /* { dg-warning "near init" "before end" { target *-*-* } 13 } */ diff --git a/gcc/testsuite/gcc.dg/bitfld-1.c b/gcc/testsuite/gcc.dg/bitfld-1.c index 37acb6e..fa835f2 100644 --- a/gcc/testsuite/gcc.dg/bitfld-1.c +++ b/gcc/testsuite/gcc.dg/bitfld-1.c @@ -24,7 +24,7 @@ struct bf1 float f: 1; /* { dg-error "invalid type" } */ unsigned long g: 5; /* { dg-warning "GCC extension|ISO C" } */ ui h: 5; - enum foo i: 2; /* { dg-error "narrower" } */ + enum foo i: 2; /* { dg-warning "narrower" } */ /* { dg-warning "GCC extension|ISO C" "extension" { target *-*-* } 27 } */ enum foo j: 3; /* { dg-warning "GCC extension|ISO C" } */ unsigned int k: 256; /* { dg-error "exceeds its type" } */ diff --git a/gcc/testsuite/gcc.dg/charset/attribute2.c b/gcc/testsuite/gcc.dg/charset/attribute2.c index ef1f35f..427e949 100644 --- a/gcc/testsuite/gcc.dg/charset/attribute2.c +++ b/gcc/testsuite/gcc.dg/charset/attribute2.c @@ -4,5 +4,5 @@ /* { dg-do compile } { dg-require-iconv "IBM1047" } */ -int foo __attribute__ ((walrus)); /* { dg-error "walrus" "ignored" } */ +int foo __attribute__ ((walrus)); /* { dg-warning "walrus" "ignored" } */ char x[] = "foobar"; diff --git a/gcc/testsuite/gcc.dg/empty2.c b/gcc/testsuite/gcc.dg/empty2.c index 54b98f6..acc1ac8 100644 --- a/gcc/testsuite/gcc.dg/empty2.c +++ b/gcc/testsuite/gcc.dg/empty2.c @@ -1,8 +1,8 @@ /* { dg-do compile } */ - +/* { dg-options "-pedantic" } */ double d=0; -struct A {} a; /* { dg-warning "(has no members)" } */ +struct A {} a; /* { dg-warning "struct has no members" } */ void foo(struct A x) { diff --git a/gcc/testsuite/gcc.dg/pack-test-2.c b/gcc/testsuite/gcc.dg/pack-test-2.c index 974d982..8cb89f4 100644 --- a/gcc/testsuite/gcc.dg/pack-test-2.c +++ b/gcc/testsuite/gcc.dg/pack-test-2.c @@ -3,23 +3,23 @@ /* { dg-do compile { target *-*-linux* *-*-cygwin* powerpc*-*-eabi* } } */ -#pragma pack(pop) /* { dg-error "without matching" } */ +#pragma pack(pop) /* { dg-warning "without matching" } */ #pragma pack(push) #pragma pack(pop) /* reset */ #pragma pack(push, foo, 1) -#pragma pack(pop, foo, 1) /* { dg-error "malformed" } (/ +#pragma pack(pop, foo, 1) /* { dg-warning "malformed" } (/ #pragma pack(pop) /* reset */ #pragma pack(push, foo, 1) -#pragma pack(pop, bar) /* { dg-error "without matching" } */ +#pragma pack(pop, bar) /* { dg-warning "without matching" } */ #pragma pack(pop) /* reset */ #pragma pack(push, foo, 1) #pragma pack(pop) -#pragma pack(pop, foo) /* { dg-error "without matching" } */ +#pragma pack(pop, foo) /* { dg-warning "without matching" } */ -#pragma pack(push, foo, 3) /* { dg-error "small power of two" } */ +#pragma pack(push, foo, 3) /* { dg-warning "small power of two" } */ extern int blah; /* prevent "ISO C forbids an empty source file" */ diff --git a/gcc/testsuite/gcc.dg/pr14475.c b/gcc/testsuite/gcc.dg/pr14475.c index 8009d46..4fa5b04 100644 --- a/gcc/testsuite/gcc.dg/pr14475.c +++ b/gcc/testsuite/gcc.dg/pr14475.c @@ -3,6 +3,8 @@ struct tree_common { - enum tree_code code : 8; /* {dg-error "" "" } */ -/* { dg-warning "" "" { target *-*-* } 6 } */ + enum tree_code code : 8; /* { dg-error "ISO C forbids forward references to" "" } */ + /* { dg-error "type of bit-field .code. is a GCC extension" "" { target *-*-* } 6 } */ + /* { dg-warning "narrower than values of its type" "" { target *-*-* } 6 } */ + /* { dg-error "incomplete type" "" { target *-*-* } 6 } */ }; diff --git a/gcc/testsuite/gcc.dg/pr18809-1.c b/gcc/testsuite/gcc.dg/pr18809-1.c index f20f004..27f2be9 100644 --- a/gcc/testsuite/gcc.dg/pr18809-1.c +++ b/gcc/testsuite/gcc.dg/pr18809-1.c @@ -3,5 +3,8 @@ /* { dg-do compile } */ -void foo(enum E e) {} /* { dg-error "" } */ +void foo(enum E e) {} /* { dg-error "forward ref" "forward" } */ + /* { dg-warning "declared" "declared" { target *-*-* } 6 } */ + /* { dg-warning "scope" "scope" { target *-*-* } 6 } */ + /* { dg-error "incomplete" "incomplete" { target *-*-* } 6 } */ void bar() { foo(0); } /* { dg-error "formal" } */ diff --git a/gcc/testsuite/gcc.dg/pr27953.c b/gcc/testsuite/gcc.dg/pr27953.c index b5e86e2..7df46b1 100644 --- a/gcc/testsuite/gcc.dg/pr27953.c +++ b/gcc/testsuite/gcc.dg/pr27953.c @@ -1,4 +1,8 @@ /* PR c/27953 */ -void foo(struct A a) {} /* { dg-warning "parameter list|definition|incomplete type" } */ +void foo(struct A a) {} /* { dg-warning "declared inside parameter list" } */ +/* { dg-warning "its scope is only" "" { target *-*-* } 3 } */ +/* { dg-error "incomplete type" "" { target *-*-* } 3 } */ + void foo() {} /* { dg-error "redefinition" } */ +/* { dg-error "previous definition" "" { target *-*-* } 3 } */ diff --git a/gcc/testsuite/gcc.dg/redecl-1.c b/gcc/testsuite/gcc.dg/redecl-1.c index 75ce208..c76004e 100644 --- a/gcc/testsuite/gcc.dg/redecl-1.c +++ b/gcc/testsuite/gcc.dg/redecl-1.c @@ -52,50 +52,51 @@ void test3(void) void prime4(void) { - bar4(); /* { dg-error "previous|implicit" } */ + bar4(); /* { dg-warning "implicit declaration of function" } */ } void test4(void) { extern double bar4(double); /* { dg-error "conflict" } */ +/* { dg-error "previous implicit declaration" "" { target *-*-* } 55 } */ } /* Implicit decl, clashing with extern at previous function scope. */ void prime5(void) { - extern double bar5(double); /* { dg-error "previous" "" } */ -} + extern double bar5(double); /* { dg-message "note: previous declaration" "" } */ +} /* { dg-error "previous implicit declaration" "" { target *-*-* } 68 } */ void test5(void) { - bar5(1); /* { dg-error "implicit" } */ -} + bar5(1); /* { dg-warning "warning: implicit declaration of function" } */ +} /* { dg-error "error: incompatible implicit declaration" "" { target *-*-* } 73 } */ /* Extern then static, both at file scope. */ -extern int test6(int); /* { dg-warning "previous" "" } */ +extern int test6(int); /* { dg-error "previous" "" } */ static int test6(int x) -{ return x; } /* { dg-warning "follows non-static" } */ +{ return x; } /* { dg-error "follows non-static" } */ /* Extern then static, extern at previous function scope. */ void prime7(void) { - extern int test7(int); /* { dg-warning "previous" "" } */ + extern int test7(int); /* { dg-error "previous" "" } */ } static int test7(int x) -{ return x; } /* { dg-warning "follows non-static" } */ +{ return x; } /* { dg-error "follows non-static" } */ /* Implicit decl then static. */ void prime8(void) { - test8(); /* { dg-warning "previous" "" } */ - /* { dg-warning "implicit" "implicit" { target *-*-* } 96 } */ + test8(); /* { dg-error "previous" "" } */ + /* { dg-warning "implicit" "implicit" { target *-*-* } 97 } */ } static int test8(int x) -{ return x; } /* { dg-warning "follows non-static" } */ +{ return x; } /* { dg-error "follows non-static" } */ diff --git a/gcc/testsuite/gcc.dg/vla-init-1.c b/gcc/testsuite/gcc.dg/vla-init-1.c index 61d2357..68e7d65 100644 --- a/gcc/testsuite/gcc.dg/vla-init-1.c +++ b/gcc/testsuite/gcc.dg/vla-init-1.c @@ -9,5 +9,7 @@ int a; void foo (void) { - int x[a] = { 1 }; /* { dg-error "init" "VLA init" } */ + int x[a] = { 1 }; /* { dg-error "variable-sized object may not be initialized" "VLA init" } */ + /* { dg-warning "excess elements in array initializer" "" { target *-*-* } 12 } */ + /* { dg-warning "near initialization" "" { target *-*-* } 12 } */ } diff --git a/gcc/testsuite/gcc.target/i386/20060512-4.c b/gcc/testsuite/gcc.target/i386/20060512-4.c index 353b6dd..372a3b1 100644 --- a/gcc/testsuite/gcc.target/i386/20060512-4.c +++ b/gcc/testsuite/gcc.target/i386/20060512-4.c @@ -6,7 +6,7 @@ outer_function (int x, int y) { int __attribute__ ((__noinline__)) nested_function (int x, int y) - { /* { dg-error "-mstackrealign ignored for nested functions" } */ + { /* { dg-warning "-mstackrealign ignored for nested functions" } */ return (x + y); } return (3 + nested_function (x, y)); diff --git a/gcc/testsuite/gcc.target/i386/sseregparm-2.c b/gcc/testsuite/gcc.target/i386/sseregparm-2.c index 1b152e9..84bf589 100644 --- a/gcc/testsuite/gcc.target/i386/sseregparm-2.c +++ b/gcc/testsuite/gcc.target/i386/sseregparm-2.c @@ -4,14 +4,14 @@ float essef(float) __attribute__((sseregparm)); double essed(double) __attribute__((sseregparm)); -float __attribute__((sseregparm, noinline)) ssef(float f) { return f; } /* { dg-warning "SSE" } */ -double __attribute__((sseregparm, noinline)) ssed(double d) { return d; } /* { dg-warning "SSE" } */ +float __attribute__((sseregparm, noinline)) ssef(float f) { return f; } /* { dg-error "SSE" } */ +double __attribute__((sseregparm, noinline)) ssed(double d) { return d; } /* { dg-error "SSE" } */ extern double d; extern float f; void test(void) { - f = essef(f); /* { dg-warning "SSE" } */ - d = essed(d); /* { dg-warning "SSE" } */ - f = ssef(f); /* { dg-warning "SSE" } */ - d = ssed(d); /* { dg-warning "SSE" } */ + f = essef(f); /* { dg-error "SSE" } */ + d = essed(d); /* { dg-error "SSE" } */ + f = ssef(f); /* { dg-error "SSE" } */ + d = ssed(d); /* { dg-error "SSE" } */ } -- cgit v1.1