From 42ee120e8c49c5f9aaba35689e09f9ecef407758 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Tue, 24 Mar 2009 18:47:23 -0700 Subject: Fix gcc, sparse & lint warnings cppsetup.c:74:9: warning: Using plain integer as NULL pointer parse.c: In function `gobble': parse.c:94: warning: int format, long int arg (arg 2) parse.c: In function `find_includes': parse.c:641: warning: int format, long int arg (arg 2) parse.c:664: warning: int format, long int arg (arg 2) parse.c:677: warning: int format, long int arg (arg 2) parse.c:684: warning: int format, long int arg (arg 2) pr.c: In function `add_include': pr.c:57: warning: int format, long int arg (arg 4) pr.c:59: warning: int format, long int arg (arg 3) declared global, could be static sig_act main.c(142) predefs main.c:imakemdep.h(51) Signed-off-by: Alan Coopersmith --- cppsetup.c | 2 +- def.h | 6 +++--- imakemdep.h | 2 +- main.c | 2 +- parse.c | 10 +++++----- pr.c | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/cppsetup.c b/cppsetup.c index 5824253..3b010cb 100644 --- a/cppsetup.c +++ b/cppsetup.c @@ -71,7 +71,7 @@ lookup_variable (IfParser *ip, const char *var, int len) struct _parse_data *pd = (struct _parse_data *) ip->data; if (len > MAXNAMELEN) - return 0; + return NULL; strncpy (tmpbuf, var, len); tmpbuf[len] = '\0'; diff --git a/def.h b/def.h index ca37e73..6c705a1 100644 --- a/def.h +++ b/def.h @@ -176,6 +176,6 @@ int cppsetup(const char *filename, struct inclist *inc); -extern void fatalerr(const char *, ...); -extern void warning(const char *, ...); -extern void warning1(const char *, ...); +extern void fatalerr(const char *, ...) _X_ATTRIBUTE_PRINTF(1, 2); +extern void warning(const char *, ...) _X_ATTRIBUTE_PRINTF(1, 2); +extern void warning1(const char *, ...) _X_ATTRIBUTE_PRINTF(1, 2); diff --git a/imakemdep.h b/imakemdep.h index 60222a2..97ff5b4 100644 --- a/imakemdep.h +++ b/imakemdep.h @@ -48,7 +48,7 @@ in this Software without prior written authorization from The Open Group. #undef DEF_STRINGIFY #define DEF_EVALUATE(__x) #__x #define DEF_STRINGIFY(_x) DEF_EVALUATE(_x) -const struct symtab predefs[] = { +static const struct symtab predefs[] = { #ifdef apollo {"apollo", "1"}, #endif diff --git a/main.c b/main.c index 802ef3d..46e7c73 100644 --- a/main.c +++ b/main.c @@ -143,7 +143,7 @@ catch (int sig) #define sa_mask sv_mask #define sa_flags sv_flags #endif -struct sigaction sig_act; +static struct sigaction sig_act; #endif /* USGISH */ #ifndef USING_AUTOCONF diff --git a/parse.c b/parse.c index 36dc558..91a8df7 100644 --- a/parse.c +++ b/parse.c @@ -90,7 +90,7 @@ gobble(struct filepointer *filep, struct inclist *file, warning("%s", file_red->i_file); if (file_red != file) warning1(" (reading %s)", file->i_file); - warning1(", line %d: unknown directive == \"%s\"\n", + warning1(", line %ld: unknown directive == \"%s\"\n", filep->f_line, line); break; } @@ -637,7 +637,7 @@ find_includes(struct filepointer *filep, struct inclist *file, warning("%s", file_red->i_file); if (file_red != file) warning1(" (reading %s)", file->i_file); - warning1(", line %d: incomplete undef == \"%s\"\n", + warning1(", line %ld: incomplete undef == \"%s\"\n", filep->f_line, line); break; } @@ -660,7 +660,7 @@ find_includes(struct filepointer *filep, struct inclist *file, warning("%s", file_red->i_file); if (file_red != file) warning1(" (reading %s)", file->i_file); - warning1(", line %d: %s\n", + warning1(", line %ld: %s\n", filep->f_line, line); break; @@ -673,14 +673,14 @@ find_includes(struct filepointer *filep, struct inclist *file, warning("%s", file_red->i_file); if (file_red != file) warning1(" (reading %s)", file->i_file); - warning1(", line %d: unknown directive == \"%s\"\n", + warning1(", line %ld: unknown directive == \"%s\"\n", filep->f_line, line); break; case -2: warning("%s", file_red->i_file); if (file_red != file) warning1(" (reading %s)", file->i_file); - warning1(", line %d: incomplete include == \"%s\"\n", + warning1(", line %ld: incomplete include == \"%s\"\n", filep->f_line, line); break; } diff --git a/pr.c b/pr.c index dd9ee6e..4afffd6 100644 --- a/pr.c +++ b/pr.c @@ -53,10 +53,10 @@ add_include(struct filepointer *filep, struct inclist *file, if (failOK) return; if (file != file_red) - warning("%s (reading %s, line %d): ", + warning("%s (reading %s, line %ld): ", file_red->i_file, file->i_file, filep->f_line); else - warning("%s, line %d: ", file->i_file, filep->f_line); + warning("%s, line %ld: ", file->i_file, filep->f_line); warning1("cannot find include file \"%s\"\n", include); show_where_not = TRUE; newfile = inc_path(file->i_file, include, type); -- cgit v1.2.1