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

PR testsuite/25241
	* g++.old-deja/g++.brendan/crash7.C: Remove "error" or "warning" from
	message for dg-error/dg-warning.
	* g++.old-deja/g++.jason/crash11.C: Ditto.
	* g++.old-deja/g++.oliva/template1.C: Ditto.
	* g++.old-deja/g++.benjamin/tem03.C: Ditto.
	* g++.dg/rtti/no-rtti.C: Ditto.
	* g++.dg/cpp/pedantic-errors.C: Ditto.
	* g++.dg/cpp/string-2.C: Ditto.
	* g++.dg/ext/fpreg1.C: Ditto.
	* g++.dg/ext/altivec-types-1.C: Ditto.
	* g++.dg/warn/write-strings-default.C: Ditto.
	* g++.dg/warn/Wvla-2.C: Ditto.
	* g++.dg/warn/register-var-1.C: Ditto.
	* g++.dg/warn/deprecated-3.C: Ditto.
	* g++.dg/warn/pr30551-2.C: Ditto.
	* g++.dg/warn/overflow-warn-1.C: Ditto.
	* g++.dg/warn/pr30551.C: Ditto.
	* g++.dg/warn/pointer-integer-comparison.C: Ditto.
	* g++.dg/warn/pr12242.C: Ditto.
	* g++.dg/warn/write-strings.C: Ditto.
	* g++.dg/warn/overflow-warn-3.C: Ditto.
	* g++.dg/warn/overflow-warn-4.C: Ditto.
	* g++.dg/warn/overflow-warn-6.C: Ditto.
	* g++.dg/parse/crash43.C: Ditto.
	* g++.dg/parse/crash44.C: Ditto.
	* g++.dg/parse/offsetof8.C: Ditto.
	* g++.dg/gomp/pr35158.C: Ditto.
	* g++.dg/template/crash81.C: Ditto.

From-SVN: r140437
This commit is contained in:
Janis Johnson 2008-09-17 23:23:11 +00:00 committed by Janis Johnson
parent 116a365bd4
commit c95ef33cc6
28 changed files with 215 additions and 181 deletions

View File

@ -1,3 +1,35 @@
2008-09-17 Janis Johnson <janis187@us.ibm.com>
PR testsuite/25241
* g++.old-deja/g++.brendan/crash7.C: Remove "error" or "warning" from
message for dg-error/dg-warning.
* g++.old-deja/g++.jason/crash11.C: Ditto.
* g++.old-deja/g++.oliva/template1.C: Ditto.
* g++.old-deja/g++.benjamin/tem03.C: Ditto.
* g++.dg/rtti/no-rtti.C: Ditto.
* g++.dg/cpp/pedantic-errors.C: Ditto.
* g++.dg/cpp/string-2.C: Ditto.
* g++.dg/ext/fpreg1.C: Ditto.
* g++.dg/ext/altivec-types-1.C: Ditto.
* g++.dg/warn/write-strings-default.C: Ditto.
* g++.dg/warn/Wvla-2.C: Ditto.
* g++.dg/warn/register-var-1.C: Ditto.
* g++.dg/warn/deprecated-3.C: Ditto.
* g++.dg/warn/pr30551-2.C: Ditto.
* g++.dg/warn/overflow-warn-1.C: Ditto.
* g++.dg/warn/pr30551.C: Ditto.
* g++.dg/warn/pointer-integer-comparison.C: Ditto.
* g++.dg/warn/pr12242.C: Ditto.
* g++.dg/warn/write-strings.C: Ditto.
* g++.dg/warn/overflow-warn-3.C: Ditto.
* g++.dg/warn/overflow-warn-4.C: Ditto.
* g++.dg/warn/overflow-warn-6.C: Ditto.
* g++.dg/parse/crash43.C: Ditto.
* g++.dg/parse/crash44.C: Ditto.
* g++.dg/parse/offsetof8.C: Ditto.
* g++.dg/gomp/pr35158.C: Ditto.
* g++.dg/template/crash81.C: Ditto.
2008-09-18 Paul Thomas <pault@gcc.gnu.org>
PR fortran/37274

View File

@ -2,4 +2,4 @@
/* { dg-options "-std=c++98 -pedantic-errors" } */
#if 1
#endif 1 /* { dg-error "error: extra tokens at end of #endif directive" } */
#endif 1 /* { dg-error "extra tokens at end of #endif directive" } */

View File

@ -3,4 +3,4 @@
// { dg-do compile }
// { dg-options "" }
const char *s = "\q"; // { dg-warning "warning: unknown escape sequence" }
const char *s = "\q"; // { dg-warning "unknown escape sequence" }

View File

@ -68,21 +68,21 @@ __vector __complex unsigned long long v_cull; /* { dg-error "AltiVec types" "" }
/* These should be rejected because the component types are invalid. We
don't care about the actual error messages here. */
__vector __bool unsigned char vbuc; /* { dg-error "error" "" } */
__vector __bool signed char vbsc; /* { dg-error "error" "" } */
__vector __bool unsigned short vbuh; /* { dg-error "error" "" } */
__vector __bool signed short vbsh; /* { dg-error "error" "" } */
__vector __bool unsigned int vbui; /* { dg-error "error" "" } */
__vector __bool signed int vbsi; /* { dg-error "error" "" } */
__vector __bool unsigned vbuj; /* { dg-error "error" "" } */
__vector __bool signed vbsj; /* { dg-error "error" "" } */
__vector signed float vsf; /* { dg-error "error" "" } */
__vector unsigned float vuf; /* { dg-error "error" "" } */
__vector short float vsf; /* { dg-error "error" "" } */
__vector signed double vsd; /* { dg-error "error" "" } */
__vector unsigned double vud; /* { dg-error "error" "" } */
__vector short double vsd; /* { dg-error "error" "" } */
__vector __bool float vbf; /* { dg-error "error" "" } */
__vector __bool double vbd; /* { dg-error "error" "" } */
__vector __bool short float blf; /* { dg-error "error" "" } */
__vector __bool short double vlbd; /* { dg-error "error" "" } */
__vector __bool unsigned char vbuc; /* { dg-error "" "" } */
__vector __bool signed char vbsc; /* { dg-error "" "" } */
__vector __bool unsigned short vbuh; /* { dg-error "" "" } */
__vector __bool signed short vbsh; /* { dg-error "" "" } */
__vector __bool unsigned int vbui; /* { dg-error "" "" } */
__vector __bool signed int vbsi; /* { dg-error "" "" } */
__vector __bool unsigned vbuj; /* { dg-error "" "" } */
__vector __bool signed vbsj; /* { dg-error "" "" } */
__vector signed float vsf; /* { dg-error "" "" } */
__vector unsigned float vuf; /* { dg-error "" "" } */
__vector short float vsf; /* { dg-error "" "" } */
__vector signed double vsd; /* { dg-error "" "" } */
__vector unsigned double vud; /* { dg-error "" "" } */
__vector short double vsd; /* { dg-error "" "" } */
__vector __bool float vbf; /* { dg-error "" "" } */
__vector __bool double vbd; /* { dg-error "" "" } */
__vector __bool short float blf; /* { dg-error "" "" } */
__vector __bool short double vlbd; /* { dg-error "" "" } */

View File

@ -8,7 +8,7 @@ double d;
// Default initialized __fpreg is OK.
__fpreg fpreg, fpreg2;
// But explicitly zero-initialized is an invalid conversion.
__fpreg fi = 0; // { dg-error "error: invalid conversion to '__fpreg'" }
__fpreg fi = 0; // { dg-error "invalid conversion to '__fpreg'" }
__fpreg f0 (__fpreg);
int f1 (__float80);
@ -36,47 +36,47 @@ f (void)
d = sizeof (fpreg);
(void)(fpreg, fpreg);
// Invalid operations.
++fpreg; // { dg-error "error: invalid operation on '__fpreg'" }
--fpreg; // { dg-error "error: invalid operation on '__fpreg'" }
fpreg++; // { dg-error "error: invalid operation on '__fpreg'" }
fpreg--; // { dg-error "error: invalid operation on '__fpreg'" }
fpreg = -fpreg; // { dg-error "error: invalid operation on '__fpreg'" }
fpreg = ~fpreg; // { dg-error "error: invalid operation on '__fpreg'" }
d = !fpreg; // { dg-error "error: invalid operation on '__fpreg'" }
d = *fpreg; // { dg-error "error: invalid type argument" }
if (fpreg) // { dg-error "error: invalid conversion from '__fpreg'" }
++fpreg; // { dg-error "invalid operation on '__fpreg'" }
--fpreg; // { dg-error "invalid operation on '__fpreg'" }
fpreg++; // { dg-error "invalid operation on '__fpreg'" }
fpreg--; // { dg-error "invalid operation on '__fpreg'" }
fpreg = -fpreg; // { dg-error "invalid operation on '__fpreg'" }
fpreg = ~fpreg; // { dg-error "invalid operation on '__fpreg'" }
d = !fpreg; // { dg-error "invalid operation on '__fpreg'" }
d = *fpreg; // { dg-error "invalid type argument" }
if (fpreg) // { dg-error "invalid conversion from '__fpreg'" }
return;
d = fpreg; // { dg-error "error: invalid conversion from '__fpreg'" }
d = (double) fpreg; // { dg-error "error: invalid conversion from '__fpreg'" }
fpreg = (__fpreg) d; // { dg-error "error: invalid conversion to '__fpreg'" }
fpreg = fpreg * fpreg; // { dg-error "error: invalid operation on '__fpreg'" }
fpreg = fpreg / fpreg; // { dg-error "error: invalid operation on '__fpreg'" }
fpreg = fpreg % fpreg; // { dg-error "error: invalid operation on '__fpreg'" }
fpreg = fpreg + fpreg; // { dg-error "error: invalid operation on '__fpreg'" }
fpreg = fpreg - fpreg; // { dg-error "error: invalid operation on '__fpreg'" }
fpreg = fpreg << fpreg; // { dg-error "error: invalid operation on '__fpreg'" }
fpreg = fpreg >> fpreg; // { dg-error "error: invalid operation on '__fpreg'" }
d = fpreg < fpreg; // { dg-error "error: invalid operation on '__fpreg'" }
d = fpreg > fpreg; // { dg-error "error: invalid operation on '__fpreg'" }
d = fpreg <= fpreg; // { dg-error "error: invalid operation on '__fpreg'" }
d = fpreg >= fpreg; // { dg-error "error: invalid operation on '__fpreg'" }
d = fpreg == fpreg; // { dg-error "error: invalid operation on '__fpreg'" }
d = fpreg != fpreg; // { dg-error "error: invalid operation on '__fpreg'" }
d = fpreg & fpreg; // { dg-error "error: invalid operation on '__fpreg'" }
d = fpreg ^ fpreg; // { dg-error "error: invalid operation on '__fpreg'" }
d = fpreg | fpreg; // { dg-error "error: invalid operation on '__fpreg'" }
d = fpreg && fpreg; // { dg-error "error: invalid operation on '__fpreg'" }
d = fpreg || fpreg; // { dg-error "error: invalid operation on '__fpreg'" }
d = (fpreg ? 1 : 2); // { dg-error "error: invalid conversion from '__fpreg'" }
fpreg = (d ? fpreg : d); // { dg-error "error: invalid conversion to '__fpreg'" }
fpreg *= fpreg; // { dg-error "error: invalid operation on '__fpreg'|in evaluation" }
fpreg /= fpreg; // { dg-error "error: invalid operation on '__fpreg'|in evaluation" }
fpreg %= fpreg; // { dg-error "error: invalid operation on '__fpreg'|in evaluation" }
fpreg += fpreg; // { dg-error "error: invalid operation on '__fpreg'|in evaluation" }
fpreg -= fpreg; // { dg-error "error: invalid operation on '__fpreg'|in evaluation" }
fpreg <<= fpreg; // { dg-error "error: invalid operation on '__fpreg'|in evaluation" }
fpreg >>= fpreg; // { dg-error "error: invalid operation on '__fpreg'|in evaluation" }
fpreg &= fpreg; // { dg-error "error: invalid operation on '__fpreg'|in evaluation" }
fpreg ^= fpreg; // { dg-error "error: invalid operation on '__fpreg'|in evaluation" }
fpreg |= fpreg; // { dg-error "error: invalid operation on '__fpreg'|in evaluation" }
d = fpreg; // { dg-error "invalid conversion from '__fpreg'" }
d = (double) fpreg; // { dg-error "invalid conversion from '__fpreg'" }
fpreg = (__fpreg) d; // { dg-error "invalid conversion to '__fpreg'" }
fpreg = fpreg * fpreg; // { dg-error "invalid operation on '__fpreg'" }
fpreg = fpreg / fpreg; // { dg-error "invalid operation on '__fpreg'" }
fpreg = fpreg % fpreg; // { dg-error "invalid operation on '__fpreg'" }
fpreg = fpreg + fpreg; // { dg-error "invalid operation on '__fpreg'" }
fpreg = fpreg - fpreg; // { dg-error "invalid operation on '__fpreg'" }
fpreg = fpreg << fpreg; // { dg-error "invalid operation on '__fpreg'" }
fpreg = fpreg >> fpreg; // { dg-error "invalid operation on '__fpreg'" }
d = fpreg < fpreg; // { dg-error "invalid operation on '__fpreg'" }
d = fpreg > fpreg; // { dg-error "invalid operation on '__fpreg'" }
d = fpreg <= fpreg; // { dg-error "invalid operation on '__fpreg'" }
d = fpreg >= fpreg; // { dg-error "invalid operation on '__fpreg'" }
d = fpreg == fpreg; // { dg-error "invalid operation on '__fpreg'" }
d = fpreg != fpreg; // { dg-error "invalid operation on '__fpreg'" }
d = fpreg & fpreg; // { dg-error "invalid operation on '__fpreg'" }
d = fpreg ^ fpreg; // { dg-error "invalid operation on '__fpreg'" }
d = fpreg | fpreg; // { dg-error "invalid operation on '__fpreg'" }
d = fpreg && fpreg; // { dg-error "invalid operation on '__fpreg'" }
d = fpreg || fpreg; // { dg-error "invalid operation on '__fpreg'" }
d = (fpreg ? 1 : 2); // { dg-error "invalid conversion from '__fpreg'" }
fpreg = (d ? fpreg : d); // { dg-error "invalid conversion to '__fpreg'" }
fpreg *= fpreg; // { dg-error "invalid operation on '__fpreg'|in evaluation" }
fpreg /= fpreg; // { dg-error "invalid operation on '__fpreg'|in evaluation" }
fpreg %= fpreg; // { dg-error "invalid operation on '__fpreg'|in evaluation" }
fpreg += fpreg; // { dg-error "invalid operation on '__fpreg'|in evaluation" }
fpreg -= fpreg; // { dg-error "invalid operation on '__fpreg'|in evaluation" }
fpreg <<= fpreg; // { dg-error "invalid operation on '__fpreg'|in evaluation" }
fpreg >>= fpreg; // { dg-error "invalid operation on '__fpreg'|in evaluation" }
fpreg &= fpreg; // { dg-error "invalid operation on '__fpreg'|in evaluation" }
fpreg ^= fpreg; // { dg-error "invalid operation on '__fpreg'|in evaluation" }
fpreg |= fpreg; // { dg-error "invalid operation on '__fpreg'|in evaluation" }
}

View File

@ -5,7 +5,7 @@
int main(int argc, char *argv[])
{
#pragma omp parallel for
for (int i(0) ; // { dg-error "error: parenthesized initialization is not allowed in OpenMP 'for' loop" }
for (int i(0) ; // { dg-error "parenthesized initialization is not allowed in OpenMP 'for' loop" }
i < 10 ;
i++)
;

View File

@ -4,6 +4,6 @@ namespace N
{
void foo()
{
extern int i = 0; // { dg-error "error: 'i' has both 'extern' and initializer" }
extern int i = 0; // { dg-error "'i' has both 'extern' and initializer" }
}
}

View File

@ -8,7 +8,7 @@ struct test {
int main(void) {
struct test foo = {
once: PTHREAD_ONCE_INITIALIZER // { dg-error "error: 'PTHREAD_ONCE_INITIALIZER' was not declared in this scope" }
once: PTHREAD_ONCE_INITIALIZER // { dg-error "'PTHREAD_ONCE_INITIALIZER' was not declared in this scope" }
};
return 0;

View File

@ -12,5 +12,5 @@ struct B
void foo()
{
__builtin_offsetof(B, a[0]); /* { dg-error "error: cannot apply 'offsetof' when 'operator\\\[\\\]' is overloaded" } */
__builtin_offsetof(B, a[0]); /* { dg-error "cannot apply 'offsetof' when 'operator\\\[\\\]' is overloaded" } */
}

View File

@ -14,5 +14,5 @@ A* f();
int main()
{
B* b = dynamic_cast<B*>(f()); // { dg-error "error: " }
B* b = dynamic_cast<B*>(f()); // { dg-error "" }
}

View File

@ -2,5 +2,7 @@
struct A
{
template<T::X> struct X; // { dg-error "error: 'T' has not been declared|error: declaration of 'template<int X> struct A::X'|error: shadows template parm 'int X'" }
template<T::X> struct X; // { dg-error "'T' has not been declared" "T" }
// { dg-error "declaration of 'template<int X> struct A::X'" "A::X" { target *-*-* } 5 }
// { dg-error "shadows template parm 'int X'" "shadow" { target *-*-* } 5 }
};

View File

@ -3,5 +3,5 @@
void func (int i)
{
int array[i]; /* { dg-error "error: ISO C.* forbids variable.* array 'array'" } */
int array[i]; /* { dg-error "ISO C.* forbids variable.* array 'array'" } */
}

View File

@ -10,5 +10,5 @@ struct Foo
void g(void)
{
Foo f;
(int)f; // { dg-warning "warning: 'Foo::operator int\\(\\)' is deprecated \\(declared at" }
(int)f; // { dg-warning "'Foo::operator int\\(\\)' is deprecated \\(declared at" }
}

View File

@ -12,23 +12,23 @@ enum e {
/* Overflow in an unevaluated part of an expression is OK (example
in the standard). */
E2 = 2 || 1 / 0, /* { dg-bogus "warning: division by zero" "" { xfail *-*-* } 14 } */
E3 = 1 / 0, /* { dg-warning "warning: division by zero" } */
/* { dg-error "error: enumerator value for 'E3' is not an integer constant" "enum error" { target *-*-* } 15 } */
E3 = 1 / 0, /* { dg-warning "division by zero" } */
/* { dg-error "enumerator value for 'E3' is not an integer constant" "enum error" { target *-*-* } 15 } */
/* But as in DR#031, the 1/0 in an evaluated subexpression means the
whole expression violates the constraints. */
E4 = 0 * (1 / 0), /* { dg-warning "warning: division by zero" } */
/* { dg-error "error: enumerator value for 'E4' is not an integer constant" "enum error" { xfail *-*-* } 19 } */
E5 = INT_MAX + 1, /* { dg-warning "warning: integer overflow in expression" } */
E4 = 0 * (1 / 0), /* { dg-warning "division by zero" } */
/* { dg-error "enumerator value for 'E4' is not an integer constant" "enum error" { xfail *-*-* } 19 } */
E5 = INT_MAX + 1, /* { dg-warning "integer overflow in expression" } */
/* Again, overflow in evaluated subexpression. */
E6 = 0 * (INT_MAX + 1), /* { dg-warning "warning: integer overflow in expression" } */
E6 = 0 * (INT_MAX + 1), /* { dg-warning "integer overflow in expression" } */
/* A cast does not constitute overflow in conversion. */
E7 = (char) INT_MAX
};
struct s {
int a;
int : 0 * (1 / 0); /* { dg-warning "warning: division by zero" } */
int : 0 * (INT_MAX + 1); /* { dg-warning "warning: integer overflow in expression" } */
int : 0 * (1 / 0); /* { dg-warning "division by zero" } */
int : 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */
};
void
@ -36,11 +36,11 @@ f (void)
{
/* This expression is not required to be a constant expression, so
it should just involve undefined behavior at runtime. */
int c = INT_MAX + 1; /* { dg-warning "warning: integer overflow in expression" } */
int c = INT_MAX + 1; /* { dg-warning "integer overflow in expression" } */
}
/* This expression is neither required to be constant. */
static int sc = INT_MAX + 1; /* { dg-warning "warning: integer overflow in expression" } */
static int sc = INT_MAX + 1; /* { dg-warning "integer overflow in expression" } */
// Test for overflow in null pointer constant.
@ -48,9 +48,9 @@ void *n = 0;
/* The first two of these involve overflow, so are not null pointer
constants. The third has the overflow in an unevaluated
subexpression, so is a null pointer constant. */
void *p = 0 * (INT_MAX + 1); /* { dg-warning "warning: integer overflow in expression" } */
void *p = 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */
/* { dg-error "invalid conversion from 'int' to 'void" "null" { target *-*-* } 51 } */
void *q = 0 * (1 / 0); /* { dg-warning "warning: division by zero" } */
void *q = 0 * (1 / 0); /* { dg-warning "division by zero" } */
/* { dg-error "invalid conversion from 'int' to 'void*'" "null" { xfail *-*-* } 53 } */
void *r = (1 ? 0 : INT_MAX+1); /* { dg-bogus "integer overflow in expression" "" { xfail *-*-* } 55 } */
@ -59,9 +59,9 @@ g (int i)
{
switch (i)
{
case 0 * (1/0): /* { dg-warning "warning: division by zero" } */
case 0 * (1/0): /* { dg-warning "division by zero" } */
;
case 1 + 0 * (INT_MAX + 1): /* { dg-warning "warning: integer overflow in expression" } */
case 1 + 0 * (INT_MAX + 1): /* { dg-warning "integer overflow in expression" } */
;
}
}
@ -69,13 +69,13 @@ g (int i)
int
h (void)
{
return INT_MAX + 1; /* { dg-warning "warning: integer overflow in expression" } */
return INT_MAX + 1; /* { dg-warning "integer overflow in expression" } */
}
int
h1 (void)
{
return INT_MAX + 1 - INT_MAX; /* { dg-warning "warning: integer overflow in expression" } */
return INT_MAX + 1 - INT_MAX; /* { dg-warning "integer overflow in expression" } */
}
void fuc (unsigned char);
@ -85,14 +85,14 @@ void
h2 (void)
{
fsc (SCHAR_MAX + 1);
fsc (SCHAR_MIN - 1); /* { dg-warning "warning: overflow in implicit constant conversion" } */
fsc (SCHAR_MIN - 1); /* { dg-warning "overflow in implicit constant conversion" } */
fsc (UCHAR_MAX);
fsc (UCHAR_MAX + 1); /* { dg-warning "warning: overflow in implicit constant conversion" } */
fsc (UCHAR_MAX + 1); /* { dg-warning "overflow in implicit constant conversion" } */
fuc (-1);
fuc (UCHAR_MAX + 1); /* { dg-warning "warning: large integer implicitly truncated to unsigned type" } */
fuc (UCHAR_MAX + 1); /* { dg-warning "large integer implicitly truncated to unsigned type" } */
fuc (SCHAR_MIN);
fuc (SCHAR_MIN - 1); /* { dg-warning "warning: large integer implicitly truncated to unsigned type" } */
fuc (-UCHAR_MAX); /* { dg-warning "warning: large integer implicitly truncated to unsigned type" } */
fuc (SCHAR_MIN - 1); /* { dg-warning "large integer implicitly truncated to unsigned type" } */
fuc (-UCHAR_MAX); /* { dg-warning "large integer implicitly truncated to unsigned type" } */
}
void fui (unsigned int);

View File

@ -12,26 +12,26 @@ enum e {
/* Overflow in an unevaluated part of an expression is OK (example
in the standard). */
E2 = 2 || 1 / 0, /* { dg-bogus "warning: division by zero" "" { xfail *-*-* } 14 } */
E3 = 1 / 0, /* { dg-warning "warning: division by zero" } */
/* { dg-error "error: enumerator value for 'E3' is not an integer constant" "enum error" { target *-*-* } 15 } */
E3 = 1 / 0, /* { dg-warning "division by zero" } */
/* { dg-error "enumerator value for 'E3' is not an integer constant" "enum error" { target *-*-* } 15 } */
/* But as in DR#031, the 1/0 in an evaluated subexpression means the
whole expression violates the constraints. */
E4 = 0 * (1 / 0), /* { dg-warning "warning: division by zero" } */
/* { dg-error "error: enumerator value for 'E4' is not an integer constant" "enum error" { xfail *-*-* } 19 } */
E5 = INT_MAX + 1, /* { dg-warning "warning: integer overflow in expression" } */
/* { dg-warning "warning: overflow in constant expression" "constant" { target *-*-* } 21 } */
E4 = 0 * (1 / 0), /* { dg-warning "division by zero" } */
/* { dg-error "enumerator value for 'E4' is not an integer constant" "enum error" { xfail *-*-* } 19 } */
E5 = INT_MAX + 1, /* { dg-warning "integer overflow in expression" } */
/* { dg-warning "overflow in constant expression" "constant" { target *-*-* } 21 } */
/* Again, overflow in evaluated subexpression. */
E6 = 0 * (INT_MAX + 1), /* { dg-warning "warning: integer overflow in expression" } */
/* { dg-warning "warning: overflow in constant expression" "constant" { target *-*-* } 24 } */
E6 = 0 * (INT_MAX + 1), /* { dg-warning "integer overflow in expression" } */
/* { dg-warning "overflow in constant expression" "constant" { target *-*-* } 24 } */
/* A cast does not constitute overflow in conversion. */
E7 = (char) INT_MAX
};
struct s {
int a;
int : 0 * (1 / 0); /* { dg-warning "warning: division by zero" } */
int : 0 * (INT_MAX + 1); /* { dg-warning "warning: integer overflow in expression" } */
/* { dg-warning "warning: overflow in constant expression" "constant" { target *-*-* } 33 } */
int : 0 * (1 / 0); /* { dg-warning "division by zero" } */
int : 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */
/* { dg-warning "overflow in constant expression" "constant" { target *-*-* } 33 } */
};
void
@ -39,12 +39,12 @@ f (void)
{
/* This expression is not required to be a constant expression, so
it should just involve undefined behavior at runtime. */
int c = INT_MAX + 1; /* { dg-warning "warning: integer overflow in expression" } */
int c = INT_MAX + 1; /* { dg-warning "integer overflow in expression" } */
}
/* This expression is neither required to be constant. */
static int sc = INT_MAX + 1; /* { dg-warning "warning: integer overflow in expression" } */
static int sc = INT_MAX + 1; /* { dg-warning "integer overflow in expression" } */
// Test for overflow in null pointer constant.
@ -52,11 +52,11 @@ void *n = 0;
/* The first two of these involve overflow, so are not null pointer
constants. The third has the overflow in an unevaluated
subexpression, so is a null pointer constant. */
void *p = 0 * (INT_MAX + 1); /* { dg-warning "warning: integer overflow in expression" } */
/* { dg-error "invalid conversion from 'int' to 'void" "null" { target *-*-* } 55 } */
void *p = 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */
/* { dg-warning "invalid conversion from 'int' to 'void" "null" { target *-*-* } 55 } */
void *q = 0 * (1 / 0); /* { dg-warning "warning: division by zero" } */
/* { dg-error "invalid conversion from 'int' to 'void*'" "null" { xfail *-*-* } 58 } */
void *q = 0 * (1 / 0); /* { dg-warning "division by zero" } */
/* { dg-warning "invalid conversion from 'int' to 'void*'" "null" { xfail *-*-* } 58 } */
void *r = (1 ? 0 : INT_MAX+1); /* { dg-bogus "integer overflow in expression" "" { xfail *-*-* } 60 } */
void
@ -64,10 +64,10 @@ g (int i)
{
switch (i)
{
case 0 * (1/0): /* { dg-warning "warning: division by zero" } */
case 0 * (1/0): /* { dg-warning "division by zero" } */
;
case 1 + 0 * (INT_MAX + 1): /* { dg-warning "warning: integer overflow in expression" } */
/* { dg-warning "warning: overflow in constant expression" "constant" { target *-*-* } 69 } */
case 1 + 0 * (INT_MAX + 1): /* { dg-warning "integer overflow in expression" } */
/* { dg-warning "overflow in constant expression" "constant" { target *-*-* } 69 } */
;
}
}
@ -75,13 +75,13 @@ g (int i)
int
h (void)
{
return INT_MAX + 1; /* { dg-warning "warning: integer overflow in expression" } */
return INT_MAX + 1; /* { dg-warning "integer overflow in expression" } */
}
int
h1 (void)
{
return INT_MAX + 1 - INT_MAX; /* { dg-warning "warning: integer overflow in expression" } */
return INT_MAX + 1 - INT_MAX; /* { dg-warning "integer overflow in expression" } */
}
void fuc (unsigned char);
@ -90,15 +90,15 @@ void fsc (signed char);
void
h2 (void)
{
fsc (SCHAR_MAX + 1); /* { dg-warning "warning: overflow in implicit constant conversion" } */
fsc (SCHAR_MIN - 1); /* { dg-warning "warning: overflow in implicit constant conversion" } */
fsc (UCHAR_MAX); /* { dg-warning "warning: overflow in implicit constant conversion" } */
fsc (UCHAR_MAX + 1); /* { dg-warning "warning: overflow in implicit constant conversion" } */
fsc (SCHAR_MAX + 1); /* { dg-warning "overflow in implicit constant conversion" } */
fsc (SCHAR_MIN - 1); /* { dg-warning "overflow in implicit constant conversion" } */
fsc (UCHAR_MAX); /* { dg-warning "overflow in implicit constant conversion" } */
fsc (UCHAR_MAX + 1); /* { dg-warning "overflow in implicit constant conversion" } */
fuc (-1);
fuc (UCHAR_MAX + 1); /* { dg-warning "warning: large integer implicitly truncated to unsigned type" } */
fuc (UCHAR_MAX + 1); /* { dg-warning "large integer implicitly truncated to unsigned type" } */
fuc (SCHAR_MIN);
fuc (SCHAR_MIN - 1); /* { dg-warning "warning: large integer implicitly truncated to unsigned type" } */
fuc (-UCHAR_MAX); /* { dg-warning "warning: large integer implicitly truncated to unsigned type" } */
fuc (SCHAR_MIN - 1); /* { dg-warning "large integer implicitly truncated to unsigned type" } */
fuc (-UCHAR_MAX); /* { dg-warning "large integer implicitly truncated to unsigned type" } */
}
void fui (unsigned int);

View File

@ -12,26 +12,26 @@ enum e {
/* Overflow in an unevaluated part of an expression is OK (example
in the standard). */
E2 = 2 || 1 / 0, /* { dg-bogus "warning: division by zero" "" { xfail *-*-* } 14 } */
E3 = 1 / 0, /* { dg-warning "warning: division by zero" } */
/* { dg-error "error: enumerator value for 'E3' is not an integer constant" "enum error" { target *-*-* } 15 } */
E3 = 1 / 0, /* { dg-warning "division by zero" } */
/* { dg-error "enumerator value for 'E3' is not an integer constant" "enum error" { target *-*-* } 15 } */
/* But as in DR#031, the 1/0 in an evaluated subexpression means the
whole expression violates the constraints. */
E4 = 0 * (1 / 0), /* { dg-warning "warning: division by zero" } */
/* { dg-error "error: enumerator value for 'E4' is not an integer constant" "enum error" { xfail *-*-* } 19 } */
E5 = INT_MAX + 1, /* { dg-warning "warning: integer overflow in expression" } */
/* { dg-error "error: overflow in constant expression" "constant" { target *-*-* } 21 } */
E4 = 0 * (1 / 0), /* { dg-warning "division by zero" } */
/* { dg-error "enumerator value for 'E4' is not an integer constant" "enum error" { xfail *-*-* } 19 } */
E5 = INT_MAX + 1, /* { dg-warning "integer overflow in expression" } */
/* { dg-error "overflow in constant expression" "constant" { target *-*-* } 21 } */
/* Again, overflow in evaluated subexpression. */
E6 = 0 * (INT_MAX + 1), /* { dg-warning "warning: integer overflow in expression" } */
/* { dg-error "error: overflow in constant expression" "constant" { target *-*-* } 24 } */
E6 = 0 * (INT_MAX + 1), /* { dg-warning "integer overflow in expression" } */
/* { dg-error "overflow in constant expression" "constant" { target *-*-* } 24 } */
/* A cast does not constitute overflow in conversion. */
E7 = (char) INT_MAX
};
struct s {
int a;
int : 0 * (1 / 0); /* { dg-warning "warning: division by zero" } */
int : 0 * (INT_MAX + 1); /* { dg-warning "warning: integer overflow in expression" } */
/* { dg-error "error: overflow in constant expression" "constant" { target *-*-* } 33 } */
int : 0 * (1 / 0); /* { dg-warning "division by zero" } */
int : 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */
/* { dg-error "overflow in constant expression" "constant" { target *-*-* } 33 } */
};
void
@ -39,12 +39,12 @@ f (void)
{
/* This expression is not required to be a constant expression, so
it should just involve undefined behavior at runtime. */
int c = INT_MAX + 1; /* { dg-warning "warning: integer overflow in expression" } */
int c = INT_MAX + 1; /* { dg-warning "integer overflow in expression" } */
}
/* This expression is neither required to be constant. */
static int sc = INT_MAX + 1; /* { dg-warning "warning: integer overflow in expression" } */
static int sc = INT_MAX + 1; /* { dg-warning "integer overflow in expression" } */
// Test for overflow in null pointer constant.
@ -52,10 +52,10 @@ void *n = 0;
/* The first two of these involve overflow, so are not null pointer
constants. The third has the overflow in an unevaluated
subexpression, so is a null pointer constant. */
void *p = 0 * (INT_MAX + 1); /* { dg-warning "warning: integer overflow in expression" } */
void *p = 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */
/* { dg-error "invalid conversion from 'int' to 'void" "null" { target *-*-* } 55 } */
void *q = 0 * (1 / 0); /* { dg-warning "warning: division by zero" } */
void *q = 0 * (1 / 0); /* { dg-warning "division by zero" } */
/* { dg-error "invalid conversion from 'int' to 'void*'" "null" { xfail *-*-* } 58 } */
void *r = (1 ? 0 : INT_MAX+1); /* { dg-bogus "integer overflow in expression" "" { xfail *-*-* } 60 } */
@ -64,10 +64,10 @@ g (int i)
{
switch (i)
{
case 0 * (1/0): /* { dg-warning "warning: division by zero" } */
case 0 * (1/0): /* { dg-warning "division by zero" } */
;
case 1 + 0 * (INT_MAX + 1): /* { dg-warning "warning: integer overflow in expression" } */
/* { dg-error "error: overflow in constant expression" "constant" { target *-*-* } 69 } */
case 1 + 0 * (INT_MAX + 1): /* { dg-warning "integer overflow in expression" } */
/* { dg-error "overflow in constant expression" "constant" { target *-*-* } 69 } */
;
}
}
@ -75,13 +75,13 @@ g (int i)
int
h (void)
{
return INT_MAX + 1; /* { dg-warning "warning: integer overflow in expression" } */
return INT_MAX + 1; /* { dg-warning "integer overflow in expression" } */
}
int
h1 (void)
{
return INT_MAX + 1 - INT_MAX; /* { dg-warning "warning: integer overflow in expression" } */
return INT_MAX + 1 - INT_MAX; /* { dg-warning "integer overflow in expression" } */
}
void fuc (unsigned char);
@ -90,15 +90,15 @@ void fsc (signed char);
void
h2 (void)
{
fsc (SCHAR_MAX + 1); /* { dg-warning "warning: overflow in implicit constant conversion" } */
fsc (SCHAR_MIN - 1); /* { dg-warning "warning: overflow in implicit constant conversion" } */
fsc (UCHAR_MAX); /* { dg-warning "warning: overflow in implicit constant conversion" } */
fsc (UCHAR_MAX + 1); /* { dg-warning "warning: overflow in implicit constant conversion" } */
fsc (SCHAR_MAX + 1); /* { dg-warning "overflow in implicit constant conversion" } */
fsc (SCHAR_MIN - 1); /* { dg-warning "overflow in implicit constant conversion" } */
fsc (UCHAR_MAX); /* { dg-warning "overflow in implicit constant conversion" } */
fsc (UCHAR_MAX + 1); /* { dg-warning "overflow in implicit constant conversion" } */
fuc (-1);
fuc (UCHAR_MAX + 1); /* { dg-warning "warning: large integer implicitly truncated to unsigned type" } */
fuc (UCHAR_MAX + 1); /* { dg-warning "large integer implicitly truncated to unsigned type" } */
fuc (SCHAR_MIN);
fuc (SCHAR_MIN - 1); /* { dg-warning "warning: large integer implicitly truncated to unsigned type" } */
fuc (-UCHAR_MAX); /* { dg-warning "warning: large integer implicitly truncated to unsigned type" } */
fuc (SCHAR_MIN - 1); /* { dg-warning "large integer implicitly truncated to unsigned type" } */
fuc (-UCHAR_MAX); /* { dg-warning "large integer implicitly truncated to unsigned type" } */
}
void fui (unsigned int);

View File

@ -7,12 +7,12 @@
int
h1 (int x)
{
return x * (0 * (INT_MAX + 1)); /* { dg-warning "warning: integer overflow in expression" } */
return x * (0 * (INT_MAX + 1)); /* { dg-warning "integer overflow in expression" } */
}
int
h2 (int x)
{
return ((INT_MAX + 1) * 0) * x; /* { dg-warning "warning: integer overflow in expression" } */
return ((INT_MAX + 1) * 0) * x; /* { dg-warning "integer overflow in expression" } */
}

View File

@ -3,24 +3,24 @@
int foo (int i, void *p)
{
if (i == p) // { dg-warning "warning: ISO C.. forbids comparison between pointer and integer" }
if (i == p) // { dg-warning "ISO C.. forbids comparison between pointer and integer" }
return 0;
else if (i != p) // { dg-warning "warning: ISO C.. forbids comparison between pointer and integer" }
else if (i != p) // { dg-warning "ISO C.. forbids comparison between pointer and integer" }
return 1;
}
int bar (int i, void *p)
{
if (i < p) // { dg-warning "warning: ISO C.. forbids comparison between pointer and integer" }
if (i < p) // { dg-warning "ISO C.. forbids comparison between pointer and integer" }
return 0;
else if (i >= p) // { dg-warning "warning: ISO C.. forbids comparison between pointer and integer" }
else if (i >= p) // { dg-warning "ISO C.. forbids comparison between pointer and integer" }
return 1;
}
int baz (int i, void *p)
{
if (i <= p) // { dg-warning "warning: ISO C.. forbids comparison between pointer and integer" }
if (i <= p) // { dg-warning "ISO C.. forbids comparison between pointer and integer" }
return 0;
else if (i > p) // { dg-warning "warning: ISO C.. forbids comparison between pointer and integer" }
else if (i > p) // { dg-warning "ISO C.. forbids comparison between pointer and integer" }
return 1;
}

View File

@ -10,33 +10,33 @@ void example ()
X x;
Y y;
x = 10; // { dg-warning "warning: invalid conversion from .int. to .X." }
// { dg-warning "warning:\[^\n\]*unspecified" "" { target *-*-* } 13 }
x = 1; // { dg-warning "warning: invalid conversion from .int. to .X." }
x = C; // { dg-error "error: cannot convert .Y. to .X. in assignment" }
x = D; // { dg-error "error: cannot convert .Y. to .X. in assignment" }
y = A; // { dg-error "error: cannot convert .X. to .Y. in assignment" }
x = y; // { dg-error "error: cannot convert .Y. to .X. in assignment" }
x = i; // { dg-warning "warning: invalid conversion from .int. to .X." }
x = 10; // { dg-warning "invalid conversion from .int. to .X." }
// { dg-warning "unspecified" "" { target *-*-* } 13 }
x = 1; // { dg-warning "invalid conversion from .int. to .X." }
x = C; // { dg-error "cannot convert .Y. to .X. in assignment" }
x = D; // { dg-error "cannot convert .Y. to .X. in assignment" }
y = A; // { dg-error "cannot convert .X. to .Y. in assignment" }
x = y; // { dg-error "cannot convert .Y. to .X. in assignment" }
x = i; // { dg-warning "invalid conversion from .int. to .X." }
}
void foo ()
{
X a = static_cast<X> (10); // { dg-warning "warning:\[^\n\]*unspecified" }
X a = static_cast<X> (10); // { dg-warning "unspecified" }
X b = static_cast<X> (0);
X c = static_cast<X> (1);
X d = static_cast<X> (2); // { dg-warning "warning:\[^\n\]*unspecified" }
X d = static_cast<X> (2); // { dg-warning "unspecified" }
X f = static_cast<X> ((int)A);
X g = static_cast<X> (B);
X h = static_cast<X> (C);
X e = static_cast<X> (D); // { dg-warning "warning\[^\n\]*unspecified" }
X e = static_cast<X> (D); // { dg-warning "unspecified" }
}
enum QEvent { x = 42 };
int bar()
{
QEvent x = ( QEvent ) 42000; // { dg-warning "warning\[^\n\]*unspecified" }
QEvent x = ( QEvent ) 42000; // { dg-warning "unspecified" }
return ( int ) x;
}
@ -51,7 +51,7 @@ void baz() {
W(three),
W(3),
Z(four),
Z(4) // { dg-warning "warning\[^\n\]*unspecified" }
Z(4) // { dg-warning "unspecified" }
);
}

View File

@ -2,5 +2,5 @@
// { dg-do compile }
// { dg-options "-pedantic-errors" }
// { dg-skip-if "-Wmain not enabled with -pedantic on SPU" { spu-*-* } }
int main(char a) {} /* { dg-error "error: first argument of .*main.* should be .int." } */
/* { dg-error "error: .*main.* takes only zero or two arguments" "" { target *-*-* } 5 } */
int main(char a) {} /* { dg-error "first argument of .*main.* should be .int." } */
/* { dg-error "main.* takes only zero or two arguments" "" { target *-*-* } 5 } */

View File

@ -2,5 +2,5 @@
// { dg-do compile }
// { dg-options "" }
// { dg-skip-if "-Wmain not enabled on SPU" { spu-*-* } }
int main(char a) {} /* { dg-warning "warning: first argument of .*main.* should be .int." } */
/* { dg-warning "warning: .*main.* takes only zero or two arguments" "" { target *-*-* } 5 } */
int main(char a) {} /* { dg-warning "first argument of .*main.* should be .int." } */
/* { dg-warning "main.* takes only zero or two arguments" "" { target *-*-* } 5 } */

View File

@ -10,5 +10,5 @@ void g(int *);
void f(void)
{
register int x __asm ("eax");
g(&x); /* { dg-error "error: address of explicit register variable" } */
g(&x); /* { dg-error "address of explicit register variable" } */
}

View File

@ -3,5 +3,5 @@
int main()
{
char* p = "Asgaard"; // { dg-warning "warning:.*deprecated.*" }
char* p = "Asgaard"; // { dg-warning "deprecated" }
}

View File

@ -3,5 +3,5 @@
int main()
{
char* p = "Asgaard"; // { dg-warning "warning:.*deprecated.*" }
char* p = "Asgaard"; // { dg-warning "deprecated" }
}

View File

@ -83,7 +83,7 @@ public:
template <class T10, int i> struct Xfour {// { dg-error "" } .*
int T10; // { dg-error "" } .*
void f(){
char T10; // { dg-error "error: declaration of 'char T10'" }
char T10; // { dg-error "declaration of 'char T10'" }
}
};
@ -123,7 +123,7 @@ public:
template <class U>
friend bool fooy(U u);
template <class T161> // { dg-error "error: declaration of 'class T161'" }
template <class T161> // { dg-error "declaration of 'class T161'" }
friend bool foo(T161 u)
{
Xseven<T161, 5, int> obj;

View File

@ -44,5 +44,5 @@ void Sort<Comp>::sort (Vector<Comp::T> &v)// { dg-error "" } use of bad T
void
f (Vector<int> &vi)
{
Sort<Comparator<int> >::sort (vi); // { dg-error "error: 'sort' is not a member of 'Sort<Comparator<int> >'" }
Sort<Comparator<int> >::sort (vi); // { dg-error "'sort' is not a member of 'Sort<Comparator<int> >'" }
}

View File

@ -6,4 +6,4 @@ struct A {
};
const char foo[] = "bar";
const A a = { foo };
extern const A* ap = &a; //{ dg-warning "warning: 'ap' initialized and declared 'extern'" }
extern const A* ap = &a; //{ dg-warning "'ap' initialized and declared 'extern'" }

View File

@ -7,7 +7,7 @@
template<int P = 0> struct foo {
static void bar(double (*)[dim]) {} // { dg-error "" } dim not declared
static void bar(double (*)[dim]) {} // { dg-error "'dim' was not declared" }
};
void bar() {