From 7c8c70e9416704d3349980711d8fa0b8825a9daa Mon Sep 17 00:00:00 2001 From: ghazi Date: Tue, 22 Dec 1998 06:57:17 +0000 Subject: [PATCH] Warning fixes: * argv.c (buildargv): Cast the result of alloca in assignment. * choose-temp.c: Include stdlib.h. * cplus-dem.c (demangle_arm_pt): Remove unused prototype. (snarf_numeric_literal): Constify first parameter. (code_for_qualifier): Avoid a gcc extension, make the parameter an int, not a char. (demangle_qualifier): Likewise. (demangle_signature): Cast the argument of a ctype function to unsigned char. (arm_pt): Add parens around assignment used as truth value. (demangle_arm_hp_template): Constify variable `args'. (do_hpacc_template_const_value): Cast the argument of a ctype function to unsigned char. (do_hpacc_template_literal): Remove unused variable `i'. (snarf_numeric_literal): Constify parameter `args'. Cast the argument of a ctype function to unsigned char. * floatformat.c (floatformat_to_double): Add explicit braces to avoid ambiguous `else'. * fnmatch.c (fnmatch): Change type of variables `c', `c1', `cstart' and `cend' to unsigned char. Cast the argument of macro `FOLD', which uses ctype functions, to unsigned char. * objalloc.c (free): Add prototype. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@24392 138bc75d-0d04-0410-961f-82ee72b054a4 --- libiberty/ChangeLog | 30 ++++++++++++++++++++++++++++++ libiberty/argv.c | 2 +- libiberty/choose-temp.c | 3 +++ libiberty/cplus-dem.c | 30 +++++++++++++----------------- libiberty/floatformat.c | 10 ++++++---- libiberty/fnmatch.c | 15 ++++++++------- libiberty/objalloc.c | 1 + 7 files changed, 62 insertions(+), 29 deletions(-) diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 8baafe0b0bd..63d9ee82ddf 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,33 @@ +Tue Dec 22 09:43:35 1998 Kaveh R. Ghazi + + * argv.c (buildargv): Cast the result of alloca in assignment. + + * choose-temp.c: Include stdlib.h. + + * cplus-dem.c (demangle_arm_pt): Remove unused prototype. + (snarf_numeric_literal): Constify first parameter. + (code_for_qualifier): Avoid a gcc extension, make the parameter an + int, not a char. + (demangle_qualifier): Likewise. + (demangle_signature): Cast the argument of a ctype function to + unsigned char. + (arm_pt): Add parens around assignment used as truth value. + (demangle_arm_hp_template): Constify variable `args'. + (do_hpacc_template_const_value): Cast the argument of a ctype + function to unsigned char. + (do_hpacc_template_literal): Remove unused variable `i'. + (snarf_numeric_literal): Constify parameter `args'. + Cast the argument of a ctype function to unsigned char. + + * floatformat.c (floatformat_to_double): Add explicit braces to + avoid ambiguous `else'. + + * fnmatch.c (fnmatch): Change type of variables `c', `c1', + `cstart' and `cend' to unsigned char. Cast the argument of macro + `FOLD', which uses ctype functions, to unsigned char. + + * objalloc.c (free): Add prototype. + Sun Dec 20 16:03:46 1998 Hans-Peter Nilsson * Makefile.in (CFILES): Fix typo: splay-tree.c, not splay-tree.o diff --git a/libiberty/argv.c b/libiberty/argv.c index 195d31019a0..85c17e930ee 100644 --- a/libiberty/argv.c +++ b/libiberty/argv.c @@ -225,7 +225,7 @@ char *input; if (input != NULL) { - copybuf = alloca (strlen (input) + 1); + copybuf = (char *) alloca (strlen (input) + 1); /* Is a do{}while to always execute the loop once. Always return an argv, even for null strings. See NOTES above, test case below. */ do diff --git a/libiberty/choose-temp.c b/libiberty/choose-temp.c index c295ca15b2a..49c73869155 100644 --- a/libiberty/choose-temp.c +++ b/libiberty/choose-temp.c @@ -31,6 +31,9 @@ Boston, MA 02111-1307, USA. */ #ifdef HAVE_UNISTD_H #include #endif +#ifdef HAVE_STDLIB_H +#include +#endif #ifdef HAVE_SYS_FILE_H #include /* May get R_OK, etc. on some systems. */ #endif diff --git a/libiberty/cplus-dem.c b/libiberty/cplus-dem.c index 1d0ef28ae72..eda561608a7 100644 --- a/libiberty/cplus-dem.c +++ b/libiberty/cplus-dem.c @@ -285,9 +285,6 @@ static int arm_pt PARAMS ((struct work_stuff *, const char *, int, const char **, const char **)); -static void -demangle_arm_pt PARAMS ((struct work_stuff *, const char **, int, string *)); - static int demangle_class_name PARAMS ((struct work_stuff *, const char **, string *)); @@ -402,7 +399,7 @@ static int do_hpacc_template_literal PARAMS ((struct work_stuff *, const char **, string *)); static int -snarf_numeric_literal PARAMS ((char **, string *)); +snarf_numeric_literal PARAMS ((const char **, string *)); /* There is a TYPE_QUAL value for each type qualifier. They can be combined by bitwise-or to form the complete set of qualifiers for a @@ -414,13 +411,13 @@ snarf_numeric_literal PARAMS ((char **, string *)); #define TYPE_QUAL_RESTRICT 0x4 static int -code_for_qualifier PARAMS ((char)); +code_for_qualifier PARAMS ((int)); static const char* qualifier_string PARAMS ((int)); static const char* -demangle_qualifier PARAMS ((char)); +demangle_qualifier PARAMS ((int)); /* Translate count to integer, consuming tokens in the process. Conversion terminates on the first non-digit character. @@ -483,7 +480,7 @@ consume_count_with_underscores (mangled) static int code_for_qualifier (c) - char c; + int c; { switch (c) { @@ -551,7 +548,7 @@ qualifier_string (type_quals) static const char* demangle_qualifier (c) - char c; + int c; { return qualifier_string (code_for_qualifier (c)); } @@ -1130,7 +1127,7 @@ demangle_signature (work, mangled, declp) if (HP_DEMANGLING) { (*mangled)++; - while (**mangled && isdigit (**mangled)) + while (**mangled && isdigit ((unsigned char)**mangled)) (*mangled)++; } else @@ -1768,7 +1765,7 @@ arm_pt (work, mangled, n, anchor, args) return 1; } } - else if (*anchor = mystrstr (mangled, "__S")) + else if ((*anchor = mystrstr (mangled, "__S"))) { int len; *args = *anchor + 3; @@ -1792,7 +1789,7 @@ demangle_arm_hp_template (work, mangled, n, declp) string *declp; { const char *p; - char *args; + const char *args; const char *e = *mangled + n; string arg; @@ -3356,12 +3353,12 @@ do_hpacc_template_const_value (work, mangled, result) } /* We have to be looking at an integer now */ - if (!(isdigit (**mangled))) + if (!(isdigit ((unsigned char)**mangled))) return 0; /* We only deal with integral values for template parameters -- so it's OK to look only for digits */ - while (isdigit (**mangled)) + while (isdigit ((unsigned char)**mangled)) { char_str[0] = **mangled; string_append (result, char_str); @@ -3387,7 +3384,6 @@ do_hpacc_template_literal (work, mangled, result) string *result; { int literal_len = 0; - int i; char * recurse; char * recurse_dem; @@ -3429,7 +3425,7 @@ do_hpacc_template_literal (work, mangled, result) static int snarf_numeric_literal (args, arg) - char ** args; + const char ** args; string * arg; { if (**args == '-') @@ -3441,10 +3437,10 @@ snarf_numeric_literal (args, arg) else if (**args == '+') (*args)++; - if (!isdigit (**args)) + if (!isdigit ((unsigned char)**args)) return 0; - while (isdigit (**args)) + while (isdigit ((unsigned char)**args)) { char_str[0] = **args; string_append (arg, char_str); diff --git a/libiberty/floatformat.c b/libiberty/floatformat.c index 6ad290cceb0..c4f21e4ce89 100644 --- a/libiberty/floatformat.c +++ b/libiberty/floatformat.c @@ -192,10 +192,12 @@ floatformat_to_double (fmt, from, to) increment the exponent by one to account for the integer bit. */ if (!special_exponent) - if (fmt->intbit == floatformat_intbit_no) - dto = ldexp (1.0, exponent); - else - exponent++; + { + if (fmt->intbit == floatformat_intbit_no) + dto = ldexp (1.0, exponent); + else + exponent++; + } while (mant_bits_left > 0) { diff --git a/libiberty/fnmatch.c b/libiberty/fnmatch.c index 685d9e40edc..453caced72f 100644 --- a/libiberty/fnmatch.c +++ b/libiberty/fnmatch.c @@ -71,7 +71,7 @@ fnmatch (pattern, string, flags) int flags; { register const char *p = pattern, *n = string; - register char c; + register unsigned char c; /* Note that this evalutes C many times. */ #define FOLD(c) ((flags & FNM_CASEFOLD) && isupper (c) ? tolower (c) : (c)) @@ -98,7 +98,7 @@ fnmatch (pattern, string, flags) c = *p++; c = FOLD (c); } - if (FOLD (*n) != c) + if (FOLD ((unsigned char)*n) != c) return FNM_NOMATCH; break; @@ -116,10 +116,10 @@ fnmatch (pattern, string, flags) return 0; { - char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c; + unsigned char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c; c1 = FOLD (c1); for (--p; *n != '\0'; ++n) - if ((c == '[' || FOLD (*n) == c1) && + if ((c == '[' || FOLD ((unsigned char)*n) == c1) && fnmatch (p, n, flags & ~FNM_PERIOD) == 0) return 0; return FNM_NOMATCH; @@ -144,7 +144,7 @@ fnmatch (pattern, string, flags) c = *p++; for (;;) { - register char cstart = c, cend = c; + register unsigned char cstart = c, cend = c; if (!(flags & FNM_NOESCAPE) && c == '\\') cstart = cend = *p++; @@ -174,7 +174,8 @@ fnmatch (pattern, string, flags) c = *p++; } - if (FOLD (*n) >= cstart && FOLD (*n) <= cend) + if (FOLD ((unsigned char)*n) >= cstart + && FOLD ((unsigned char)*n) <= cend) goto matched; if (c == ']') @@ -203,7 +204,7 @@ fnmatch (pattern, string, flags) break; default: - if (c != FOLD (*n)) + if (c != FOLD ((unsigned char)*n)) return FNM_NOMATCH; } diff --git a/libiberty/objalloc.c b/libiberty/objalloc.c index 34687d3891a..3474b6a50f5 100644 --- a/libiberty/objalloc.c +++ b/libiberty/objalloc.c @@ -34,6 +34,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ /* For systems with larger pointers than ints, this must be declared. */ extern PTR malloc PARAMS ((size_t)); +extern void free PARAMS ((PTR)); #endif /* These routines allocate space for an object. Freeing allocated -- 2.11.0