Debian Codegraph @

gcc/testsuite/gcc.dg/cpp/extratokens.c

raw
1 /* Copyright (C) 2000, 2008 Free Software Foundation, Inc. */
2
3 /* { dg-do preprocess } */
4 /* { dg-options "-Wno-deprecated" } */
5
6 /* Tests all directives that do not permit excess tokens at the end of
7 the line. */
8
9 /* Source: Neil Booth, 4 Dec 2000. The combination of separate test
10 cases. */
11
12 #ifdef foo bar /* { dg-warning "extra tokens" "tokens after #ifdef" } */
13 #endif
14
15 #ifndef foo bar /* { dg-warning "extra tokens" "tokens after #ifndef" } */
16 #endif
17
18 #if 1
19 #if 0
20 #else foo /* { dg-warning "extra tokens" "tokens after #else" } */
21 #endif / /* { dg-warning "extra tokens" "tokens after #endif" } */
22 #endif
23
24 #undef foo bar /* { dg-warning "extra tokens" "tokens after #undef" } */
25
26 #assert foo(bar) bar /* { dg-warning "extra tokens" "tokens after #assert" } */
27
28 #unassert foo(bar) b /* { dg-warning "extra tokens" "tokens after #unassert" } */
29
30 #include "mi1c.h" bar /* { dg-warning "extra tokens" "tokens after #include" } */
31
32 #ident "something" bar /* { dg-warning "extra tokens" "tokens after #ident" } */
33
34 # 36 "file.c" 3
35
36 /* ... but in a system header, it's acceptable. */
37 #ifdef KERNEL
38 #endif KERNEL /* { dg-bogus "extra tokens" "bad warning" } */