preprocess.c 4.0 KB

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