Commit 91e0f659 by Kaveh R. Ghazi Committed by Kaveh Ghazi

Warning fixes:

        * choose-temp.c: Prototype mkstemps() when IN_GCC.
        * cplus-dem.c (consume_count): Cast argument of ctype macro to
        `unsigned char'.
        (cplus_demangle_opname): Cast the result of `strlen' to (int) when
        comparing against one.
        (cplus_mangle_opname): Likewise.
        (demangle_integral_value): Cast argument of ctype macro to
        `unsigned char'.
        (demangle_template_value_parm): Likewise.
        (demangle_template): Initialize variable `bindex'.  Cast the
        result of `strlen' to (int) when comparing against one.  Remove
        unused variable `start_of_value_parm'.
        (demangle_class_name): Cast the result of `strlen' to (int) when
        comparing against one.
        (demangle_prefix): Cast argument of ctype macro to `unsigned char'.
        (gnu_special): Likewise.  Cast the result of `strlen' to (int)
        when comparing against one.
        (demangle_qualified): Cast argument of ctype macro to `unsigned char'.
        (get_count): Likewise.
        (do_type): Likewise.  Cast the result of `strlen' to (int) when
        comparing against one.
        (demangle_fund_type): Cast argument of ctype macro to `unsigned char'.
        (demangle_function_name): Cast the result of `strlen' to (int)
        when comparing against one.
        * mkstemp.c (mkstemps): Cast variable `len' to (int) when
        comparing against one.

From-SVN: r23113
parent ce0a5952
Thu Oct 15 18:51:12 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* choose-temp.c: Prototype mkstemps() when IN_GCC.
* cplus-dem.c (consume_count): Cast argument of ctype macro to
`unsigned char'.
(cplus_demangle_opname): Cast the result of `strlen' to (int) when
comparing against one.
(cplus_mangle_opname): Likewise.
(demangle_integral_value): Cast argument of ctype macro to
`unsigned char'.
(demangle_template_value_parm): Likewise.
(demangle_template): Initialize variable `bindex'. Cast the
result of `strlen' to (int) when comparing against one. Remove
unused variable `start_of_value_parm'.
(demangle_class_name): Cast the result of `strlen' to (int) when
comparing against one.
(demangle_prefix): Cast argument of ctype macro to `unsigned char'.
(gnu_special): Likewise. Cast the result of `strlen' to (int)
when comparing against one.
(demangle_qualified): Cast argument of ctype macro to `unsigned char'.
(get_count): Likewise.
(do_type): Likewise. Cast the result of `strlen' to (int) when
comparing against one.
(demangle_fund_type): Cast argument of ctype macro to `unsigned char'.
(demangle_function_name): Cast the result of `strlen' to (int)
when comparing against one.
* mkstemp.c (mkstemps): Cast variable `len' to (int) when
comparing against one.
Tue Oct 13 23:51:51 1998 Jeffrey A Law (law@cygnus.com) Tue Oct 13 23:51:51 1998 Jeffrey A Law (law@cygnus.com)
* mkstemp.c: Check HAVE_SYS_TIME_H before including sys/time.h * mkstemp.c: Check HAVE_SYS_TIME_H before including sys/time.h
......
...@@ -53,6 +53,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -53,6 +53,7 @@ Boston, MA 02111-1307, USA. */
#ifdef IN_GCC #ifdef IN_GCC
#include "gansidecl.h" #include "gansidecl.h"
extern char *xmalloc (); extern char *xmalloc ();
extern int mkstemps ();
#else #else
#include "ansidecl.h" #include "ansidecl.h"
#include "libiberty.h" #include "libiberty.h"
......
...@@ -403,7 +403,7 @@ consume_count (type) ...@@ -403,7 +403,7 @@ consume_count (type)
{ {
int count = 0; int count = 0;
while (isdigit (**type)) while (isdigit ((unsigned char)**type))
{ {
count *= 10; count *= 10;
count += **type - '0'; count += **type - '0';
...@@ -426,7 +426,7 @@ consume_count_with_underscores (mangled) ...@@ -426,7 +426,7 @@ consume_count_with_underscores (mangled)
if (**mangled == '_') if (**mangled == '_')
{ {
(*mangled)++; (*mangled)++;
if (!isdigit (**mangled)) if (!isdigit ((unsigned char)**mangled))
return -1; return -1;
idx = consume_count (mangled); idx = consume_count (mangled);
...@@ -532,7 +532,7 @@ cplus_demangle_opname (opname, result, options) ...@@ -532,7 +532,7 @@ cplus_demangle_opname (opname, result, options)
for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++) for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
{ {
len1 = len - 10; len1 = len - 10;
if (strlen (optable[i].in) == len1 if ((int) strlen (optable[i].in) == len1
&& memcmp (optable[i].in, opname + 10, len1) == 0) && memcmp (optable[i].in, opname + 10, len1) == 0)
{ {
strcat (result, "operator"); strcat (result, "operator");
...@@ -549,7 +549,7 @@ cplus_demangle_opname (opname, result, options) ...@@ -549,7 +549,7 @@ cplus_demangle_opname (opname, result, options)
for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++) for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
{ {
len1 = len - 3; len1 = len - 3;
if (strlen (optable[i].in) == len1 if ((int) strlen (optable[i].in) == len1
&& memcmp (optable[i].in, opname + 3, len1) == 0) && memcmp (optable[i].in, opname + 3, len1) == 0)
{ {
strcat (result, "operator"); strcat (result, "operator");
...@@ -594,7 +594,7 @@ cplus_mangle_opname (opname, options) ...@@ -594,7 +594,7 @@ cplus_mangle_opname (opname, options)
len = strlen (opname); len = strlen (opname);
for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++) for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
{ {
if (strlen (optable[i].out) == len if ((int) strlen (optable[i].out) == len
&& (options & DMGL_ANSI) == (optable[i].flags & DMGL_ANSI) && (options & DMGL_ANSI) == (optable[i].flags & DMGL_ANSI)
&& memcmp (optable[i].out, opname, len) == 0) && memcmp (optable[i].out, opname, len) == 0)
return optable[i].in; return optable[i].in;
...@@ -1228,7 +1228,7 @@ demangle_integral_value (work, mangled, s) ...@@ -1228,7 +1228,7 @@ demangle_integral_value (work, mangled, s)
string_appendn (s, "-", 1); string_appendn (s, "-", 1);
(*mangled)++; (*mangled)++;
} }
while (isdigit (**mangled)) while (isdigit ((unsigned char)**mangled))
{ {
string_appendn (s, *mangled, 1); string_appendn (s, *mangled, 1);
(*mangled)++; (*mangled)++;
...@@ -1305,7 +1305,7 @@ demangle_template_value_parm (work, mangled, s, tk) ...@@ -1305,7 +1305,7 @@ demangle_template_value_parm (work, mangled, s, tk)
string_appendn (s, "-", 1); string_appendn (s, "-", 1);
(*mangled)++; (*mangled)++;
} }
while (isdigit (**mangled)) while (isdigit ((unsigned char)**mangled))
{ {
string_appendn (s, *mangled, 1); string_appendn (s, *mangled, 1);
(*mangled)++; (*mangled)++;
...@@ -1314,7 +1314,7 @@ demangle_template_value_parm (work, mangled, s, tk) ...@@ -1314,7 +1314,7 @@ demangle_template_value_parm (work, mangled, s, tk)
{ {
string_appendn (s, ".", 1); string_appendn (s, ".", 1);
(*mangled)++; (*mangled)++;
while (isdigit (**mangled)) while (isdigit ((unsigned char)**mangled))
{ {
string_appendn (s, *mangled, 1); string_appendn (s, *mangled, 1);
(*mangled)++; (*mangled)++;
...@@ -1324,7 +1324,7 @@ demangle_template_value_parm (work, mangled, s, tk) ...@@ -1324,7 +1324,7 @@ demangle_template_value_parm (work, mangled, s, tk)
{ {
string_appendn (s, "e", 1); string_appendn (s, "e", 1);
(*mangled)++; (*mangled)++;
while (isdigit (**mangled)) while (isdigit ((unsigned char)**mangled))
{ {
string_appendn (s, *mangled, 1); string_appendn (s, *mangled, 1);
(*mangled)++; (*mangled)++;
...@@ -1383,7 +1383,7 @@ demangle_template (work, mangled, tname, trawname, is_type, remember) ...@@ -1383,7 +1383,7 @@ demangle_template (work, mangled, tname, trawname, is_type, remember)
int success = 0; int success = 0;
const char *start; const char *start;
string temp; string temp;
int bindex; int bindex = 0;
(*mangled)++; (*mangled)++;
if (is_type) if (is_type)
...@@ -1421,7 +1421,8 @@ demangle_template (work, mangled, tname, trawname, is_type, remember) ...@@ -1421,7 +1421,8 @@ demangle_template (work, mangled, tname, trawname, is_type, remember)
} }
else else
{ {
if ((r = consume_count (mangled)) == 0 || strlen (*mangled) < r) if ((r = consume_count (mangled)) == 0
|| (int) strlen (*mangled) < r)
{ {
return (0); return (0);
} }
...@@ -1484,7 +1485,8 @@ demangle_template (work, mangled, tname, trawname, is_type, remember) ...@@ -1484,7 +1485,8 @@ demangle_template (work, mangled, tname, trawname, is_type, remember)
success = demangle_template_template_parm (work, mangled, tname); success = demangle_template_template_parm (work, mangled, tname);
if (success if (success
&& (r2 = consume_count (mangled)) > 0 && strlen (*mangled) >= r2) && (r2 = consume_count (mangled)) > 0
&& (int) strlen (*mangled) >= r2)
{ {
string_append (tname, " "); string_append (tname, " ");
string_appendn (tname, *mangled, r2); string_appendn (tname, *mangled, r2);
...@@ -1507,7 +1509,6 @@ demangle_template (work, mangled, tname, trawname, is_type, remember) ...@@ -1507,7 +1509,6 @@ demangle_template (work, mangled, tname, trawname, is_type, remember)
{ {
string param; string param;
string* s; string* s;
const char* start_of_value_parm = *mangled;
/* otherwise, value parameter */ /* otherwise, value parameter */
...@@ -1650,7 +1651,7 @@ demangle_class_name (work, mangled, declp) ...@@ -1650,7 +1651,7 @@ demangle_class_name (work, mangled, declp)
int success = 0; int success = 0;
n = consume_count (mangled); n = consume_count (mangled);
if (strlen (*mangled) >= n) if ((int) strlen (*mangled) >= n)
{ {
demangle_arm_pt (work, mangled, n, declp); demangle_arm_pt (work, mangled, n, declp);
success = 1; success = 1;
...@@ -1849,19 +1850,20 @@ demangle_prefix (work, mangled, declp) ...@@ -1849,19 +1850,20 @@ demangle_prefix (work, mangled, declp)
} }
else if (work -> static_type) else if (work -> static_type)
{ {
if (!isdigit (scan[0]) && (scan[0] != 't')) if (!isdigit ((unsigned char)scan[0]) && (scan[0] != 't'))
{ {
success = 0; success = 0;
} }
} }
else if ((scan == *mangled) else if ((scan == *mangled)
&& (isdigit (scan[2]) || (scan[2] == 'Q') || (scan[2] == 't') && (isdigit ((unsigned char)scan[2]) || (scan[2] == 'Q')
|| (scan[2] == 'K') || (scan[2] == 'H'))) || (scan[2] == 't') || (scan[2] == 'K') || (scan[2] == 'H')))
{ {
/* The ARM says nothing about the mangling of local variables. /* The ARM says nothing about the mangling of local variables.
But cfront mangles local variables by prepending __<nesting_level> But cfront mangles local variables by prepending __<nesting_level>
to them. As an extension to ARM demangling we handle this case. */ to them. As an extension to ARM demangling we handle this case. */
if ((LUCID_DEMANGLING || ARM_DEMANGLING) && isdigit (scan[2])) if ((LUCID_DEMANGLING || ARM_DEMANGLING)
&& isdigit ((unsigned char)scan[2]))
{ {
*mangled = scan + 2; *mangled = scan + 2;
consume_count (mangled); consume_count (mangled);
...@@ -1880,7 +1882,8 @@ demangle_prefix (work, mangled, declp) ...@@ -1880,7 +1882,8 @@ demangle_prefix (work, mangled, declp)
*mangled = scan + 2; *mangled = scan + 2;
} }
} }
else if ((scan == *mangled) && !isdigit (scan[2]) && (scan[2] != 't')) else if ((scan == *mangled) && !isdigit ((unsigned char)scan[2])
&& (scan[2] != 't'))
{ {
/* Mangled name starts with "__". Skip over any leading '_' characters, /* Mangled name starts with "__". Skip over any leading '_' characters,
then find the next "__" that separates the prefix from the signature. then find the next "__" that separates the prefix from the signature.
...@@ -2011,14 +2014,14 @@ gnu_special (work, mangled, declp) ...@@ -2011,14 +2014,14 @@ gnu_special (work, mangled, declp)
1); 1);
break; break;
default: default:
if (isdigit(*mangled[0])) if (isdigit((unsigned char)*mangled[0]))
{ {
n = consume_count(mangled); n = consume_count(mangled);
/* We may be seeing a too-large size, or else a /* We may be seeing a too-large size, or else a
".<digits>" indicating a static local symbol. In ".<digits>" indicating a static local symbol. In
any case, declare victory and move on; *don't* try any case, declare victory and move on; *don't* try
to use n to allocate. */ to use n to allocate. */
if (n > strlen (*mangled)) if (n > (int) strlen (*mangled))
{ {
success = 1; success = 1;
break; break;
...@@ -2282,11 +2285,11 @@ demangle_qualified (work, mangled, result, isfuncname, append) ...@@ -2282,11 +2285,11 @@ demangle_qualified (work, mangled, result, isfuncname, append)
by an underscore. */ by an underscore. */
p = *mangled + 2; p = *mangled + 2;
qualifiers = atoi (p); qualifiers = atoi (p);
if (!isdigit (*p) || *p == '0') if (!isdigit ((unsigned char)*p) || *p == '0')
success = 0; success = 0;
/* Skip the digits. */ /* Skip the digits. */
while (isdigit (*p)) while (isdigit ((unsigned char)*p))
++p; ++p;
if (*p != '_') if (*p != '_')
...@@ -2435,7 +2438,7 @@ get_count (type, count) ...@@ -2435,7 +2438,7 @@ get_count (type, count)
const char *p; const char *p;
int n; int n;
if (!isdigit (**type)) if (!isdigit ((unsigned char)**type))
{ {
return (0); return (0);
} }
...@@ -2443,7 +2446,7 @@ get_count (type, count) ...@@ -2443,7 +2446,7 @@ get_count (type, count)
{ {
*count = **type - '0'; *count = **type - '0';
(*type)++; (*type)++;
if (isdigit (**type)) if (isdigit ((unsigned char)**type))
{ {
p = *type; p = *type;
n = *count; n = *count;
...@@ -2453,7 +2456,7 @@ get_count (type, count) ...@@ -2453,7 +2456,7 @@ get_count (type, count)
n += *p - '0'; n += *p - '0';
p++; p++;
} }
while (isdigit (*p)); while (isdigit ((unsigned char)*p));
if (*p == '_') if (*p == '_')
{ {
*type = p + 1; *type = p + 1;
...@@ -2576,7 +2579,7 @@ do_type (work, mangled, result) ...@@ -2576,7 +2579,7 @@ do_type (work, mangled, result)
member = **mangled == 'M'; member = **mangled == 'M';
(*mangled)++; (*mangled)++;
if (!isdigit (**mangled) && **mangled != 't') if (!isdigit ((unsigned char)**mangled) && **mangled != 't')
{ {
success = 0; success = 0;
break; break;
...@@ -2584,10 +2587,10 @@ do_type (work, mangled, result) ...@@ -2584,10 +2587,10 @@ do_type (work, mangled, result)
string_append (&decl, ")"); string_append (&decl, ")");
string_prepend (&decl, SCOPE_STRING (work)); string_prepend (&decl, SCOPE_STRING (work));
if (isdigit (**mangled)) if (isdigit ((unsigned char)**mangled))
{ {
n = consume_count (mangled); n = consume_count (mangled);
if (strlen (*mangled) < n) if ((int) strlen (*mangled) < n)
{ {
success = 0; success = 0;
break; break;
...@@ -2897,7 +2900,7 @@ demangle_fund_type (work, mangled, result) ...@@ -2897,7 +2900,7 @@ demangle_fund_type (work, mangled, result)
break; break;
case 'G': case 'G':
(*mangled)++; (*mangled)++;
if (!isdigit (**mangled)) if (!isdigit ((unsigned char)**mangled))
{ {
success = 0; success = 0;
break; break;
...@@ -3430,7 +3433,7 @@ demangle_function_name (work, mangled, declp, scan) ...@@ -3430,7 +3433,7 @@ demangle_function_name (work, mangled, declp, scan)
for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++) for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
{ {
int len = declp->p - declp->b - 10; int len = declp->p - declp->b - 10;
if (strlen (optable[i].in) == len if ((int) strlen (optable[i].in) == len
&& memcmp (optable[i].in, declp->b + 10, len) == 0) && memcmp (optable[i].in, declp->b + 10, len) == 0)
{ {
string_clear (declp); string_clear (declp);
...@@ -3446,7 +3449,7 @@ demangle_function_name (work, mangled, declp, scan) ...@@ -3446,7 +3449,7 @@ demangle_function_name (work, mangled, declp, scan)
for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++) for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
{ {
int len = declp->p - declp->b - 3; int len = declp->p - declp->b - 3;
if (strlen (optable[i].in) == len if ((int) strlen (optable[i].in) == len
&& memcmp (optable[i].in, declp->b + 3, len) == 0) && memcmp (optable[i].in, declp->b + 3, len) == 0)
{ {
string_clear (declp); string_clear (declp);
......
...@@ -82,7 +82,7 @@ mkstemps (template, suffix_len) ...@@ -82,7 +82,7 @@ mkstemps (template, suffix_len)
len = strlen (template); len = strlen (template);
if (len < 6 + suffix_len if ((int) len < 6 + suffix_len
|| strncmp (&template[len - 6 - suffix_len], "XXXXXX", 6)) || strncmp (&template[len - 6 - suffix_len], "XXXXXX", 6))
{ {
return -1; return -1;
......
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