From f96e7d4df901d66ed8f5025c20cc5976115d0a54 Mon Sep 17 00:00:00 2001 From: MaartenBrock Date: Wed, 6 Dec 2006 17:04:20 +0000 Subject: [PATCH] * src/SDCCsymt.c (addDecl): fixed bug 1609244 * 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 | 2 ++ doc/sdccman.lyx | 2 +- src/SDCCsymt.c | 44 ++++++++++++++++++++++++-------------------- 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index a43f5b3c..a1c3a92a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 2006-12-06 Maarten Brock + * 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 diff --git a/doc/sdccman.lyx b/doc/sdccman.lyx index 3ea03eb8..5ba1663d 100644 --- a/doc/sdccman.lyx +++ b/doc/sdccman.lyx @@ -82,7 +82,7 @@ SDCC Compiler User Guide \size normal -SDCC 2.6.1 +SDCC 2.6.2 \size footnotesize \newline diff --git a/src/SDCCsymt.c b/src/SDCCsymt.c index eba05f5a..c65c3e2f 100644 --- a/src/SDCCsymt.c +++ b/src/SDCCsymt.c @@ -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 -- 2.47.2