/* Simple compliance test for a C compiler. Copyright (C) 2005 MacroExpressions Tests if standrard features expected by C-SLang are implemented correctly. */ #define EXPOSE_BUGS /* The compiler may be confused with incomplete types */ typedef char text_t[]; typedef struct { #ifdef EXPOSE_BUGS /* The compiler may be confused with const qualifiers */ const char *buf; #else char *buf; #endif char size; } buf_t; #ifdef EXPOSE_BUGS /* The compiler may be confused with incomplete types into thinking that all text_t is of the size of a[] */ extern const text_t a, b, c; # if 0 extern const char a[], b[], c[]; /*doesn't help if after the above declaration*/ # endif #else extern const text_t a; extern const text_t b; extern const text_t c; /* This also works if alone: extern const char a[], b[], c[]; */ #endif #ifdef EXPOSE_BUGS /* The compiler may be confused with const qualifiers */ const char * const abc[] = { #else char * const abc[] = { #endif a, b, c }; const char a[] ={ 1, 2, 3, 4, 5 }; const char b[] ={ 1, 2, 3, 4, 5, 6 }; const char c[] ={ 1, 2, 3, 4, }; #define TEXT1 "someone to fix it?" #define TEXT2 {'s', 'o', 'm', 'e', '\0'} #ifdef EXPOSE_BUGS /* The compiler may be confused with incomplete types into thinking that sizeof(t1) and sizeof(t2) are zeros */ static char const t1[]=TEXT1; static const char t2[]=TEXT2; #else static const char t1[sizeof(TEXT1)]=TEXT1; static const char t2[sizeof(TEXT1)]=TEXT2; #endif const buf_t buf1 = { t1, sizeof(t1), }; const buf_t buf2 = { t2, sizeof(t2), };