* src/SDCCsymt.c: fixed bug #1159134: invalid duplicate declarations
authorborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 10 Feb 2007 13:41:24 +0000 (13:41 +0000)
committerborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 10 Feb 2007 13:41:24 +0000 (13:41 +0000)
  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
src/SDCCsymt.c
support/regression/tests/bug-1654060.c [new file with mode: 0644]

index 8451c6713c6cb9d7fa4c1a052e8a3d6e3a78ba3a..82008415f6b75537d93e0d72b6dcfd68766294c6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,9 @@
 2007-02-10 Borut Razem <borut.razem AT siol.net>
 
-       * 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 <bernhard AT bernhardheld.de>
 
@@ -10,8 +12,8 @@
 
 2007-02-09 Borut Razem <borut.razem AT siol.net>
 
-       * 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 <sourceforge.brock AT dse.nl>
 
index a2fd33ce83a39869d6a5b78f2e029aa4e801a324..8d16e7f7f07fc29ca525a6d6ed7db00ca7772542 100644 (file)
@@ -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 (file)
index 0000000..aba5246
--- /dev/null
@@ -0,0 +1,26 @@
+/*\r
+   bug-1654060.c\r
+\r
+   typedef within function causes syntax error\r
+*/\r
+\r
+#include <testfwk.h>\r
+typedef char mytype1;\r
+typedef int mytype2;\r
+\r
+mytype1 c1 = 'A';\r
+mytype2 i1 = 12345;\r
+\r
+void testTypedef(void)\r
+{\r
+  typedef int mytype1;\r
+  typedef char mytype2;\r
+\r
+  mytype1 i2 = 21435;\r
+  mytype2 c2 = 'B';\r
+\r
+  ASSERT(c1 == 'A');\r
+  ASSERT(i1 == 12345);\r
+  ASSERT(c1 == 'B');\r
+  ASSERT(i1 == 21435);\r
+}\r