summaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/cpp/pr65238-1.c
blob: 6d6346535ab8f891a37cdbe7e18a341e10149c79 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* PR preprocessor/65238 */
/* { dg-do run } */

#define A unused
#define B A
#define C B
#define D __has_attribute(unused)
#define E __has_attribute(C)
#define F(X) __has_attribute(X)
#if !__has_attribute(unused)
#error unused attribute not supported - 1
#endif
#if !__has_attribute(C)
#error unused attribute not supported - 2
#endif
#if !D
#error unused attribute not supported - 3
#endif
#if !E
#error unused attribute not supported - 4
#endif
#if !F(unused)
#error unused attribute not supported - 5
#endif
#if !F(C)
#error unused attribute not supported - 6
#endif
int a = __has_attribute (unused) + __has_attribute (C) + D + E + F (unused) + F (C);
int b = __has_attribute (unused);
int c = __has_attribute (C);
int d = D;
int e = E;
int f = F (unused);
int g = F (C);
int h = __has_attribute (
  unused
) + __has_attribute  (

C) + F (
unused

) + F
(
C
);

int
main ()
{
  if (a != 6 || b != 1 || c != 1 || d != 1 || e != 1 || f != 1 || g != 1 || h != 4)
    __builtin_abort ();
  return 0;
}