From 0ac3f73cc9164ae51eaabbdbb8c6fb5948d82078 Mon Sep 17 00:00:00 2001 From: borutr Date: Sat, 10 Feb 2007 13:41:24 +0000 Subject: [PATCH] * src/SDCCsymt.c: fixed bug #1159134: invalid duplicate declarations with same scope * support/regression/tests/bug-1654060.c: added regression test for #1654060 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4628 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 10 ++++++---- src/SDCCsymt.c | 5 +++-- support/regression/tests/bug-1654060.c | 26 ++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 6 deletions(-) create mode 100644 support/regression/tests/bug-1654060.c diff --git a/ChangeLog b/ChangeLog index 8451c671..82008415 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,9 @@ 2007-02-10 Borut Razem - * src/SDCC.y: fixed bug #1159134: invalid duplicate declarations with - same scope, this time for real ;-) + * src/SDCCsymt.c: fixed bug #1159134: invalid duplicate declarations + with same scope + * support/regression/tests/bug-1654060.c: added regression test for + #1654060 2007-02-09 Bernhard Held @@ -10,8 +12,8 @@ 2007-02-09 Borut Razem - * src/SDCC.y: fixed bug #1159134: invalid duplicate declarations with - same scope + * src/SDCC.y: fixed bug #1654060 typedef within function causes + syntax error 2007-02-07 Maarten Brock diff --git a/src/SDCCsymt.c b/src/SDCCsymt.c index a2fd33ce..8d16e7f7 100644 --- a/src/SDCCsymt.c +++ b/src/SDCCsymt.c @@ -1080,9 +1080,10 @@ addSymChain (symbol ** symHead) if ((csym = findSymWithLevel (SymbolTab, sym)) && csym->level == sym->level) { - /* if not in file scope then show symbol redefined error + /* if not formal parameter and not in file scope + then show symbol redefined error else check if symbols have conpatible types */ - if (sym->level > 0) + if (!sym->_isparm && sym->level > 0) error = 1; else { diff --git a/support/regression/tests/bug-1654060.c b/support/regression/tests/bug-1654060.c new file mode 100644 index 00000000..aba52463 --- /dev/null +++ b/support/regression/tests/bug-1654060.c @@ -0,0 +1,26 @@ +/* + bug-1654060.c + + typedef within function causes syntax error +*/ + +#include +typedef char mytype1; +typedef int mytype2; + +mytype1 c1 = 'A'; +mytype2 i1 = 12345; + +void testTypedef(void) +{ + typedef int mytype1; + typedef char mytype2; + + mytype1 i2 = 21435; + mytype2 c2 = 'B'; + + ASSERT(c1 == 'A'); + ASSERT(i1 == 12345); + ASSERT(c1 == 'B'); + ASSERT(i1 == 21435); +} -- 2.30.2