X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=support%2Fregression%2Ffwk%2Flib%2Ftestfwk.c;h=48d923178d87502ec8480b97ea7d4453c93822e3;hb=aaa16aad6fcd7bfcfd2c2070bcfe59bf0da07244;hp=ed6a6143db9adcdce3d4400be573dd4e6be3c7cf;hpb=c952b788d3bc57479db3a7c5e156185bcfbdf9f3;p=fw%2Fsdcc diff --git a/support/regression/fwk/lib/testfwk.c b/support/regression/fwk/lib/testfwk.c index ed6a6143..48d92317 100644 --- a/support/regression/fwk/lib/testfwk.c +++ b/support/regression/fwk/lib/testfwk.c @@ -3,10 +3,20 @@ #include #include +#ifdef __ds390 +#include /* main() must see the ISR declarations */ +#endif + +#if defined(PORT_HOST) || defined(SDCC_z80) || defined(SDCC_gbz80) +#define _REENTRANT +#else +#define _REENTRANT reentrant +#endif + /** Define this if the port's div or mod functions are broken. A slow loop based method will be substituded. */ -#define BROKEN_DIV_MOD 1 +//#define BROKEN_DIV_MOD 1 void _putchar(char c); void _exitEmu(void); @@ -41,7 +51,7 @@ int __mod(int num, int denom) } #endif -static void _printn(int n) +static void _printn(int n) _REENTRANT { int rem; @@ -57,18 +67,6 @@ static void _printn(int n) _putchar('0' + rem); } -#ifdef SDCC_mcs51 -union -{ - struct - { - int offset; - char data_space; - } part; - char *p; -} generic_p_u; -#endif - void __printf(const char *szFormat, ...) REENTRANT { va_list ap; @@ -78,16 +76,7 @@ void __printf(const char *szFormat, ...) REENTRANT if (*szFormat == '%') { switch (*++szFormat) { case 's': { -#ifdef SDCC_mcs51 -#warning Workaround bug #436344 - char GENERIC *sz; - - generic_p_u.part.data_space = va_arg (ap, char); - generic_p_u.part.offset = va_arg (ap, int); - sz = generic_p_u.p; -#else - char GENERIC *sz = va_arg(ap, char GENERIC *); -#endif + char *sz = va_arg(ap, char *); while (*sz) { _putchar(*sz++); } @@ -126,12 +115,12 @@ __fail(const char *szMsg, const char *szCond, const char *szFile, int line) int main(void) { - TESTFUN **cases; + TESTFUNP *cases; int numCases = 0; __printf("--- Running: %s\n", getSuiteName()); - cases = (TESTFUN **)suite(); + cases = suite(); while (*cases) { __printf("Running %u\n", numCases);