Commit ce1cc601 by Kaveh R. Ghazi Committed by Kaveh Ghazi

Warning fixes:

	* builtins.c (c_getstr): Constify variable.
	* gmon-sol2.c (_mcleanup): Comment out #endif labels.
	* conflict.c (const_conflict_graph_arc): New typedef.
	(arc_hash, arc_eq): Avoid needlessly casting away const-ness.
	* cppmacro.c (builtin_macro): Likewise.
	* dwarf2out.c (output_comp_unit): Constify variable.
	* fix-header.c (v_fatal): Add ATTRIBUTE_PRINTF.
	* protoize.c (IS_SAME_PATH_CHAR): Use TOUPPER, not toupper.
	* ssa.c (ssa_rename_from_hash_function): Avoid needlessly casting
	away const-ness.
	* tradcpp.c (rescan, do_line, macroexpand, macarg): Use
	ISALNUM/ISDIGIT/ISPRINT, not isalnum/isdigit/isprint.
	* varasm.c (const_str_htab_hash, const_str_htab_eq,
	compare_constant_1, record_constant_1): Constify.

From-SVN: r37565
parent 7e9355c6
2000-11-19 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* builtins.c (c_getstr): Constify variable.
* gmon-sol2.c (_mcleanup): Comment out #endif labels.
* conflict.c (const_conflict_graph_arc): New typedef.
(arc_hash, arc_eq): Avoid needlessly casting away const-ness.
* cppmacro.c (builtin_macro): Likewise.
* dwarf2out.c (output_comp_unit): Constify variable.
* fix-header.c (v_fatal): Add ATTRIBUTE_PRINTF.
* protoize.c (IS_SAME_PATH_CHAR): Use TOUPPER, not toupper.
* ssa.c (ssa_rename_from_hash_function): Avoid needlessly casting
away const-ness.
* tradcpp.c (rescan, do_line, macroexpand, macarg): Use
ISALNUM/ISDIGIT/ISPRINT, not isalnum/isdigit/isprint.
* varasm.c (const_str_htab_hash, const_str_htab_eq,
compare_constant_1, record_constant_1): Constify.
2000-11-18 Richard Henderson <rth@redhat.com> 2000-11-18 Richard Henderson <rth@redhat.com>
* c-decl.c (grokdeclarator): Special case the creation of an * c-decl.c (grokdeclarator): Special case the creation of an
......
...@@ -278,7 +278,7 @@ c_getstr (src) ...@@ -278,7 +278,7 @@ c_getstr (src)
{ {
tree offset_node; tree offset_node;
int offset, max; int offset, max;
char *ptr; const char *ptr;
src = string_constant (src, &offset_node); src = string_constant (src, &offset_node);
if (src == 0) if (src == 0)
...@@ -301,7 +301,7 @@ c_getstr (src) ...@@ -301,7 +301,7 @@ c_getstr (src)
return 0; return 0;
} }
return (const char *) ptr + offset; return ptr + offset;
} }
/* Given TEM, a pointer to a stack frame, follow the dynamic chain COUNT /* Given TEM, a pointer to a stack frame, follow the dynamic chain COUNT
......
...@@ -208,7 +208,7 @@ _mcleanup() ...@@ -208,7 +208,7 @@ _mcleanup()
} }
# ifdef DEBUG # ifdef DEBUG
fprintf( stderr , "[mcleanup] sbuf 0x%x ssiz %d\n" , sbuf , ssiz ); fprintf( stderr , "[mcleanup] sbuf 0x%x ssiz %d\n" , sbuf , ssiz );
# endif DEBUG # endif /* DEBUG */
write( fd , sbuf , ssiz ); write( fd , sbuf , ssiz );
endfrom = s_textsize / (HASHFRACTION * sizeof(*froms)); endfrom = s_textsize / (HASHFRACTION * sizeof(*froms));
for ( fromindex = 0 ; fromindex < endfrom ; fromindex++ ) { for ( fromindex = 0 ; fromindex < endfrom ; fromindex++ ) {
...@@ -221,7 +221,7 @@ _mcleanup() ...@@ -221,7 +221,7 @@ _mcleanup()
fprintf( stderr , fprintf( stderr ,
"[mcleanup] frompc 0x%x selfpc 0x%x count %d\n" , "[mcleanup] frompc 0x%x selfpc 0x%x count %d\n" ,
frompc , tos[toindex].selfpc , tos[toindex].count ); frompc , tos[toindex].selfpc , tos[toindex].count );
# endif DEBUG # endif /* DEBUG */
rawarc.raw_frompc = (unsigned long) frompc; rawarc.raw_frompc = (unsigned long) frompc;
rawarc.raw_selfpc = (unsigned long) tos[toindex].selfpc; rawarc.raw_selfpc = (unsigned long) tos[toindex].selfpc;
rawarc.raw_count = tos[toindex].count; rawarc.raw_count = tos[toindex].count;
......
...@@ -85,6 +85,7 @@ struct conflict_graph_arc_def ...@@ -85,6 +85,7 @@ struct conflict_graph_arc_def
}; };
typedef struct conflict_graph_arc_def *conflict_graph_arc; typedef struct conflict_graph_arc_def *conflict_graph_arc;
typedef const struct conflict_graph_arc_def *const_conflict_graph_arc;
/* A conflict graph. */ /* A conflict graph. */
...@@ -127,7 +128,7 @@ static unsigned ...@@ -127,7 +128,7 @@ static unsigned
arc_hash (arcp) arc_hash (arcp)
const void *arcp; const void *arcp;
{ {
conflict_graph_arc arc = (conflict_graph_arc) arcp; const_conflict_graph_arc arc = (const_conflict_graph_arc) arcp;
return CONFLICT_HASH_FN (arc->smaller, arc->larger); return CONFLICT_HASH_FN (arc->smaller, arc->larger);
} }
...@@ -140,8 +141,8 @@ arc_eq (arcp1, arcp2) ...@@ -140,8 +141,8 @@ arc_eq (arcp1, arcp2)
const void *arcp1; const void *arcp1;
const void *arcp2; const void *arcp2;
{ {
conflict_graph_arc arc1 = (conflict_graph_arc) arcp1; const_conflict_graph_arc arc1 = (const_conflict_graph_arc) arcp1;
conflict_graph_arc arc2 = (conflict_graph_arc) arcp2; const_conflict_graph_arc arc2 = (const_conflict_graph_arc) arcp2;
return arc1->smaller == arc2->smaller && arc1->larger == arc2->larger; return arc1->smaller == arc2->smaller && arc1->larger == arc2->larger;
} }
......
...@@ -170,7 +170,7 @@ builtin_macro (pfile, token) ...@@ -170,7 +170,7 @@ builtin_macro (pfile, token)
file = ip->nominal_fname; file = ip->nominal_fname;
} }
make_string_token (pfile->string_pool, token, make_string_token (pfile->string_pool, token,
(U_CHAR *) file, strlen (file)); (const U_CHAR *) file, strlen (file));
} }
break; break;
......
...@@ -6110,7 +6110,7 @@ static void ...@@ -6110,7 +6110,7 @@ static void
output_comp_unit (die) output_comp_unit (die)
dw_die_ref die; dw_die_ref die;
{ {
char *secname; const char *secname;
if (die->die_child == 0) if (die->die_child == 0)
return; return;
...@@ -6126,12 +6126,13 @@ output_comp_unit (die) ...@@ -6126,12 +6126,13 @@ output_comp_unit (die)
if (die->die_symbol) if (die->die_symbol)
{ {
secname = (char *) alloca (strlen (die->die_symbol) + 24); char *tmp = (char *) alloca (strlen (die->die_symbol) + 24);
sprintf (secname, ".gnu.linkonce.wi.%s", die->die_symbol); sprintf (tmp, ".gnu.linkonce.wi.%s", die->die_symbol);
secname = tmp;
die->die_symbol = NULL; die->die_symbol = NULL;
} }
else else
secname = (char *) DEBUG_INFO_SECTION; secname = (const char *) DEBUG_INFO_SECTION;
/* Output debugging information. */ /* Output debugging information. */
fputc ('\n', asm_out_file); fputc ('\n', asm_out_file);
......
...@@ -77,7 +77,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ ...@@ -77,7 +77,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "scan.h" #include "scan.h"
#include "cpplib.h" #include "cpplib.h"
static void v_fatal PARAMS ((const char *, va_list)) ATTRIBUTE_NORETURN; static void v_fatal PARAMS ((const char *, va_list)) ATTRIBUTE_PRINTF (1,0) ATTRIBUTE_NORETURN;
static void fatal PARAMS ((const char *, ...)) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; static void fatal PARAMS ((const char *, ...)) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
sstring buf; sstring buf;
......
...@@ -36,7 +36,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -36,7 +36,7 @@ Boston, MA 02111-1307, USA. */
/* Macro to see if the path elements match. */ /* Macro to see if the path elements match. */
#ifdef HAVE_DOS_BASED_FILE_SYSTEM #ifdef HAVE_DOS_BASED_FILE_SYSTEM
#define IS_SAME_PATH_CHAR(a,b) (toupper (a) == toupper (b)) #define IS_SAME_PATH_CHAR(a,b) (TOUPPER (a) == TOUPPER (b))
#else #else
#define IS_SAME_PATH_CHAR(a,b) ((a) == (b)) #define IS_SAME_PATH_CHAR(a,b) ((a) == (b))
#endif #endif
......
...@@ -384,7 +384,7 @@ static hashval_t ...@@ -384,7 +384,7 @@ static hashval_t
ssa_rename_from_hash_function (srfp) ssa_rename_from_hash_function (srfp)
const void *srfp; const void *srfp;
{ {
return ((ssa_rename_from_pair *) srfp)->reg; return ((const ssa_rename_from_pair *) srfp)->reg;
} }
/* Test whether two hash table entries SRFP1 and SRFP2 are equal. */ /* Test whether two hash table entries SRFP1 and SRFP2 are equal. */
......
...@@ -1359,7 +1359,7 @@ do { ip = &instack[indepth]; \ ...@@ -1359,7 +1359,7 @@ do { ip = &instack[indepth]; \
ibp += 2; ibp += 2;
} }
c = *ibp++; c = *ibp++;
if (!isalnum (c) && c != '.' && c != '_') { if (!ISALNUM (c) && c != '.' && c != '_') {
--ibp; --ibp;
break; break;
} }
...@@ -2888,7 +2888,7 @@ do_line (buf, limit, op, keyword) ...@@ -2888,7 +2888,7 @@ do_line (buf, limit, op, keyword)
bp = tem.buf; bp = tem.buf;
SKIP_WHITE_SPACE (bp); SKIP_WHITE_SPACE (bp);
if (!isdigit (*bp)) { if (!ISDIGIT (*bp)) {
error ("invalid format #line command"); error ("invalid format #line command");
return; return;
} }
...@@ -2899,7 +2899,7 @@ do_line (buf, limit, op, keyword) ...@@ -2899,7 +2899,7 @@ do_line (buf, limit, op, keyword)
new_lineno = atoi ((const char *)bp) - 1; new_lineno = atoi ((const char *)bp) - 1;
/* skip over the line number. */ /* skip over the line number. */
while (isdigit (*bp)) while (ISDIGIT (*bp))
bp++; bp++;
#if 0 /* #line 10"foo.c" is supposed to be allowed. */ #if 0 /* #line 10"foo.c" is supposed to be allowed. */
...@@ -3726,7 +3726,7 @@ macroexpand (hp, op) ...@@ -3726,7 +3726,7 @@ macroexpand (hp, op)
/* Escape these chars */ /* Escape these chars */
if (c == '\"' || (in_string && c == '\\')) if (c == '\"' || (in_string && c == '\\'))
xbuf[totlen++] = '\\'; xbuf[totlen++] = '\\';
if (isprint (c)) if (ISPRINT (c))
xbuf[totlen++] = c; xbuf[totlen++] = c;
else { else {
sprintf ((char *) &xbuf[totlen], "\\%03o", (unsigned int) c); sprintf ((char *) &xbuf[totlen], "\\%03o", (unsigned int) c);
...@@ -3928,7 +3928,7 @@ macarg (argptr) ...@@ -3928,7 +3928,7 @@ macarg (argptr)
in case we need to keep it all. */ in case we need to keep it all. */
if (c == '\"' || c == '\\') /* escape these chars */ if (c == '\"' || c == '\\') /* escape these chars */
totlen++; totlen++;
else if (!isprint (c)) else if (!ISPRINT (c))
totlen += 3; totlen += 3;
} }
argptr->stringified_length = totlen; argptr->stringified_length = totlen;
......
...@@ -2402,7 +2402,7 @@ static hashval_t ...@@ -2402,7 +2402,7 @@ static hashval_t
const_str_htab_hash (x) const_str_htab_hash (x)
const void *x; const void *x;
{ {
return STRHASH (((struct deferred_string *) x)->label); return STRHASH (((const struct deferred_string *) x)->label);
} }
/* Returns non-zero if the value represented by X (which is really a /* Returns non-zero if the value represented by X (which is really a
...@@ -2414,7 +2414,7 @@ const_str_htab_eq (x, y) ...@@ -2414,7 +2414,7 @@ const_str_htab_eq (x, y)
const void *x; const void *x;
const void *y; const void *y;
{ {
return (((struct deferred_string *) x)->label == (char *) y); return (((const struct deferred_string *) x)->label == (const char *) y);
} }
/* Delete the hash table entry dfsp. */ /* Delete the hash table entry dfsp. */
...@@ -2607,7 +2607,7 @@ compare_constant_1 (exp, p) ...@@ -2607,7 +2607,7 @@ compare_constant_1 (exp, p)
if ((enum machine_mode) *p++ != TYPE_MODE (TREE_TYPE (exp))) if ((enum machine_mode) *p++ != TYPE_MODE (TREE_TYPE (exp)))
return 0; return 0;
strp = (unsigned char *)TREE_STRING_POINTER (exp); strp = (const unsigned char *)TREE_STRING_POINTER (exp);
len = TREE_STRING_LENGTH (exp); len = TREE_STRING_LENGTH (exp);
if (memcmp ((char *) &TREE_STRING_LENGTH (exp), p, if (memcmp ((char *) &TREE_STRING_LENGTH (exp), p,
sizeof TREE_STRING_LENGTH (exp))) sizeof TREE_STRING_LENGTH (exp)))
...@@ -2750,8 +2750,8 @@ compare_constant_1 (exp, p) ...@@ -2750,8 +2750,8 @@ compare_constant_1 (exp, p)
return 0; return 0;
/* Compare symbol name. */ /* Compare symbol name. */
strp = (unsigned char *) XSTR (value.base, 0); strp = (const unsigned char *) XSTR (value.base, 0);
len = strlen ((char *) strp) + 1; len = strlen ((const char *) strp) + 1;
} }
break; break;
...@@ -2816,7 +2816,7 @@ static void ...@@ -2816,7 +2816,7 @@ static void
record_constant_1 (exp) record_constant_1 (exp)
tree exp; tree exp;
{ {
register unsigned char *strp; register const unsigned char *strp;
register int len; register int len;
register enum tree_code code = TREE_CODE (exp); register enum tree_code code = TREE_CODE (exp);
...@@ -2841,7 +2841,7 @@ record_constant_1 (exp) ...@@ -2841,7 +2841,7 @@ record_constant_1 (exp)
return; return;
obstack_1grow (&permanent_obstack, TYPE_MODE (TREE_TYPE (exp))); obstack_1grow (&permanent_obstack, TYPE_MODE (TREE_TYPE (exp)));
strp = (unsigned char *) TREE_STRING_POINTER (exp); strp = (const unsigned char *) TREE_STRING_POINTER (exp);
len = TREE_STRING_LENGTH (exp); len = TREE_STRING_LENGTH (exp);
obstack_grow (&permanent_obstack, (char *) &TREE_STRING_LENGTH (exp), obstack_grow (&permanent_obstack, (char *) &TREE_STRING_LENGTH (exp),
sizeof TREE_STRING_LENGTH (exp)); sizeof TREE_STRING_LENGTH (exp));
......
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