1 /* 2 preproc.c 3 4 preprocessor and punctuators tests 5 */ 6 7 #include <testfwk.h> 8 9 /* 10 * the following tests are applicable only for SDCC, 11 * since they are using SDCC specific pragmas 12 */ 13 #ifdef __SDCC 14 /* 15 * test for bug 135170 16 */ 17 const char * const_str(void)18const_str(void) 19 { 20 return "A" 21 22 23 24 /* just for testing, actually nop */ 25 #pragma save 26 27 28 29 30 31 "B"; 32 #pragma restore 33 } 34 35 /* 36 * test for bug 982435 37 */ 38 #pragma pedantic_parse_number + 39 40 #define LO_B(x) ((x) & 0xff) 41 #define BAD(x) ((x) & 0xff) 42 43 unsigned char hexeminus(void)44hexeminus(void) 45 { 46 unsigned char a=0x\ 47 fe\ 48 -\ 49 LO_B(3); 50 51 unsigned char b=0xfe-BAD(3); 52 53 return (a + b); 54 } 55 #endif 56 57 /* 58 * test punctuators, as defined in ISO/IEC 9899:1999, chapter 6.4.6#3 59 */ 60 void testPunctuators(void)61testPunctuators (void) 62 <% 63 %:define N 10 64 %:define VAL 123 65 %:define C(NAME) NAME %:%: ___ 66 int C(a)<:N:>; 67 68 C(a)<:0:> = VAL; 69 ASSERT (a___<:0:> == VAL); 70 %> 71