Fixed my "unsigned vs unsigned char" error
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 11 Jun 2001 08:59:06 +0000 (08:59 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 11 Jun 2001 08:59:06 +0000 (08:59 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@877 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCC.y
src/SDCCsymt.c

index ec90153ab7dc95add11b0ede8af3a2dbda2afea9..59c7b982685838b7e7c3a3664448225ba2db899b 100644 (file)
@@ -582,13 +582,11 @@ type_specifier2
    | SIGNED {
                $$=newLink();
                $$->class = SPECIFIER   ;
-               SPEC_NOUN($$) = V_INT   ;
                SPEC_SIGNED($$) = 1     ;
             }
    | UNSIGNED  {
                $$=newLink();
                $$->class = SPECIFIER   ;
-               SPEC_NOUN($$) = V_INT   ;
                SPEC_USIGN($$) = 1      ;
             }
    | VOID   {
index 07b39065482ad52a1a113c45d9a89debf013ed6f..6f20b9825bf13e93646e0b470868de4cb5017ea3 100644 (file)
@@ -103,6 +103,9 @@ addSym (bucket ** stab,
   int i;                       /* index into the hash Table */
   bucket *bp;                  /* temp bucket    *         */
 
+  if (getenv("DEBUG_SANITY")) {
+    fprintf (stderr, "addSym: %s\n", sname);
+  }
   /* Make sure sym is a symbol and not a structdef */
   if (StructTab!=stab) checkTypeSanity(((symbol *)sym)->etype, sname);
 
@@ -456,13 +459,17 @@ void checkTypeSanity(sym_link *dest, char *name) {
   char *noun;
 
   if (!dest) {
-    //printf ("sanity check skipped for %s\n", name);
+    if (getenv("DEBUG_SANITY")) {
+      printf ("sanity check skipped for %s\n", name);
+    }
     return;
   }
 
   noun=nounName(dest);
 
-  //printf ("checking sanity for %s\n", name);
+  if (getenv("DEBUG_SANITY")) {
+    printf ("checking sanity for %s\n", name);
+  }
 
   if ((SPEC_NOUN(dest)==V_CHAR || 
        SPEC_NOUN(dest)==V_FLOAT || 
@@ -479,6 +486,13 @@ void checkTypeSanity(sym_link *dest, char *name) {
     // signed or unsigned for float double or void
     werror (E_SIGNED_OR_UNSIGNED_INVALID, noun, name);
   }
+
+  if (!SPEC_NOUN(dest)) {
+    if (SPEC_SIGNED(dest) || SPEC_USIGN(dest)) {
+      SPEC_NOUN(dest)=V_INT;
+    }
+  }
+
   if (SPEC_SIGNED(dest) && SPEC_USIGN(dest)) {
     // signed AND unsigned 
     werror (E_SIGNED_AND_UNSIGNED_INVALID, noun, name);
@@ -500,6 +514,9 @@ mergeSpec (sym_link * dest, sym_link * src)
   /* we shouldn't redeclare the type */
   if ((SPEC_NOUN (dest) && SPEC_NOUN (src)) && 
       (SPEC_NOUN(dest) != SPEC_NOUN(src))) {
+    if (getenv("DEBUG_SANITY")) {
+      fprintf (stderr, "mergeSpec: ");
+    }
     werror(E_TWO_OR_MORE_DATA_TYPES, yylval.yychar);
   }