summaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/cpp/has-builtin.c
blob: 93516519acee52477f45a9ad4def7f6ef5f16020 (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
/* PR c/66970 - Add __has_builtin() macro
   Verify that errors are detected and handled gracefully.
   { dg-do compile } */

#ifndef __has_builtin
#  error "__has_builtin is not defined"
#endif

#if __has_builtin             // { dg-error "missing '\\\(' after \"__has_builtin\"" }
#endif

#if __has_builtin (           // { dg-error "macro \"__has_builtin\" requires an identifier" }
#endif

#if __has_builtin ()          // { dg-error "macro \"__has_builtin\" requires an identifier" }
#endif

#if __has_builtin (1)         // { dg-error "macro \"__has_builtin\" requires an identifier" }
#endif

#if __has_builtin (1, 2)      // { dg-error "macro \"__has_builtin\" requires an identifier" }
#endif

#if __has_builtin (1 + 2)     // { dg-error "macro \"__has_builtin\" requires an identifier" }
#endif

#if __has_builtin (x, y)      // { dg-error "expected '\\\)' after \"x\"" } */
#endif

#if __has_builtin (x + 1)     // { dg-error "expected '\\\)' after \"x\"" } */
#endif

#if __has_builtin (p->i)      // { dg-error "expected '\\\)' after \"p\"" } */
#endif

#if __has_builtin ((x))       // { dg-error "macro \"__has_builtin\" requires an identifier" }
#endif

#if __has_builtin ((y)        // { dg-error "macro \"__has_builtin\" requires an identifier" }
#endif

#if __has_builtin ((((z)      // { dg-error "macro \"__has_builtin\" requires an identifier" }
#endif

#if __has_builtin (x)))       // { dg-error "missing '\\\('" }"
#endif

#if __has_builtin (f ())      // { dg-error "expected '\\\)' after \"f\"" }"
#endif