re PR testsuite/25241 ([C++] DejaGNU does not distinguish between errors and warnings)

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
parent 83983455
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
/* { 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" } */
......
......@@ -5,5 +5,5 @@
void foo()
{
return;
break; /* { dg-warning "break statement not within" } */
break; /* { dg-error "break statement not within" } */
}
/* { 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 } */
......@@ -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 } */
......@@ -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" } */
......
......@@ -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";
/* { 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)
{
......
......@@ -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" */
......@@ -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 } */
};
......@@ -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" } */
/* 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 } */
......@@ -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" } */
......@@ -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 } */
}
......@@ -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));
......
......@@ -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" } */
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment