CheckTypeSizeC.c.in 1023 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #cmakedefine CHECK_TYPE_SIZE_TYPE @CHECK_TYPE_SIZE_TYPE@
  2. #ifdef CHECK_TYPE_SIZE_TYPE
  3. @CHECK_TYPE_SIZE_PREINCLUDE@
  4. #ifdef HAVE_SYS_TYPES_H
  5. # include <sys/types.h>
  6. #endif /* HAVE_SYS_TYPES_H */
  7. #ifdef HAVE_STDINT_H
  8. # include <stdint.h>
  9. #endif /* HAVE_STDINT_H */
  10. #ifdef HAVE_STDDEF_H
  11. # include <stddef.h>
  12. #endif /* HAVE_STDDEF_H */
  13. @CHECK_TYPE_SIZE_PREMAIN@
  14. #ifdef __CLASSIC_C__
  15. # define const
  16. #endif
  17. #define SIZE (sizeof(@CHECK_TYPE_SIZE_TYPE@))
  18. const char info_sizeof[] = {'I', 'N', 'F', 'O', ':', 's','i','z','e','o','f','[',
  19. ('0' + ((SIZE / 10000)%10)),
  20. ('0' + ((SIZE / 1000)%10)),
  21. ('0' + ((SIZE / 100)%10)),
  22. ('0' + ((SIZE / 10)%10)),
  23. ('0' + (SIZE % 10)),
  24. ']','\0'};
  25. #ifdef __CLASSIC_C__
  26. int main(argc, argv) int argc; char *argv[];
  27. #else
  28. int main(int argc, char *argv[])
  29. #endif
  30. {
  31. int require = 0;
  32. require += info_sizeof[argc];
  33. (void)argv;
  34. return require;
  35. }
  36. #else /* CHECK_TYPE_SIZE_TYPE */
  37. # error "CHECK_TYPE_SIZE_TYPE has to specify the type"
  38. #endif /* CHECK_TYPE_SIZE_TYPE */