Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Tests / Preprocess / preprocess.c
blob16209acf49be8329b2ebe18b9ff9f2ed0bae2ba6
1 #include <preprocess.h>
3 #include FILE_PATH
4 #include TARGET_PATH
6 #include <string.h>
7 #include <stdio.h>
9 int check_defines_C(void)
11 int result = 1;
12 if(strcmp(FILE_STRING, STRING_VALUE) != 0)
14 fprintf(stderr,
15 "FILE_STRING has wrong value in C [%s]\n", FILE_STRING);
16 result = 0;
18 if(strcmp(TARGET_STRING, STRING_VALUE) != 0)
20 fprintf(stderr,
21 "TARGET_STRING has wrong value in C [%s]\n", TARGET_STRING);
22 result = 0;
25 int x = 2;
26 int y = 3;
27 if((FILE_EXPR) != (EXPR))
29 fprintf(stderr, "FILE_EXPR did not work in C [%s]\n",
30 TO_STRING(FILE_EXPR));
31 result = 0;
33 if((TARGET_EXPR) != (EXPR))
35 fprintf(stderr, "TARGET_EXPR did not work in C [%s]\n",
36 TO_STRING(FILE_EXPR));
37 result = 0;
40 #ifdef NDEBUG
41 # ifdef FILE_DEF_DEBUG
43 fprintf(stderr, "FILE_DEF_DEBUG should not be defined in C\n");
44 result = 0;
46 # endif
47 # ifdef TARGET_DEF_DEBUG
49 fprintf(stderr, "TARGET_DEF_DEBUG should not be defined in C\n");
50 result = 0;
52 # endif
53 # ifdef DIRECTORY_DEF_DEBUG
55 fprintf(stderr, "DIRECTORY_DEF_DEBUG should not be defined in C\n");
56 result = 0;
58 # endif
59 # ifndef FILE_DEF_RELEASE
60 # ifndef PREPROCESS_XCODE
62 fprintf(stderr, "FILE_DEF_RELEASE should be defined in C\n");
63 result = 0;
65 # endif
66 # endif
67 # ifndef TARGET_DEF_RELEASE
69 fprintf(stderr, "TARGET_DEF_RELEASE should be defined in C\n");
70 result = 0;
72 # endif
73 # ifndef DIRECTORY_DEF_RELEASE
75 fprintf(stderr, "DIRECTORY_DEF_RELEASE should be defined in C\n");
76 result = 0;
78 # endif
79 #endif
80 #ifdef PREPROCESS_DEBUG
81 # ifndef FILE_DEF_DEBUG
82 # ifndef PREPROCESS_XCODE
84 fprintf(stderr, "FILE_DEF_DEBUG should be defined in C\n");
85 result = 0;
87 # endif
88 # endif
89 # ifndef TARGET_DEF_DEBUG
91 fprintf(stderr, "TARGET_DEF_DEBUG should be defined in C\n");
92 result = 0;
94 # endif
95 # ifndef DIRECTORY_DEF_DEBUG
97 fprintf(stderr, "DIRECTORY_DEF_DEBUG should be defined in C\n");
98 result = 0;
100 # endif
101 # ifdef FILE_DEF_RELEASE
103 fprintf(stderr, "FILE_DEF_RELEASE should not be defined in C\n");
104 result = 0;
106 # endif
107 # ifdef TARGET_DEF_RELEASE
109 fprintf(stderr, "TARGET_DEF_RELEASE should not be defined in C\n");
110 result = 0;
112 # endif
113 # ifdef DIRECTORY_DEF_RELEASE
115 fprintf(stderr, "DIRECTORY_DEF_RELEASE should not be defined in C\n");
116 result = 0;
118 # endif
119 #endif
120 #if defined(FILE_DEF_DEBUG) || defined(TARGET_DEF_DEBUG)
121 # if !defined(FILE_DEF_DEBUG) || !defined(TARGET_DEF_DEBUG)
122 # ifndef PREPROCESS_XCODE
124 fprintf(stderr,
125 "FILE_DEF_DEBUG and TARGET_DEF_DEBUG inconsistent in C\n");
126 result = 0;
128 # endif
129 # endif
130 # if defined(FILE_DEF_RELEASE) || defined(TARGET_DEF_RELEASE)
132 fprintf(stderr, "DEBUG and RELEASE definitions inconsistent in C\n");
133 result = 0;
135 # endif
136 #endif
137 #if defined(FILE_DEF_RELEASE) || defined(TARGET_DEF_RELEASE)
138 # if !defined(FILE_DEF_RELEASE) || !defined(TARGET_DEF_RELEASE)
139 # ifndef PREPROCESS_XCODE
141 fprintf(stderr,
142 "FILE_DEF_RELEASE and TARGET_DEF_RELEASE inconsistent in C\n");
143 result = 0;
145 # endif
146 # endif
147 # if defined(FILE_DEF_DEBUG) || defined(TARGET_DEF_DEBUG)
149 fprintf(stderr, "RELEASE and DEBUG definitions inconsistent in C\n");
150 result = 0;
152 # endif
153 #endif
154 #ifndef FILE_PATH_DEF
156 fprintf(stderr, "FILE_PATH_DEF not defined in C\n");
157 result = 0;
159 #endif
160 #ifndef TARGET_PATH_DEF
162 fprintf(stderr, "TARGET_PATH_DEF not defined in C\n");
163 result = 0;
165 #endif
166 #ifndef FILE_DEF
168 fprintf(stderr, "FILE_DEF not defined in C\n");
169 result = 0;
171 #endif
172 #ifndef TARGET_DEF
174 fprintf(stderr, "TARGET_DEF not defined in C\n");
175 result = 0;
177 #endif
178 #ifndef DIRECTORY_DEF
180 fprintf(stderr, "DIRECTORY_DEF not defined in C\n");
181 result = 0;
183 #endif
184 #ifndef OLD_DEF
186 fprintf(stderr, "OLD_DEF not defined in C\n");
187 result = 0;
189 #endif
190 #if !defined(OLD_EXPR) || OLD_EXPR != 2
192 fprintf(stderr, "OLD_EXPR id not work in C [%s]\n",
193 TO_STRING(OLD_EXPR));
194 result = 0;
196 #endif
197 return result;