if register class & storage class then storage class
authorsandeep <sandeep@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 5 Mar 2001 00:36:55 +0000 (00:36 +0000)
committersandeep <sandeep@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 5 Mar 2001 00:36:55 +0000 (00:36 +0000)
overrides the register class

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

src/SDCCast.c
src/SDCCsymt.c

index d75e2d97a05d57356ea844fa62d78a5cfcb468f4..e5b321cad83b0c5533cdb6fe35939a4a653b4fec 100644 (file)
@@ -4158,8 +4158,6 @@ void ast_print (ast * tree, FILE *outfile, int indent)
        }
 
        
-       INDENT(indent,outfile);
-
        /* print the line          */
        /* if not block & function */
        if (tree->type == EX_OP &&
@@ -4188,13 +4186,17 @@ void ast_print (ast * tree, FILE *outfile, int indent)
                        decls = decls->next;                    
                }
                ast_print(tree->right,outfile,indent+4);
+               fprintf(outfile,"}\n");
                return;
        }
        if (tree->opval.op == NULLOP) {
+               fprintf(outfile,"\n");
                ast_print(tree->left,outfile,indent);
+               fprintf(outfile,"\n");
                ast_print(tree->right,outfile,indent);
                return ;
        }
+       INDENT(indent,outfile);
 
        /*------------------------------------------------------------------*/
        /*----------------------------*/
@@ -4222,6 +4224,8 @@ void ast_print (ast * tree, FILE *outfile, int indent)
                        fprintf(outfile," type (");
                        printTypeChain(tree->ftype,outfile);
                        fprintf(outfile,")\n");
+               } else {
+                       fprintf(outfile,"\n");
                }
                return ;
        }
@@ -4703,9 +4707,9 @@ void ast_print (ast * tree, FILE *outfile, int indent)
                /*----------------------------*/
        case RETURN:
                fprintf(outfile,"RETURN (%p) type (",tree);
-               printTypeChain(tree->ftype,outfile);
+               printTypeChain(tree->right->ftype,outfile);
                fprintf(outfile,")\n");
-               ast_print(tree->left,outfile,indent+4);
+               ast_print(tree->right,outfile,indent+4);
                return ;
                /*------------------------------------------------------------------*/
                /*----------------------------*/
@@ -4740,8 +4744,9 @@ void ast_print (ast * tree, FILE *outfile, int indent)
                /* ifx Statement              */
                /*----------------------------*/
        case IFX:
+               ast_print(tree->left,outfile,indent);
+               INDENT(indent,outfile);
                fprintf(outfile,"IF (%p) \n",tree);
-               ast_print(tree->left,outfile,indent+4);
                if (tree->trueLabel) {
                        INDENT(indent,outfile);
                        fprintf(outfile,"NE(==) 0 goto %s\n",tree->trueLabel->name);
index 0f532e0fefc6c78bd2edef1fb7b5d29a2bbc80c9..aecca442c390de9495d48899af930dd1150297c3 100644 (file)
@@ -435,7 +435,9 @@ mergeSpec (sym_link * dest, sym_link * src)
     SPEC_NOUN (dest) = SPEC_NOUN (src);
 
   /* if destination has no storage class */
-  if (!SPEC_SCLS (dest) || (SPEC_SCLS(dest) == S_CONSTANT && SPEC_SCLS (src)))
+  if (!SPEC_SCLS (dest) || 
+      ((SPEC_SCLS(dest) == S_CONSTANT || SPEC_SCLS(dest) == S_REGISTER) && 
+       SPEC_SCLS (src)))
     SPEC_SCLS (dest) = SPEC_SCLS (src);
   /* special case for const */
   /* copy all the specifications  */