From 74a75cd59f262e48be5141982112043c3e27ba3b Mon Sep 17 00:00:00 2001 From: sandeep Date: Mon, 5 Mar 2001 00:36:55 +0000 Subject: [PATCH] if register class & storage class then storage class 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 | 15 ++++++++++----- src/SDCCsymt.c | 4 +++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/SDCCast.c b/src/SDCCast.c index d75e2d97..e5b321ca 100644 --- a/src/SDCCast.c +++ b/src/SDCCast.c @@ -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); diff --git a/src/SDCCsymt.c b/src/SDCCsymt.c index 0f532e0f..aecca442 100644 --- a/src/SDCCsymt.c +++ b/src/SDCCsymt.c @@ -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 */ -- 2.30.2