From bda8dfa2c6924c84ffa321b785df93fbe6507c81 Mon Sep 17 00:00:00 2001 From: rlar Date: Tue, 23 Nov 2010 19:20:30 +0000 Subject: [PATCH] swallow type conversion warnings (assignment of an int to unsigned:1 flags) --- ChangeLog | 24 +++++++++++++++++++++++- src/spicelib/analysis/cktsopt.c | 14 +++++++------- src/spicelib/analysis/dctrcurv.c | 6 +++--- src/spicelib/devices/bjt/bjtparam.c | 2 +- src/spicelib/devices/bjt2/bjt2param.c | 2 +- src/spicelib/devices/bsim2/b2mpar.c | 2 +- src/spicelib/devices/dio/dioparam.c | 2 +- src/spicelib/devices/jfet/jfetpar.c | 2 +- src/spicelib/devices/jfet2/jfet2par.c | 2 +- src/spicelib/devices/mos1/mos1par.c | 2 +- src/spicelib/devices/mos2/mos2par.c | 2 +- src/spicelib/devices/mos3/mos3par.c | 2 +- src/spicelib/devices/mos6/mos6par.c | 2 +- src/spicelib/devices/mos9/mos9par.c | 2 +- src/spicelib/devices/soi3/soi3par.c | 2 +- src/spicelib/devices/vbic/vbicparam.c | 2 +- 16 files changed, 46 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5a38e71ea..c64feeeaa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2010-11-23 Robert Larice + * src/spicelib/analysis/cktsopt.c , + * src/spicelib/analysis/dctrcurv.c , + * src/spicelib/devices/bjt/bjtparam.c , + * src/spicelib/devices/bjt2/bjt2param.c , + * src/spicelib/devices/bsim2/b2mpar.c , + * src/spicelib/devices/dio/dioparam.c , + * src/spicelib/devices/jfet/jfetpar.c , + * src/spicelib/devices/jfet2/jfet2par.c , + * src/spicelib/devices/mos1/mos1par.c , + * src/spicelib/devices/mos2/mos2par.c , + * src/spicelib/devices/mos3/mos3par.c , + * src/spicelib/devices/mos6/mos6par.c , + * src/spicelib/devices/mos9/mos9par.c , + * src/spicelib/devices/soi3/soi3par.c , + * src/spicelib/devices/vbic/vbicparam.c : + swallow type conversion warnings (assignment of int to unsigned:1 flags) + actually this fix changes the semantic from + true if and only if given number is odd + to + true if and only if given number != 0 + 2010-11-22 Robert Larice * src/frontend/parse-bison.c , * src/spicelib/parser/inpptree-parser.c : @@ -19,7 +41,7 @@ This phenomenon is well known, see for example http://gcc.gnu.org/bugzilla/show_bug.cgi?id=323 This `bug workaround' fixes the problem - by declaring the `test_double' to be a `void' double, + by declaring the `test_double' to be a `volatile' double, which enforces truncation of the 80bit value, when it is used in the comparison. This fix will cause the test-case to pass. diff --git a/src/spicelib/analysis/cktsopt.c b/src/spicelib/analysis/cktsopt.c index 939249897..92d0b9289 100644 --- a/src/spicelib/analysis/cktsopt.c +++ b/src/spicelib/analysis/cktsopt.c @@ -37,7 +37,7 @@ CKTsetOpt(CKTcircuit *ckt, JOB *anal, int opt, IFvalue *val) switch(opt) { case OPT_NOOPITER: - task->TSKnoOpIter = val->iValue; + task->TSKnoOpIter = (val->iValue != 0); break; case OPT_GMIN: task->TSKgmin = val->rValue; @@ -125,7 +125,7 @@ CKTsetOpt(CKTcircuit *ckt, JOB *anal, int opt, IFvalue *val) } break; case OPT_OLDLIMIT: - task->TSKfixLimit = val->iValue; + task->TSKfixLimit = (val->iValue != 0); break; case OPT_MINBREAK: task->TSKminBreak = val->rValue; @@ -138,19 +138,19 @@ CKTsetOpt(CKTcircuit *ckt, JOB *anal, int opt, IFvalue *val) else return(E_METHOD); break; case OPT_TRYTOCOMPACT: - task->TSKtryToCompact = val->iValue; + task->TSKtryToCompact = (val->iValue != 0); break; case OPT_BADMOS3: - task->TSKbadMos3 = val->iValue; + task->TSKbadMos3 = (val->iValue != 0); break; case OPT_KEEPOPINFO: - task->TSKkeepOpInfo = val->iValue; + task->TSKkeepOpInfo = (val->iValue != 0); break; case OPT_COPYNODESETS: - task->TSKcopyNodesets = val->iValue; + task->TSKcopyNodesets = (val->iValue != 0); break; case OPT_NODEDAMPING: - task->TSKnodeDamping = val->iValue; + task->TSKnodeDamping = (val->iValue != 0); break; case OPT_ABSDV: task->TSKabsDv = val->rValue; diff --git a/src/spicelib/analysis/dctrcurv.c b/src/spicelib/analysis/dctrcurv.c index 0cbe34b13..ec0e52b7d 100644 --- a/src/spicelib/analysis/dctrcurv.c +++ b/src/spicelib/analysis/dctrcurv.c @@ -527,11 +527,11 @@ nextstep:; if(cv->TRCVvType[i] == vcode) { /* voltage source */ ((VSRCinstance*)(cv->TRCVvElt[i]))->VSRCdcValue = cv->TRCVvSave[i]; - ((VSRCinstance*)(cv->TRCVvElt[i]))->VSRCdcGiven = cv->TRCVgSave[i]; + ((VSRCinstance*)(cv->TRCVvElt[i]))->VSRCdcGiven = (cv->TRCVgSave[i] != 0); } else if(cv->TRCVvType[i] == icode) /*current source */ { ((ISRCinstance*)(cv->TRCVvElt[i]))->ISRCdcValue = cv->TRCVvSave[i]; - ((ISRCinstance*)(cv->TRCVvElt[i]))->ISRCdcGiven = cv->TRCVgSave[i]; + ((ISRCinstance*)(cv->TRCVvElt[i]))->ISRCdcGiven = (cv->TRCVgSave[i] != 0); } else if(cv->TRCVvType[i] == rcode) /* Resistance */ { ((RESinstance*)(cv->TRCVvElt[i]))->RESresist = cv->TRCVvSave[i]; @@ -539,7 +539,7 @@ nextstep:; ((RESinstance*)(cv->TRCVvElt[i]))->RESconduct = 1/(((RESinstance*)(cv->TRCVvElt[i]))->RESresist); - ((RESinstance*)(cv->TRCVvElt[i]))->RESresGiven = cv->TRCVgSave[i]; + ((RESinstance*)(cv->TRCVvElt[i]))->RESresGiven = (cv->TRCVgSave[i] != 0); DEVices[rcode]->DEVload(cv->TRCVvElt[i]->GENmodPtr, ckt); /* diff --git a/src/spicelib/devices/bjt/bjtparam.c b/src/spicelib/devices/bjt/bjtparam.c index 7bf98e5f6..bec74e0a3 100644 --- a/src/spicelib/devices/bjt/bjtparam.c +++ b/src/spicelib/devices/bjt/bjtparam.c @@ -52,7 +52,7 @@ BJTparam(int param, IFvalue *value, GENinstance *instPtr, IFvalue *select) here->BJTdtempGiven = TRUE; break; case BJT_OFF: - here->BJToff = value->iValue; + here->BJToff = (value->iValue != 0); break; case BJT_IC_VBE: here->BJTicVBE = value->rValue; diff --git a/src/spicelib/devices/bjt2/bjt2param.c b/src/spicelib/devices/bjt2/bjt2param.c index 563569d70..c18149a55 100644 --- a/src/spicelib/devices/bjt2/bjt2param.c +++ b/src/spicelib/devices/bjt2/bjt2param.c @@ -53,7 +53,7 @@ BJT2param(int param, IFvalue *value, GENinstance *instPtr, IFvalue *select) here->BJT2dtempGiven = TRUE; break; case BJT2_OFF: - here->BJT2off = value->iValue; + here->BJT2off = (value->iValue != 0); break; case BJT2_IC_VBE: here->BJT2icVBE = value->rValue; diff --git a/src/spicelib/devices/bsim2/b2mpar.c b/src/spicelib/devices/bsim2/b2mpar.c index 478477307..31cbb292a 100644 --- a/src/spicelib/devices/bsim2/b2mpar.c +++ b/src/spicelib/devices/bsim2/b2mpar.c @@ -506,7 +506,7 @@ B2mParam(int param, IFvalue *value, GENmodel *inMod) mod->B2gateBulkOverlapCapGiven = TRUE; break; case BSIM2_MOD_XPART : - mod->B2channelChargePartitionFlag = value->iValue; + mod->B2channelChargePartitionFlag = (value->iValue != 0); mod->B2channelChargePartitionFlagGiven = TRUE; break; case BSIM2_MOD_RSH : diff --git a/src/spicelib/devices/dio/dioparam.c b/src/spicelib/devices/dio/dioparam.c index d0794942b..65618d7cb 100644 --- a/src/spicelib/devices/dio/dioparam.c +++ b/src/spicelib/devices/dio/dioparam.c @@ -45,7 +45,7 @@ DIOparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select) here->DIOdtempGiven = TRUE; break; case DIO_OFF: - here->DIOoff = value->iValue; + here->DIOoff = (value->iValue != 0); break; case DIO_IC: here->DIOinitCond = value->rValue; diff --git a/src/spicelib/devices/jfet/jfetpar.c b/src/spicelib/devices/jfet/jfetpar.c index 46c4f6ed7..02aeba302 100644 --- a/src/spicelib/devices/jfet/jfetpar.c +++ b/src/spicelib/devices/jfet/jfetpar.c @@ -47,7 +47,7 @@ JFETparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select) here->JFETicVGSGiven = TRUE; break; case JFET_OFF: - here->JFEToff = value->iValue; + here->JFEToff = (value->iValue != 0); break; case JFET_IC: switch(value->v.numValue) { diff --git a/src/spicelib/devices/jfet2/jfet2par.c b/src/spicelib/devices/jfet2/jfet2par.c index de60bc6ff..c25412684 100644 --- a/src/spicelib/devices/jfet2/jfet2par.c +++ b/src/spicelib/devices/jfet2/jfet2par.c @@ -51,7 +51,7 @@ JFET2param(int param, IFvalue *value, GENinstance *inst, IFvalue *select) here->JFET2icVGSGiven = TRUE; break; case JFET2_OFF: - here->JFET2off = value->iValue; + here->JFET2off = (value->iValue != 0); break; case JFET2_IC: switch(value->v.numValue) { diff --git a/src/spicelib/devices/mos1/mos1par.c b/src/spicelib/devices/mos1/mos1par.c index d837d6ce5..f4796b193 100644 --- a/src/spicelib/devices/mos1/mos1par.c +++ b/src/spicelib/devices/mos1/mos1par.c @@ -68,7 +68,7 @@ MOS1param(int param, IFvalue *value, GENinstance *inst, IFvalue *select) here->MOS1drainSquaresGiven = TRUE; break; case MOS1_OFF: - here->MOS1off = value->iValue; + here->MOS1off = (value->iValue != 0); break; case MOS1_IC_VBS: here->MOS1icVBS = value->rValue; diff --git a/src/spicelib/devices/mos2/mos2par.c b/src/spicelib/devices/mos2/mos2par.c index 95806249d..5e5175e33 100644 --- a/src/spicelib/devices/mos2/mos2par.c +++ b/src/spicelib/devices/mos2/mos2par.c @@ -69,7 +69,7 @@ MOS2param(int param, IFvalue *value, GENinstance *inst, here->MOS2drainSquaresGiven = TRUE; break; case MOS2_OFF: - here->MOS2off = value->iValue; + here->MOS2off = (value->iValue != 0); break; case MOS2_IC_VBS: here->MOS2icVBS = value->rValue; diff --git a/src/spicelib/devices/mos3/mos3par.c b/src/spicelib/devices/mos3/mos3par.c index ae8d82e8d..39590fa84 100644 --- a/src/spicelib/devices/mos3/mos3par.c +++ b/src/spicelib/devices/mos3/mos3par.c @@ -61,7 +61,7 @@ MOS3param(int param, IFvalue *value, GENinstance *inst, IFvalue *select) here->MOS3drainSquaresGiven = TRUE; break; case MOS3_OFF: - here->MOS3off = value->iValue; + here->MOS3off = (value->iValue != 0); break; case MOS3_IC_VBS: here->MOS3icVBS = value->rValue; diff --git a/src/spicelib/devices/mos6/mos6par.c b/src/spicelib/devices/mos6/mos6par.c index b9d341b23..e5e653ce4 100644 --- a/src/spicelib/devices/mos6/mos6par.c +++ b/src/spicelib/devices/mos6/mos6par.c @@ -67,7 +67,7 @@ MOS6param(int param, IFvalue *value, GENinstance *inst, IFvalue *select) here->MOS6drainSquaresGiven = TRUE; break; case MOS6_OFF: - here->MOS6off = value->iValue; + here->MOS6off = (value->iValue != 0); break; case MOS6_IC_VBS: here->MOS6icVBS = value->rValue; diff --git a/src/spicelib/devices/mos9/mos9par.c b/src/spicelib/devices/mos9/mos9par.c index 24590687c..376dc4991 100644 --- a/src/spicelib/devices/mos9/mos9par.c +++ b/src/spicelib/devices/mos9/mos9par.c @@ -62,7 +62,7 @@ MOS9param(int param, IFvalue *value, GENinstance *inst, here->MOS9drainSquaresGiven = TRUE; break; case MOS9_OFF: - here->MOS9off = value->iValue; + here->MOS9off = (value->iValue != 0); break; case MOS9_IC_VBS: here->MOS9icVBS = value->rValue; diff --git a/src/spicelib/devices/soi3/soi3par.c b/src/spicelib/devices/soi3/soi3par.c index 63a70bd01..44f5b5cbf 100644 --- a/src/spicelib/devices/soi3/soi3par.c +++ b/src/spicelib/devices/soi3/soi3par.c @@ -70,7 +70,7 @@ SOI3param(int param, IFvalue *value, GENinstance *inst, IFvalue *select) here->SOI3sourceSquaresGiven = TRUE; break; case SOI3_OFF: - here->SOI3off = value->iValue; + here->SOI3off = (value->iValue != 0); break; case SOI3_IC_VDS: here->SOI3icVDS = value->rValue; diff --git a/src/spicelib/devices/vbic/vbicparam.c b/src/spicelib/devices/vbic/vbicparam.c index 7f531cbfe..e38d9167b 100644 --- a/src/spicelib/devices/vbic/vbicparam.c +++ b/src/spicelib/devices/vbic/vbicparam.c @@ -32,7 +32,7 @@ VBICparam(int param, IFvalue *value, GENinstance *instPtr, IFvalue *select) here->VBICareaGiven = TRUE; break; case VBIC_OFF: - here->VBICoff = value->iValue; + here->VBICoff = (value->iValue != 0); break; case VBIC_IC_VBE: here->VBICicVBE = value->rValue;