* src/SDCCsymt.c (addDecl): fixed bug 1609244
authorMaartenBrock <MaartenBrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 6 Dec 2006 17:04:20 +0000 (17:04 +0000)
committerMaartenBrock <MaartenBrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 6 Dec 2006 17:04:20 +0000 (17:04 +0000)
* doc/sdccman.lyx: bumped to 2.6.2

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4503 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
doc/sdccman.lyx
src/SDCCsymt.c

index a43f5b3c987540c675ae80e1b2aa1fd5907389f6..a1c3a92a24a868cebc7a64d2403a1f69663a5342 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
 2006-12-06 Maarten Brock <sourceforge.brock AT dse.nl>
 
+       * src/SDCCsymt.c (addDecl): fixed bug 1609244
        * src/SDCCmain.c (linkEdit): fixed bug 1609279
+       * doc/sdccman.lyx,
        * .version: bumped to 2.6.2 because a) it's been a while
          b) the linker sources have moved c) the preprocessor is upgraded
 
index 3ea03eb8ac14549e31bf2c59f176d11c64b97faf..5ba1663d11a1f49c5dfc3fb77e3658d9adc0abd1 100644 (file)
@@ -82,7 +82,7 @@ SDCC Compiler User Guide
 
 
 \size normal 
-SDCC 2.6.1
+SDCC 2.6.2
 \size footnotesize 
 
 \newline 
index eba05f5a30e72bd66415023b7f2aead7706c8a08..c65c3e2f965da328d1853bce5a27131d975d9ff4 100644 (file)
@@ -438,6 +438,7 @@ pointerTypes (sym_link * ptr, sym_link * type)
 void 
 addDecl (symbol * sym, int type, sym_link * p)
 {
+  static sym_link *empty = NULL;
   sym_link *head;
   sym_link *tail;
   sym_link *t;
@@ -445,6 +446,9 @@ addDecl (symbol * sym, int type, sym_link * p)
   if (getenv("SDCC_DEBUG_FUNCTION_POINTERS"))
     fprintf (stderr, "SDCCsymt.c:addDecl(%s,%d,%p)\n", sym->name, type, p);
 
+  if (empty == NULL)
+    empty = newLink(SPECIFIER);
+
   /* if we are passed a link then set head & tail */
   if (p)
     {
@@ -464,28 +468,28 @@ addDecl (symbol * sym, int type, sym_link * p)
       sym->type = head;
       sym->etype = tail;
     }
+  else if (IS_SPEC (sym->etype) && IS_SPEC (head) && head == tail)
+    {
+      sym->etype = mergeSpec (sym->etype, head, sym->name);
+    }
+  else if (IS_SPEC (sym->etype) && !IS_SPEC (head) && head == tail)
+    {
+      t = sym->type;
+      while (t->next != sym->etype)
+        t = t->next;
+      t->next = head;
+      tail->next = sym->etype;
+    }
+  else if (IS_FUNC (sym->type) && IS_SPEC (sym->type->next) &&
+           !memcmp(sym->type->next, empty, sizeof(sym_link)))
+    {
+      sym->type->next = head;
+      sym->etype = tail;
+    }
   else
     {
-      if (IS_SPEC (sym->etype) && IS_SPEC (head) && head == tail)
-        {
-          sym->etype = mergeSpec (sym->etype, head, sym->name);
-        }
-      else
-        {
-          if (IS_SPEC (sym->etype) && !IS_SPEC (head) && head == tail)
-            {
-              t = sym->type;
-              while (t->next != sym->etype)
-                t = t->next;
-              t->next = head;
-              tail->next = sym->etype;
-            }
-          else
-            {
-              sym->etype->next = head;
-              sym->etype = tail;
-            }
-        }
+      sym->etype->next = head;
+      sym->etype = tail;
     }
 
   /* if the type is an unknown pointer and has