Resolve many build warnings
This patch fixes many warnings from the beginning of the build up to and including the depend stage. Nearly all warnings should be gone even with -Wall.
This commit is contained in:
committed by
Jon Trulson
parent
2bf29e5d63
commit
42e891d9e7
@@ -161,7 +161,7 @@ my_if_errors (ip, cp, expecting)
|
||||
int prefixlen;
|
||||
int i;
|
||||
|
||||
sprintf (prefix, "\"%s\":%d", filename, lineno);
|
||||
snprintf (prefix, 300, "\"%s\":%d", filename, lineno);
|
||||
prefixlen = strlen(prefix);
|
||||
fprintf (stderr, "%s: %s", prefix, pd->line);
|
||||
i = cp - pd->line;
|
||||
@@ -224,7 +224,7 @@ my_eval_variable (ip, var, len)
|
||||
return 0;
|
||||
do {
|
||||
var = (*s)->s_value;
|
||||
if (!isvarfirstletter(*var) || !strcmp((*s)->s_name, var))
|
||||
if (!isvarfirstletter((int)*var) || !strcmp((*s)->s_name, var))
|
||||
break;
|
||||
s = lookup_variable (ip, var, strlen(var));
|
||||
} while (s);
|
||||
@@ -235,7 +235,7 @@ my_eval_variable (ip, var, len)
|
||||
}
|
||||
|
||||
|
||||
cppsetup(line, filep, inc)
|
||||
int cppsetup(line, filep, inc)
|
||||
register char *line;
|
||||
register struct filepointer *filep;
|
||||
register struct inclist *inc;
|
||||
|
||||
@@ -148,6 +148,7 @@ char *malloc();
|
||||
char *realloc();
|
||||
#endif
|
||||
|
||||
int match();
|
||||
char *copy();
|
||||
char *base_name();
|
||||
char *our_getline();
|
||||
@@ -155,8 +156,17 @@ struct symtab **slookup();
|
||||
struct symtab **isdefined();
|
||||
struct symtab **fdefined();
|
||||
struct filepointer *getfile();
|
||||
void included_by();
|
||||
struct inclist *newinclude();
|
||||
void inc_clean();
|
||||
struct inclist *inc_path();
|
||||
void freefile();
|
||||
void define2();
|
||||
void define();
|
||||
int find_includes();
|
||||
void recursive_pr_include();
|
||||
void add_include();
|
||||
int cppsetup();
|
||||
|
||||
#if NeedVarargsPrototypes
|
||||
extern void fatalerr(char *, ...);
|
||||
|
||||
@@ -81,6 +81,8 @@
|
||||
|
||||
#include "ifparser.h"
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
|
||||
/****************************************************************************
|
||||
@@ -89,8 +91,8 @@
|
||||
|
||||
#define DO(val) if (!(val)) return NULL
|
||||
#define CALLFUNC(ggg,fff) (*((ggg)->funcs.fff))
|
||||
#define SKIPSPACE(ccc) while (isspace(*ccc)) ccc++
|
||||
#define isvarfirstletter(ccc) (isalpha(ccc) || (ccc) == '_')
|
||||
#define SKIPSPACE(ccc) while (isspace((int)*ccc)) ccc++
|
||||
#define isvarfirstletter(ccc) (isalpha((int)ccc) || (ccc) == '_')
|
||||
|
||||
|
||||
static const char *
|
||||
@@ -106,7 +108,7 @@ parse_variable (g, cp, varp)
|
||||
|
||||
*varp = cp;
|
||||
/* EMPTY */
|
||||
for (cp++; isalnum(*cp) || *cp == '_'; cp++) ;
|
||||
for (cp++; isalnum((int)*cp) || *cp == '_'; cp++) ;
|
||||
return cp;
|
||||
}
|
||||
|
||||
@@ -120,7 +122,7 @@ parse_number (g, cp, valp)
|
||||
long base = 10;
|
||||
SKIPSPACE (cp);
|
||||
|
||||
if (!isdigit(*cp))
|
||||
if (!isdigit((int)*cp))
|
||||
return CALLFUNC(g, handle_error) (g, cp, "number");
|
||||
|
||||
*valp = 0;
|
||||
@@ -248,7 +250,7 @@ parse_value (g, cp, valp)
|
||||
return cp + 1;
|
||||
|
||||
case 'd':
|
||||
if (strncmp (cp, "defined", 7) == 0 && !isalnum(cp[7])) {
|
||||
if (strncmp (cp, "defined", 7) == 0 && !isalnum((int)cp[7])) {
|
||||
int paren = 0;
|
||||
int len;
|
||||
|
||||
@@ -269,7 +271,7 @@ parse_value (g, cp, valp)
|
||||
/* fall out */
|
||||
}
|
||||
|
||||
if (isdigit(*cp)) {
|
||||
if (isdigit((int)*cp)) {
|
||||
DO (cp = parse_number (g, cp, valp));
|
||||
} else if (!isvarfirstletter(*cp))
|
||||
return CALLFUNC(g, handle_error) (g, cp, "variable or number");
|
||||
|
||||
@@ -79,7 +79,7 @@ issymbolic(dir, component)
|
||||
struct stat st;
|
||||
char buf[ BUFSIZ ], **pp;
|
||||
|
||||
sprintf(buf, "%s%s%s", dir, *dir ? "/" : "", component);
|
||||
snprintf(buf, BUFSIZ, "%s%s%s", dir, *dir ? "/" : "", component);
|
||||
for (pp=notdotdot; *pp; pp++)
|
||||
if (strcmp(*pp, buf) == 0)
|
||||
return (TRUE);
|
||||
@@ -166,7 +166,7 @@ remove_dotdot(path)
|
||||
/*
|
||||
* copy the reconstituted path back to our pointer.
|
||||
*/
|
||||
strcpy(path, newpath);
|
||||
strncpy(path, newpath, BUFSIZ);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -299,11 +299,12 @@ struct inclist *inc_path(file, include, dot)
|
||||
if (*p == '/')
|
||||
break;
|
||||
if (p == file)
|
||||
strcpy(path, include);
|
||||
strncpy(path, include, BUFSIZ);
|
||||
else {
|
||||
strncpy(path, file, (p-file) + 1);
|
||||
path[ (p-file) + 1 ] = '\0';
|
||||
strcpy(path + (p-file) + 1, include);
|
||||
strncpy(path + (p-file) + 1, include,
|
||||
BUFSIZ - (p-file) - 1);
|
||||
}
|
||||
remove_dotdot(path);
|
||||
if (stat(path, &st) == 0) {
|
||||
@@ -320,7 +321,7 @@ struct inclist *inc_path(file, include, dot)
|
||||
*/
|
||||
if (!found)
|
||||
for (pp = includedirs; *pp; pp++) {
|
||||
sprintf(path, "%s/%s", *pp, include);
|
||||
snprintf(path, BUFSIZ, "%s/%s", *pp, include);
|
||||
remove_dotdot(path);
|
||||
if (stat(path, &st) == 0) {
|
||||
ip = newinclude(path, include);
|
||||
|
||||
@@ -148,7 +148,7 @@ catch (sig)
|
||||
struct sigaction sig_act;
|
||||
#endif /* USGISH */
|
||||
|
||||
main(argc, argv)
|
||||
int main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
@@ -491,11 +491,11 @@ char *copy(str)
|
||||
{
|
||||
register char *p = (char *)malloc(strlen(str) + 1);
|
||||
|
||||
strcpy(p, str);
|
||||
strncpy(p, str, strlen(str) + 1);
|
||||
return(p);
|
||||
}
|
||||
|
||||
match(str, list)
|
||||
int match(str, list)
|
||||
register char *str, **list;
|
||||
{
|
||||
register int i;
|
||||
@@ -642,7 +642,7 @@ redirect(line, makefile)
|
||||
stat(makefile, &st);
|
||||
if ((fdin = fopen(makefile, "r")) == NULL)
|
||||
fatalerr("cannot open \"%s\"\n", makefile);
|
||||
sprintf(backup, "%s.bak", makefile);
|
||||
snprintf(backup, BUFSIZ, "%s.bak", makefile);
|
||||
unlink(backup);
|
||||
#ifdef WIN32
|
||||
fclose(fdin);
|
||||
|
||||
@@ -45,6 +45,10 @@ in this Software without prior written authorization from The Open Group.
|
||||
|
||||
#include "def.h"
|
||||
|
||||
static int deftype();
|
||||
static int zero_value();
|
||||
static int merge2defines();
|
||||
|
||||
extern char *directives[];
|
||||
extern struct inclist maininclist;
|
||||
|
||||
@@ -56,7 +60,7 @@ gobble(filep, file, file_red)
|
||||
register char *line;
|
||||
register int type;
|
||||
|
||||
while (line = our_getline(filep)) {
|
||||
while ((line = our_getline(filep))) {
|
||||
switch(type = deftype(line, filep, file_red, file, FALSE)) {
|
||||
case IF:
|
||||
case IFFALSE:
|
||||
@@ -189,7 +193,7 @@ int deftype (line, filep, file_red, file, parse_it)
|
||||
/*
|
||||
* separate the name of a single symbol.
|
||||
*/
|
||||
while (isalnum(*p) || *p == '_')
|
||||
while (isalnum((int)*p) || *p == '_')
|
||||
*line++ = *p++;
|
||||
*line = '\0';
|
||||
break;
|
||||
@@ -265,7 +269,7 @@ struct symtab **fdefined(symbol, file, srcfile)
|
||||
if (file->i_flags & DEFCHECKED)
|
||||
return(NULL);
|
||||
file->i_flags |= DEFCHECKED;
|
||||
if (val = slookup(symbol, file))
|
||||
if ((val = slookup(symbol, file)))
|
||||
debug(1,("%s defined in %s as %s\n",
|
||||
symbol, file->i_file, (*val)->s_value));
|
||||
if (val == NULL && file->i_list)
|
||||
@@ -294,12 +298,12 @@ struct symtab **isdefined(symbol, file, srcfile)
|
||||
{
|
||||
register struct symtab **val;
|
||||
|
||||
if (val = slookup(symbol, &maininclist)) {
|
||||
if ((val = slookup(symbol, &maininclist))) {
|
||||
debug(1,("%s defined on command line\n", symbol));
|
||||
if (srcfile != NULL) *srcfile = &maininclist;
|
||||
return(val);
|
||||
}
|
||||
if (val = fdefined(symbol, file, srcfile))
|
||||
if ((val = fdefined(symbol, file, srcfile)))
|
||||
return(val);
|
||||
debug(1,("%s not defined in %s\n", symbol, file->i_file));
|
||||
return(NULL);
|
||||
@@ -314,7 +318,7 @@ zero_value(exp, filep, file_red)
|
||||
register struct filepointer *filep;
|
||||
register struct inclist *file_red;
|
||||
{
|
||||
if (cppsetup(exp, filep, file_red))
|
||||
if ((cppsetup(exp, filep, file_red)))
|
||||
return(IFFALSE);
|
||||
else
|
||||
return(IF);
|
||||
@@ -413,7 +417,7 @@ define(def, file)
|
||||
|
||||
/* Separate symbol name and its value */
|
||||
val = def;
|
||||
while (isalnum(*val) || *val == '_')
|
||||
while (isalnum((int)*val) || *val == '_')
|
||||
val++;
|
||||
if (*val)
|
||||
*val++ = '\0';
|
||||
@@ -549,7 +553,7 @@ find_includes(filep, file, file_red, recursion, failOK)
|
||||
register int type;
|
||||
boolean recfailOK;
|
||||
|
||||
while (line = our_getline(filep)) {
|
||||
while ((line = our_getline(filep))) {
|
||||
switch(type = deftype(line, filep, file_red, file, TRUE)) {
|
||||
case IF:
|
||||
doif:
|
||||
|
||||
@@ -107,13 +107,13 @@ pr(ip, file, base)
|
||||
len = strlen(ip->i_file)+1;
|
||||
if (current_len + len > width || file != lastfile) {
|
||||
lastfile = file;
|
||||
sprintf(buf, "\n%s%s%s: %s", objprefix, base, objsuffix,
|
||||
ip->i_file);
|
||||
snprintf(buf, BUFSIZ, "\n%s%s%s: %s", objprefix, base,
|
||||
objsuffix, ip->i_file);
|
||||
len = current_len = strlen(buf);
|
||||
}
|
||||
else {
|
||||
buf[0] = ' ';
|
||||
strcpy(buf+1, ip->i_file);
|
||||
strncpy(buf+1, ip->i_file, BUFSIZ - 1);
|
||||
current_len += len;
|
||||
}
|
||||
fwrite(buf, len, 1, stdout);
|
||||
|
||||
Reference in New Issue
Block a user