From: frief Date: Thu, 9 Nov 2006 15:07:43 +0000 (+0000) Subject: * support/regression/generate-cases.py, X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=ac6ae34b4d2b2319e278201b25d1e742748640e8;p=fw%2Fsdcc * support/regression/generate-cases.py, * support/regression/fwk/include/testfwk.h, * support/regression/fwk/lib/testfwk.c: used code pointers, (about 50kByte less code generated for mcs51) git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4470 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index da090bb0..3c8b0e74 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-11-09 Frieder Ferlemann + + * support/regression/generate-cases.py, + * support/regression/fwk/include/testfwk.h, + * support/regression/fwk/lib/testfwk.c: used code pointers, + (about 50kByte less code generated for mcs51) + 2006-11-06 Borut Razem * debugger/mcs51/acinclude.m4, debugger/mcs51/aclocal.m4, diff --git a/support/regression/fwk/include/testfwk.h b/support/regression/fwk/include/testfwk.h index 29987ba9..467e2055 100644 --- a/support/regression/fwk/include/testfwk.h +++ b/support/regression/fwk/include/testfwk.h @@ -11,20 +11,6 @@ void __printf(const char *szFormat, ...); #define LOG(_a) /* hollow log */ #endif -void __fail(const char *szMsg, const char *szCond, const char *szFile, int line); -void __prints(const char *s); -void __printn(int n); -const char *__getSuiteName(void); -void __runSuite(void); - -#define ASSERT(_a) (__numTests++, (_a) ? (void)0 : __fail("Assertion failed", #_a, __FILE__, __LINE__)) -#define FAIL() FAILM("Failure") -#define FAILM(_a) __fail(_a, #_a, __FILE__, __LINE__) - -#define NULL 0 - -#define UNUSED(_a) if (_a) { } - #if defined(PORT_HOST) || defined(SDCC_z80) || defined(SDCC_gbz80) # define idata # define pdata @@ -43,4 +29,18 @@ void __runSuite(void); # define xdata data #endif +void __fail(code const char *szMsg, code const char *szCond, code const char *szFile, int line); +void __prints(const char *s); +void __printn(int n); +code const char *__getSuiteName(void); +void __runSuite(void); + +#define ASSERT(_a) (__numTests++, (_a) ? (void)0 : __fail("Assertion failed", #_a, __FILE__, __LINE__)) +#define FAIL() FAILM("Failure") +#define FAILM(_a) __fail(_a, #_a, __FILE__, __LINE__) + +#define NULL 0 + +#define UNUSED(_a) if (_a) { } + #endif diff --git a/support/regression/fwk/lib/testfwk.c b/support/regression/fwk/lib/testfwk.c index 8c162c88..eed8c6f2 100644 --- a/support/regression/fwk/lib/testfwk.c +++ b/support/regression/fwk/lib/testfwk.c @@ -12,6 +12,9 @@ #ifdef SDCC_mcs51 /* until changed, isr's must have a prototype in the module containing main */ void T2_isr (void) interrupt 5; +#define MEMSPACE_BUF idata +#else +#define MEMSPACE_BUF #endif /** Define this if the port's div or mod functions are broken. @@ -69,8 +72,8 @@ __printn(int n) _putchar('0'); } else { - static char buf[6]; - char *p = &buf[sizeof(buf) - 1]; + static char MEMSPACE_BUF buf[6]; + char MEMSPACE_BUF *p = &buf[sizeof(buf) - 1]; char neg = 0; buf[sizeof(buf) - 1] = '\0'; @@ -128,7 +131,7 @@ __printf(const char *szFormat, ...) } void -__fail(const char *szMsg, const char *szCond, const char *szFile, int line) +__fail(code const char *szMsg, code const char *szCond, code const char *szFile, int line) { __printf("--- FAIL: \"%s\" on %s at %s:%u\n", szMsg, szCond, szFile, line); __numFailures++; @@ -154,7 +157,7 @@ main(void) } #else void -__fail(const char *szMsg, const char *szCond, const char *szFile, int line) +__fail(code const char *szMsg, code const char *szCond, code const char *szFile, int line) { __prints("--- FAIL: \""); __prints(szMsg); diff --git a/support/regression/generate-cases.py b/support/regression/generate-cases.py index 9ad7a5bb..70da87d9 100644 --- a/support/regression/generate-cases.py +++ b/support/regression/generate-cases.py @@ -20,7 +20,7 @@ testfuntablefooter = """} # Code to generate the suite function testfunsuite = """ -const char * +code const char * __getSuiteName(void) { return "{testcase}";