Debian Codegraph @

gcc/testsuite/gcc.dg/cpp/tr-warn6.c

raw
1 /* Test for -Wtraditional warnings for stringification of macro args.
2 Note, gcc should omit these warnings in system header files.
3 By Kaveh R. Ghazi <[email protected]> 9/8/2000. */
4 /* { dg-do preprocess } */
5 /* { dg-options "-Wtraditional" } */
6
7 #define foo1(h) sdf "h3" fds "h" /* { dg-warning "macro argument 'h' would be stringified" "traditional stringification" } */
8 #define foo2(h2) sdf "h2" fds "h3" /* { dg-warning "macro argument 'h2' would be stringified" "traditional stringification" } */
9 #define foo3(h3) sdf "h2" fds "h3" /* { dg-warning "macro argument 'h3' would be stringified" "traditional stringification" } */
10 #define foo4(h) sdf 'h3' fds 'h' /* { dg-warning "macro argument 'h' would be stringified" "traditional stringification" } */
11 #define foo5(h2) sdf 'h2' fds 'h3' /* { dg-warning "macro argument 'h2' would be stringified" "traditional stringification" } */
12 #define foo6(h3) sdf 'h2' fds 'h3' /* { dg-warning "macro argument 'h3' would be stringified" "traditional stringification" } */
13 #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" } */
14 /* Catch the second warning from the above line. */
15 /* { dg-warning "macro argument 'world' would be stringified" "traditional stringification second warning" { target *-*-* } .-2 } */
16
17 # 19 "sys-header.h" 3
18 /* We are in system headers now, no -Wtraditional warnings should issue. */
19
20 #define bar1(h) sdf "h3" fds "h"
21 #define bar2(h2) sdf "h2" fds "h3"
22 #define bar3(h3) sdf "h2" fds "h3"
23 #define bar4(h) sdf 'h3' fds 'h'
24 #define bar5(h2) sdf 'h2' fds 'h3'
25 #define bar6(h3) sdf 'h2' fds 'h3'
26 #define bar7(AA, hello, world, EEE) sdf "A B hello C,world,DhelloE F" fds EEE