Skip to content

Commit 2a4f3ad

Browse files
committed
Cleaned up the sources wrt -Wpedantic
1 parent 730243a commit 2a4f3ad

File tree

19 files changed

+249
-195
lines changed

19 files changed

+249
-195
lines changed

sources/compcomm.c

Lines changed: 62 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -73,62 +73,62 @@ static KEYWORD chisoptions[] = {
7373
,{"symmetrize", (TFUN)0, ALSOREVERSE, 0 }
7474
};
7575

76-
static KEYWORD writeoptions[] = {
77-
{"stats", (TFUN)&(AC.StatsFlag), 1, 0}
78-
,{"statistics", (TFUN)&(AC.StatsFlag), 1, 0}
79-
,{"shortstats", (TFUN)&(AC.ShortStats), 1, 0}
80-
,{"shortstatistics",(TFUN)&(AC.ShortStats), 1, 0}
81-
,{"warnings", (TFUN)&(AC.WarnFlag), 1, 0}
82-
,{"allwarnings", (TFUN)&(AC.WarnFlag), 2, 0}
83-
,{"setup", (TFUN)&(AC.SetupFlag), 1, 0}
84-
,{"names", (TFUN)&(AC.NamesFlag), 1, 0}
85-
,{"allnames", (TFUN)&(AC.NamesFlag), 2, 0}
86-
,{"codes", (TFUN)&(AC.CodesFlag), 1, 0}
87-
,{"highfirst", (TFUN)&(AC.SortType), SORTHIGHFIRST, SORTLOWFIRST}
88-
,{"lowfirst", (TFUN)&(AC.SortType), SORTLOWFIRST, SORTHIGHFIRST}
89-
,{"powerfirst", (TFUN)&(AC.SortType), SORTPOWERFIRST, SORTHIGHFIRST}
90-
,{"tokens", (TFUN)&(AC.TokensWriteFlag),1, 0}
76+
static KEYWORDV writeoptions[] = {
77+
{"stats", &(AC.StatsFlag), 1, 0}
78+
,{"statistics", &(AC.StatsFlag), 1, 0}
79+
,{"shortstats", &(AC.ShortStats), 1, 0}
80+
,{"shortstatistics",&(AC.ShortStats), 1, 0}
81+
,{"warnings", &(AC.WarnFlag), 1, 0}
82+
,{"allwarnings", &(AC.WarnFlag), 2, 0}
83+
,{"setup", &(AC.SetupFlag), 1, 0}
84+
,{"names", &(AC.NamesFlag), 1, 0}
85+
,{"allnames", &(AC.NamesFlag), 2, 0}
86+
,{"codes", &(AC.CodesFlag), 1, 0}
87+
,{"highfirst", &(AC.SortType), SORTHIGHFIRST, SORTLOWFIRST}
88+
,{"lowfirst", &(AC.SortType), SORTLOWFIRST, SORTHIGHFIRST}
89+
,{"powerfirst", &(AC.SortType), SORTPOWERFIRST, SORTHIGHFIRST}
90+
,{"tokens", &(AC.TokensWriteFlag),1, 0}
9191
};
9292

93-
static KEYWORD onoffoptions[] = {
94-
{"compress", (TFUN)&(AC.NoCompress), 0, 1}
95-
,{"checkpoint", (TFUN)&(AC.CheckpointFlag), 1, 0}
96-
,{"insidefirst", (TFUN)&(AC.insidefirst), 1, 0}
97-
,{"propercount", (TFUN)&(AC.BottomLevel), 1, 0}
98-
,{"stats", (TFUN)&(AC.StatsFlag), 1, 0}
99-
,{"statistics", (TFUN)&(AC.StatsFlag), 1, 0}
100-
,{"shortstats", (TFUN)&(AC.ShortStats), 1, 0}
101-
,{"shortstatistics",(TFUN)&(AC.ShortStats), 1, 0}
102-
,{"names", (TFUN)&(AC.NamesFlag), 1, 0}
103-
,{"allnames", (TFUN)&(AC.NamesFlag), 2, 0}
104-
,{"warnings", (TFUN)&(AC.WarnFlag), 1, 0}
105-
,{"allwarnings", (TFUN)&(AC.WarnFlag), 2, 0}
106-
,{"highfirst", (TFUN)&(AC.SortType), SORTHIGHFIRST, SORTLOWFIRST}
107-
,{"lowfirst", (TFUN)&(AC.SortType), SORTLOWFIRST, SORTHIGHFIRST}
108-
,{"powerfirst", (TFUN)&(AC.SortType), SORTPOWERFIRST, SORTHIGHFIRST}
109-
,{"setup", (TFUN)&(AC.SetupFlag), 1, 0}
110-
,{"codes", (TFUN)&(AC.CodesFlag), 1, 0}
111-
,{"tokens", (TFUN)&(AC.TokensWriteFlag),1,0}
112-
,{"properorder", (TFUN)&(AC.properorderflag),1,0}
113-
,{"threadloadbalancing",(TFUN)&(AC.ThreadBalancing),1, 0}
114-
,{"threads", (TFUN)&(AC.ThreadsFlag),1, 0}
115-
,{"threadsortfilesynch",(TFUN)&(AC.ThreadSortFileSynch),1, 0}
116-
,{"threadstats", (TFUN)&(AC.ThreadStats),1, 0}
117-
,{"finalstats", (TFUN)&(AC.FinalStats),1, 0}
118-
,{"fewerstats", (TFUN)&(AC.ShortStatsMax), 10, 0}
119-
,{"fewerstatistics",(TFUN)&(AC.ShortStatsMax), 10, 0}
120-
,{"processstats", (TFUN)&(AC.ProcessStats),1, 0}
121-
,{"oldparallelstats",(TFUN)&(AC.OldParallelStats),1,0}
122-
,{"parallel", (TFUN)&(AC.parallelflag),PARALLELFLAG,NOPARALLEL_USER}
123-
,{"nospacesinnumbers",(TFUN)&(AO.NoSpacesInNumbers),1,0}
124-
,{"indentspace", (TFUN)&(AO.IndentSpace),INDENTSPACE,0}
125-
,{"totalsize", (TFUN)&(AM.PrintTotalSize), 1, 0}
126-
,{"flag", (TFUN)&(AC.debugFlags), 1, 0}
127-
,{"oldfactarg", (TFUN)&(AC.OldFactArgFlag), 1, 0}
128-
,{"memdebugflag", (TFUN)&(AC.MemDebugFlag), 1, 0}
129-
,{"oldgcd", (TFUN)&(AC.OldGCDflag), 1, 0}
130-
,{"innertest", (TFUN)&(AC.InnerTest), 1, 0}
131-
,{"wtimestats", (TFUN)&(AC.WTimeStatsFlag), 1, 0}
93+
static KEYWORDV onoffoptions[] = {
94+
{"compress", &(AC.NoCompress), 0, 1}
95+
,{"checkpoint", &(AC.CheckpointFlag), 1, 0}
96+
,{"insidefirst", &(AC.insidefirst), 1, 0}
97+
,{"propercount", &(AC.BottomLevel), 1, 0}
98+
,{"stats", &(AC.StatsFlag), 1, 0}
99+
,{"statistics", &(AC.StatsFlag), 1, 0}
100+
,{"shortstats", &(AC.ShortStats), 1, 0}
101+
,{"shortstatistics",&(AC.ShortStats), 1, 0}
102+
,{"names", &(AC.NamesFlag), 1, 0}
103+
,{"allnames", &(AC.NamesFlag), 2, 0}
104+
,{"warnings", &(AC.WarnFlag), 1, 0}
105+
,{"allwarnings", &(AC.WarnFlag), 2, 0}
106+
,{"highfirst", &(AC.SortType), SORTHIGHFIRST, SORTLOWFIRST}
107+
,{"lowfirst", &(AC.SortType), SORTLOWFIRST, SORTHIGHFIRST}
108+
,{"powerfirst", &(AC.SortType), SORTPOWERFIRST, SORTHIGHFIRST}
109+
,{"setup", &(AC.SetupFlag), 1, 0}
110+
,{"codes", &(AC.CodesFlag), 1, 0}
111+
,{"tokens", &(AC.TokensWriteFlag),1,0}
112+
,{"properorder", &(AC.properorderflag),1,0}
113+
,{"threadloadbalancing",&(AC.ThreadBalancing),1, 0}
114+
,{"threads", &(AC.ThreadsFlag),1, 0}
115+
,{"threadsortfilesynch",&(AC.ThreadSortFileSynch),1, 0}
116+
,{"threadstats", &(AC.ThreadStats),1, 0}
117+
,{"finalstats", &(AC.FinalStats),1, 0}
118+
,{"fewerstats", &(AC.ShortStatsMax), 10, 0}
119+
,{"fewerstatistics",&(AC.ShortStatsMax), 10, 0}
120+
,{"processstats", &(AC.ProcessStats),1, 0}
121+
,{"oldparallelstats",&(AC.OldParallelStats),1,0}
122+
,{"parallel", &(AC.parallelflag),PARALLELFLAG,NOPARALLEL_USER}
123+
,{"nospacesinnumbers",&(AO.NoSpacesInNumbers),1,0}
124+
,{"indentspace", &(AO.IndentSpace),INDENTSPACE,0}
125+
,{"totalsize", &(AM.PrintTotalSize), 1, 0}
126+
,{"flag", (int *)&(AC.debugFlags), 1, 0}
127+
,{"oldfactarg", &(AC.OldFactArgFlag), 1, 0}
128+
,{"memdebugflag", &(AC.MemDebugFlag), 1, 0}
129+
,{"oldgcd", &(AC.OldGCDflag), 1, 0}
130+
,{"innertest", &(AC.InnerTest), 1, 0}
131+
,{"wtimestats", &(AC.WTimeStatsFlag), 1, 0}
132132
};
133133

134134
static WORD one = 1;
@@ -348,7 +348,7 @@ int CoOff(UBYTE *s)
348348
}
349349
}
350350
*s = c;
351-
*((int *)(onoffoptions[i].func)) = onoffoptions[i].flags;
351+
*onoffoptions[i].var = onoffoptions[i].flags;
352352
AR.SortType = AC.SortType;
353353
AC.mparallelflag = AC.parallelflag | AM.hparallelflag;
354354
}
@@ -595,7 +595,7 @@ int CoOn(UBYTE *s)
595595
}
596596
}
597597
else { *s = c; }
598-
*((int *)(onoffoptions[i].func)) = onoffoptions[i].type;
598+
*onoffoptions[i].var = onoffoptions[i].type;
599599
AR.SortType = AC.SortType;
600600
AC.mparallelflag = AC.parallelflag | AM.hparallelflag;
601601
}
@@ -2263,18 +2263,18 @@ int CoWrite(UBYTE *s)
22632263
{
22642264
GETIDENTITY
22652265
UBYTE *option;
2266-
KEYWORD *key;
2266+
KEYWORDV *key;
22672267
option = s;
22682268
if ( ( ( s = SkipAName(s) ) == 0 ) || *s != 0 ) {
22692269
MesPrint("&Proper use of write statement is: write option");
22702270
return(1);
22712271
}
2272-
key = FindInKeyWord(option,writeoptions,sizeof(writeoptions)/sizeof(KEYWORD));
2272+
key = (KEYWORDV *)FindInKeyWord(option,(KEYWORD *)writeoptions,sizeof(writeoptions)/sizeof(KEYWORD));
22732273
if ( key == 0 ) {
22742274
MesPrint("&Unrecognized option in write statement");
22752275
return(1);
22762276
}
2277-
*((int *)(key->func)) = key->type;
2277+
*key->var = key->type;
22782278
AR.SortType = AC.SortType;
22792279
return(0);
22802280
}
@@ -2288,18 +2288,18 @@ int CoNWrite(UBYTE *s)
22882288
{
22892289
GETIDENTITY
22902290
UBYTE *option;
2291-
KEYWORD *key;
2291+
KEYWORDV *key;
22922292
option = s;
22932293
if ( ( ( s = SkipAName(s) ) == 0 ) || *s != 0 ) {
22942294
MesPrint("&Proper use of nwrite statement is: nwrite option");
22952295
return(1);
22962296
}
2297-
key = FindInKeyWord(option,writeoptions,sizeof(writeoptions)/sizeof(KEYWORD));
2297+
key = (KEYWORDV *)FindInKeyWord(option,(KEYWORD *)writeoptions,sizeof(writeoptions)/sizeof(KEYWORD));
22982298
if ( key == 0 ) {
22992299
MesPrint("&Unrecognized option in nwrite statement");
23002300
return(1);
23012301
}
2302-
*((int *)(key->func)) = key->flags;
2302+
*key->var = key->flags;
23032303
AR.SortType = AC.SortType;
23042304
return(0);
23052305
}

sources/declare.h

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ static inline LONG ULongToLong(ULONG x)
420420
#ifdef WITHPTHREADS
421421

422422
#define EXTERNLOCK(x) extern pthread_mutex_t x;
423-
#define INILOCK(x) pthread_mutex_t x = PTHREAD_MUTEX_INITIALIZER
423+
#define INILOCK(x) pthread_mutex_t x = PTHREAD_MUTEX_INITIALIZER;
424424
#define EXTERNRWLOCK(x) extern pthread_rwlock_t x;
425425
#define INIRWLOCK(x) pthread_rwlock_t x = PTHREAD_RWLOCK_INITIALIZER;
426426
#ifdef DEBUGGINGLOCKS
@@ -508,7 +508,7 @@ extern WORD DoesCommu(WORD *);
508508
extern int CompArg(WORD *,WORD *);
509509
extern WORD CompCoef(WORD *, WORD *);
510510
extern WORD CompGroup(PHEAD WORD,WORD **,WORD *,WORD *,WORD);
511-
extern WORD Compare1(PHEAD WORD *,WORD *,WORD);
511+
extern WORD Compare1(WORD *,WORD *,WORD);
512512
extern WORD CountDo(WORD *,WORD *);
513513
extern WORD CountFun(WORD *,WORD *);
514514
extern WORD DimensionSubterm(WORD *);
@@ -535,13 +535,13 @@ extern int DoShattering(PHEAD WORD *,WORD *,WORD *,WORD);
535535
extern WORD GenerateTopologies(PHEAD WORD,WORD,WORD,WORD);
536536
extern WORD DoTableExpansion(WORD *,WORD);
537537
extern WORD DoDistrib(PHEAD WORD *,WORD);
538-
extern WORD DoShuffle(PHEAD WORD *,WORD,WORD,WORD);
538+
extern WORD DoShuffle(WORD *,WORD,WORD,WORD);
539539
extern WORD DoPermutations(PHEAD WORD *,WORD);
540-
extern int Shuffle(PHEAD WORD *, WORD *, WORD *);
541-
extern int FinishShuffle(PHEAD WORD *);
542-
extern WORD DoStuffle(PHEAD WORD *,WORD,WORD,WORD);
543-
extern int Stuffle(PHEAD WORD *, WORD *, WORD *);
544-
extern int FinishStuffle(PHEAD WORD *);
540+
extern int Shuffle(WORD *, WORD *, WORD *);
541+
extern int FinishShuffle(WORD *);
542+
extern WORD DoStuffle(WORD *,WORD,WORD,WORD);
543+
extern int Stuffle(WORD *, WORD *, WORD *);
544+
extern int FinishStuffle(WORD *);
545545
extern WORD *StuffRootAdd(WORD *, WORD *, WORD *);
546546
extern WORD TestUse(WORD *,WORD);
547547
extern DBASE *FindTB(UBYTE *);
@@ -906,6 +906,8 @@ extern int DoSystem(UBYTE *);
906906
extern int DoPipe(UBYTE *);
907907
extern VOID StartPrepro(VOID);
908908
extern int DoIfdef(UBYTE *,int);
909+
extern int DoIfydef(UBYTE *);
910+
extern int DoIfndef(UBYTE *);
909911
extern int DoElse(UBYTE *);
910912
extern int DoElseif(UBYTE *);
911913
extern int DoEndif(UBYTE *);
@@ -1446,13 +1448,10 @@ typedef int (*GETCFROMEXTCHANNEL)(VOID);
14461448
typedef int (*SETTERMINATORFOREXTERNALCHANNEL)(char *);
14471449
typedef int (*SETKILLMODEFOREXTERNALCHANNEL)(int,int);
14481450
typedef LONG (*WRITEFILE)(int,UBYTE *,LONG);
1449-
typedef WORD (*COMPARE)(PHEAD WORD *,WORD *,WORD);
14501451
typedef WORD (*GETTERM)(PHEAD WORD *);
1451-
typedef WORD (*FINISHUFFLE)(PHEAD WORD *);
1452-
typedef WORD (*DO_UFFLE)(PHEAD WORD *,WORD,WORD,WORD);
14531452

14541453
#define CompareTerms ((COMPARE)AR.CompareRoutine)
1455-
#define FiniShuffle ((FINISHUFFLE)AN.SHvar.finishuf)
1454+
#define FiniShuffle AN.SHvar.finishuf
14561455
#define DoShtuffle ((DO_UFFLE)AN.SHvar.do_uffle)
14571456

14581457
extern UBYTE *defineChannel(UBYTE*, HANDLERS*);
@@ -1473,8 +1472,8 @@ extern int ReleaseTB(VOID);
14731472

14741473
extern int SymbolNormalize(WORD *);
14751474
extern int TestFunFlag(PHEAD WORD *);
1476-
extern int CompareSymbols(PHEAD WORD *,WORD *,WORD);
1477-
extern int CompareHSymbols(PHEAD WORD *,WORD *,WORD);
1475+
extern int CompareSymbols(WORD *,WORD *,WORD);
1476+
extern int CompareHSymbols(WORD *,WORD *,WORD);
14781477
extern WORD NextPrime(PHEAD WORD);
14791478
extern UWORD wranf(PHEAD0);
14801479
extern UWORD iranf(PHEAD UWORD);

sources/diagrams.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ int DoCanonicalize(PHEAD WORD *term, WORD *params)
303303
}
304304
else { /*if ( args[4] >= 0 ) */
305305
WORD *ss, *sy, n;
306-
ss = AC.SetElementList.lijst+Sets[args[4]].first;
306+
ss = (WORD *)(AC.SetElementList.lijst)+Sets[args[4]].first;
307307
nsymlist = n = Sets[args[4]].last-Sets[args[4]].first;
308308
sy = symlist = AT.WorkPointer;
309309
NCOPY(sy,ss,n);

sources/dollar.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2471,7 +2471,7 @@ int TwoExprCompare(WORD *buf1, WORD *buf2, int oprtr)
24712471
WORD *t1, *t2, cond;
24722472
t1 = buf1; t2 = buf2;
24732473
while ( *t1 && *t2 ) {
2474-
cond = CompareTerms(BHEAD t1,t2,1);
2474+
cond = CompareTerms(t1,t2,1);
24752475
if ( cond != 0 ) {
24762476
if ( cond > 0 ) { /* t1 comes first */
24772477
switch ( oprtr ) { /* t1 is less */
@@ -3512,7 +3512,7 @@ getout2: AR.SortType = oldsorttype;
35123512
nextj1:;
35133513
s1 = *(fac[j1]); s2 = *(fac[j2]);
35143514
while ( *s1 && *s2 ) {
3515-
if ( ( ret = CompareTerms(BHEAD s2, s1, (WORD)2) ) == 0 ) {
3515+
if ( ( ret = CompareTerms(s2, s1, (WORD)2) ) == 0 ) {
35163516
s1 += *s1; s2 += *s2;
35173517
}
35183518
else if ( ret > 0 ) goto nextj;

sources/ftypes.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,6 @@
4747
* These macro's contain the comma as well. Hence we need special macro's if
4848
* there are no other arguments. These are called PHEAD0 and BHEAD0.
4949
*/
50-
#ifdef WITHPTHREADS
51-
#define PHEAD ALLPRIVATES *B,
52-
#define PHEAD0 ALLPRIVATES *B
53-
#define BHEAD B,
54-
#define BHEAD0 B
55-
#else
56-
#define PHEAD
57-
#define PHEAD0 VOID
58-
#define BHEAD
59-
#define BHEAD0
60-
#endif
6150

6251
#define WITHOUTERROR 0
6352
#define WITHERROR 1

sources/gentopo.cc

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@
1919

2020
using namespace std;
2121

22+
// The next limitation is imposed by the fact that the latest compilers
23+
// can give warnings on declarations like "int dtcl1[nNodes]"
24+
// With a bit of overkil there should be no real problems.
25+
#define MAXNODES 100
26+
#define MAXNCLASSES 100
27+
2228
// Generate scalar connected Feynman graphs.
2329

2430
//==============================================================
@@ -396,7 +402,8 @@ void MNodeClass::incMat(int nd, int td, int val)
396402
// Check whether the configuration satisfies the ordering condition or not.
397403
Bool MNodeClass::chkOrd(int nd, int ndc, MNodeClass *cl, int *dtcl)
398404
{
399-
Bool tcl[cl->nClasses];
405+
Bool tcl[MAXNCLASSES];
406+
// Bool tcl[cl->nClasses];
400407
int tn, tc, mxn, cmp, n;
401408
DUMMYUSE(nd);
402409

@@ -734,7 +741,7 @@ MNodeClass *MGraph::refineClass(MNodeClass *cl, int cn)
734741
MNodeClass *ccl = cl;
735742
int ccn = cn;
736743
MNodeClass *ncl = NULL;
737-
int ucl[nNodes];
744+
int ucl[MAXNODES];
738745
int nucl, nce;
739746
int td, cmp;
740747

@@ -902,7 +909,7 @@ int MGraph::count1PI(void)
902909
long MGraph::generate(void)
903910
{
904911
MNodeClass *cl;
905-
int dscl[nNodes];
912+
int dscl[MAXNODES];
906913
int n;
907914

908915
for (n = 0; n < nNodes; n++) {
@@ -1024,7 +1031,7 @@ void MGraph::connectClass(MNodeClass *cl, int *dscl)
10241031
void MGraph::connectNode(int sc, int ss, MNodeClass *cl, int *dscl)
10251032
{
10261033
int sn;
1027-
int dtcl[nNodes];
1034+
int dtcl[MAXNODES];
10281035

10291036
if (DEBUG0) {
10301037
printf("connectNode:begin:(%d,%d)", sc, ss);
@@ -1067,7 +1074,7 @@ void MGraph::connectNode(int sc, int ss, MNodeClass *cl, int *dscl)
10671074
void MGraph::connectLeg(int sc, int sn, int tc, int ts, MNodeClass *cl, int *dscl, int* dtcl)
10681075
{
10691076
int tn, maxself, nc2, nc, maxcon, ts1, wc, ncm;
1070-
int dtcl1[nNodes];
1077+
int dtcl1[MAXNODES];
10711078

10721079
if (DEBUG0) {
10731080
printf("connectLeg:begin:(%d,%d,%d,%d)", sc, sn, tc, ts);

0 commit comments

Comments
 (0)