diff --git a/configure b/configure index 85dda98b..a702197c 100755 --- a/configure +++ b/configure @@ -3976,7 +3976,7 @@ fi if test "$GCC" = yes; then - CFLAGS="$CFLAGS -Wall -Wstrict-prototypes" + CFLAGS="$CFLAGS -Wall -Wextra -Wstrict-prototypes" fi for ac_func in setenv unsetenv glob mbstowcs setlocale diff --git a/configure.in b/configure.in index add49f9d..b687e4ad 100644 --- a/configure.in +++ b/configure.in @@ -71,7 +71,7 @@ AC_FUNC_UTIME_NULL AC_HEADER_TIME if test "$GCC" = yes; then - CFLAGS="$CFLAGS -Wall -Wstrict-prototypes" + CFLAGS="$CFLAGS -Wall -Wextra -Wstrict-prototypes" fi AC_CHECK_FUNCS(setenv unsetenv glob mbstowcs setlocale) diff --git a/src/calendar.c b/src/calendar.c index b38a74f0..2021c318 100644 --- a/src/calendar.c +++ b/src/calendar.c @@ -955,7 +955,7 @@ static int DoCalRem(ParsePtr p, int col) return E_EOLN; } if (trig.typ == SAT_TYPE) { - r=DoSatRemind(&trig, &tim, p); + r=DoSatRemind(&trig, p); if (r) { FreeTrig(&trig); if (r == E_EXPIRED) return OK; diff --git a/src/dorem.c b/src/dorem.c index b0591f9d..8f960d6e 100644 --- a/src/dorem.c +++ b/src/dorem.c @@ -68,7 +68,7 @@ int DoRem(ParsePtr p) if (trig.typ == SAT_TYPE) { PurgeEchoLine("%s\n", "#!P: Cannot purge SATISFY-type reminders"); PurgeEchoLine("%s\n", CurLine); - r=DoSatRemind(&trig, &tim, p); + r=DoSatRemind(&trig, p); if (r) { FreeTrig(&trig); if (r == E_EXPIRED) return OK; @@ -1019,7 +1019,7 @@ int ShouldTriggerReminder(Trigger *t, TimeTrig *tim, int jul, int *err) /* Do the "satisfying..." remind calculation. */ /* */ /***************************************************************/ -int DoSatRemind(Trigger *trig, TimeTrig *tim, ParsePtr p) +int DoSatRemind(Trigger *trig, ParsePtr p) { int iter, jul, r; Value v; diff --git a/src/expr.c b/src/expr.c index 2ad2678b..f87b5cfe 100644 --- a/src/expr.c +++ b/src/expr.c @@ -798,7 +798,7 @@ static int Add(void) v3.type = STR_TYPE; l1 = strlen(v1.v.str); l2 = strlen(v2.v.str); - if (MaxStringLen && (l1 + l2 > MaxStringLen)) { + if (MaxStringLen && (l1 + l2 > (size_t) MaxStringLen)) { DestroyValue(v1); DestroyValue(v2); return E_STRING_TOO_LONG; } diff --git a/src/main.c b/src/main.c index 8f894058..ce51f741 100644 --- a/src/main.c +++ b/src/main.c @@ -713,7 +713,7 @@ int DoIf(ParsePtr p) int r; unsigned syndrome; - if (NumIfs >= IF_NEST) return E_NESTED_IF; + if ((size_t) NumIfs >= IF_NEST) return E_NESTED_IF; if (ShouldIgnoreLine()) syndrome = IF_TRUE | BEFORE_ELSE; else { @@ -794,7 +794,7 @@ int DoIfTrig(ParsePtr p) int jul; - if (NumIfs >= IF_NEST) return E_NESTED_IF; + if ((size_t) NumIfs >= IF_NEST) return E_NESTED_IF; if (ShouldIgnoreLine()) syndrome = IF_TRUE | BEFORE_ELSE; else { if ( (r=ParseRem(p, &trig, &tim, 1)) ) return r; @@ -1302,6 +1302,7 @@ void UTCToLocal(int utcdate, int utctime, int *locdate, int *loctime) void SigIntHandler(int d) { + UNUSED(d); signal(SIGINT, SigIntHandler); GotSigInt(); exit(0); diff --git a/src/protos.h b/src/protos.h index 4ab6de48..be12037c 100644 --- a/src/protos.h +++ b/src/protos.h @@ -9,6 +9,9 @@ /* */ /***************************************************************/ +/* Suppress unused variable warnings */ +#define UNUSED(x) (void) x + /* Define a string assignment macro - be careful!!! */ #define STRSET(x, str) { if (x) free(x); (x) = StrDup(str); } @@ -102,7 +105,7 @@ void DumpVarTable (void); void DestroyVars (int all); int PreserveVar (char const *name); int DoPreserve (Parser *p); -int DoSatRemind (Trigger *trig, TimeTrig *tim, ParsePtr p); +int DoSatRemind (Trigger *trig, ParsePtr p); int DoMsgCommand (char const *cmd, char const *msg); int ParseNonSpaceChar (ParsePtr p, int *err, int peek); unsigned int HashVal (char const *str); diff --git a/src/queue.c b/src/queue.c index 118c35c5..220f96dc 100644 --- a/src/queue.c +++ b/src/queue.c @@ -179,7 +179,7 @@ void HandleQueuedReminders(void) while (TimeToSleep > 0L) { SleepTime = TimeToSleep; - if (Daemon > 0 && SleepTime > 60*Daemon) SleepTime = 60*Daemon; + if (Daemon > 0 && SleepTime > (unsigned int) 60*Daemon) SleepTime = 60*Daemon; /* Wake up once a minute to recalibrate sleep time in case of laptop hibernation */ diff --git a/src/rem2ps.c b/src/rem2ps.c index c888bfb5..2a603a7d 100644 --- a/src/rem2ps.c +++ b/src/rem2ps.c @@ -62,7 +62,7 @@ char const *SmallCalLoc[] = { "sbt", }; -#define NUMSMALL (sizeof(SmallCalLoc)/sizeof(SmallCalLoc[0])) +#define NUMSMALL ((int) (sizeof(SmallCalLoc)/sizeof(SmallCalLoc[0]))) char const *SmallLocation; int SmallCol1, SmallCol2; @@ -669,7 +669,8 @@ void Init(int argc, char *argv[]) char const *s; char const *t; int i=1; - int j; + size_t j; + int k; int offset; PortraitMode = 1; @@ -798,13 +799,13 @@ void Init(int argc, char *argv[]) case 'i': UseISO = 1; break; - case 'c': j=(*s); - if (!j) { + case 'c': k=(*s); + if (!k) { SmallLocation = SmallCalLoc[0]; } else { - j -= '0'; - if (j>=0 && j=0 && ktype = DATE_TYPE; if (!LastTrigValid) { val->v.val = 0; @@ -48,6 +49,7 @@ static int trig_date_func(int do_set, Value *val) static int trig_day_func(int do_set, Value *val) { int y, m, d; + UNUSED(do_set); val->type = INT_TYPE; if (!LastTrigValid) { val->v.val = -1; @@ -62,6 +64,7 @@ static int trig_day_func(int do_set, Value *val) static int trig_mon_func(int do_set, Value *val) { int y, m, d; + UNUSED(do_set); val->type = INT_TYPE; if (!LastTrigValid) { val->v.val = -1; @@ -76,6 +79,7 @@ static int trig_mon_func(int do_set, Value *val) static int trig_year_func(int do_set, Value *val) { int y, m, d; + UNUSED(do_set); val->type = INT_TYPE; if (!LastTrigValid) { val->v.val = -1; @@ -90,6 +94,7 @@ static int trig_year_func(int do_set, Value *val) static int trig_wday_func(int do_set, Value *val) { val->type = INT_TYPE; + UNUSED(do_set); if (!LastTrigValid) { val->v.val = -1; return OK; @@ -101,6 +106,7 @@ static int trig_wday_func(int do_set, Value *val) static int today_date_func(int do_set, Value *val) { + UNUSED(do_set); val->type = DATE_TYPE; val->v.val = JulianToday; return OK; @@ -108,6 +114,7 @@ static int today_date_func(int do_set, Value *val) static int today_day_func(int do_set, Value *val) { int y, m, d; + UNUSED(do_set); val->type = INT_TYPE; FromJulian(JulianToday, &y, &m, &d); val->v.val = d; @@ -117,6 +124,7 @@ static int today_day_func(int do_set, Value *val) static int today_mon_func(int do_set, Value *val) { int y, m, d; + UNUSED(do_set); val->type = INT_TYPE; FromJulian(JulianToday, &y, &m, &d); val->v.val = m+1; @@ -126,6 +134,7 @@ static int today_mon_func(int do_set, Value *val) static int today_year_func(int do_set, Value *val) { int y, m, d; + UNUSED(do_set); val->type = INT_TYPE; FromJulian(JulianToday, &y, &m, &d); val->v.val = y; @@ -134,6 +143,7 @@ static int today_year_func(int do_set, Value *val) static int today_wday_func(int do_set, Value *val) { + UNUSED(do_set); val->type = INT_TYPE; val->v.val = (JulianToday + 1) % 7; return OK; @@ -748,7 +758,7 @@ static SysVar *FindSysVar(char const *name) /***************************************************************/ void DumpSysVarByName(char const *name) { - int i; + size_t i; SysVar *v; if (!name || !*name) {