aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/cpp/redef2.c
blob: 5838c47506e4861a0ebdf37ce14ed80f7ff7416e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* Test for redefining macros with significant differences.  */

/* { dg-do preprocess }
   { dg-options "-ansi -pedantic -Wall -fno-show-column" } */

#define mac(a, b) (a) + (b)
#define mac(a, b) (a) * (b)
#define mac(a, b) (a) * (x)
#define mac(a, g) (a) * (x)

#define ro(x) foo x bar
#define ro(x, b) foo x bar

#define va(a...) a
#define va(...) __VA_ARGS__

/* { dg-warning "redefined" "redef mac"     { target *-*-* } 7  }
   { dg-warning "redefined" "redef mac"     { target *-*-* } 8  }
   { dg-warning "redefined" "redef mac"     { target *-*-* } 9  }
   { dg-warning "redefined" "redef ro"      { target *-*-* } 12 }
   { dg-warning "redefined" "redef va"      { target *-*-* } 15 }

   { dg-warning "previous"  "prev def mac"  { target *-*-* } 6  }
   { dg-warning "previous"  "prev def mac"  { target *-*-* } 7  }
   { dg-warning "previous"  "prev def mac"  { target *-*-* } 8  }
   { dg-warning "previous"  "prev def ro"   { target *-*-* } 11 }
   { dg-warning "previous"  "prev def va"   { target *-*-* } 14 }

   { dg-warning "named variable"   "named"  { target *-*-* } 14 }
   { dg-warning "anonymous variable" "anon" { target *-*-* } 15 } */