diff options
| author | Xavier ASUS <xavi92psx@gmail.com> | 2019-10-18 00:31:54 +0200 |
|---|---|---|
| committer | Xavier ASUS <xavi92psx@gmail.com> | 2019-10-18 00:31:54 +0200 |
| commit | 268a53de823a6750d6256ee1fb1e7707b4b45740 (patch) | |
| tree | 42c1799a9a82b2f7d9790ee9fe181d72a7274751 /support/regression/tests/preproc.c | |
| download | sdcc-gas-268a53de823a6750d6256ee1fb1e7707b4b45740.tar.gz | |
sdcc-3.9.0 fork implementing GNU assembler syntax
This fork aims to provide better support for stm8-binutils
Diffstat (limited to 'support/regression/tests/preproc.c')
| -rw-r--r-- | support/regression/tests/preproc.c | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/support/regression/tests/preproc.c b/support/regression/tests/preproc.c new file mode 100644 index 0000000..9d86905 --- /dev/null +++ b/support/regression/tests/preproc.c @@ -0,0 +1,70 @@ +/* + preproc.c + + preprocessor and punctuators tests +*/ + +#include <testfwk.h> + +/* + * the following tests are applicable only for SDCC, + * since they are using SDCC specific pragmas + */ +#ifdef __SDCC +/* + * test for bug 135170 + */ +const char * +const_str(void) +{ +return "A" + + + +/* just for testing, actually nop */ +#pragma save + + + + + +"B"; +#pragma restore +} + +/* + * test for bug 982435 + */ +#pragma pedantic_parse_number + + +#define LO_B(x) ((x) & 0xff) +#define BAD(x) ((x) & 0xff) + +unsigned char +hexeminus(void) +{ +unsigned char a=0x\ +fe\ +-\ +LO_B(3); + +unsigned char b=0xfe-BAD(3); + +return (a + b); +} +#endif + +/* + * test punctuators, as defined in ISO/IEC 9899:1999, chapter 6.4.6#3 + */ +void +testPunctuators (void) +<% +%:define N 10 +%:define VAL 123 +%:define C(NAME) NAME %:%: ___ + int C(a)<:N:>; + + C(a)<:0:> = VAL; + ASSERT (a___<:0:> == VAL); +%> |
