preprocess.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. #include <preprocess.h>
  2. #include FILE_PATH
  3. #include TARGET_PATH
  4. #include <stdio.h>
  5. #include <string.h>
  6. int check_defines_C(void)
  7. {
  8. int result = 1;
  9. if (strcmp(FILE_STRING, STRING_VALUE) != 0) {
  10. fprintf(stderr, "FILE_STRING has wrong value in C [%s]\n", FILE_STRING);
  11. result = 0;
  12. }
  13. if (strcmp(TARGET_STRING, STRING_VALUE) != 0) {
  14. fprintf(stderr, "TARGET_STRING has wrong value in C [%s]\n",
  15. TARGET_STRING);
  16. result = 0;
  17. }
  18. {
  19. int x = 2;
  20. int y = 3;
  21. if ((FILE_EXPR) != (EXPR)) {
  22. fprintf(stderr, "FILE_EXPR did not work in C [%s]\n",
  23. TO_STRING(FILE_EXPR));
  24. result = 0;
  25. }
  26. if ((TARGET_EXPR) != (EXPR)) {
  27. fprintf(stderr, "TARGET_EXPR did not work in C [%s]\n",
  28. TO_STRING(FILE_EXPR));
  29. result = 0;
  30. }
  31. }
  32. #ifdef NDEBUG
  33. #ifdef FILE_DEF_DEBUG
  34. {
  35. fprintf(stderr, "FILE_DEF_DEBUG should not be defined in C\n");
  36. result = 0;
  37. }
  38. #endif
  39. #ifdef TARGET_DEF_DEBUG
  40. {
  41. fprintf(stderr, "TARGET_DEF_DEBUG should not be defined in C\n");
  42. result = 0;
  43. }
  44. #endif
  45. #ifdef DIRECTORY_DEF_DEBUG
  46. {
  47. fprintf(stderr, "DIRECTORY_DEF_DEBUG should not be defined in C\n");
  48. result = 0;
  49. }
  50. #endif
  51. #ifndef FILE_DEF_RELEASE
  52. #ifndef PREPROCESS_XCODE
  53. {
  54. fprintf(stderr, "FILE_DEF_RELEASE should be defined in C\n");
  55. result = 0;
  56. }
  57. #endif
  58. #endif
  59. #ifndef TARGET_DEF_RELEASE
  60. {
  61. fprintf(stderr, "TARGET_DEF_RELEASE should be defined in C\n");
  62. result = 0;
  63. }
  64. #endif
  65. #ifndef DIRECTORY_DEF_RELEASE
  66. {
  67. fprintf(stderr, "DIRECTORY_DEF_RELEASE should be defined in C\n");
  68. result = 0;
  69. }
  70. #endif
  71. #endif
  72. #ifdef PREPROCESS_DEBUG
  73. #ifndef FILE_DEF_DEBUG
  74. #ifndef PREPROCESS_XCODE
  75. {
  76. fprintf(stderr, "FILE_DEF_DEBUG should be defined in C\n");
  77. result = 0;
  78. }
  79. #endif
  80. #endif
  81. #ifndef TARGET_DEF_DEBUG
  82. {
  83. fprintf(stderr, "TARGET_DEF_DEBUG should be defined in C\n");
  84. result = 0;
  85. }
  86. #endif
  87. #ifndef DIRECTORY_DEF_DEBUG
  88. {
  89. fprintf(stderr, "DIRECTORY_DEF_DEBUG should be defined in C\n");
  90. result = 0;
  91. }
  92. #endif
  93. #ifdef FILE_DEF_RELEASE
  94. {
  95. fprintf(stderr, "FILE_DEF_RELEASE should not be defined in C\n");
  96. result = 0;
  97. }
  98. #endif
  99. #ifdef TARGET_DEF_RELEASE
  100. {
  101. fprintf(stderr, "TARGET_DEF_RELEASE should not be defined in C\n");
  102. result = 0;
  103. }
  104. #endif
  105. #ifdef DIRECTORY_DEF_RELEASE
  106. {
  107. fprintf(stderr, "DIRECTORY_DEF_RELEASE should not be defined in C\n");
  108. result = 0;
  109. }
  110. #endif
  111. #endif
  112. #if defined(FILE_DEF_DEBUG) || defined(TARGET_DEF_DEBUG)
  113. #if !defined(FILE_DEF_DEBUG) || !defined(TARGET_DEF_DEBUG)
  114. #ifndef PREPROCESS_XCODE
  115. {
  116. fprintf(stderr, "FILE_DEF_DEBUG and TARGET_DEF_DEBUG inconsistent in C\n");
  117. result = 0;
  118. }
  119. #endif
  120. #endif
  121. #if defined(FILE_DEF_RELEASE) || defined(TARGET_DEF_RELEASE)
  122. {
  123. fprintf(stderr, "DEBUG and RELEASE definitions inconsistent in C\n");
  124. result = 0;
  125. }
  126. #endif
  127. #endif
  128. #if defined(FILE_DEF_RELEASE) || defined(TARGET_DEF_RELEASE)
  129. #if !defined(FILE_DEF_RELEASE) || !defined(TARGET_DEF_RELEASE)
  130. #ifndef PREPROCESS_XCODE
  131. {
  132. fprintf(stderr,
  133. "FILE_DEF_RELEASE and TARGET_DEF_RELEASE inconsistent in C\n");
  134. result = 0;
  135. }
  136. #endif
  137. #endif
  138. #if defined(FILE_DEF_DEBUG) || defined(TARGET_DEF_DEBUG)
  139. {
  140. fprintf(stderr, "RELEASE and DEBUG definitions inconsistent in C\n");
  141. result = 0;
  142. }
  143. #endif
  144. #endif
  145. #ifndef FILE_PATH_DEF
  146. {
  147. fprintf(stderr, "FILE_PATH_DEF not defined in C\n");
  148. result = 0;
  149. }
  150. #endif
  151. #ifndef TARGET_PATH_DEF
  152. {
  153. fprintf(stderr, "TARGET_PATH_DEF not defined in C\n");
  154. result = 0;
  155. }
  156. #endif
  157. #ifndef FILE_DEF
  158. {
  159. fprintf(stderr, "FILE_DEF not defined in C\n");
  160. result = 0;
  161. }
  162. #endif
  163. #ifndef TARGET_DEF
  164. {
  165. fprintf(stderr, "TARGET_DEF not defined in C\n");
  166. result = 0;
  167. }
  168. #endif
  169. #ifndef DIRECTORY_DEF
  170. {
  171. fprintf(stderr, "DIRECTORY_DEF not defined in C\n");
  172. result = 0;
  173. }
  174. #endif
  175. #ifndef OLD_DEF
  176. {
  177. fprintf(stderr, "OLD_DEF not defined in C\n");
  178. result = 0;
  179. }
  180. #endif
  181. #if !defined(OLD_EXPR) || OLD_EXPR != 2
  182. {
  183. fprintf(stderr, "OLD_EXPR id not work in C [%s]\n", TO_STRING(OLD_EXPR));
  184. result = 0;
  185. }
  186. #endif
  187. return result;
  188. }