• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*=============================================================================
2     Boost.Wave: A Standard compliant C++ preprocessor library
3     http://www.boost.org/
4 
5     Copyright (c) 2020 Jeff Trull. Distributed under the Boost
6     Software License, Version 1.0. (See accompanying file
7     LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 =============================================================================*/
9 
10 //O --c++17
11 //O -Werror
12 
13 // Test __has_include() with computed includes
14 
15 // point system path to this directory
16 //O -S.
17 
18 // does this file exist?
19 #if __has_include(__FILE__)
20 #define GOTTHISFILE
21 #else
22 #warning has_include could not find with file predefined macro
23 #endif
24 
25 //H 10: t_2_025.cpp(19): #if
26 //H 01: <built-in>(1): __FILE__
27 //H 02: "$F"
28 //H 03: "$F"
29 //H 11: t_2_025.cpp(19): #if __has_include(__FILE__): 1
30 //H 10: t_2_025.cpp(20): #define
31 //H 08: t_2_025.cpp(20): GOTTHISFILE=
32 //H 10: t_2_025.cpp(21): #else
33 
34 // try a computation producing a quoted file
35 #define FOO(X) "t_2_025.cpp"
36 #define BAR 0
37 #if __has_include(FOO(BAR))
38 #define FOUND_DQUOTE
39 #else
40 #warning has_include could not find this file using quotes
41 #endif
42 
43 //H 10: t_2_025.cpp(35): #define
44 //H 08: t_2_025.cpp(35): FOO(X)="t_2_025.cpp"
45 //H 10: t_2_025.cpp(36): #define
46 //H 08: t_2_025.cpp(36): BAR=0
47 //H 10: t_2_025.cpp(37): #if
48 //H 00: t_2_025.cpp(37): FOO(BAR), [t_2_025.cpp(35): FOO(X)="t_2_025.cpp"]
49 //H 02: "t_2_025.cpp"
50 //H 03: "t_2_025.cpp"
51 //H 11: t_2_025.cpp(37): #if __has_include(FOO(BAR)): 1
52 //H 10: t_2_025.cpp(38): #define
53 //H 08: t_2_025.cpp(38): FOUND_DQUOTE=
54 //H 10: t_2_025.cpp(39): #else
55 
56 // try a computation producing a bracketed name
57 #define EMPTY
58 #define ASSEMBLE(ARG) <t_2_025.cpp>
59 #if __has_include(ASSEMBLE(EMPTY))
60 #define FOUND_ABRACKET
61 #else
62 #warning has_include could not find this file using angle brackets
63 #endif
64 
65 //H 10: t_2_025.cpp(57): #define
66 //H 08: t_2_025.cpp(57): EMPTY=
67 //H 10: t_2_025.cpp(58): #define
68 //H 08: t_2_025.cpp(58): ASSEMBLE(ARG)=<t_2_025.cpp>
69 //H 10: t_2_025.cpp(59): #if
70 //H 00: t_2_025.cpp(59): ASSEMBLE(EMPTY), [t_2_025.cpp(58): ASSEMBLE(ARG)=<t_2_025.cpp>]
71 //H 02: <t_2_025.cpp>
72 //H 03: <t_2_025.cpp>
73 //H 11: t_2_025.cpp(59): #if __has_include(ASSEMBLE(EMPTY)): 1
74 //H 10: t_2_025.cpp(60): #define
75 //H 08: t_2_025.cpp(60): FOUND_ABRACKET=
76 //H 10: t_2_025.cpp(61): #else
77