diff options
author | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-11-19 13:15:51 +0000 |
---|---|---|
committer | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-11-19 13:15:51 +0000 |
commit | dd9977e9d827caaa0712c625804cade660dd5beb (patch) | |
tree | eaf63c52b5062fa22f55d651138eb5cd20b0a102 | |
parent | ec96e4ed1757343dff78ed5ec7b70f1389da125c (diff) | |
download | gcc-dd9977e9d827caaa0712c625804cade660dd5beb.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37565 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 17 | ||||
-rw-r--r-- | gcc/builtins.c | 4 | ||||
-rw-r--r-- | gcc/config/sparc/gmon-sol2.c | 4 | ||||
-rw-r--r-- | gcc/conflict.c | 7 | ||||
-rw-r--r-- | gcc/cppmacro.c | 2 | ||||
-rw-r--r-- | gcc/dwarf2out.c | 9 | ||||
-rw-r--r-- | gcc/fix-header.c | 2 | ||||
-rw-r--r-- | gcc/protoize.c | 2 | ||||
-rw-r--r-- | gcc/ssa.c | 2 | ||||
-rw-r--r-- | gcc/tradcpp.c | 10 | ||||
-rw-r--r-- | gcc/varasm.c | 14 |
11 files changed, 46 insertions, 27 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1e26641cb43..7788cd03504 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,20 @@ +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> * c-decl.c (grokdeclarator): Special case the creation of an diff --git a/gcc/builtins.c b/gcc/builtins.c index ec12cae98ce..221cba6f34b 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -278,7 +278,7 @@ c_getstr (src) { tree offset_node; int offset, max; - char *ptr; + const char *ptr; src = string_constant (src, &offset_node); if (src == 0) @@ -301,7 +301,7 @@ c_getstr (src) return 0; } - return (const char *) ptr + offset; + return ptr + offset; } /* Given TEM, a pointer to a stack frame, follow the dynamic chain COUNT diff --git a/gcc/config/sparc/gmon-sol2.c b/gcc/config/sparc/gmon-sol2.c index 1e5f0da9467..6d6696644d9 100644 --- a/gcc/config/sparc/gmon-sol2.c +++ b/gcc/config/sparc/gmon-sol2.c @@ -208,7 +208,7 @@ _mcleanup() } # ifdef DEBUG fprintf( stderr , "[mcleanup] sbuf 0x%x ssiz %d\n" , sbuf , ssiz ); -# endif DEBUG +# endif /* DEBUG */ write( fd , sbuf , ssiz ); endfrom = s_textsize / (HASHFRACTION * sizeof(*froms)); for ( fromindex = 0 ; fromindex < endfrom ; fromindex++ ) { @@ -221,7 +221,7 @@ _mcleanup() fprintf( stderr , "[mcleanup] frompc 0x%x selfpc 0x%x count %d\n" , frompc , tos[toindex].selfpc , tos[toindex].count ); -# endif DEBUG +# endif /* DEBUG */ rawarc.raw_frompc = (unsigned long) frompc; rawarc.raw_selfpc = (unsigned long) tos[toindex].selfpc; rawarc.raw_count = tos[toindex].count; diff --git a/gcc/conflict.c b/gcc/conflict.c index d467ba1b87a..c233d234bb8 100644 --- a/gcc/conflict.c +++ b/gcc/conflict.c @@ -85,6 +85,7 @@ struct conflict_graph_arc_def }; typedef struct conflict_graph_arc_def *conflict_graph_arc; +typedef const struct conflict_graph_arc_def *const_conflict_graph_arc; /* A conflict graph. */ @@ -127,7 +128,7 @@ static unsigned arc_hash (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); } @@ -140,8 +141,8 @@ arc_eq (arcp1, arcp2) const void *arcp1; const void *arcp2; { - conflict_graph_arc arc1 = (conflict_graph_arc) arcp1; - conflict_graph_arc arc2 = (conflict_graph_arc) arcp2; + const_conflict_graph_arc arc1 = (const_conflict_graph_arc) arcp1; + const_conflict_graph_arc arc2 = (const_conflict_graph_arc) arcp2; return arc1->smaller == arc2->smaller && arc1->larger == arc2->larger; } diff --git a/gcc/cppmacro.c b/gcc/cppmacro.c index fcaa7c6df6a..978f4cbd804 100644 --- a/gcc/cppmacro.c +++ b/gcc/cppmacro.c @@ -170,7 +170,7 @@ builtin_macro (pfile, token) file = ip->nominal_fname; } make_string_token (pfile->string_pool, token, - (U_CHAR *) file, strlen (file)); + (const U_CHAR *) file, strlen (file)); } break; diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index dba01479894..6ddd9824d16 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -6110,7 +6110,7 @@ static void output_comp_unit (die) dw_die_ref die; { - char *secname; + const char *secname; if (die->die_child == 0) return; @@ -6126,12 +6126,13 @@ output_comp_unit (die) if (die->die_symbol) { - secname = (char *) alloca (strlen (die->die_symbol) + 24); - sprintf (secname, ".gnu.linkonce.wi.%s", die->die_symbol); + char *tmp = (char *) alloca (strlen (die->die_symbol) + 24); + sprintf (tmp, ".gnu.linkonce.wi.%s", die->die_symbol); + secname = tmp; die->die_symbol = NULL; } else - secname = (char *) DEBUG_INFO_SECTION; + secname = (const char *) DEBUG_INFO_SECTION; /* Output debugging information. */ fputc ('\n', asm_out_file); diff --git a/gcc/fix-header.c b/gcc/fix-header.c index 3741a138333..be377de6b7a 100644 --- a/gcc/fix-header.c +++ b/gcc/fix-header.c @@ -77,7 +77,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "scan.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; sstring buf; diff --git a/gcc/protoize.c b/gcc/protoize.c index 580fa146305..6816952ef09 100644 --- a/gcc/protoize.c +++ b/gcc/protoize.c @@ -36,7 +36,7 @@ Boston, MA 02111-1307, USA. */ /* Macro to see if the path elements match. */ #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 #define IS_SAME_PATH_CHAR(a,b) ((a) == (b)) #endif diff --git a/gcc/ssa.c b/gcc/ssa.c index 3dabc626a14..d57720e032f 100644 --- a/gcc/ssa.c +++ b/gcc/ssa.c @@ -384,7 +384,7 @@ static hashval_t ssa_rename_from_hash_function (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. */ diff --git a/gcc/tradcpp.c b/gcc/tradcpp.c index 3e4955fb401..1117748fb1a 100644 --- a/gcc/tradcpp.c +++ b/gcc/tradcpp.c @@ -1359,7 +1359,7 @@ do { ip = &instack[indepth]; \ ibp += 2; } c = *ibp++; - if (!isalnum (c) && c != '.' && c != '_') { + if (!ISALNUM (c) && c != '.' && c != '_') { --ibp; break; } @@ -2888,7 +2888,7 @@ do_line (buf, limit, op, keyword) bp = tem.buf; SKIP_WHITE_SPACE (bp); - if (!isdigit (*bp)) { + if (!ISDIGIT (*bp)) { error ("invalid format #line command"); return; } @@ -2899,7 +2899,7 @@ do_line (buf, limit, op, keyword) new_lineno = atoi ((const char *)bp) - 1; /* skip over the line number. */ - while (isdigit (*bp)) + while (ISDIGIT (*bp)) bp++; #if 0 /* #line 10"foo.c" is supposed to be allowed. */ @@ -3726,7 +3726,7 @@ macroexpand (hp, op) /* Escape these chars */ if (c == '\"' || (in_string && c == '\\')) xbuf[totlen++] = '\\'; - if (isprint (c)) + if (ISPRINT (c)) xbuf[totlen++] = c; else { sprintf ((char *) &xbuf[totlen], "\\%03o", (unsigned int) c); @@ -3928,7 +3928,7 @@ macarg (argptr) in case we need to keep it all. */ if (c == '\"' || c == '\\') /* escape these chars */ totlen++; - else if (!isprint (c)) + else if (!ISPRINT (c)) totlen += 3; } argptr->stringified_length = totlen; diff --git a/gcc/varasm.c b/gcc/varasm.c index 8faedda980f..170cf09ab1c 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -2402,7 +2402,7 @@ static hashval_t const_str_htab_hash (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 @@ -2414,7 +2414,7 @@ const_str_htab_eq (x, y) const void *x; 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. */ @@ -2607,7 +2607,7 @@ compare_constant_1 (exp, p) if ((enum machine_mode) *p++ != TYPE_MODE (TREE_TYPE (exp))) return 0; - strp = (unsigned char *)TREE_STRING_POINTER (exp); + strp = (const unsigned char *)TREE_STRING_POINTER (exp); len = TREE_STRING_LENGTH (exp); if (memcmp ((char *) &TREE_STRING_LENGTH (exp), p, sizeof TREE_STRING_LENGTH (exp))) @@ -2750,8 +2750,8 @@ compare_constant_1 (exp, p) return 0; /* Compare symbol name. */ - strp = (unsigned char *) XSTR (value.base, 0); - len = strlen ((char *) strp) + 1; + strp = (const unsigned char *) XSTR (value.base, 0); + len = strlen ((const char *) strp) + 1; } break; @@ -2816,7 +2816,7 @@ static void record_constant_1 (exp) tree exp; { - register unsigned char *strp; + register const unsigned char *strp; register int len; register enum tree_code code = TREE_CODE (exp); @@ -2841,7 +2841,7 @@ record_constant_1 (exp) return; 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); obstack_grow (&permanent_obstack, (char *) &TREE_STRING_LENGTH (exp), sizeof TREE_STRING_LENGTH (exp)); |