blob: fdcae78b751e1e1b5c31f18eacdb2079c8bd93ad (
about) (
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
// RUN: %clang_cc1 -ffreestanding -Eonly -verify %s
// Try different path permutations of __has_include with existing file.
#if __has_include("stdint.h")
#else
#error "__has_include failed (1)."
#endif
#if __has_include(<stdint.h>)
#else
#error "__has_include failed (2)."
#endif
// Try unary expression.
#if !__has_include("stdint.h")
#error "__has_include failed (5)."
#endif
// Try binary expression.
#if __has_include("stdint.h") && __has_include("stddef.h")
#else
#error "__has_include failed (6)."
#endif
// Try non-existing file.
#if __has_include("blahblah.h")
#error "__has_include failed (7)."
#endif
// Try defined.
#if !defined(__has_include)
#error "defined(__has_include) failed (8)."
#endif
// Try different path permutations of __has_include_next with existing file.
#if __has_include_next("stddef.h") // expected-warning {{#include_next in primary source file}}
#else
#error "__has_include failed (1)."
#endif
#if __has_include_next(<stddef.h>) // expected-warning {{#include_next in primary source file}}
#else
#error "__has_include failed (2)."
#endif
// Try unary expression.
#if !__has_include_next("stdint.h") // expected-warning {{#include_next in primary source file}}
#error "__has_include_next failed (5)."
#endif
// Try binary expression.
#if __has_include_next("stdint.h") && __has_include("stddef.h") // expected-warning {{#include_next in primary source file}}
#else
#error "__has_include_next failed (6)."
#endif
// Try non-existing file.
#if __has_include_next("blahblah.h") // expected-warning {{#include_next in primary source file}}
#error "__has_include_next failed (7)."
#endif
// Try defined.
#if !defined(__has_include_next)
#error "defined(__has_include_next) failed (8)."
#endif
// Try badly formed expressions.
// FIXME: I don't quite know how to avoid preprocessor side effects.
// Use FileCheck?
// It also assert due to unterminated #if's.
//#if __has_include("stdint.h"
//#if __has_include "stdint.h")
//#if __has_include(stdint.h)
//#if __has_include()
//#if __has_include(
//#if __has_include)
//#if __has_include
//#if __has_include(<stdint.h>
//#if __has_include<stdint.h>)
//#if __has_include("stdint.h)
//#if __has_include(stdint.h")
//#if __has_include(<stdint.h)
//#if __has_include(stdint.h>)
|