OSDN Git Service

* gcc.dg/anon-struct-6.c, gcc.dg/array-8.c,
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / cpp / tr-warn6.c
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 <ghazi@caip.rutgers.edu> 9/8/2000.  */
4 /* { dg-do preprocess } */
5 /* { dg-options "-Wtraditional -fno-show-column" } */
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
15 /* Catch the second warning from the above line.  */
16 /* { dg-warning "macro argument \"world\" would be stringified" "traditional stringification second warning" { target *-*-* } 13 } */
17
18 # 19 "sys-header.h" 3
19 /* We are in system headers now, no -Wtraditional warnings should issue.  */
20
21 #define bar1(h) sdf "h3" fds "h"
22 #define bar2(h2) sdf "h2" fds "h3"
23 #define bar3(h3) sdf "h2" fds "h3"
24 #define bar4(h) sdf 'h3' fds 'h'
25 #define bar5(h2) sdf 'h2' fds 'h3'
26 #define bar6(h3) sdf 'h2' fds 'h3'
27 #define bar7(AA, hello, world, EEE) sdf "A B hello C,world,DhelloE F" fds EEE