Commit 087aa398 by Kaveh R. Ghazi Committed by Kaveh Ghazi

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.

From-SVN: r24392
parent 4510c86d
Tue Dec 22 09:43:35 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* 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 <hp@axis.se> Sun Dec 20 16:03:46 1998 Hans-Peter Nilsson <hp@axis.se>
* Makefile.in (CFILES): Fix typo: splay-tree.c, not splay-tree.o * Makefile.in (CFILES): Fix typo: splay-tree.c, not splay-tree.o
......
...@@ -225,7 +225,7 @@ char *input; ...@@ -225,7 +225,7 @@ char *input;
if (input != NULL) 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 /* Is a do{}while to always execute the loop once. Always return an
argv, even for null strings. See NOTES above, test case below. */ argv, even for null strings. See NOTES above, test case below. */
do do
......
...@@ -31,6 +31,9 @@ Boston, MA 02111-1307, USA. */ ...@@ -31,6 +31,9 @@ Boston, MA 02111-1307, USA. */
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_SYS_FILE_H #ifdef HAVE_SYS_FILE_H
#include <sys/file.h> /* May get R_OK, etc. on some systems. */ #include <sys/file.h> /* May get R_OK, etc. on some systems. */
#endif #endif
......
...@@ -285,9 +285,6 @@ static int ...@@ -285,9 +285,6 @@ static int
arm_pt PARAMS ((struct work_stuff *, const char *, int, const char **, arm_pt PARAMS ((struct work_stuff *, const char *, int, const char **,
const char **)); const char **));
static void
demangle_arm_pt PARAMS ((struct work_stuff *, const char **, int, string *));
static int static int
demangle_class_name PARAMS ((struct work_stuff *, const char **, string *)); demangle_class_name PARAMS ((struct work_stuff *, const char **, string *));
...@@ -402,7 +399,7 @@ static int ...@@ -402,7 +399,7 @@ static int
do_hpacc_template_literal PARAMS ((struct work_stuff *, const char **, string *)); do_hpacc_template_literal PARAMS ((struct work_stuff *, const char **, string *));
static int 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 /* 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 combined by bitwise-or to form the complete set of qualifiers for a
...@@ -414,13 +411,13 @@ snarf_numeric_literal PARAMS ((char **, string *)); ...@@ -414,13 +411,13 @@ snarf_numeric_literal PARAMS ((char **, string *));
#define TYPE_QUAL_RESTRICT 0x4 #define TYPE_QUAL_RESTRICT 0x4
static int static int
code_for_qualifier PARAMS ((char)); code_for_qualifier PARAMS ((int));
static const char* static const char*
qualifier_string PARAMS ((int)); qualifier_string PARAMS ((int));
static const char* static const char*
demangle_qualifier PARAMS ((char)); demangle_qualifier PARAMS ((int));
/* Translate count to integer, consuming tokens in the process. /* Translate count to integer, consuming tokens in the process.
Conversion terminates on the first non-digit character. Conversion terminates on the first non-digit character.
...@@ -483,7 +480,7 @@ consume_count_with_underscores (mangled) ...@@ -483,7 +480,7 @@ consume_count_with_underscores (mangled)
static int static int
code_for_qualifier (c) code_for_qualifier (c)
char c; int c;
{ {
switch (c) switch (c)
{ {
...@@ -551,7 +548,7 @@ qualifier_string (type_quals) ...@@ -551,7 +548,7 @@ qualifier_string (type_quals)
static const char* static const char*
demangle_qualifier (c) demangle_qualifier (c)
char c; int c;
{ {
return qualifier_string (code_for_qualifier (c)); return qualifier_string (code_for_qualifier (c));
} }
...@@ -1130,7 +1127,7 @@ demangle_signature (work, mangled, declp) ...@@ -1130,7 +1127,7 @@ demangle_signature (work, mangled, declp)
if (HP_DEMANGLING) if (HP_DEMANGLING)
{ {
(*mangled)++; (*mangled)++;
while (**mangled && isdigit (**mangled)) while (**mangled && isdigit ((unsigned char)**mangled))
(*mangled)++; (*mangled)++;
} }
else else
...@@ -1768,7 +1765,7 @@ arm_pt (work, mangled, n, anchor, args) ...@@ -1768,7 +1765,7 @@ arm_pt (work, mangled, n, anchor, args)
return 1; return 1;
} }
} }
else if (*anchor = mystrstr (mangled, "__S")) else if ((*anchor = mystrstr (mangled, "__S")))
{ {
int len; int len;
*args = *anchor + 3; *args = *anchor + 3;
...@@ -1792,7 +1789,7 @@ demangle_arm_hp_template (work, mangled, n, declp) ...@@ -1792,7 +1789,7 @@ demangle_arm_hp_template (work, mangled, n, declp)
string *declp; string *declp;
{ {
const char *p; const char *p;
char *args; const char *args;
const char *e = *mangled + n; const char *e = *mangled + n;
string arg; string arg;
...@@ -3356,12 +3353,12 @@ do_hpacc_template_const_value (work, mangled, result) ...@@ -3356,12 +3353,12 @@ do_hpacc_template_const_value (work, mangled, result)
} }
/* We have to be looking at an integer now */ /* We have to be looking at an integer now */
if (!(isdigit (**mangled))) if (!(isdigit ((unsigned char)**mangled)))
return 0; return 0;
/* We only deal with integral values for template /* We only deal with integral values for template
parameters -- so it's OK to look only for digits */ parameters -- so it's OK to look only for digits */
while (isdigit (**mangled)) while (isdigit ((unsigned char)**mangled))
{ {
char_str[0] = **mangled; char_str[0] = **mangled;
string_append (result, char_str); string_append (result, char_str);
...@@ -3387,7 +3384,6 @@ do_hpacc_template_literal (work, mangled, result) ...@@ -3387,7 +3384,6 @@ do_hpacc_template_literal (work, mangled, result)
string *result; string *result;
{ {
int literal_len = 0; int literal_len = 0;
int i;
char * recurse; char * recurse;
char * recurse_dem; char * recurse_dem;
...@@ -3429,7 +3425,7 @@ do_hpacc_template_literal (work, mangled, result) ...@@ -3429,7 +3425,7 @@ do_hpacc_template_literal (work, mangled, result)
static int static int
snarf_numeric_literal (args, arg) snarf_numeric_literal (args, arg)
char ** args; const char ** args;
string * arg; string * arg;
{ {
if (**args == '-') if (**args == '-')
...@@ -3441,10 +3437,10 @@ snarf_numeric_literal (args, arg) ...@@ -3441,10 +3437,10 @@ snarf_numeric_literal (args, arg)
else if (**args == '+') else if (**args == '+')
(*args)++; (*args)++;
if (!isdigit (**args)) if (!isdigit ((unsigned char)**args))
return 0; return 0;
while (isdigit (**args)) while (isdigit ((unsigned char)**args))
{ {
char_str[0] = **args; char_str[0] = **args;
string_append (arg, char_str); string_append (arg, char_str);
......
...@@ -192,10 +192,12 @@ floatformat_to_double (fmt, from, to) ...@@ -192,10 +192,12 @@ floatformat_to_double (fmt, from, to)
increment the exponent by one to account for the integer bit. */ increment the exponent by one to account for the integer bit. */
if (!special_exponent) if (!special_exponent)
if (fmt->intbit == floatformat_intbit_no) {
dto = ldexp (1.0, exponent); if (fmt->intbit == floatformat_intbit_no)
else dto = ldexp (1.0, exponent);
exponent++; else
exponent++;
}
while (mant_bits_left > 0) while (mant_bits_left > 0)
{ {
......
...@@ -71,7 +71,7 @@ fnmatch (pattern, string, flags) ...@@ -71,7 +71,7 @@ fnmatch (pattern, string, flags)
int flags; int flags;
{ {
register const char *p = pattern, *n = string; register const char *p = pattern, *n = string;
register char c; register unsigned char c;
/* Note that this evalutes C many times. */ /* Note that this evalutes C many times. */
#define FOLD(c) ((flags & FNM_CASEFOLD) && isupper (c) ? tolower (c) : (c)) #define FOLD(c) ((flags & FNM_CASEFOLD) && isupper (c) ? tolower (c) : (c))
...@@ -98,7 +98,7 @@ fnmatch (pattern, string, flags) ...@@ -98,7 +98,7 @@ fnmatch (pattern, string, flags)
c = *p++; c = *p++;
c = FOLD (c); c = FOLD (c);
} }
if (FOLD (*n) != c) if (FOLD ((unsigned char)*n) != c)
return FNM_NOMATCH; return FNM_NOMATCH;
break; break;
...@@ -116,10 +116,10 @@ fnmatch (pattern, string, flags) ...@@ -116,10 +116,10 @@ fnmatch (pattern, string, flags)
return 0; return 0;
{ {
char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c; unsigned char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c;
c1 = FOLD (c1); c1 = FOLD (c1);
for (--p; *n != '\0'; ++n) for (--p; *n != '\0'; ++n)
if ((c == '[' || FOLD (*n) == c1) && if ((c == '[' || FOLD ((unsigned char)*n) == c1) &&
fnmatch (p, n, flags & ~FNM_PERIOD) == 0) fnmatch (p, n, flags & ~FNM_PERIOD) == 0)
return 0; return 0;
return FNM_NOMATCH; return FNM_NOMATCH;
...@@ -144,7 +144,7 @@ fnmatch (pattern, string, flags) ...@@ -144,7 +144,7 @@ fnmatch (pattern, string, flags)
c = *p++; c = *p++;
for (;;) for (;;)
{ {
register char cstart = c, cend = c; register unsigned char cstart = c, cend = c;
if (!(flags & FNM_NOESCAPE) && c == '\\') if (!(flags & FNM_NOESCAPE) && c == '\\')
cstart = cend = *p++; cstart = cend = *p++;
...@@ -174,7 +174,8 @@ fnmatch (pattern, string, flags) ...@@ -174,7 +174,8 @@ fnmatch (pattern, string, flags)
c = *p++; c = *p++;
} }
if (FOLD (*n) >= cstart && FOLD (*n) <= cend) if (FOLD ((unsigned char)*n) >= cstart
&& FOLD ((unsigned char)*n) <= cend)
goto matched; goto matched;
if (c == ']') if (c == ']')
...@@ -203,7 +204,7 @@ fnmatch (pattern, string, flags) ...@@ -203,7 +204,7 @@ fnmatch (pattern, string, flags)
break; break;
default: default:
if (c != FOLD (*n)) if (c != FOLD ((unsigned char)*n))
return FNM_NOMATCH; return FNM_NOMATCH;
} }
......
...@@ -34,6 +34,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ...@@ -34,6 +34,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* For systems with larger pointers than ints, this must be declared. */ /* For systems with larger pointers than ints, this must be declared. */
extern PTR malloc PARAMS ((size_t)); extern PTR malloc PARAMS ((size_t));
extern void free PARAMS ((PTR));
#endif #endif
/* These routines allocate space for an object. Freeing allocated /* These routines allocate space for an object. Freeing allocated
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment