From f4259cdc176cd73028cd62fe411bff29b32b941b Mon Sep 17 00:00:00 2001 From: michaelh Date: Thu, 18 Oct 2001 02:13:45 +0000 Subject: [PATCH] * support/regression/fwk/include/testfwk.h: Fixed up to use function pts correctly. * support/regression/generate-cases.py: Fixed up to use function pts correctly. git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1414 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- support/regression/fwk/include/testfwk.h | 4 ++-- support/regression/fwk/lib/testfwk.c | 4 ++-- support/regression/generate-cases.py | 6 +++--- support/regression/tests/constmodifiers.c | 11 +++++++++++ support/regression/tests/stacks.c | 2 +- 5 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 support/regression/tests/constmodifiers.c diff --git a/support/regression/fwk/include/testfwk.h b/support/regression/fwk/include/testfwk.h index 4a178514..07cfa31f 100644 --- a/support/regression/fwk/include/testfwk.h +++ b/support/regression/fwk/include/testfwk.h @@ -11,10 +11,10 @@ void __printf(const char *szFormat, ...) REENTRANT; #define FAIL() FAILM("Failure") #define FAILM(_a) __fail(_a, #_a, __FILE__, __LINE__) -typedef void TESTFUN(void); +typedef void (*TESTFUNP)(void); // Provided by the suite -void ** +TESTFUNP * suite(void); const char * diff --git a/support/regression/fwk/lib/testfwk.c b/support/regression/fwk/lib/testfwk.c index 9f013c2d..8259f53e 100644 --- a/support/regression/fwk/lib/testfwk.c +++ b/support/regression/fwk/lib/testfwk.c @@ -105,12 +105,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); diff --git a/support/regression/generate-cases.py b/support/regression/generate-cases.py index 32f8190e..a7dd57b4 100644 --- a/support/regression/generate-cases.py +++ b/support/regression/generate-cases.py @@ -9,7 +9,7 @@ outdir = 'gen' # Start of the test function table definition testfuntableheader = """ -static void (*const _tests[])(void) = { +static TESTFUNP _tests[] = { """ @@ -20,10 +20,10 @@ testfuntablefooter = """\tNULL # Code to generate the suite function testfunsuite = """ -void ** +TESTFUNP * suite(void) { - return (void **)_tests; + return _tests; } const char * diff --git a/support/regression/tests/constmodifiers.c b/support/regression/tests/constmodifiers.c new file mode 100644 index 00000000..f64dc776 --- /dev/null +++ b/support/regression/tests/constmodifiers.c @@ -0,0 +1,11 @@ +/* Tests usage of constant modifiers. + */ +#include + +void +testUMod(void) +{ + volatile unsigned char a = 0; + + ASSERT((a |= 0xFFL) == 0xFFL); +} diff --git a/support/regression/tests/stacks.c b/support/regression/tests/stacks.c index 59b0d1c1..51942cbd 100644 --- a/support/regression/tests/stacks.c +++ b/support/regression/tests/stacks.c @@ -10,7 +10,7 @@ spoil(char a) } void -spoilPtr(char *p) +spoilPtr(volatile char *p) { UNUSED(p); } -- 2.47.2