mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-16 06:18:47 +02:00
Enable warning-free compilation even with -Wextra.
This commit is contained in:
2
configure
vendored
2
configure
vendored
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 */
|
||||
|
||||
15
src/rem2ps.c
15
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<NUMSMALL) {
|
||||
SmallLocation = SmallCalLoc[j];
|
||||
k -= '0';
|
||||
if (k>=0 && k<NUMSMALL) {
|
||||
SmallLocation = SmallCalLoc[k];
|
||||
} else {
|
||||
SmallLocation = SmallCalLoc[0];
|
||||
}
|
||||
|
||||
12
src/var.c
12
src/var.c
@@ -37,6 +37,7 @@ typedef int (*SysVarFunc)(int, Value *);
|
||||
|
||||
static int trig_date_func(int do_set, Value *val)
|
||||
{
|
||||
UNUSED(do_set);
|
||||
val->type = 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) {
|
||||
|
||||
Reference in New Issue
Block a user