From 35ec73b0ba17116bd42c43b4383b124fb8cd2ed4 Mon Sep 17 00:00:00 2001 From: johanknol Date: Wed, 18 Jul 2001 14:57:07 +0000 Subject: [PATCH] better type check for type-def's git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1080 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/SDCCsymt.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/SDCCsymt.c b/src/SDCCsymt.c index 9db4cf03..f8301369 100644 --- a/src/SDCCsymt.c +++ b/src/SDCCsymt.c @@ -524,10 +524,32 @@ void checkTypeSanity(sym_link *etype, char *name) { /*------------------------------------------------------------------*/ /* mergeSpec - merges two specifiers and returns the new one */ /*------------------------------------------------------------------*/ +#define LAST_MINUTE_2_3_0_FIX sym_link * mergeSpec (sym_link * dest, sym_link * src, char *name) { +#ifdef LAST_MINUTE_2_3_0_FIX + sym_link *symlink; + + if (!IS_SPEC(dest)) { + // This should not happen + fprintf (stderr, "*** internal error: can't merge declarators\n"); + } + if (!IS_SPEC(src)) { + // here we have a declarator as source, reverse them + symlink=src; + src=dest; + dest=symlink; + while (!IS_SPEC(dest)) { + // and find the specifier + dest=dest->next; + } + } else { + symlink=dest; + } +#endif + if (getenv("DEBUG_mergeSpec")) { fprintf (stderr, "mergeSpec: \"%s\"\n", name); } @@ -592,7 +614,11 @@ mergeSpec (sym_link * dest, sym_link * src, char *name) if (IS_STRUCT (dest) && SPEC_STRUCT (dest) == NULL) SPEC_STRUCT (dest) = SPEC_STRUCT (src); +#ifdef LAST_MINUTE_2_3_0_FIX + return symlink; +#else return dest; +#endif } /*------------------------------------------------------------------*/ -- 2.30.2