From bc526d87c6af28688d2178c816977af4dabe34d4 Mon Sep 17 00:00:00 2001 From: epetrich Date: Sun, 8 Feb 2004 08:47:57 +0000 Subject: [PATCH] * src/mcs51/gen.c (genNearPointerGet, genPagedPointerGet, genFarPointerGet, genCodePointerGet, genGenPointerGet, genNearPointerSet, genPagedPointerSet, genFarPointerSet, genGenPointerSet), * src/ds390/gen.c (genNearPointerGet, genPagedPointerGet, genFarPointerGet, genCodePointerGet, genGenPointerGet, genNearPointerSet, genPagedPointerSet, genFarPointerSet, genGenPointerSet), * src/pic16/gen.c (genNearPointerGet, genPagedPointerGet, genFarPointerGet, genCodePointerGet, genGenPointerGet, genNearPointerSet, genPagedPointerSet, genFarPointerSet, genGenPointerSet), * src/pic/gen.c (genNearPointerGet, genPagedPointerGet, genFarPointerGet, genCodePointerGet, genGenPointerGet, genNearPointerSet, genPagedPointerSet, genFarPointerSet, genGenPointerSet): fixed bug #892400 * src/pic16/gen.c (genSkipz, AccRol): disabled functions with #if 0 to eliminate build warnings. * src/SDCCast.c (processParms), * src/SDCC.y (function_declarator2, declarator2_function_attributes): fixed bug 751859 * support/valdiag/valdiag.py: added GCC to the list of defines active when compiling with gcc git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3176 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 26 +++++++++++++++++ src/SDCC.y | 57 +++++++++++++++++++++++--------------- src/SDCCast.c | 1 + src/ds390/gen.c | 28 +++++++++---------- src/mcs51/gen.c | 28 ++++++++++--------- src/pic/gen.c | 20 ++++++------- src/pic16/gen.c | 23 +++++++++------ support/valdiag/valdiag.py | 3 +- 8 files changed, 116 insertions(+), 70 deletions(-) diff --git a/ChangeLog b/ChangeLog index b3c5516f..dca9e566 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,29 @@ +2004-02-08 Erik Petrich + + * src/mcs51/gen.c (genNearPointerGet, genPagedPointerGet, + genFarPointerGet, genCodePointerGet, genGenPointerGet, + genNearPointerSet, genPagedPointerSet, genFarPointerSet, + genGenPointerSet), + * src/ds390/gen.c (genNearPointerGet, genPagedPointerGet, + genFarPointerGet, genCodePointerGet, genGenPointerGet, + genNearPointerSet, genPagedPointerSet, genFarPointerSet, + genGenPointerSet), + * src/pic16/gen.c (genNearPointerGet, genPagedPointerGet, + genFarPointerGet, genCodePointerGet, genGenPointerGet, + genNearPointerSet, genPagedPointerSet, genFarPointerSet, + genGenPointerSet), + * src/pic/gen.c (genNearPointerGet, genPagedPointerGet, + genFarPointerGet, genCodePointerGet, genGenPointerGet, + genNearPointerSet, genPagedPointerSet, genFarPointerSet, + genGenPointerSet): fixed bug #892400 + * src/pic16/gen.c (genSkipz, AccRol): disabled functions with #if 0 + to eliminate build warnings. + * src/SDCCast.c (processParms), + * src/SDCC.y (function_declarator2, declarator2_function_attributes): + fixed bug 751859 + * support/valdiag/valdiag.py: added GCC to the list of defines active + when compiling with gcc + 2004-02-07 Erik Petrich * support/Util/SDCCerr.h, diff --git a/src/SDCC.y b/src/SDCC.y index a7cf2431..801fad44 100644 --- a/src/SDCC.y +++ b/src/SDCC.y @@ -1021,21 +1021,32 @@ declarator2_function_attributes : function_declarator2 { $$ = $1 ; } | function_declarator2 function_attribute { // copy the functionAttributes (not the args and hasVargs !!) - sym_link *funcType=$1->etype; - struct value *args=FUNC_ARGS(funcType); - unsigned hasVargs=FUNC_HASVARARGS(funcType); + struct value *args; + unsigned hasVargs; + sym_link *funcType=$1->type; - memcpy (&funcType->funcAttrs, &$2->funcAttrs, - sizeof($2->funcAttrs)); - - FUNC_ARGS(funcType)=args; - FUNC_HASVARARGS(funcType)=hasVargs; - - // just to be sure - memset (&$2->funcAttrs, 0, - sizeof($2->funcAttrs)); + while (funcType && !IS_FUNC(funcType)) + funcType = funcType->next; + + if (!funcType) + werror (E_FUNC_ATTR); + else + { + args=FUNC_ARGS(funcType); + hasVargs=FUNC_HASVARARGS(funcType); + + memcpy (&funcType->funcAttrs, &$2->funcAttrs, + sizeof($2->funcAttrs)); + + FUNC_ARGS(funcType)=args; + FUNC_HASVARARGS(funcType)=hasVargs; + + // just to be sure + memset (&$2->funcAttrs, 0, + sizeof($2->funcAttrs)); - addDecl ($1,0,$2); + addDecl ($1,0,$2); + } } ; @@ -1078,26 +1089,26 @@ function_declarator2 | declarator2 '(' { NestLevel++ ; currBlockno++; } parameter_type_list ')' { + sym_link *funcType; addDecl ($1,FUNCTION,NULL) ; + + funcType = $1->type; + while (funcType && !IS_FUNC(funcType)) + funcType = funcType->next; - FUNC_HASVARARGS($1->type) = IS_VARG($4); - FUNC_ARGS($1->type) = reverseVal($4); + assert (funcType); + + FUNC_HASVARARGS(funcType) = IS_VARG($4); + FUNC_ARGS(funcType) = reverseVal($4); /* nest level was incremented to take care of the parms */ NestLevel-- ; currBlockno--; // if this was a pointer (to a function) - if (IS_PTR($1->type)) { - // move the args and hasVargs to the function - FUNC_ARGS($1->etype)=FUNC_ARGS($1->type); - FUNC_HASVARARGS($1->etype)=FUNC_HASVARARGS($1->type); - memset (&$1->type->funcAttrs, 0, - sizeof($1->type->funcAttrs)); - // remove the symbol args (if any) + if (!IS_FUNC($1->type)) cleanUpLevel(SymbolTab,NestLevel+1); - } $$ = $1; } diff --git a/src/SDCCast.c b/src/SDCCast.c index 134f9cc5..2c9e1490 100644 --- a/src/SDCCast.c +++ b/src/SDCCast.c @@ -679,6 +679,7 @@ processParms (ast *func, if (func->type != EX_VALUE && !IFFUNC_ISREENT (functype) && !options.stackAuto) { werror (W_NONRENT_ARGS); + fatalError++; return 1; } diff --git a/src/ds390/gen.c b/src/ds390/gen.c index 39acbf48..653fa3fb 100644 --- a/src/ds390/gen.c +++ b/src/ds390/gen.c @@ -9366,7 +9366,7 @@ genNearPointerGet (operand * left, aopOp (result, ic, FALSE, FALSE); /* if bitfield then unpack the bits */ - if (IS_BITVAR (retype) || IS_BITVAR (letype)) + if (IS_BITFIELD (retype) || IS_BITFIELD (letype)) genUnpackBits (result, rname, POINTER); else { @@ -9466,7 +9466,7 @@ genPagedPointerGet (operand * left, aopOp (result, ic, FALSE, FALSE); /* if bitfield then unpack the bits */ - if (IS_BITVAR (retype) || IS_BITVAR (letype)) + if (IS_BITFIELD (retype) || IS_BITFIELD (letype)) genUnpackBits (result, rname, PPOINTER); else { @@ -9571,7 +9571,7 @@ genFarPointerGet (operand * left, aopOp (result, ic, FALSE, (AOP_INDPTRn(left) ? FALSE : TRUE)); /* if bit then unpack */ - if (IS_BITVAR (retype) || IS_BITVAR (letype)) { + if (IS_BITFIELD (retype) || IS_BITFIELD (letype)) { if (AOP_INDPTRn(left)) { genSetDPTR(AOP(left)->aopu.dptr); } @@ -9691,7 +9691,7 @@ genCodePointerGet (operand * left, aopOp (result, ic, FALSE, (AOP_INDPTRn(left) ? FALSE : TRUE)); /* if bit then unpack */ - if (IS_BITVAR (retype)) { + if (IS_BITFIELD (retype)) { if (AOP_INDPTRn(left)) { genSetDPTR(AOP(left)->aopu.dptr); } @@ -9816,7 +9816,7 @@ genGenPointerGet (operand * left, _G.bInUse--; /* if bit then unpack */ - if (IS_BITVAR (retype) || IS_BITVAR (letype)) + if (IS_BITFIELD (retype) || IS_BITFIELD (letype)) { genUnpackBits (result, "dptr", GPOINTER); } @@ -10153,8 +10153,8 @@ genNearPointerSet (operand * right, aopOp (right, ic, FALSE, FALSE); /* if bitfield then unpack the bits */ - if (IS_BITVAR (retype) || IS_BITVAR (letype)) - genPackBits ((IS_BITVAR (retype) ? retype : letype), right, rname, POINTER); + if (IS_BITFIELD (retype) || IS_BITFIELD (letype)) + genPackBits ((IS_BITFIELD (retype) ? retype : letype), right, rname, POINTER); else { /* we have can just get the values */ @@ -10249,8 +10249,8 @@ genPagedPointerSet (operand * right, aopOp (right, ic, FALSE, FALSE); /* if bitfield then unpack the bits */ - if (IS_BITVAR (retype) || IS_BITVAR (letype)) - genPackBits ((IS_BITVAR (retype) ? retype : letype), right, rname, PPOINTER); + if (IS_BITFIELD (retype) || IS_BITFIELD (letype)) + genPackBits ((IS_BITFIELD (retype) ? retype : letype), right, rname, PPOINTER); else { /* we have can just get the values */ @@ -10356,11 +10356,11 @@ genFarPointerSet (operand * right, aopOp (right, ic, FALSE, (AOP_INDPTRn(result) ? FALSE : TRUE)); /* if bit then unpack */ - if (IS_BITVAR (retype) || IS_BITVAR (letype)) { + if (IS_BITFIELD (retype) || IS_BITFIELD (letype)) { if (AOP_INDPTRn(result)) { genSetDPTR(AOP(result)->aopu.dptr); } - genPackBits ((IS_BITVAR (retype) ? retype : letype), right, "dptr", FPOINTER); + genPackBits ((IS_BITFIELD (retype) ? retype : letype), right, "dptr", FPOINTER); if (AOP_INDPTRn(result)) { genSetDPTR(0); } @@ -10478,9 +10478,9 @@ genGenPointerSet (operand * right, /* if bit then unpack */ - if (IS_BITVAR (retype) || IS_BITVAR (letype)) + if (IS_BITFIELD (retype) || IS_BITFIELD (letype)) { - genPackBits ((IS_BITVAR (retype) ? retype : letype), right, "dptr", GPOINTER); + genPackBits ((IS_BITFIELD (retype) ? retype : letype), right, "dptr", GPOINTER); } else { @@ -11166,7 +11166,7 @@ genCast (iCode * ic) if (operandsEqu (IC_RESULT (ic), IC_RIGHT (ic))) return; - aopOp (right, ic, FALSE, FALSE); + aopOp (right, ic, FALSE, AOP_IS_STR (result)); aopOp (result, ic, FALSE, (AOP_TYPE(right) == AOP_DPTR)); /* if the result is a bit */ diff --git a/src/mcs51/gen.c b/src/mcs51/gen.c index c3a96b8d..bd7049bc 100644 --- a/src/mcs51/gen.c +++ b/src/mcs51/gen.c @@ -135,6 +135,8 @@ emitcode (char *inst, const char *fmt,...) while (isspace (*lbp)) lbp++; + //printf ("%s\n", lb); + if (lbp && *lbp) lineCurr = (lineCurr ? connectLine (lineCurr, newLineNode (lb)) : @@ -7619,7 +7621,7 @@ genNearPointerGet (operand * left, aopOp (result, ic, result?TRUE:FALSE); /* if bitfield then unpack the bits */ - if (IS_BITVAR (retype)) + if (IS_BITFIELD (retype)) genUnpackBits (result, rname, POINTER); else { @@ -7718,7 +7720,7 @@ genPagedPointerGet (operand * left, aopOp (result, ic, FALSE); /* if bitfield then unpack the bits */ - if (IS_BITVAR (retype)) + if (IS_BITFIELD (retype)) genUnpackBits (result, rname, PPOINTER); else { @@ -7850,7 +7852,7 @@ genFarPointerGet (operand * left, aopOp (result, ic, FALSE); /* if bit then unpack */ - if (IS_BITVAR (retype)) + if (IS_BITFIELD (retype)) genUnpackBits (result, "dptr", FPOINTER); else { @@ -7894,7 +7896,7 @@ genCodePointerGet (operand * left, aopOp (result, ic, FALSE); /* if bit then unpack */ - if (IS_BITVAR (retype)) + if (IS_BITFIELD (retype)) genUnpackBits (result, "dptr", CPOINTER); else { @@ -7947,7 +7949,7 @@ genGenPointerGet (operand * left, aopOp (result, ic, FALSE); /* if bit then unpack */ - if (IS_BITVAR (retype)) + if (IS_BITFIELD (retype)) genUnpackBits (result, "dptr", GPOINTER); else { @@ -8270,8 +8272,8 @@ genNearPointerSet (operand * right, aopOp (right, ic, FALSE); /* if bitfield then unpack the bits */ - if (IS_BITVAR (retype) || IS_BITVAR (letype)) - genPackBits ((IS_BITVAR (retype) ? retype : letype), right, rname, POINTER); + if (IS_BITFIELD (retype) || IS_BITFIELD (letype)) + genPackBits ((IS_BITFIELD (retype) ? retype : letype), right, rname, POINTER); else { /* we have can just get the values */ @@ -8365,8 +8367,8 @@ genPagedPointerSet (operand * right, aopOp (right, ic, FALSE); /* if bitfield then unpack the bits */ - if (IS_BITVAR (retype) || IS_BITVAR (letype)) - genPackBits ((IS_BITVAR (retype) ? retype : letype), right, rname, PPOINTER); + if (IS_BITFIELD (retype) || IS_BITFIELD (letype)) + genPackBits ((IS_BITFIELD (retype) ? retype : letype), right, rname, PPOINTER); else { /* we have can just get the values */ @@ -8440,8 +8442,8 @@ genFarPointerSet (operand * right, aopOp (right, ic, FALSE); /* if bit then unpack */ - if (IS_BITVAR (retype) || IS_BITVAR (letype)) - genPackBits ((IS_BITVAR (retype) ? retype : letype), right, "dptr", FPOINTER); + if (IS_BITFIELD (retype) || IS_BITFIELD (letype)) + genPackBits ((IS_BITFIELD (retype) ? retype : letype), right, "dptr", FPOINTER); else { size = AOP_SIZE (right); @@ -8485,8 +8487,8 @@ genGenPointerSet (operand * right, aopOp (right, ic, FALSE); /* if bit then unpack */ - if (IS_BITVAR (retype) || IS_BITVAR (letype)) - genPackBits ((IS_BITVAR (retype) ? retype : letype), right, "dptr", GPOINTER); + if (IS_BITFIELD (retype) || IS_BITFIELD (letype)) + genPackBits ((IS_BITFIELD (retype) ? retype : letype), right, "dptr", GPOINTER); else { size = AOP_SIZE (right); diff --git a/src/pic/gen.c b/src/pic/gen.c index 8cb10b27..bc284a3e 100644 --- a/src/pic/gen.c +++ b/src/pic/gen.c @@ -7977,7 +7977,7 @@ static void genNearPointerGet (operand *left, aopOp (result,ic,FALSE); /* if bitfield then unpack the bits */ - if (IS_BITVAR(retype)) + if (IS_BITFIELD(retype)) genUnpackBits (result,rname,POINTER); else { /* we have can just get the values */ @@ -8075,7 +8075,7 @@ static void genPagedPointerGet (operand *left, aopOp (result,ic,FALSE); /* if bitfield then unpack the bits */ - if (IS_BITVAR(retype)) + if (IS_BITFIELD(retype)) genUnpackBits (result,rname,PPOINTER); else { /* we have can just get the values */ @@ -8153,7 +8153,7 @@ static void genFarPointerGet (operand *left, aopOp(result,ic,FALSE); /* if bit then unpack */ - if (IS_BITVAR(retype)) + if (IS_BITFIELD(retype)) genUnpackBits(result,"dptr",FPOINTER); else { size = AOP_SIZE(result); @@ -8203,7 +8203,7 @@ static void genCodePointerGet (operand *left, aopOp(result,ic,FALSE); /* if bit then unpack */ - if (IS_BITVAR(retype)) + if (IS_BITFIELD(retype)) genUnpackBits(result,"dptr",CPOINTER); else { size = AOP_SIZE(result); @@ -8265,7 +8265,7 @@ static void genGenPointerGet (operand *left, /* so dptr know contains the address */ /* if bit then unpack */ - //if (IS_BITVAR(retype)) + //if (IS_BITFIELD(retype)) // genUnpackBits(result,"dptr",GPOINTER); release: @@ -8646,7 +8646,7 @@ static void genNearPointerSet (operand *right, //if (AOP_TYPE(result) == AOP_IMMD && if (AOP_TYPE(result) == AOP_PCODE && //AOP_TYPE(result) == AOP_IMMD && DCL_TYPE(ptype) == POINTER && - !IS_BITVAR(retype)) { + !IS_BITFIELD(retype)) { genDataPointerSet (right,result,ic); freeAsmop(result,NULL,ic,TRUE); return; @@ -8679,7 +8679,7 @@ static void genNearPointerSet (operand *right, /* if bitfield then unpack the bits */ - if (IS_BITVAR(retype)) { + if (IS_BITFIELD(retype)) { werror(E_INTERNAL_ERROR,__FILE__,__LINE__, "The programmer is obviously confused"); //genPackBits (retype,right,rname,POINTER); @@ -8784,7 +8784,7 @@ static void genPagedPointerSet (operand *right, aopOp (right,ic,FALSE); /* if bitfield then unpack the bits */ - if (IS_BITVAR(retype)) + if (IS_BITFIELD(retype)) genPackBits (retype,right,rname,PPOINTER); else { /* we have can just get the values */ @@ -8862,7 +8862,7 @@ static void genFarPointerSet (operand *right, aopOp(right,ic,FALSE); /* if bit then unpack */ - if (IS_BITVAR(retype)) + if (IS_BITFIELD(retype)) genPackBits(retype,right,"dptr",FPOINTER); else { size = AOP_SIZE(right); @@ -8958,7 +8958,7 @@ static void genGenPointerSet (operand *right, /* if bit then unpack */ - if (IS_BITVAR(retype)) + if (IS_BITFIELD(retype)) genPackBits(retype,right,"dptr",GPOINTER); else { size = AOP_SIZE(right); diff --git a/src/pic16/gen.c b/src/pic16/gen.c index 47d80228..73ca2c02 100644 --- a/src/pic16/gen.c +++ b/src/pic16/gen.c @@ -3889,6 +3889,7 @@ static void genSkipz2(resolvedIfx *rifx, int invert_condition) rifx->generated = 1; } +#if 0 /*-----------------------------------------------------------------*/ /* genSkipz */ /*-----------------------------------------------------------------*/ @@ -3913,6 +3914,8 @@ static void genSkipz(iCode *ifx, int condition) pic16_emitcode("goto","_%05d_DS_",IC_FALSE(ifx)->key+100+labelOffset); } +#endif + /*-----------------------------------------------------------------*/ /* genSkipCond */ /*-----------------------------------------------------------------*/ @@ -6469,6 +6472,7 @@ static void genGetHbit (iCode *ic) pic16_freeAsmop(result,NULL,ic,TRUE); } +#if 0 /*-----------------------------------------------------------------*/ /* AccRol - rotate left accumulator by known count */ /*-----------------------------------------------------------------*/ @@ -6506,6 +6510,7 @@ static void AccRol (int shCount) break; } } +#endif /*-----------------------------------------------------------------*/ /* AccLsh - left shift accumulator by known count */ @@ -8366,7 +8371,7 @@ static void genNearPointerGet (operand *left, pic16_aopOp (result,ic,FALSE); /* if bitfield then unpack the bits */ - if (IS_BITVAR(retype)) + if (IS_BITFIELD(retype)) genUnpackBits (result,rname,POINTER); else { /* we have can just get the values */ @@ -8464,7 +8469,7 @@ static void genPagedPointerGet (operand *left, pic16_aopOp (result,ic,FALSE); /* if bitfield then unpack the bits */ - if (IS_BITVAR(retype)) + if (IS_BITFIELD(retype)) genUnpackBits (result,rname,PPOINTER); else { /* we have can just get the values */ @@ -8542,7 +8547,7 @@ static void genFarPointerGet (operand *left, pic16_aopOp(result,ic,FALSE); /* if bit then unpack */ - if (IS_BITVAR(retype)) + if (IS_BITFIELD(retype)) genUnpackBits(result,"dptr",FPOINTER); else { size = AOP_SIZE(result); @@ -8592,7 +8597,7 @@ static void genCodePointerGet (operand *left, pic16_aopOp(result,ic,FALSE); /* if bit then unpack */ - if (IS_BITVAR(retype)) + if (IS_BITFIELD(retype)) genUnpackBits(result,"dptr",CPOINTER); else { size = AOP_SIZE(result); @@ -8654,7 +8659,7 @@ static void genGenPointerGet (operand *left, /* so dptr know contains the address */ /* if bit then unpack */ - if (IS_BITVAR(retype)) + if (IS_BITFIELD(retype)) genUnpackBits(result,"BAD",GPOINTER); release: @@ -9073,7 +9078,7 @@ static void genNearPointerSet (operand *right, DEBUGpic16_emitcode ("; ***","%s %d",__FUNCTION__,__LINE__); /* if bitfield then unpack the bits */ - if (IS_BITVAR(retype)) { + if (IS_BITFIELD(retype)) { werror(E_INTERNAL_ERROR,__FILE__,__LINE__, "The programmer is obviously confused"); // genPackBits (retype,right,"BAD",POINTER); @@ -9178,7 +9183,7 @@ static void genPagedPointerSet (operand *right, pic16_aopOp (right,ic,FALSE); /* if bitfield then unpack the bits */ - if (IS_BITVAR(retype)) + if (IS_BITFIELD(retype)) genPackBits (retype,right,rname,PPOINTER); else { /* we have can just get the values */ @@ -9256,7 +9261,7 @@ static void genFarPointerSet (operand *right, pic16_aopOp(right,ic,FALSE); /* if bit then unpack */ - if (IS_BITVAR(retype)) + if (IS_BITFIELD(retype)) genPackBits(retype,right,"dptr",FPOINTER); else { size = AOP_SIZE(right); @@ -9353,7 +9358,7 @@ static void genGenPointerSet (operand *right, /* if bit then unpack */ - if (IS_BITVAR(retype)) + if (IS_BITFIELD(retype)) genPackBits(retype,right,"dptr",GPOINTER); else { size = AOP_SIZE(right); diff --git a/support/valdiag/valdiag.py b/support/valdiag/valdiag.py index 2a4ed750..0cf03703 100644 --- a/support/valdiag/valdiag.py +++ b/support/valdiag/valdiag.py @@ -32,7 +32,8 @@ gcc = { "CCDEF":"-D", "CCOUTPUT":"-o", "defined": { - "__GNUC__":"1" + "__GNUC__":"1", + "GCC":"1" }, "ignoremsg": [ ] -- 2.30.2