test-integers.c

Go to the documentation of this file.
00001 
00023 #include "libexif/_stdint.h"
00024 #include <stdlib.h>
00025 #include <stdio.h>
00026 
00027 
00028 typedef enum {
00029    EN_A,
00030    EN_B,
00031    EN_C,
00032    EN_D,
00033    EN_E,
00034    EN_F
00035 } enum_t;
00036 
00037 
00038 #if defined(__GNUC__) && (__GNUC__ >= 4)
00039 # define CHECK(condition)                                            \
00040         if (!(condition)) {                                          \
00041                 fprintf(stderr, "%s:%d: check failed: %s\n",         \
00042                         __FILE__, __LINE__, #condition);             \
00043                 errors++;                                            \
00044         }
00045 #else
00046 # define CHECK(condition)                                            \
00047         if (!(condition)) {                                          \
00048                 abort();                                             \
00049         }
00050 #endif
00051 
00052 
00053 int main()
00054 {
00055   unsigned int errors = 0;
00056 
00057   /* libexif assumes unsigned ints are not smaller than 32bit in many places */
00058   CHECK(sizeof(unsigned int) >= sizeof(uint32_t));
00059 
00060   /* libexif assumes that enums fit into ints */
00061   CHECK(sizeof(enum_t) <= sizeof(int));
00062   
00063   return (errors>0)?1:0;
00064 }

SourceForge.net Logo Generated by doxygen