]> git.gag.com Git - fw/sdcc/commitdiff
better type check for type-def's
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 18 Jul 2001 14:57:07 +0000 (14:57 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 18 Jul 2001 14:57:07 +0000 (14:57 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1080 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCsymt.c

index 9db4cf03c2c64186e415998c4e6bb5a9c0cce988..f830136954bce1767e639ed8b77cac9d9f8f9db2 100644 (file)
@@ -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
 }
 
 /*------------------------------------------------------------------*/