2018-01-24 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / cpp / line3.c
blob4b40e4a6a95380be693d0b86d80eefd4d67f3238
1 /* { dg-do compile } */
2 /* { dg-options "-Wwrite-strings" } */
3 /* The purpose of this test is to ensure that line numbers in diagnostics
4 are accurate after macros whose arguments contain newlines and are
5 substituted multiple times. The semicolons are on separate lines because
6 #line can only correct numbering on line boundaries. */
7 #define one(x) x
8 #define two(x) x x
9 #define four(x) two(x) two(x)
11 int
12 main(void)
14 char *A;
16 A = "text"; /* { dg-warning "discards 'const' qualifier" "case zero" } */
17 A = one("text" /* { dg-warning "discards 'const' qualifier" "case one" } */
18 "text")
20 A = two("text" /* { dg-warning "discards 'const' qualifier" "case two" } */
21 "text")
23 A = four("text" /* { dg-warning "discards 'const' qualifier" "case four" } */
24 "text")
27 return 0;