Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Tests / Preprocess / preprocess.cxx
blob628521ff9d1feb3785c2011b6cad939b0ddb2013
1 #include <preprocess.h>
3 #include FILE_PATH
4 #include TARGET_PATH
6 #include <string.h>
7 #include <stdio.h>
9 extern "C" int check_defines_C(void);
11 int check_defines_CXX()
13 int result = 1;
14 #ifndef PREPROCESS_VS6
15 if(strcmp(FILE_STRING, STRING_VALUE) != 0)
17 fprintf(stderr,
18 "FILE_STRING has wrong value in CXX [%s]\n", FILE_STRING);
19 result = 0;
21 if(strcmp(TARGET_STRING, STRING_VALUE) != 0)
23 fprintf(stderr,
24 "TARGET_STRING has wrong value in CXX [%s]\n", TARGET_STRING);
25 result = 0;
28 int x = 2;
29 int y = 3;
30 if((FILE_EXPR) != (EXPR))
32 fprintf(stderr, "FILE_EXPR did not work in CXX [%s]\n",
33 TO_STRING(FILE_EXPR));
34 result = 0;
36 if((TARGET_EXPR) != (EXPR))
38 fprintf(stderr, "TARGET_EXPR did not work in CXX [%s]\n",
39 TO_STRING(FILE_EXPR));
40 result = 0;
43 #endif
44 #ifdef NDEBUG
45 # ifdef FILE_DEF_DEBUG
47 fprintf(stderr, "FILE_DEF_DEBUG should not be defined in CXX\n");
48 result = 0;
50 # endif
51 # ifdef TARGET_DEF_DEBUG
53 fprintf(stderr, "TARGET_DEF_DEBUG should not be defined in CXX\n");
54 result = 0;
56 # endif
57 # ifdef DIRECTORY_DEF_DEBUG
59 fprintf(stderr, "DIRECTORY_DEF_DEBUG should not be defined in CXX\n");
60 result = 0;
62 # endif
63 # ifndef FILE_DEF_RELEASE
64 # ifndef PREPROCESS_XCODE
66 fprintf(stderr, "FILE_DEF_RELEASE should be defined in CXX\n");
67 result = 0;
69 # endif
70 # endif
71 # ifndef TARGET_DEF_RELEASE
73 fprintf(stderr, "TARGET_DEF_RELEASE should be defined in CXX\n");
74 result = 0;
76 # endif
77 # ifndef DIRECTORY_DEF_RELEASE
79 fprintf(stderr, "DIRECTORY_DEF_RELEASE should be defined in CXX\n");
80 result = 0;
82 # endif
83 #endif
84 #ifdef PREPROCESS_DEBUG
85 # ifndef FILE_DEF_DEBUG
86 # ifndef PREPROCESS_XCODE
88 fprintf(stderr, "FILE_DEF_DEBUG should be defined in CXX\n");
89 result = 0;
91 # endif
92 # endif
93 # ifndef TARGET_DEF_DEBUG
95 fprintf(stderr, "TARGET_DEF_DEBUG should be defined in CXX\n");
96 result = 0;
98 # endif
99 # ifndef DIRECTORY_DEF_DEBUG
101 fprintf(stderr, "DIRECTORY_DEF_DEBUG should be defined in CXX\n");
102 result = 0;
104 # endif
105 # ifdef FILE_DEF_RELEASE
107 fprintf(stderr, "FILE_DEF_RELEASE should not be defined in CXX\n");
108 result = 0;
110 # endif
111 # ifdef TARGET_DEF_RELEASE
113 fprintf(stderr, "TARGET_DEF_RELEASE should not be defined in CXX\n");
114 result = 0;
116 # endif
117 # ifdef DIRECTORY_DEF_RELEASE
119 fprintf(stderr, "DIRECTORY_DEF_RELEASE should not be defined in CXX\n");
120 result = 0;
122 # endif
123 #endif
124 #if defined(FILE_DEF_DEBUG) || defined(TARGET_DEF_DEBUG)
125 # if !defined(FILE_DEF_DEBUG) || !defined(TARGET_DEF_DEBUG)
126 # ifndef PREPROCESS_XCODE
128 fprintf(stderr,
129 "FILE_DEF_DEBUG and TARGET_DEF_DEBUG inconsistent in CXX\n");
130 result = 0;
132 # endif
133 # endif
134 # if defined(FILE_DEF_RELEASE) || defined(TARGET_DEF_RELEASE)
136 fprintf(stderr, "DEBUG and RELEASE definitions inconsistent in CXX\n");
137 result = 0;
139 # endif
140 #endif
141 #if defined(FILE_DEF_RELEASE) || defined(TARGET_DEF_RELEASE)
142 # if !defined(FILE_DEF_RELEASE) || !defined(TARGET_DEF_RELEASE)
143 # ifndef PREPROCESS_XCODE
145 fprintf(stderr,
146 "FILE_DEF_RELEASE and TARGET_DEF_RELEASE inconsistent in CXX\n");
147 result = 0;
149 # endif
150 # endif
151 # if defined(FILE_DEF_DEBUG) || defined(TARGET_DEF_DEBUG)
153 fprintf(stderr, "RELEASE and DEBUG definitions inconsistent in CXX\n");
154 result = 0;
156 # endif
157 #endif
158 #ifndef FILE_PATH_DEF
160 fprintf(stderr, "FILE_PATH_DEF not defined in CXX\n");
161 result = 0;
163 #endif
164 #ifndef TARGET_PATH_DEF
166 fprintf(stderr, "TARGET_PATH_DEF not defined in CXX\n");
167 result = 0;
169 #endif
170 #ifndef FILE_DEF
172 fprintf(stderr, "FILE_DEF not defined in CXX\n");
173 result = 0;
175 #endif
176 #ifndef TARGET_DEF
178 fprintf(stderr, "TARGET_DEF not defined in CXX\n");
179 result = 0;
181 #endif
182 #ifndef DIRECTORY_DEF
184 fprintf(stderr, "DIRECTORY_DEF not defined in CXX\n");
185 result = 0;
187 #endif
188 #ifndef OLD_DEF
190 fprintf(stderr, "OLD_DEF not defined in CXX\n");
191 result = 0;
193 #endif
194 #if !defined(OLD_EXPR) || OLD_EXPR != 2
196 fprintf(stderr, "OLD_EXPR id not work in C [%s]\n",
197 TO_STRING(OLD_EXPR));
198 result = 0;
200 #endif
201 return result;
204 int main()
206 int result = 1;
208 if(!check_defines_C())
210 result = 0;
213 if(!check_defines_CXX())
215 result = 0;
218 if(result)
220 printf("All preprocessor definitions are correct.\n");
221 return 0;
223 else
225 return 1;