re PR testsuite/25241 ([C++] DejaGNU does not distinguish between errors and warnings)
authorManuel López-Ibáñez <manu@gcc.gnu.org>
Sun, 8 Jul 2007 14:50:37 +0000 (14:50 +0000)
committerManuel López-Ibáñez <manu@gcc.gnu.org>
Sun, 8 Jul 2007 14:50:37 +0000 (14:50 +0000)
2007-07-08  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

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

16 files changed:
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/20041213-1.c
gcc/testsuite/gcc.dg/20050121-1.c
gcc/testsuite/gcc.dg/940510-1.c
gcc/testsuite/gcc.dg/array-2.c
gcc/testsuite/gcc.dg/bitfld-1.c
gcc/testsuite/gcc.dg/charset/attribute2.c
gcc/testsuite/gcc.dg/empty2.c
gcc/testsuite/gcc.dg/pack-test-2.c
gcc/testsuite/gcc.dg/pr14475.c
gcc/testsuite/gcc.dg/pr18809-1.c
gcc/testsuite/gcc.dg/pr27953.c
gcc/testsuite/gcc.dg/redecl-1.c
gcc/testsuite/gcc.dg/vla-init-1.c
gcc/testsuite/gcc.target/i386/20060512-4.c
gcc/testsuite/gcc.target/i386/sseregparm-2.c

index 076eb9e3a20bd6e84e5440669f8b45adba15f10c..1eb39df47da0eaa988a1cf582d9bf0bbc9b35f81 100644 (file)
@@ -1,3 +1,25 @@
+2007-07-08  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
+
+       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  <jvdelisle@gcc.gnu.org>
 
        PR fortran/32644
index 990273714472dd9ae443faba7edf72b342e8e504..f7ef30a62f98be0f976f4f035f35d3964af689d6 100644 (file)
@@ -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" } */
index a0b717e0eb0126fff38b679b8df1fe0492b05c30..3fe299a6dc2b7318bf5bc4227d0bc6f517731b93 100644 (file)
@@ -5,5 +5,5 @@
 void foo()
 {
   return;
-  break;       /* { dg-warning "break statement not within" } */
+  break;       /* { dg-error "break statement not within" } */
 }
index a734c8f80d7679affba14422f0a69123db2bc943..2c27e0090f9dca3eee3ba01de7184b842ab8e7b6 100644 (file)
@@ -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 } */
+
index 06c753f63216be70f8d5e2204b84bc164d9b2a22..497c58666e6efdcab0e945fc618790cbb29ddd47 100644 (file)
@@ -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 } */
index 37acb6efac2aa8aef9d1d5c70e276c3420abc375..fa835f2299f69bedd6bc05af25c7660a3040fef7 100644 (file)
@@ -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" } */
index ef1f35f3ed109ece012dac9c0c5b5559cb08097e..427e94979f81b18f72c44832035a53c2a4a3da2b 100644 (file)
@@ -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";
index 54b98f6f0b3be7da1bff9ac4b97e91d5c8ef82c0..acc1ac8ddcb4a10158467b599c48bbae64f01c7e 100644 (file)
@@ -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)
 {
index 974d982c5055320abb20823d1afb5645bdbf7506..8cb89f488e3ff4a7e0c6fd5c3780c44661eb138d 100644 (file)
@@ -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" */
index 8009d46565736687ab2e5ba457b3023354789414..4fa5b0436614184b1c9216b0d0841a05a1807649 100644 (file)
@@ -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 } */
 };
index f20f00433fe6f637ca14694f3208a31f8a5cb2a1..27f2be9ef0421d7b280005a6257c47aaecdb71ce 100644 (file)
@@ -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" } */
index b5e86e262fd272e8f0785127963d7157b8dd66fc..7df46b1d8e1f62131521663deeaf3ebdd52b0b79 100644 (file)
@@ -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 } */
index 75ce208457c6295eedffe8180b6b1b3c22c77c08..c76004e0de47b1d776021c4edf872f0c881c619e 100644 (file)
@@ -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" } */
index 61d235752fa5096c8404084a089186c6fb8fec05..68e7d651210dac1ab2d6bf64aed40447ff2dc009 100644 (file)
@@ -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 } */
 }
index 353b6ddfb404a63e78f7200b37b0fb7135b3c69e..372a3b10df7136e3e64747c3dbe7ec8e581df176 100644 (file)
@@ -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));
index 1b152e9a554d349e1981f0345222ba1dc36428cd..84bf58925c70fe705d38ce5e68d6ad4d3ff0bcda 100644 (file)
@@ -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" } */
 }