CheckTypeSizeC.c.in 972 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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(){
  27. int ac;
  28. char*av[];
  29. #else
  30. int main(int ac, char*av[]){
  31. #endif
  32. return (&info_sizeof[0] != &info_sizeof[0]);
  33. }
  34. #else /* CHECK_TYPE_SIZE_TYPE */
  35. # error "CHECK_TYPE_SIZE_TYPE has to specify the type"
  36. #endif /* CHECK_TYPE_SIZE_TYPE */