+2017-05-26 Tom de Vries <tom@codesourcery.com>
+
+ PR testsuite/80557
+ * gcc.dg/20011021-1.c: Replace absolute line numbers.
+ * gcc.dg/Wcxx-compat-8.c: Same.
+ * gcc.dg/Wobjsize-1.c: Same.
+ * gcc.dg/Wshadow-local-2.c: Same.
+ * gcc.dg/Wstrict-aliasing-converted-assigned.c: Same.
+ * gcc.dg/anon-struct-6.c: Same.
+ * gcc.dg/asm-wide-1.c: Same.
+ * gcc.dg/builtin-inf-1.c: Same.
+ * gcc.dg/builtin-redefine.c: Same.
+ * gcc.dg/c90-array-lval-6.c: Same.
+ * gcc.dg/c90-array-lval-7.c: Same.
+ * gcc.dg/c90-fordecl-1.c: Same.
+ * gcc.dg/c99-fordecl-2.c: Same.
+ * gcc.dg/cast-lvalue-1.c: Same.
+ * gcc.dg/cast-lvalue-2.c: Same.
+ * gcc.dg/compound-lvalue-1.c: Same.
+ * gcc.dg/cond-lvalue-1.c: Same.
+ * gcc.dg/cpp/20000419-1.c: Same.
+ * gcc.dg/cpp/backslash.c: Same.
+ * gcc.dg/cpp/backslash2.c: Same.
+ * gcc.dg/cpp/macspace1.c: Same.
+ * gcc.dg/cpp/macspace2.c: Same.
+ * gcc.dg/cpp/multiline-2.c: Same.
+ * gcc.dg/cpp/pr27777.c: Same.
+ * gcc.dg/cpp/pr30786.c: Same.
+ * gcc.dg/cpp/pr34602.c: Same.
+ * gcc.dg/cpp/redef1.c: Same.
+ * gcc.dg/cpp/tr-warn1.c: Same.
+ * gcc.dg/cpp/tr-warn3.c: Same.
+ * gcc.dg/cpp/tr-warn6.c: Same.
+ * gcc.dg/cpp/trad/hash.c: Same.
+ * gcc.dg/cpp/trad/redef1.c: Same.
+ * gcc.dg/cpp/ucs.c: Same.
+ * gcc.dg/declspec-10.c: Same.
+ * gcc.dg/declspec-11.c: Same.
+ * gcc.dg/declspec-18.c: Same.
+ * gcc.dg/format/c99-strftime-1.c: Same.
+ * gcc.dg/format/ext-3.c: Same.
+ * gcc.dg/format/pr72858.c: Same.
+ * gcc.dg/gomp/appendix-a/a.24.1.c: Same.
+ * gcc.dg/init-string-1.c: Same.
+ * gcc.dg/label-decl-3.c: Same.
+ * gcc.dg/m-un-2.c: Same.
+ * gcc.dg/nofixed-point-2.c: Same.
+ * gcc.dg/noncompile/20020213-1.c: Same.
+ * gcc.dg/pch/counter-2.c: Same.
+ * gcc.dg/plugin/diagnostic-test-string-literals-2.c: Same.
+ * gcc.dg/pr27528.c: Same.
+ * gcc.dg/pr27953.c: Same.
+ * gcc.dg/pr35899.c: Same.
+ * gcc.dg/pr37561.c: Same.
+ * gcc.dg/pr45461.c: Same.
+ * gcc.dg/pr45750.c: Same.
+ * gcc.dg/pr53196-2.c: Same.
+ * gcc.dg/pr53265.c: Same.
+ * gcc.dg/redecl-1.c: Same.
+ * gcc.dg/tls/thr-init-1.c: Same.
+ * gcc.dg/torture/pr51106-1.c: Same.
+ * gcc.dg/torture/pr51106-2.c: Same.
+ * gcc.dg/uninit-19.c: Same.
+ * gcc.dg/uninit-pr20644.c: Same.
+
2017-05-26 Jakub Jelinek <jakub@redhat.com>
* g++.dg/cpp1z/decomp29.C (p): New variable.
struct t t;
union u u;
union u v;
- char *f;
+ char *f; /* { dg-line multilevel_f } */
};
struct t T0 = { 1 }; /* { dg-warning "missing init" } */
{ .n = 9 }, /* { dg-bogus "initialization of union" } */
/* "string here" */
}; /* { dg-warning "missing init" } */
-/* { dg-message "declared here" "near init" { target *-*-* } 27 } */
+/* { dg-message "declared here" "near init" { target *-*-* } multilevel_f } */
f5 ()
{
return &((struct t8) { }); /* { dg-warning "invalid in C\[+\]\[+\]" } */
+ /* { dg-error "invalid use of undefined type" "" { target *-*-* } .-1 } */
}
-
-/* { dg-error "invalid use of undefined type" "" { target *-*-* } 65 } */
#include "Wobjsize-1.h"
char buf[6];
+/* { dg-warning "writing" "" { target *-*-* } .-1 } */
+
int main(int argc, char **argv)
{
strcpy (buf,"hello ");
return 0;
}
-/* { dg-warning "writing" "" { target *-*-* } 6 } */
/* { dg-message "file included" "included" { target *-*-* } 0 } */
/* { dg-message "inlined from" "inlined" { target *-*-* } 0 } */
void func4() {
struct Bar bar; /* { dg-message "shadowed declaration" } */
+ /* { dg-bogus "shadows a global" "" { target *-*-* } .-1 } */
+
if (val) {
int bar; /* { dg-warning "shadows a previous local" } */
func1(bar);
}
}
-/* { dg-bogus "shadows a global" "" { target *-*-* } 42 } */
{
int i;
*(long*)&i = 0; /* { dg-warning "type-punn" "type-punn" } */
+ /* These messages are only expected for lp64, but fail there. When they
+ pass for lp64, replace "xfail *-*-*" with "target lp64". */
+ /* { dg-message "does break strict-aliasing" "break" { xfail *-*-* } .-3 } */
+ /* { dg-message "initialized" "init" { xfail *-*-* } .-4 } */
return i;
}
-
-/* These messages are only expected for lp64, but fail there. When they
- pass for lp64, replace "xfail *-*-*" with "target lp64". */
-/* { dg-message "does break strict-aliasing" "break" { xfail *-*-* } 8 } */
-/* { dg-message "initialized" "init" { xfail *-*-* } 8 } */
struct s {
int a;
const;
+ /* { dg-warning "useless type qualifier in empty declaration" "empty" { target *-*-* } .-1 } */
+ /* { dg-warning "empty declaration" "empty 2" { target *-*-* } .-2 } */
};
-/* { dg-warning "useless type qualifier in empty declaration" "empty" { target *-*-* } 9 } */
-/* { dg-warning "empty declaration" "empty 2" { target *-*-* } 9 } */
asm (L"foo"); /* { dg-error "8:wide string literal in 'asm'" } */
asm ("foo" :
L"=g" (x)); /* { dg-error "8:wide string literal in 'asm'" } */
+ /* Extra errors from the substitution of "" for wide strings: */
+ /* { dg-error "output" "output" { target *-*-* } .-2 } */
asm ("foo" : [x]
L"=g" (x)); /* { dg-error "8:wide string literal in 'asm'" } */
+ /* { dg-error "output" "output" { target *-*-* } .-1 } */
asm ("foo" : [x] "=g" (x),
L"=g" (x)); /* { dg-error "8:wide string literal in 'asm'" } */
+ /* { dg-error "output" "output" { target *-*-* } .-1 } */
asm ("foo" : :
L"g" (x)); /* { dg-error "8:wide string literal in 'asm'" } */
asm ("foo" : : :
asm ("foo" : : : "memory",
L"memory"); /* { dg-error "8:wide string literal in 'asm'" } */
}
-
-/* Extra errors from the substitution of "" for wide strings: */
-/* { dg-error "output" "output" { target *-*-* } 16 } */
-/* { dg-error "output" "output" { target *-*-* } 18 } */
-/* { dg-error "output" "output" { target *-*-* } 20 } */
/* { dg-do compile } */
float fi = __builtin_inff();
+/* { dg-error "does not support infinity" "INF unsupported" { target vax-*-* spu-*-* } .-1 } */
double di = __builtin_inf();
+/* { dg-error "does not support infinity" "INF unsupported" { target vax-*-* } .-1 } */
long double li = __builtin_infl();
+/* { dg-error "does not support infinity" "INF unsupported" { target vax-*-* } .-1 } */
float fh = __builtin_huge_valf();
double dh = __builtin_huge_val();
long double lh = __builtin_huge_vall();
-/* { dg-error "does not support infinity" "INF unsupported" { target vax-*-* spu-*-* } 3 } */
-/* { dg-error "does not support infinity" "INF unsupported" { target vax-*-* } 4 } */
-/* { dg-error "does not support infinity" "INF unsupported" { target vax-*-* } 5 } */
#undef __TIME__ /* Undefine while already undefined. */
#define __TIME__ "X" /* Define while undefined. */
-#define __TIME__ "X" /* Re-define while defined. */
+#define __TIME__ "X" /* Re-define while defined. */ /* { dg-line time_prev } */
#define __TIME__ "Y" /* { dg-warning "\"__TIME__\" redefined" } */
-/* { dg-message "previous definition" "" { target *-*-* } 28 } */
+/* { dg-message "previous definition" "" { target *-*-* } time_prev } */
#undef __TIME__ /* Undefine while defined. */
#undef __DATE__ /* Undefine while already undefined. */
#define __DATE__ "X" /* Define while undefined. */
-#define __DATE__ "X" /* Re-define while defined. */
+#define __DATE__ "X" /* Re-define while defined. */ /* { dg-line date_prev } */
#define __DATE__ "Y" /* { dg-warning "\"__DATE__\" redefined" } */
-/* { dg-message "previous definition" "" { target *-*-* } 39 } */
+/* { dg-message "previous definition" "" { target *-*-* } date_prev } */
#undef __DATE__ /* Undefine while defined. */
#define __TIMESTAMP__ "X" /* Define while already defined. */
-#define __TIMESTAMP__ "X" /* Re-define while defined. */
+#define __TIMESTAMP__ "X" /* Re-define while defined. */ /* { dg-line timestamp_prev } */
#define __TIMESTAMP__ "Y" /* { dg-warning "\"__TIMESTAMP__\" redefined" } */
-/* { dg-message "previous definition" "" { target *-*-* } 48 } */
+/* { dg-message "previous definition" "" { target *-*-* } timestamp_prev } */
#undef __TIMESTAMP__ /* Undefine while defined. */
void bar(void)
{
char *ptr = foo().c; /* { dg-bogus "warning" "warning in place of error" } */
+ /* { dg-error "non-lvalue" "array not decaying to lvalue" { target *-*-* } .-1 } */
}
-/* { dg-error "non-lvalue" "array not decaying to lvalue" { target *-*-* } 14 } */
6.3.15 does not permit conditional expressions between arrays.
In C99, they decay to pointers. */
(e ? (d ? b : c).c : (e ? b : c).c); /* { dg-bogus "warning" "warning in place of error" } */
+ /* { dg-error "array" "bad conditional" { target *-*-* } .-1 } */
}
-
-/* { dg-error "array" "bad conditional" { target *-*-* } 20 } */
{
int j = 0;
for (int i = 1; i <= 10; i++) /* { dg-bogus "warning" "warning in place of error" } */
+ /* { dg-error "'for' loop initial declarations are only allowed in C99 or C11 mode" "declaration in for loop" { target *-*-* } .-1 } */
+ /* { dg-message "note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code" "note" { target *-*-* } .-2 }} */
j += i;
- /* { dg-error "'for' loop initial declarations are only allowed in C99 or C11 mode" "declaration in for loop" { target *-*-* } 10 } */
- /* { dg-message "note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code" "note" { target *-*-* } 10 }} */
}
behind these tests. */
int j = 0;
for (int i = 1, bar (void); i <= 10; i++) /* { dg-bogus "warning" "warning in place of error" } */
+ /* { dg-error "bar" "function in for loop" { target *-*-* } .-1 } */
j += i;
- /* { dg-error "bar" "function in for loop" { target *-*-* } 12 } */
+
for (static int i = 1; i <= 10; i++) /* { dg-bogus "warning" "warning in place of error" } */
+ /* { dg-error "static" "static in for loop" { target *-*-* } .-1 } */
j += i;
- /* { dg-error "static" "static in for loop" { target *-*-* } 15 } */
+
for (extern int i; j <= 500; j++) /* { dg-bogus "warning" "warning in place of error" } */
+ /* { dg-error "extern" "extern in for loop" { target *-*-* } .-1 } */
j += 5;
- /* { dg-error "extern" "extern in for loop" { target *-*-* } 18 } */
+
for (enum { FOO } i = FOO; i < 10; i++) /* { dg-bogus "warning" "warning in place of error" } */
+ /* { dg-error "FOO" "enum value in for loop" { target *-*-* } .-1 } */
j += i;
- /* { dg-error "FOO" "enum value in for loop" { target *-*-* } 21 } */
+
for (enum BAR { FOO } i = FOO; i < 10; i++) /* { dg-bogus "warning" "warning in place of error" } */
+ /* { dg-error "FOO" "enum value in for loop" { target *-*-* } .-1 } */
+ /* { dg-error "BAR" "enum tag in for loop" { target *-*-* } .-2 } */
j += i;
- /* { dg-error "FOO" "enum value in for loop" { target *-*-* } 24 } */
- /* { dg-error "BAR" "enum tag in for loop" { target *-*-* } 24 } */
}
foo (void)
{
(char) x = 1; /* { dg-bogus "warning" "warning in place of error" } */
+ /* { dg-error "lvalue" "cast as lvalue" { target *-*-* } .-1 } */
}
-/* { dg-error "lvalue" "cast as lvalue" { target *-*-* } 11 } */
foo (void)
{
(int) x = 1; /* { dg-bogus "warning" "warning in place of error" } */
+ /* { dg-error "lvalue" "cast as lvalue" { target *-*-* } .-1 } */
}
-/* { dg-error "lvalue" "cast as lvalue" { target *-*-* } 11 } */
foo (void)
{
(x, y) = 1; /* { dg-bogus "warning" "warning in place of error" } */
+ /* { dg-error "lvalue" "compound expression as lvalue" { target *-*-* } .-1 } */
}
-/* { dg-error "lvalue" "compound expression as lvalue" { target *-*-* } 11 } */
foo (void)
{
(x ? y : z) = 1; /* { dg-bogus "warning" "warning in place of error" } */
+ /* { dg-error "lvalue" "conditional expression as lvalue" { target *-*-* } .-1 } */
}
-/* { dg-error "lvalue" "conditional expression as lvalue" { target *-*-* } 11 } */
__REDIRECT (a, b, c)
__ASMNAME2 (__USER_LABEL_PREFIX__, harumph)
-
-/* { dg-bogus "used without args" "no args, 1" { target *-*-* } 11 } */
-/* { dg-bogus "used without args" "no args, 1" { target *-*-* } 12 } */
+/* { dg-bogus "used without args" "no args, 1" { target *-*-* } .-2 } */
+/* { dg-bogus "used without args" "no args, 1" { target *-*-* } .-2 } */
b, \
c
-/* Note the trailing whitespace on the next three lines. */
+/* Note the trailing whitespace on the first three lines of beta def. */
+/* { dg-warning "separated by space" "space" { target *-*-* } .+3 } */
+/* { dg-warning "separated by space" "tab" { target *-*-* } .+3 } */
+/* { dg-warning "separated by space" "space and tab" { target *-*-* } .+3 } */
#define beta(a, b, c) \
a, \
b, \
c
-/* { dg-warning "separated by space" "space" { target *-*-* } 9 } */
-/* { dg-warning "separated by space" "tab" { target *-*-* } 10 } */
-/* { dg-warning "separated by space" "space and tab" { target *-*-* } 11 } */
-
int x[] = {
alpha(1, 2, 3),
beta(4, 5, 6)
foo \
bar
-/* { dg-warning "separated by space" "" { target *-*-* } 8 } */
+/* { dg-warning "separated by space" "" { target *-*-* } .-2 } */
/* foo \
bar */
-/* { dg-bogus "separated by space" "" { target *-*-* } 12 } */
+/* { dg-bogus "separated by space" "" { target *-*-* } .-2 } */
#define a! /* { dg-warning "missing whitespace" } */
#define b" /* { dg-warning "missing whitespace" } */
+/* { dg-error "missing terminating" "" { target *-*-* } .-1 } */
#define c# /* { dg-warning "missing whitespace" } */
#define d% /* { dg-warning "missing whitespace" } */
#define e& /* { dg-warning "missing whitespace" } */
#define f' /* { dg-warning "missing whitespace" } */
+/* { dg-error "missing terminating" "" { target *-*-* } .-1 } */
#define g) /* { dg-warning "missing whitespace" } */
#define h* /* { dg-warning "missing whitespace" } */
#define i+ /* { dg-warning "missing whitespace" } */
#define ag"abc" /* { dg-warning "missing whitespace" } */
int dummy;
-/* { dg-error "missing terminating" "" { target *-*-* } 6 } */
-/* { dg-error "missing terminating" "" { target *-*-* } 10 } */
#define a! /* { dg-error "requires whitespace" } */
#define b" /* { dg-error "requires whitespace" } */
+/* { dg-error "missing terminating" "missing-terminating" { target *-*-* } .-1 } */
#define c# /* { dg-error "requires whitespace" } */
#define d% /* { dg-error "requires whitespace" } */
#define e& /* { dg-error "requires whitespace" } */
#define f' /* { dg-error "requires whitespace" } */
+/* { dg-error "missing terminating" "missing-terminating" { target *-*-* } .-1 } */
#define g) /* { dg-error "requires whitespace" } */
#define h* /* { dg-error "requires whitespace" } */
#define i+ /* { dg-error "requires whitespace" } */
#define ag"abc" /* { dg-error "requires whitespace" } */
int dummy;
-/* { dg-error "missing terminating" "missing-terminating" { target *-*-* } 6 } */
-/* { dg-error "missing terminating" "missing-terminating" { target *-*-* } 10 } */
const char *p = "line 1
"
""; /* The compiler front end sees this. */
-
-/* { dg-error "17:missing term" "multiline strings" { target *-*-* } 8 } */
-/* { dg-error "missing term" "multiline strings" { target *-*-* } 9 } */
+/* { dg-error "17:missing term" "multiline strings" { target *-*-* } .-3 } */
+/* { dg-error "missing term" "multiline strings" { target *-*-* } .-3 } */
/* { dg-options { -trigraphs -Wall } } */
#error "BUG??!"
-
-/* { dg-error "BUG" "" { target *-*-* } 5 } */
-/* { dg-warning "trigraph" "" { target *-*-* } 5 } */
+/* { dg-error "BUG" "" { target *-*-* } .-1 } */
+/* { dg-warning "trigraph" "" { target *-*-* } .-2 } */
/* PR preprocessor/30786 - _Pragma at end of file should not ICE */
/* { dg-do compile } */
-/* { dg-error "parenthesized" "parenthesized" { target *-*-* } 9 } */
-/* { dg-error "expected" "expected" { target *-*-* } 9 } */
-
int x;
+/* { dg-error "parenthesized" "parenthesized" { target *-*-* } .+2 } */
+/* { dg-error "expected" "expected" { target *-*-* } .+1 } */
_Pragma
/* PR preprocessor/34602 - no internal error trying to spell EOF. */
/* { dg-do preprocess } */
-/* { dg-error "unexpected end" "" { target *-*-* } 6 } */
-
+/* { dg-error "unexpected end" "" { target *-*-* } .+1 } */
#line
#define foo bar
#define /* x */ foo /* x */ bar /* x */
+/* { dg-bogus "redefined" "foo redefined" { target *-*-* } .-1 } */
+/* { dg-bogus "previous def" "foo prev def" { target *-*-* } .-3 } */
-#define quux(thud) a one and a thud and a two
-#define /**/ quux( thud ) /**/ a one and a /**/ thud /**/ and /**/ a two
-#define quux(thud) a one and a thud and a two /* bah */
+#define quux(thud) a one and a thud and a two /* { dg-line quux_def_1 } */
+#define /**/ quux( thud ) /**/ a one and a /**/ thud /**/ and /**/ a two /* { dg-line quux_def_2 } */
+/* { dg-bogus "redefined" "quux redefined" { target *-*-* } quux_def_2 } */
+/* { dg-bogus "previous def" "quux prev def" { target *-*-* } quux_def_1 } */
-/* { dg-bogus "redefined" "foo redefined" { target *-*-* } 7 } */
-/* { dg-bogus "redefined" "quux redefined" { target *-*-* } 10 } */
-/* { dg-bogus "redefined" "quux redefined" { target *-*-* } 11 } */
-
-/* { dg-bogus "previous def" "foo prev def" { target *-*-* } 6 } */
-/* { dg-bogus "previous def" "quux prev def" { target *-*-* } 9 } */
-/* { dg-bogus "previous def" "quux prev def" { target *-*-* } 10 } */
+#define quux(thud) a one and a thud and a two /* bah */ /* { dg-line quux_def_3 } */
+/* { dg-bogus "redefined" "quux redefined" { target *-*-* } quux_def_3 } */
+/* { dg-bogus "previous def" "quux prev def" { target *-*-* } quux_def_2 } */
_and_ they should get a -pedantic warning. */
#assert foo(bar) /* { dg-warning "indented" "^#ext" } */
+/* { dg-warning "GCC extension" "extension warning" { target *-*-* } .-1 } */
# assert bar(baz) /* { dg-warning "indented" "^# ext" } */
+/* { dg-warning "GCC extension" "extension warning" { target *-*-* } .-1 } */
#assert baz(quux) /* { dg-bogus "indented" "^ #ext" } */
+/* { dg-warning "GCC extension" "extension warning" { target *-*-* } .-1 } */
# assert quux(weeble) /* { dg-bogus "indented" "^ # ext" } */
+/* { dg-warning "GCC extension" "extension warning" { target *-*-* } .-1 } */
/* We warn of #elif regardless of whether we're skipping or not, and
do not warn about indentaion. */
#endif
#elif 0 /* { dg-warning "#elif" "#elif not skipping" } */
#endif
-
-/* { dg-warning "GCC extension" "extension warning" { target *-*-* } 22 } */
-/* { dg-warning "GCC extension" "extension warning" { target *-*-* } 23 } */
-/* { dg-warning "GCC extension" "extension warning" { target *-*-* } 24 } */
-/* { dg-warning "GCC extension" "extension warning" { target *-*-* } 25 } */
they should get a -pedantic warning. */
#assert foo(bar) /* { dg-warning "indented" "^#ext" } */
+/* { dg-warning "GCC extension" "extension warning" { target *-*-* } .-1 } */
# assert bar(baz) /* { dg-warning "indented" "^# ext" } */
+/* { dg-warning "GCC extension" "extension warning" { target *-*-* } .-1 } */
#assert baz(quux) /* { dg-bogus "indented" "^ #ext" } */
+/* { dg-warning "GCC extension" "extension warning" { target *-*-* } .-1 } */
# assert quux(weeble) /* { dg-bogus "indented" "^ # ext" } */
+/* { dg-warning "GCC extension" "extension warning" { target *-*-* } .-1 } */
#else
# unassert quux(weeble) /* { dg-bogus "indented" "^ # ext" } */
#endif
-
-/* { dg-warning "GCC extension" "extension warning" { target *-*-* } 27 } */
-/* { dg-warning "GCC extension" "extension warning" { target *-*-* } 28 } */
-/* { dg-warning "GCC extension" "extension warning" { target *-*-* } 29 } */
-/* { dg-warning "GCC extension" "extension warning" { target *-*-* } 30 } */
#define foo5(h2) sdf 'h2' fds 'h3' /* { dg-warning "macro argument \"h2\" would be stringified" "traditional stringification" } */
#define foo6(h3) sdf 'h2' fds 'h3' /* { dg-warning "macro argument \"h3\" would be stringified" "traditional stringification" } */
#define foo7(AA, hello, world, EEE) sdf "A B hello C,world,DhelloE F" fds EEE /* { dg-warning "macro argument \"hello\" would be stringified" "traditional stringification" } */
-
/* Catch the second warning from the above line. */
-/* { dg-warning "macro argument \"world\" would be stringified" "traditional stringification second warning" { target *-*-* } 13 } */
+/* { dg-warning "macro argument \"world\" would be stringified" "traditional stringification second warning" { target *-*-* } .-2 } */
# 19 "sys-header.h" 3
/* We are in system headers now, no -Wtraditional warnings should issue. */
#ifndef foo
#define foo /**/
#endif
+/* { dg-bogus "(start|end) of macro" "paste at end" { target *-*-* } .-1 } */
#ifndef foo
#define foo /* as nothing */
#endif
-
-/* { dg-bogus "(start|end) of macro" "paste at end" { target *-*-* } 7 } */
-/* { dg-bogus "(start|end) of macro" "comment at end" { target *-*-* } 11 } */
+/* { dg-bogus "(start|end) of macro" "comment at end" { target *-*-* } .-1 } */
#define foo bar
#define /* x */ foo /* x */ bar /* x */
+/* { dg-bogus "redefined" "foo redefined" { target *-*-* } .-1 } */
+/* { dg-bogus "previous def" "foo prev def" { target *-*-* } .-3 } */
-#define quux(thud) a one and a thud and a two
-#define /**/ quux( thud ) /**/ a one and a /**/ thud /**/ and /**/ a two
-#define quux(thud) a one and a thud and a two /* bah */
+#define quux(thud) a one and a thud and a two /* { dg-line quux_def_1 } */
+#define /**/ quux( thud ) /**/ a one and a /**/ thud /**/ and /**/ a two /* { dg-line quux_def_2 } */
+/* { dg-bogus "redefined" "quux redefined" { target *-*-* } quux_def_2 } */
+/* { dg-bogus "previous def" "quux prev def" { target *-*-* } quux_def_1 } */
+
+#define quux(thud) a one and a thud and a two /* bah */ /* { dg-line quux_def_3 } */
+/* { dg-bogus "redefined" "quux redefined" { target *-*-* } quux_def_3 } */
+/* { dg-bogus "previous def" "quux prev def" { target *-*-* } quux_def_2 } */
#define f(x, y)x "x y z" y
#define f(x, y) x "x y z" y
+/* { dg-bogus "redefined" "f redefined" { target *-*-* } .-1 } */
+/* { dg-bogus "previous def" "f prev def" { target *-*-* } .-3 } */
#define baz() whiz bang
#define baz() whiz bang
+/* { dg-bogus "redefined" "baz redefined" { target *-*-* } .-1 } */
+/* { dg-bogus "previous def" "baz prev def" { target *-*-* } .-3 } */
#define g foo
#undef g
#define g
-
-/* { dg-bogus "redefined" "foo redefined" { target *-*-* } 8 } */
-/* { dg-bogus "redefined" "quux redefined" { target *-*-* } 11 } */
-/* { dg-bogus "redefined" "quux redefined" { target *-*-* } 12 } */
-/* { dg-bogus "redefined" "f redefined" { target *-*-* } 15 } */
-/* { dg-bogus "redefined" "baz redefined" { target *-*-* } 18 } */
-/* { dg-bogus "redefined" "g redefined" { target *-*-* } 22 } */
-
-/* { dg-bogus "previous def" "foo prev def" { target *-*-* } 7 } */
-/* { dg-bogus "previous def" "quux prev def" { target *-*-* } 10 } */
-/* { dg-bogus "previous def" "quux prev def" { target *-*-* } 11 } */
-/* { dg-bogus "previous def" "f prev def" { target *-*-* } 14 } */
-/* { dg-bogus "previous def" "baz prev def" { target *-*-* } 17 } */
-/* { dg-bogus "previous def" "g prev def" { target *-*-* } 20 } */
+/* { dg-bogus "redefined" "g redefined" { target *-*-* } .-1 } */
+/* { dg-bogus "previous def" "g prev def" { target *-*-* } .-4 } */
c = L'\u000x'; /* { dg-error "incomplete" "non-hex digit in UCN" } */
/* If sizeof(HOST_WIDE_INT) > sizeof(wchar_t), we can get a multi-character
constant warning even for wide characters. */
- /* { dg-warning "too long|multi-character" "" { target *-*-* } 54 } */
+ /* { dg-warning "too long|multi-character" "" { target *-*-* } .-3 } */
c = '\u0024'; /* { dg-bogus "invalid" "0024 is a valid UCN" } */
c = "\u0040"[0]; /* { dg-bogus "invalid" "0040 is a valid UCN" } */
void f7 (typedef int); /* { dg-error "storage class specified for unnamed parameter" } */
auto int x; /* { dg-error "file-scope declaration of 'x' specifies 'auto'" } */
-register int y; /* { dg-warning "file-scope declaration of 'y' specifies 'register'" } */
+
+register int y;
+/* { dg-warning "file-scope declaration of 'y' specifies 'register'" "" { target *-*-* } .-1 } */
+/* { dg-message "error: register name not specified for 'y'" "not specified" { target *-*-* } .-2 } */
void h (void) { extern void x (void) {} } /* { dg-error "nested function 'x' declared 'extern'" } */
/* { dg-warning "ISO C forbids nested functions" "nested" { target *-*-* } .-1 } */
/* { dg-warning "function definition declared 'auto'" "nested" { target *-*-* } .-1 } */
inline int main (void) { return 0; } /* { dg-warning "cannot inline function 'main'" } */
-
-/* { dg-message "error: register name not specified for 'y'" "not specified" { target *-*-* } 19 } */
void f7 (typedef int); /* { dg-error "storage class specified for unnamed parameter" } */
auto int x; /* { dg-error "file-scope declaration of 'x' specifies 'auto'" } */
-register int y; /* { dg-error "file-scope declaration of 'y' specifies 'register'" } */
+
+register int y;
+/* { dg-error "file-scope declaration of 'y' specifies 'register'" "" { target *-*-* } .-1 } */
+/* { dg-message "error: register name not specified for 'y'" "" { target *-*-* } .-2 } */
void h (void) { extern void x (void) {} } /* { dg-error "nested function 'x' declared 'extern'" } */
/* { dg-error "ISO C forbids nested functions" "nested" { target *-*-* } .-1 } */
/* { dg-error "function definition declared 'auto'" "nested" { target *-*-* } .-1 } */
inline int main (void) { return 0; } /* { dg-error "cannot inline function 'main'" } */
-
-/* { dg-message "error: register name not specified for 'y'" "" { target *-*-* } 19 } */
};
typeof (z) c1;
-typeof (x1) c2; /* { dg-error "undeclared" "undeclared" } */
+
+typeof (x1) c2;
+/* { dg-error "undeclared" "undeclared" { target *-*-* } .-1 } */
+/* { dg-bogus "unknown type name 'x1'" "unknown" { target *-*-* } .-2 } */
+
typeof (const t11) c3; /* { dg-error "unknown type name 't11'" } */
-typeof (t12 *) c3; /* { dg-error "unknown type name 't12'" "t12" { xfail *-*-* } } */
-/* { dg-bogus "unknown type name 'x1'" unknown"" { target *-*-* } 26 } */
-/* { dg-bogus "undeclared" "undeclared" { xfail *-*-* } 28 } */
-/* { dg-bogus "expected expression before" "expected" { xfail *-*-* } 28 } */
+
+typeof (t12 *) c3;
+/* { dg-error "unknown type name 't12'" "t12" { xfail *-*-* } .-1 } */
+/* { dg-bogus "undeclared" "undeclared" { xfail *-*-* } .-2 } */
+/* { dg-bogus "expected expression before" "expected" { xfail *-*-* } .-3 } */
int recover1;
int s0 = sizeof (z);
-int s1 = sizeof (x2); /* { dg-error "undeclared" "undeclared" } */
+
+int s1 = sizeof (x2);
+/* { dg-error "undeclared" "undeclared" { target *-*-* } .-1 } */
+/* { dg-bogus "unknown type name 'x2'" "unknown" { target *-*-* } .-2 } */
+
int s2 = sizeof (const t13); /* { dg-error "unknown type name 't13'" } */
-int s3 = sizeof (t14 *); /* { dg-error "unknown type name 't14'" "t14" { xfail *-*-* } } */
-int recover2;
+int s3 = sizeof (t14 *);
+/* { dg-error "unknown type name 't14'" "t14" { xfail *-*-* } .-1 } */
+/* { dg-bogus "undeclared" "undeclared" { xfail *-*-* } .-2 } */
+/* { dg-bogus "expected expression before" "expected" { xfail *-*-* } .-3 } */
-/* { dg-bogus "unknown type name 'x2'" "unknown" { target *-*-* } 36 } */
-/* { dg-bogus "undeclared" "undeclared" { xfail *-*-* } 38 } */
-/* { dg-bogus "expected expression before" "expected" { xfail *-*-* } 38 } */
+int recover2;
int a0 = __alignof__ (z);
+
int a1 = __alignof__ (x3); /* { dg-error "undeclared" } */
+/* { dg-bogus "unknown type name 'x3'" "" { target *-*-* } .-1 } */
+
int a2 = __alignof__ (const t15); /* { dg-error "unknown type name 't15'" } */
-int a3 = __alignof__ (t16 *); /* { dg-error "unknown type name 't16'" "t16" { xfail *-*-* } } */
-int recover3;
+int a3 = __alignof__ (t16 *);
+/* { dg-error "unknown type name 't16'" "t16" { xfail *-*-* } .-1 } */
+/* { dg-bogus "undeclared" "undeclared" { xfail *-*-* } .-2 } */
+/* { dg-bogus "expected expression before" "expected" { xfail *-*-* } .-3 } */
-/* { dg-bogus "unknown type name 'x3'" "" { target *-*-* } 47 } */
-/* { dg-bogus "undeclared" "undeclared" { xfail *-*-* } 49 } */
-/* { dg-bogus "expected expression before" "expected" { xfail *-*-* } 49 } */
+int recover3;
/* Cannot detect (undefd_type *) or (undefd_type (*) because it would
/* Bad uses of %E and %O. */
strftime (s, m, "%EEY", tp); /* { dg-warning "multiple|repeated" "multiple %E/%O" } */
strftime (s, m, "%EOy", tp); /* { dg-warning "multiple|together" "multiple %E/%O" } */
+ /* { dg-warning "only last 2" "2-digit year" { target *-*-* } .-1 } */
strftime (s, m, "%OEy", tp); /* { dg-warning "multiple|together" "multiple %E/%O" } */
+ /* { dg-warning "only last 2" "2-digit year" { target *-*-* } .-1 } */
strftime (s, m, "%OOV", tp); /* { dg-warning "multiple|repeated" "multiple %E/%O" } */
- /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 31 } */
- /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 32 } */
strftime (s, m, "%Ea", tp); /* { dg-warning "flag|modifier" "bad %Ea" } */
strftime (s, m, "%EA", tp); /* { dg-warning "flag|modifier" "bad %EA" } */
strftime (s, m, "%Eb", tp); /* { dg-warning "flag|modifier" "bad %Eb" } */
strftime (s, m, "%-Z", tp); /* { dg-warning "flag" "bad %Z" } */
strftime (s, m, "%_Z", tp); /* { dg-warning "flag" "bad %Z" } */
strftime (s, m, "%0Z", tp); /* { dg-warning "flag" "bad %Z" } */
+
/* Incorrect usages with Y2K problems. */
strftime (s, m, "%5c", tp); /* { dg-warning "width" "bad %c" } */
+ /* { dg-warning "only last 2" "2-digit year" { target *-*-* } .-1 } */
strftime (s, m, "%-c", tp); /* { dg-warning "flag" "bad %c" } */
+ /* { dg-warning "only last 2" "2-digit year" { target *-*-* } .-1 } */
strftime (s, m, "%_c", tp); /* { dg-warning "flag" "bad %c" } */
+ /* { dg-warning "only last 2" "2-digit year" { target *-*-* } .-1 } */
strftime (s, m, "%0c", tp); /* { dg-warning "flag" "bad %c" } */
+ /* { dg-warning "only last 2" "2-digit year" { target *-*-* } .-1 } */
strftime (s, m, "%5D", tp); /* { dg-warning "width" "bad %D" } */
+ /* { dg-warning "only last 2" "2-digit year" { target *-*-* } .-1 } */
strftime (s, m, "%-D", tp); /* { dg-warning "flag" "bad %D" } */
+ /* { dg-warning "only last 2" "2-digit year" { target *-*-* } .-1 } */
strftime (s, m, "%_D", tp); /* { dg-warning "flag" "bad %D" } */
+ /* { dg-warning "only last 2" "2-digit year" { target *-*-* } .-1 } */
strftime (s, m, "%0D", tp); /* { dg-warning "flag" "bad %D" } */
+ /* { dg-warning "only last 2" "2-digit year" { target *-*-* } .-1 } */
strftime (s, m, "%5x", tp); /* { dg-warning "width" "bad %x" } */
+ /* { dg-warning "only last 2" "2-digit year" { target *-*-* } .-1 } */
strftime (s, m, "%-x", tp); /* { dg-warning "flag" "bad %x" } */
+ /* { dg-warning "only last 2" "2-digit year" { target *-*-* } .-1 } */
strftime (s, m, "%_x", tp); /* { dg-warning "flag" "bad %x" } */
+ /* { dg-warning "only last 2" "2-digit year" { target *-*-* } .-1 } */
strftime (s, m, "%0x", tp); /* { dg-warning "flag" "bad %x" } */
- /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 89 } */
- /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 90 } */
- /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 91 } */
- /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 92 } */
- /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 93 } */
- /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 94 } */
- /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 95 } */
- /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 96 } */
- /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 97 } */
- /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 98 } */
- /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 99 } */
- /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 100 } */
+ /* { dg-warning "only last 2" "2-digit year" { target *-*-* } .-1 } */
+
/* Incorrect usages with GNU extension conversion characters. */
strftime (s, m, "%5P", tp); /* { dg-warning "width" "bad %P" } */
strftime (s, m, "%-P", tp); /* { dg-warning "flag" "bad %P" } */
strftime (s, m, "%#l", tp); /* { dg-warning "flag" "bad %l" } */
strftime (s, m, "%^s", tp); /* { dg-warning "flag" "bad %s" } */
strftime (s, m, "%#s", tp); /* { dg-warning "flag" "bad %s" } */
+
/* Bad usages with Y2K problems. */
strftime (s, m, "%^c", tp); /* { dg-warning "flag" "bad %c" } */
+ /* { dg-warning "only last 2" "2-digit year" { target *-*-* } .-1 } */
strftime (s, m, "%#c", tp); /* { dg-warning "flag" "bad %c" } */
+ /* { dg-warning "only last 2" "2-digit year" { target *-*-* } .-1 } */
strftime (s, m, "%^D", tp); /* { dg-warning "flag" "bad %D" } */
+ /* { dg-warning "only last 2" "2-digit year" { target *-*-* } .-1 } */
strftime (s, m, "%#D", tp); /* { dg-warning "flag" "bad %D" } */
+ /* { dg-warning "only last 2" "2-digit year" { target *-*-* } .-1 } */
strftime (s, m, "%^g", tp); /* { dg-warning "flag" "bad %g" } */
+ /* { dg-warning "only last 2" "2-digit year" { target *-*-* } .-1 } */
strftime (s, m, "%#g", tp); /* { dg-warning "flag" "bad %g" } */
+ /* { dg-warning "only last 2" "2-digit year" { target *-*-* } .-1 } */
strftime (s, m, "%^x", tp); /* { dg-warning "flag" "bad %x" } */
+ /* { dg-warning "only last 2" "2-digit year" { target *-*-* } .-1 } */
strftime (s, m, "%#x", tp); /* { dg-warning "flag" "bad %x" } */
+ /* { dg-warning "only last 2" "2-digit year" { target *-*-* } .-1 } */
strftime (s, m, "%^y", tp); /* { dg-warning "flag" "bad %y" } */
+ /* { dg-warning "only last 2" "2-digit year" { target *-*-* } .-1 } */
strftime (s, m, "%#y", tp); /* { dg-warning "flag" "bad %y" } */
- /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 182 } */
- /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 183 } */
- /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 184 } */
- /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 185 } */
- /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 186 } */
- /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 187 } */
- /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 188 } */
- /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 189 } */
- /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 190 } */
- /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 191 } */
+ /* { dg-warning "only last 2" "2-digit year" { target *-*-* } .-1 } */
+
/* GCC also accepts the glibc format extensions %P, %k, %l, %s. */
strftime (s, m, "%P%k%l%s", tp);
/* GCC also accepts the glibc extension of the "O" modifier on some
void
test_everything (char *d, long lexpr)
{
- sprintf (d, "before %-+*.*lld after", lexpr, lexpr, lexpr); /* { dg-warning "26: field width specifier '\\*' expects argument of type 'int', but argument 3 has type 'long int'" } */
+ sprintf (d, "before %-+*.*lld after", lexpr, lexpr, lexpr); /* { dg-line test_everything_sprintf } */
+
+ /* { dg-warning "26: field width specifier '\\*' expects argument of type 'int', but argument 3 has type 'long int'" "" { target *-*-* } test_everything_sprintf } */
/* { dg-begin-multiline-output "" }
sprintf (d, "before %-+*.*lld after", lexpr, lexpr, lexpr);
~~~^~~~~~
{ dg-end-multiline-output "" } */
- /* { dg-warning "28: field precision specifier '\\.\\*' expects argument of type 'int', but argument 4 has type 'long int'" "" { target *-*-* } 392 } */
+ /* { dg-warning "28: field precision specifier '\\.\\*' expects argument of type 'int', but argument 4 has type 'long int'" "" { target *-*-* } test_everything_sprintf } */
/* { dg-begin-multiline-output "" }
sprintf (d, "before %-+*.*lld after", lexpr, lexpr, lexpr);
~~~~~^~~~
{ dg-end-multiline-output "" } */
- /* { dg-warning "31: format '%lld' expects argument of type 'long long int', but argument 5 has type 'long int'" "" { target *-*-* } 392 } */
+ /* { dg-warning "31: format '%lld' expects argument of type 'long long int', but argument 5 has type 'long int'" "" { target *-*-* } test_everything_sprintf } */
/* { dg-begin-multiline-output "" }
sprintf (d, "before %-+*.*lld after", lexpr, lexpr, lexpr);
~~~~~~~~^
const int c = 1;
int i = 0;
int l = 0;
-#pragma omp parallel default(none) private(a) shared(z)
+#pragma omp parallel default(none) private(a) shared(z) /* { dg-line omp_parallel } */
{
int j = omp_get_num_threads ();
/* O.K. - j is declared within parallel region */
/* - c has const-qualified type */
z[i] = y;
/* { dg-error "'i' not specified" "" { target *-*-* } .-1 } */
- /* { dg-error "enclosing 'parallel'" "" { target *-*-* } 13 } */
- /* { dg-error "'y' not specified" "" { target *-*-* } 21 } */
+ /* { dg-error "enclosing 'parallel'" "" { target *-*-* } omp_parallel } */
+ /* { dg-error "'y' not specified" "" { target *-*-* } .-3 } */
#pragma omp for firstprivate(y)
for (i = 0; i < 10; i++)
{
"j",
1,
(L"j")
+ /* { dg-error "parenthesized|near init" "paren array" { target *-*-* } .-1 } */
}; /* { dg-bogus "warning" "warning in place of error" } */
-/* { dg-error "parenthesized|near init" "paren array" { target *-*-* } 31 } */
+
struct s k = {
(("k")), /* { dg-bogus "warning" "warning in place of error" } */
/* { dg-error "parenthesized|near init" "paren array" { target *-*-* } .-1 } */
struct s m = {
.c = L"m",
.a = ("m")
+ /* { dg-error "parenthesized|near init" "paren array" { target *-*-* } .-1 } */
}; /* { dg-bogus "warning" "warning in place of error" } */
-/* { dg-error "parenthesized|near init" "paren array" { target *-*-* } 49 } */
char *n = (char []){ "n" };
f (void)
{
__label__ a, b, c, d;
+ /* { dg-error "ISO C forbids label declarations" "label decls" { target *-*-* } .-1 } */
__extension__ (void)&&d; /* { dg-error "label 'd' used but not defined" } */
- /* { dg-error "ISO C forbids label declarations" "label decls" { target *-*-* } 12 } */
goto c; /* { dg-error "label 'c' used but not defined" } */
a: (void)0;
b: (void)0;
struct vtable {
void* (* _malloc) (size_t);
void (* _free) (void*);
- void* (* _realloc) (void*, size_t);
+ void* (* _realloc) (void*, size_t); /* { dg-line vtable_realloc } */
};
struct vtable mtable = {
malloc,
free
}; /* { dg-warning "missing initializer" "warning regression" } */
- /* { dg-message "declared here" "warning regression 2" { target *-*-* } 12 } */
+ /* { dg-message "declared here" "warning regression 2" { target *-*-* } vtable_realloc } */
/* With designated initializers, we assume you meant to leave out the
initialization of any blank fields. */
return 0k; /* { dg-error "not supported" "reject fixed-point" } */
}
-_Sat /* { dg-error "not supported" "reject fixed-point" } */
+_Sat
+/* { dg-error "not supported" "reject fixed-point" { target *-*-* } .-1 } */
+/* { dg-error "is used without" "" { target *-*-* } .-2 } */
f4 (void)
{
return 0k; /* { dg-error "not supported" "reject fixed-point" } */
}
-
-/* { dg-error "is used without" "" { target *-*-* } 23 } */
Test whether argument checking is done for fputs, bzero and bcmp. */
typedef struct { int i; } FILE;
typedef __SIZE_TYPE__ size_t;
+
int fputs (const char *, FILE *);
+/* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } .-1 } */
+
void bzero (void *, size_t);
+/* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } .-1 } */
+
int bcmp (const void *, const void *, size_t);
+/* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } .-1 } */
char buf[32];
FILE *f;
int main ()
{
fputs ("foo"); /* { dg-error "too few" } */
+
fputs ("foo", "bar", "baz"); /* { dg-error "too many" } */
+ /* { dg-warning "passing argument 2 of" "2nd incompatible" { target *-*-* } .-1 } */
+
fputs (21, 43);
+ /* { dg-warning "passing argument 1 of" "1st incompatible" { target *-*-* } .-1 } */
+ /* { dg-warning "passing argument 2 of" "2nd incompatible" { target *-*-* } .-2 } */
+
bzero (buf); /* { dg-error "too few" } */
+
bzero (21); /* { dg-error "too few" } */
+ /* { dg-warning "passing argument 1 of" "1st incompatible" { target *-*-* } .-1 } */
+
bcmp (buf, buf + 16); /* { dg-error "too few" } */
+
bcmp (21); /* { dg-error "too few" } */
+ /* { dg-warning "passing argument 1 of" "1st incompatible" { target *-*-* } .-1 } */
+
fputs ("foo", f);
bzero (buf, 32);
bcmp (buf, buf + 16, 16);
return 0;
}
-
-/* { dg-warning "passing argument 2 of" "2nd incompatible" { target *-*-* } 15 } */
-/* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } 5 } */
-/* { dg-warning "passing argument 1 of" "1st incompatible" { target *-*-* } 16 } */
-/* { dg-warning "passing argument 2 of" "2nd incompatible" { target *-*-* } 16 } */
-/* { dg-warning "passing argument 1 of" "1st incompatible" { target *-*-* } 18 } */
-/* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } 6 } */
-/* { dg-warning "passing argument 1 of" "1st incompatible" { target *-*-* } 20 } */
-/* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } 7 } */
#include "counter-2.h" /* { dg-warning "not used because `__COUNTER__' is invalid" } */
/* { dg-error "counter-2.h: No such file or directory" "no such file" { target *-*-* } 0 } */
-/* { dg-error "one or more PCH files were found, but they were invalid" "invalid files" { target *-*-* } 10 } */
+/* { dg-error "one or more PCH files were found, but they were invalid" "invalid files" { target *-*-* } .-2 } */
/* { dg-message "terminated" "" { target *-*-* } 0 } */
int main(void)
} while (0)
EXAMPLE(x > 0, 1, 1, 6);
- /* { dg-error "unable to read substring location: cpp_interpret_string_1 failed" "" { target *-*-* } 28 } */
+ /* { dg-error "unable to read substring location: cpp_interpret_string_1 failed" "" { target *-*-* } .-5 } */
#undef EXAMPLE
}
/* Check the warnings and errors generated for asm operands that aren't
obviously constant but that are constrained to be constants. */
/* { dg-options "" } */
-/* { dg-error "impossible constraint" "" { target *-*-* } 13 } */
-/* { dg-error "impossible constraint" "" { target *-*-* } 14 } */
-/* { dg-error "impossible constraint" "" { target *-*-* } 15 } */
-/* { dg-error "impossible constraint" "" { target *-*-* } 16 } */
+
int bar (int);
void
foo (int *x, int y)
{
int constant = 0;
asm ("# %0" :: "i" (x)); /* { dg-warning "probably doesn't match" } */
+ /* { dg-error "impossible constraint" "" { target *-*-* } .-1 } */
+
asm ("# %0" :: "i" (bar (*x))); /* { dg-warning "probably doesn't match" } */
+ /* { dg-error "impossible constraint" "" { target *-*-* } .-1 } */
+
asm ("# %0" :: "i" (*x + 0x11)); /* { dg-warning "probably doesn't match" } */
+ /* { dg-error "impossible constraint" "" { target *-*-* } .-1 } */
+
asm ("# %0" :: "i" (constant)); /* { dg-warning "probably doesn't match" } */
+ /* { dg-error "impossible constraint" "" { target *-*-* } .-1 } */
+
asm ("# %0" :: "i" (y * 0)); /* folded */
}
/* PR c/27953 */
-void foo(struct A a) {} /* { dg-warning "declared inside parameter list" "inside" } */
-/* { dg-error "incomplete type" "incomplete" { target *-*-* } .-1 } */
+void foo(struct A a) {} /* { dg-line foo_first } */
+/* { dg-warning "declared inside parameter list" "inside" { target *-*-* } .-1 } */
+/* { dg-error "incomplete type" "incomplete" { target *-*-* } .-2 } */
-void foo() {} /* { dg-error "redefinition" "redef" } */
-/* { dg-message "note: previous definition" "previous" { target *-*-* } 3 } */
+void foo() {}
+/* { dg-error "redefinition" "redef" { target *-*-* } .-1 } */
+/* { dg-message "note: previous definition" "previous" { target *-*-* } foo_first } */
int
foo (void)
{
- int a = bar ();
+ int a = bar (); /* { dg-line bar_implicit_decl } */
return a;
}
void
-bar (void) /* { dg-warning "conflicting types for" } */
+bar (void)
+/* { dg-warning "conflicting types for" "" { target *-*-* } .-1 } */
+/* { dg-message "note: previous implicit declaration" "" { target *-*-* } bar_implicit_decl } */
{
}
-/* { dg-message "note: previous implicit declaration" "" { target *-*-* } 8 } */
foo ()
{
((char *) p)++; /* { dg-error "lvalue" } */
+
((char *) q)++; /* { dg-error "lvalue" } */
+ /* { dg-warning "cast to pointer from integer of different size" "" { target *-*-* } .-1 } */
+
((char *) p)--; /* { dg-error "lvalue" } */
+
((char *) q)--; /* { dg-error "lvalue" } */
+ /* { dg-warning "cast to pointer from integer of different size" "" { target *-*-* } .-1 } */
+
++(char *) p; /* { dg-error "lvalue" } */
+
++(char *) q; /* { dg-error "lvalue" } */
+ /* { dg-warning "cast to pointer from integer of different size" "" { target *-*-* } .-1 } */
+
--(char *) p; /* { dg-error "lvalue" } */
+
--(char *) q; /* { dg-error "lvalue" } */
+ /* { dg-warning "cast to pointer from integer of different size" "" { target *-*-* } .-1 } */
}
-/* { dg-warning "cast to pointer from integer of different size" "" { target *-*-* } 11 } */
-/* { dg-warning "cast to pointer from integer of different size" "" { target *-*-* } 13 } */
-/* { dg-warning "cast to pointer from integer of different size" "" { target *-*-* } 15 } */
-/* { dg-warning "cast to pointer from integer of different size" "" { target *-*-* } 17 } */
short e;
va_list ap;
va_start (ap, i);
+
e = va_arg (ap, short); /* { dg-warning "is promoted" "promoted" } */
+ /* { dg-message "note: \\(so you should pass" "should pass" {target *-*-* } .-1 } */
+ /* { dg-message "note: if this code" "if this code" {target *-*-* } .-2 } */
+
va_end (ap);
return e;
}
-/* { dg-message "note: \\(so you should pass" "should pass" {target *-*-* } 12 } */
-/* { dg-message "note: if this code" "if this code" {target *-*-* } 12 } */
void foo (void)
{
if (((struct S *)undeclared)->i); /* { dg-error "undeclared" } */
+ /* { dg-message "reported only once" "" { target *-*-* } .-1 } */
}
-/* { dg-message "reported only once" "" { target *-*-* } 13 } */
int
main ()
{
- struct foo f = (struct foo_typo) { }; /* { dg-error "invalid use of undefined type" } */
+ struct foo f = (struct foo_typo) { };
+ /* { dg-error "invalid use of undefined type" "" { target *-*-* } .-1 } */
+ /* { dg-error "ISO C forbids empty initializer braces" "" { target *-*-* } .-2 } */
+
printf ("%d\n", f.i);
return 0;
}
-/* { dg-error "ISO C forbids empty initializer braces" "" { target *-*-* } 11 } */
{
int a[16], b, c;
bar (a);
- for (b = a[c = 0]; c < 16; b = a[++c]) /* { dg-warning "15 invokes undefined behavior" } */
+ for (b = a[c = 0]; c < 16; b = a[++c])
+ /* { dg-warning "15 invokes undefined behavior" "" { target *-*-* } .-1 } */
+ /* { dg-message "note: within this loop" "" { target *-*-* } .-2 } */
baz (b);
}
-/* { dg-message "note: within this loop" "" { target *-*-* } 89 } */
const void *va, *vb, *vc, *vd, *ve;
const void *vf[4];
void prime4(void)
{
- bar4(); /* { dg-warning "implicit declaration of function" "implicit" } */
+ bar4(); /* { dg-line implicit_bar4 } */
+ /* { dg-warning "implicit declaration of function" "implicit" { target *-*-* } implicit_bar4 } */
}
void test4(void)
{
extern double bar4(double); /* { dg-error "conflict" } */
-/* { dg-message "note: previous implicit declaration" "previous" { target *-*-* } 55 } */
+/* { dg-message "note: previous implicit declaration" "previous" { target *-*-* } implicit_bar4 } */
}
/* Implicit decl, clashing with extern at previous function scope. */
/* { dg-require-effective-target tls } */
static __thread int fstat ;
-static __thread int fstat = 1 ;
+static __thread int fstat = 1 ; /* { dg-line fstat_prev } */
static __thread int fstat ;
-static __thread int fstat = 2; /* { dg-error "redefinition of 'fstat'" } */
- /* { dg-message "note: previous definition of 'fstat' was here" "" { target *-*-* } 5 } */
+static __thread int fstat = 2;
+/* { dg-error "redefinition of 'fstat'" "" { target *-*-* } .-1 } */
+/* { dg-message "note: previous definition of 'fstat' was here" "" { target *-*-* } fstat_prev } */
foo (int x)
{
asm goto ("" : : "i" (x) : : lab); /* { dg-error "impossible constraint" } */
+ /* { dg-warning "probably doesn.t match constraints" "" { target *-*-* } .-1 } */
return 1;
lab:
return 0;
}
-/* { dg-warning "probably doesn.t match constraints" "" { target *-*-* } 8 } */
bar (int x)
{
asm goto ("" : : "i" (x) : : lab); /* { dg-error "impossible constraint" } */
+/* { dg-warning "probably doesn.t match constraints" "" { target *-*-* } .-1 } */
__builtin_unreachable ();
lab:
return 0;
}
-/* { dg-warning "probably doesn.t match constraints" "" { target *-*-* } 9 } */
unsigned char *c2, float *p10)
{
if (p1 & 8)
- b[3] = p10[a]; /* 14. */
+ b[3] = p10[a];
+ /* { dg-warning "may be used uninitialized" "" { target { { nonpic } || { hppa*64*-*-* } } } .-1 } */
}
void
float *n;
if (l & 6)
n = &c + m;
- fn1 (l, &d, &e, &g, &i, &h, &k, n); /* 23. */
+ fn1 (l, &d, &e, &g, &i, &h, &k, n);
+ /* { dg-warning "may be used uninitialized" "" { target { ! { { nonpic } || { hppa*64*-*-* } } } } .-1 } */
}
-
-/* { dg-warning "may be used uninitialized" "" { target { { nonpic } || { hppa*64*-*-* } } } 14 } */
-/* { dg-warning "may be used uninitialized" "" { target { ! { { nonpic } || { hppa*64*-*-* } } } } 23 } */
{
int i = 1;
int j;
+ /* { dg-warning "uninitialized" "uninitialized" { target *-*-* } .-1 } */
if (1 == i)
- return j; /* { dg-warning "uninitialized" "uninitialized" { target *-*-* } 18 } */
+ return j;
return 0;
}