OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [testsuite/] [gcc.dg/] [cpp/] [tr-warn3.c] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 jlechner
/* Test for warnings about nontraditional directives inside the unused
2
   clauses of #if statements.  Extensions do _not_ receive pedantic
3
   warnings inside unused clauses because they are often hidden this
4
   way on purpose.  However they do still require indentation for K&R.  */
5
/* { dg-do preprocess } */
6
/* { dg-options "-pedantic -Wtraditional -fno-show-column" } */
7
 
8
#if 1
9
 
10
/* Block 1: K+R directives should have the # indented to warn.  */
11
 
12
#define foo bar         /* { dg-bogus "indented" "^#kandr"     } */
13
# define foo bar        /* { dg-bogus "indented" "^# kandr"    } */
14
 #define foo bar        /* { dg-warning "indented" "^ #kandr"  } */
15
 # define foo bar       /* { dg-warning "indented" "^ # kandr" } */
16
 
17
/* Block 2: C89 directives should not have the # indented to warn.  */
18
 
19
#pragma whatever        /* { dg-warning "indented" "^#c89"     } */
20
# pragma whatever       /* { dg-warning "indented" "^# c89"    } */
21
 #pragma whatever       /* { dg-bogus "indented" "^ #c89"      } */
22
 # pragma whatever      /* { dg-bogus "indented" "^ # c89"     } */
23
 
24
/* Block 3: Extensions should not have the # indented to warn, _and_
25
   they should get a -pedantic warning. */
26
 
27
#assert foo(bar)        /* { dg-warning "indented" "^#ext"    } */
28
# assert bar(baz)       /* { dg-warning "indented" "^# ext"   } */
29
 #assert baz(quux)      /* { dg-bogus "indented" "^ #ext"     } */
30
 # assert quux(weeble)  /* { dg-bogus "indented" "^ # ext"    } */
31
 
32
#else
33
 
34
/* Block 1: K+R directives should have the # indented to warn.  */
35
 
36
#undef foo bar          /* { dg-bogus "indented" "^#kandr"     } */
37
# undef foo bar         /* { dg-bogus "indented" "^# kandr"    } */
38
 #undef foo bar         /* { dg-warning "indented" "^ #kandr"  } */
39
 # undef foo bar        /* { dg-warning "indented" "^ # kandr" } */
40
 
41
/* Block 2: C89 directives should not have the # indented to warn.  */
42
 
43
#error whatever         /* { dg-warning "indented" "^#c89"     } */
44
# error whatever        /* { dg-warning "indented" "^# c89"    } */
45
 #error whatever        /* { dg-bogus "indented" "^ #c89"      } */
46
 # error whatever       /* { dg-bogus "indented" "^ # c89"     } */
47
 
48
/* Block 3: Extensions should not have the # indented to warn, and
49
   they should _not_ get a -pedantic warning. */
50
 
51
#unassert foo(bar)              /* { dg-warning "indented" "^#ext"    } */
52
# unassert bar(baz)             /* { dg-warning "indented" "^# ext"   } */
53
 #unassert baz(quux)            /* { dg-bogus "indented" "^ #ext"     } */
54
 # unassert quux(weeble)        /* { dg-bogus "indented" "^ # ext"    } */
55
 
56
#endif
57
 
58
/* { dg-warning "GCC extension" "extension warning" { target *-*-* } 27 } */
59
/* { dg-warning "GCC extension" "extension warning" { target *-*-* } 28 } */
60
/* { dg-warning "GCC extension" "extension warning" { target *-*-* } 29 } */
61
/* { dg-warning "GCC extension" "extension warning" { target *-*-* } 30 } */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.