Skip to content

Commit c7b4b3b

Browse files
committed
Yet more clang fixes
1 parent 0caa886 commit c7b4b3b

File tree

15 files changed

+80
-69
lines changed

15 files changed

+80
-69
lines changed

src/cnguts.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2154,8 +2154,6 @@ void LOCAL accumulatorsAccum(
21542154
{
21552155
ACCUMULATOR_IVL* pDst = &pACM->Y + (ivl - C_IVLCH_Y); // point destination
21562156
// ASSUMES ACCUMULATOR interval members ordered like DTIVLCH choices
2157-
ACCUMULATOR_IVL* pSrc = pDst + 1; // source: next shorter interval
2158-
21592157
if (ivl == C_IVLCH_H)
21602158
{ // construct temporary subhour ACCUMULATOR_IVL
21612159
ACCUMULATOR_IVL tempSubhr;

src/cnloads.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,7 +1270,7 @@ RC ZNR::zn_AirRequest( // determine air requirement given rs_asSup
12701270
{
12711271
RC rc = RCOK;
12721272
double tSup0 = rs->rs_asSup.as_tdb;
1273-
#if 0 && defined( _DEBUG)
1273+
#if 1 && defined( _DEBUG)
12741274
if ((options & 1) && !Top.isWarmup && rs->rs_speedF > 0.99f
12751275
&& ( (zn_hcMode == RSYS::rsmCOOL && tSup0 >= zn_tzsp)
12761276
|| (zn_hcMode == RSYS::rsmHEAT && tSup0 <= zn_tzsp && rs->rs_effHt > 0.f)))
@@ -3275,7 +3275,7 @@ RC RSYS::rs_SetupCapH( // set heating members that do not vary during simulatio
32753275
{
32763276
RC rc = RCOK;
32773277

3278-
bool bAutosizeFazInit = options & 1;
3278+
// bool bAutosizeFazInit = options & 1; not used
32793279
bool bAssumeNotAutosizing = options & 2;
32803280

32813281
if (rs_IsPMHtg())

src/cpnat.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ RC FC pnPrPg( char **ppp, SI x)
335335

336336
} /* prPrPg */
337337

338+
#if 0 // reactivate optimization, 10-2025
338339
/* 7-4-90, 6.0: found compiled wrong with FC and -Osewzr: fetched BP+6,
339340
which I claim would be x, then tested in for > 0 as tho had nrows.
340341
Caused hang and/or qemm exceptions. OK if cv-compiled.
@@ -345,6 +346,7 @@ Later 7-4-90, 6.0: under -Oswr, without FC, apparently compiled wrong again:
345346
Restore FC, try pragma. */
346347
#pragma optimize("",off) /* 6.0 7-4-90 compiled wrong */
347348
/* not reverified with final -O options */
349+
#endif
348350
//===========================================================================
349351
LOCAL RC FC pnPrRows(
350352

@@ -431,7 +433,9 @@ LOCAL RC FC pnPrRows(
431433
*ppp = pp; /* in case something moved PAGE */
432434
return rc;
433435
} /* pnPrRows */
436+
#if 0
434437
#pragma optimize("",on) /* restore */
438+
#endif
435439

436440
//===========================================================================
437441
LOCAL RC FC pnNewPrPage() /* start new (continuation) printer page */

src/cul.cpp

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4107,22 +4107,24 @@ LOCAL void FC ratCultO( void)
41074107
// eg DHWHEATER and DHWLOOPHEATER from DHWSYS
41084108
{
41094109
//if (b->isOwnable()) if an ownable-record basAnc: all are, 7-92.
4110-
if (xSp > xStk ) // if nested (not top: no owner)
4110+
if (xSp > xStk) // if nested (not top: no owner)
4111+
{
41114112
if ((xSp-1)->c->f & NOTOWNED) // if embedding table entry flagged as "not indicating ownership" 11-91
41124113
xSp->cult->IFLAGS &= ~BEEN_HERE; // clear nxRat's flag so this cult will be returned again when
4113-
// accessed by another entry -- may indicate its owner 12-10-91
4114+
// accessed by another entry -- may indicate its owner 12-10-91
41144115
else
41154116
{
41164117
BP ownB = (xSp-1)->b; // owner here is embedding basAnc
41174118
if (b->ownB != 0 // if owner already set
4118-
&& b->ownB != ownB ) // to another owner
4119-
per( MH_S0202, // error message, cuparse.cpp
4119+
&& b->ownB != ownB) // to another owner
4120+
per(MH_S0202, // error message, cuparse.cpp
41204121
//"cul.cpp:ratCultO: internal error: bad tables: \n"
41214122
//" '%s' rat at %p is 'owned' by '%s' rat at %p and also '%s' rat at %p",
4122-
b->what, b, b->ownB->what, b->ownB, ownB->what, ownB );
4123+
b->what, b, b->ownB->what, b->ownB, ownB->what, ownB);
41234124
else
41244125
b->ownB = ownB; // set owner
41254126
}
4127+
}
41264128
}
41274129
} // ratCultO
41284130

@@ -4691,23 +4693,26 @@ const char* basAnc::culMbrIdTx( // return record field id from cult table
46914693
}
46924694

46934695
const char* tx = NULL;
4694-
for (CULT *c = NULL; xnxC(c); ) // loop CULT entries, using xStk[0], making addl xStk entries
4696+
for (CULT* c = NULL; xnxC(c); ) // loop CULT entries, using xStk[0], making addl xStk entries
4697+
{
46954698
if (
46964699
#if 1 // another try, 4-9-2013
46974700
(xSp->b->rt==rt // match rt not b so run basAncs, types basAncs work
4698-
|| xSp->b == this) // also match b re ambiguous fn (e.g. among surface, door, window)
4701+
|| xSp->b == this) // also match b re ambiguous fn (e.g. among surface, door, window)
46994702
#elif 0 // experiment re ambiguous fn (e.g. among surface, door, window), 3-9-2012
47004703
x xSp->b == b // seems to work for types basAncs?
47014704
#else
47024705
x xSp->b->rt==b->rt // (match rt not b so run basAncs, types basAncs work)
47034706
#endif
4704-
&& c->cs==DAT
4705-
&& c->fn==fn) // if data entry for desired field of basAnc of desired type
4707+
&& c->cs==DAT && c->fn==fn) // if data entry for desired field of basAnc of desired type
4708+
{
47064709
if (!tx) // if first match
47074710
tx = c->id; // remember it
4708-
else if (_stricmp( tx, c->id)) // additional match: ignore if same name
4709-
return strtprintf( MH_S0276, tx, c->id);
4710-
// "[%s or %s: table ambiguity: recode this error message to not use cul.cpp:culMbrId]"
4711+
}
4712+
else if (_stricmp(tx, c->id)) // additional match: ignore if same name
4713+
return strtprintf(MH_S0276, tx, c->id);
4714+
// "[%s or %s: table ambiguity: recode this error message to not use cul.cpp:culMbrId]"
4715+
}
47114716

47124717
if (tx) // if name found
47134718
return tx; // return it. Is unique if here.

src/cuparse.cpp

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2196,10 +2196,12 @@ LOCAL RC FC fcnChoose( SFST *f, USI wanTy) // do choose-type fcns for fcn() (f-
21962196

21972197
// messages if wrong # values for hourval
21982198
if (f->f & F1) // if hourval
2199+
{
21992200
if (nAnDef < 24 && defa != 1) // < 24 args w/o user default is error
2200-
return perNx( MH_S0041); // "hourval() requires values for 24 hours"
2201+
return perNx(MH_S0041); // "hourval() requires values for 24 hours"
22012202
else if (nAnDef > 24) // > 24 args gets warning
2202-
pWarnlc( MH_S0042); // "hourval() arguments in excess of 24 will be ignored"
2203+
pWarnlc(MH_S0042); // "hourval() arguments in excess of 24 will be ignored"
2204+
}
22032205

22042206
if (isKon) // if constant index (1) or select all cond false (-1)
22052207
{
@@ -2723,12 +2725,14 @@ LOCAL RC FC sysVar( SVST *v, USI wanTy)
27232725
#endif
27242726
EE( emiLod( v->ty, v->p) ) // emit op code to load value
27252727
if (v->f & INC) // on option, emit ++ (1-base for user)
2728+
{
27262729
if (v->ty==TYSI)
2727-
EE( emit( PSIINC) )
2730+
EE(emit(PSIINC))
27282731
else if (v->ty==TYFL)
2729-
EE( emit( PSFINC) )
2730-
//(else bad table entry)
2731-
parSp->ty = v->ty; // set type
2732+
EE(emit(PSFINC))
2733+
//(else bad table entry)
2734+
}
2735+
parSp->ty = v->ty; // set type
27322736
}
27332737
break;
27342738
} // switch (v->cs)
@@ -3322,15 +3326,17 @@ LOCAL SI FC isKonExp( // test if *parSp is a constant expression
33223326
if (*parSp->psp1==kop) // if op code already constant-load
33233327
{
33243328
if (ppv) // if not NULL, tell caller
3329+
{
33253330
#if defined( USE_PSPKONN)
33263331
if (kop==PSPKONN) // string inline in code
33273332
{
3328-
p = (const char *)(parSp->psp1 + 2); // is after op code & length
3333+
p = (const char*)(parSp->psp1 + 2); // is after op code & length
33293334
*ppv = &p; // indirect like cuEvalR()
33303335
}
33313336
else // other types [or string ptr in code]
33323337
#endif
33333338
*ppv = parSp->psp1 + 1; // point to value after op code
3339+
}
33343340
return 1; // constant, but nothing to convert
33353341
}
33363342
}
@@ -3451,11 +3457,13 @@ LOCAL RC FC cnvPrevSf( // append (conversion) operation to ith previous express
34513457
if ( *(pspe-3)==PSKON4 // if frame contains 4-byte constant
34523458
&& pspe-3==parSpe->psp1 ) // and nothing more
34533459
{
3454-
if (!ISNUM(*(void **)(pspe-2))) // test the constant value: if any non-number (cnglob.h macro)
3455-
if (ISNCHOICE(*(void **)(pspe-2))) // conversion fails NOW
3456-
return perNx( MH_S0063); // "Expected numeric value, found choice value". Explain to user.
3460+
if (!ISNUM(*(void**)(pspe-2))) // test the constant value: if any non-number (cnglob.h macro)
3461+
{
3462+
if (ISNCHOICE(*(void**)(pspe-2))) // conversion fails NOW
3463+
return perNx(MH_S0063); // "Expected numeric value, found choice value". Explain to user.
34573464
else
3458-
return perNx( MH_S0064); // "Numeric value required". (unexpected) NANDLE or bug.
3465+
return perNx(MH_S0064); // "Numeric value required". (unexpected) NANDLE or bug.
3466+
}
34593467
return RCOK; // its already a number, needn't store conversion
34603468
}
34613469
// else: LATER 2-92 consider looking for single probe in stack frame,

src/cuprobe.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -782,9 +782,9 @@ void FC showProbeNames(int showAll)
782782
if (_stricmp( b->what, b2->what))
783783
continue; // name different, skip it
784784
if (b2->ba_flags & RFINP ? inB : runB) // same; ok if 1st input basAnc or 1st run basAnc with name
785-
printf( msg( NULL, MH_U0025, //"\nInternal error: Ambiguous class name '%s':\n"
786-
b->what, //" there are TWO %s rats with that .what. Change one of them.\n"
787-
b->ba_flags & RFINP ? "input" : "run" ) ); // msg() gets disk text (and formats) -- printf does not.
785+
printf( "%s", msg( NULL, MH_U0025, //"\nInternal error: Ambiguous class name '%s':\n"
786+
b->what, //" there are TWO %s rats with that .what. Change one of them.\n"
787+
b->ba_flags & RFINP ? "input" : "run" ) ); // msg() gets disk text (and formats) -- printf does not.
788788
else
789789
{
790790
b2->ba_flags |= RFLOCAL; // say this one displayed too

src/curvemap.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,6 @@ PERFORMANCEMAP* PMGRIDAXIS::pmx_GetPERFMAP() const
519519
//-----------------------------------------------------------------------------
520520
/*virtual*/ void PMGRIDAXIS::Copy( const record* pSrc, int options/*=0*/)
521521
{
522-
options;
523522
pmx_type.Release();
524523
record::Copy( pSrc, options);
525524
pmx_type.FixAfterCopy();
@@ -599,7 +598,6 @@ PERFORMANCEMAP* PMLOOKUPDATA::pmv_GetPERFMAP() const
599598
//-----------------------------------------------------------------------------
600599
/*virtual*/ void PMLOOKUPDATA::Copy( const record* pSrc, int options/*=0*/)
601600
{
602-
options;
603601
pmv_type.Release();
604602
record::Copy( pSrc, options);
605603
pmv_type.FixAfterCopy();

src/datfcns.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ RC FC dStr2MonDay( // convert string to month and day. caller has removed any q
4040
{
4141
// split into month and day tokens and deblank both ends of both tokens in place (modifies caller's buffer)
4242
while (isspaceW(*str)) // deblank beginning: advance ptr
43-
*str++;
43+
str++;
4444
char buf[30];
4545
char * s1 = strncpy( buf, str, sizeof(buf)-1); // make a copy to modify. s1 will be start 1st token.
4646
buf[sizeof(buf)-1] = '\0';

src/dhwcalc.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,6 @@ DHWSYS::~DHWSYS()
702702
//-------------------------------------------------------------------------------
703703
/*virtual*/ void DHWSYS::Copy( const record* pSrc, int options/*=0*/)
704704
{
705-
options;
706705
ws_dayUseName.Release();
707706
record::Copy( pSrc, options);
708707
ws_dayUseName.FixAfterCopy();
@@ -1753,7 +1752,7 @@ RC DHWSYS::ws_DoHourDWHR() // current hour DHWHEATREC modeling (all DHWHEATRECs
17531752
// ws_qDWHRWH = 0.f; // heat recovered to water heater inlet, Btu
17541753
// ws_whUseNoHR = 0.; // check value: hour total hot water use w/o HR, gal
17551754
// init'd by caller
1756-
int multiDraw = 0;
1755+
[[maybe_unused]] int multiDraw = 0;
17571756
// int nTk = Top.tp_NHrTicks();
17581757
for (int iTk=ws_iTk0DWHR; iTk < ws_iTkNDWHR; iTk++)
17591758
{ DHWTICK& tk = ws_ticks[ iTk]; // DHWSYS tick info

src/exman.cpp

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ RC FC exPile( // compile an expression from current input
694694
CSE_E(uniLimCt(fdTy, gotTy, _ermTx, &v)); // check limits & apply units, with errMsg suitable for compile time. below.
695695

696696
if (gotTy == TYSI // return the constant value in destination. SI has 16 bit storage only
697-
|| gotTy == TYCH && choiDt & DTBCHOICB) // choice types with this bit on are 16 bits only
697+
|| (gotTy == TYCH && choiDt & DTBCHOICB) ) // choice types with this bit on are 16 bits only
698698
{
699699
SI iV = static_cast<SI>(v);
700700
*(SI*)pDest = iV; // return lo 16 bits of value
@@ -1120,17 +1120,10 @@ RC addChafIf ( // conditionally register change flag in basAnc record for expr.
11201120
ex->ext_whChafNal = nuNal;
11211121
}
11221122

1123-
#if 1
11241123
// store info to allow locating rat member even if rat is moved to new location
11251124
// (as can happen at reallocation)
1126-
WHERE* w = new (&ex->ext_whChaf[ex->ext_whChafN++]) WHERE(ancN, i, o);
1127-
#else
1128-
WHERE* w = &ex->ext_whChaf[ex->ext_whChafN++]; // point next available change-flag-where for expression
1129-
1130-
w->rr_ancN = ancN; // store info to allow locating rat member
1131-
w->i = i; // ... even if rat is moved to new location
1132-
w->o = o; // ... (as can happen at reallocation)
1133-
#endif
1125+
// use placement new
1126+
/* WHERE* w = */ new (&ex->ext_whChaf[ex->ext_whChafN++]) WHERE(ancN, i, o);
11341127
#endif
11351128
return RCOK;
11361129
} // addChafIf
@@ -1437,10 +1430,12 @@ RC FC exInfo( // return info on expression #
14371430
if (pTy)
14381431
*pTy = ex->ext_ty;
14391432
if (pv)
1433+
{
14401434
if (ex->ext_ty==TYSI)
1441-
*(SI *)pv = (SI)(INT)ex->ext_v;
1435+
*(SI*)pv = (SI)(INT)ex->ext_v;
14421436
else
14431437
*pv = ex->ext_v; // caller cueval.cpp cupIncRef's pointer if string, 7-92.
1438+
}
14441439
return RCOK;
14451440
} // exInfo
14461441

0 commit comments

Comments
 (0)