aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog35
-rw-r--r--gcc/bitmap.c6
-rw-r--r--gcc/bitmap.h2
-rw-r--r--gcc/c-decl.c10
-rw-r--r--gcc/c-lang.c2
-rw-r--r--gcc/c-lex.c18
-rw-r--r--gcc/c-lex.h2
-rw-r--r--gcc/c-pragma.c2
-rw-r--r--gcc/c-pragma.h2
-rw-r--r--gcc/c-tree.h16
-rw-r--r--gcc/c-typeck.c61
-rw-r--r--gcc/objc/objc-act.c2
-rw-r--r--gcc/print-tree.c4
-rw-r--r--gcc/tree.h6
14 files changed, 99 insertions, 69 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5aff4b3..f5f0092 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,38 @@
+Thu Feb 18 23:28:35 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * bitmap.c (bitmap_print): Qualify a char* with the `const' keyword.
+
+ * bitmap.h (bitmap_print): Likewise.
+
+ * c-decl.c (builtin_function, grokdeclarator, grokfield): Likewise.
+
+ * c-lang.c (build_objc_string): Likewise.
+
+ * c-lex.c (yyerror, extend_token_buffer): Likewise. Don't include
+ limits.h or ctype.h. Remove unused variable `p'.
+
+ * c-lex.h (yyerror): Qualify a char* with the `const' keyword.
+
+ * c-pragma.c (handle_pragma_token): Likewise.
+
+ * c-pragma.h (handle_pragma_token): Likewise.
+
+ * c-tree.h (build_objc_string, builtin_function, grokfield,
+ build_indirect_ref, lvalue_or_else, readonly_warning, error_init,
+ pedwarn_init): Likewise.
+
+ * c-typeck.c (convert_for_assignment, warn_for_assignment,
+ push_string, warning_init, incomplete_type_error,
+ build_indirect_ref, lvalue_or_else, readonly_warning,
+ build_c_cast, spelling, push_member_name, print_spelling,
+ error_init, pedwarn_init, start_init): Likewise.
+
+ * objc/objc-act.c (build_objc_string): Likewise.
+
+ * print-tree.c (print_node_brief, print_node): Likewise.
+
+ * tree.h (lvalue_or_else, print_node, print_node_brief): Likewise.
+
Thu Feb 18 20:44:21 1999 David Edelsohn <edelsohn@mhpcc.edu>
* regclass.c (record_reg_classes): Correctly handle 'p' constraint.
diff --git a/gcc/bitmap.c b/gcc/bitmap.c
index a5aa2e7..b4fc097 100644
--- a/gcc/bitmap.c
+++ b/gcc/bitmap.c
@@ -613,10 +613,10 @@ void
bitmap_print (file, head, prefix, suffix)
FILE *file;
bitmap head;
- char *prefix;
- char *suffix;
+ const char *prefix;
+ const char *suffix;
{
- char *comma = "";
+ const char *comma = "";
int i;
fputs (prefix, file);
diff --git a/gcc/bitmap.h b/gcc/bitmap.h
index 347758d..4ff0bf4 100644
--- a/gcc/bitmap.h
+++ b/gcc/bitmap.h
@@ -89,7 +89,7 @@ extern void bitmap_debug PROTO((bitmap));
extern void bitmap_debug_file PROTO((FILE *, bitmap));
/* Print a bitmap */
-extern void bitmap_print PROTO((FILE *, bitmap, char *, char *));
+extern void bitmap_print PROTO((FILE *, bitmap, const char *, const char *));
/* Initialize a bitmap header. */
extern bitmap bitmap_initialize PROTO((bitmap));
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 7e7970a..5f9d2fa 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -3616,10 +3616,10 @@ init_decl_processing ()
tree
builtin_function (name, type, function_code, library_name)
- char *name;
+ const char *name;
tree type;
enum built_in_function function_code;
- char *library_name;
+ const char *library_name;
{
tree decl = build_decl (FUNCTION_DECL, get_identifier (name), type);
DECL_EXTERNAL (decl) = 1;
@@ -4390,7 +4390,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
int explicit_char = 0;
int defaulted_int = 0;
tree typedef_decl = 0;
- char *name;
+ const char *name;
tree typedef_type = 0;
int funcdef_flag = 0;
enum tree_code innermost_code = ERROR_MARK;
@@ -5770,8 +5770,8 @@ start_struct (code, name)
tree
grokfield (filename, line, declarator, declspecs, width)
- char *filename;
- int line;
+ const char *filename ATTRIBUTE_UNUSED;
+ int line ATTRIBUTE_UNUSED;
tree declarator, declspecs, width;
{
tree value;
diff --git a/gcc/c-lang.c b/gcc/c-lang.c
index ed2b9e4..4c55411 100644
--- a/gcc/c-lang.c
+++ b/gcc/c-lang.c
@@ -149,7 +149,7 @@ recognize_objc_keyword ()
tree
build_objc_string (len, str)
int len ATTRIBUTE_UNUSED;
- char *str ATTRIBUTE_UNUSED;
+ const char *str ATTRIBUTE_UNUSED;
{
abort ();
return NULL_TREE;
diff --git a/gcc/c-lex.c b/gcc/c-lex.c
index 54734af..e054607 100644
--- a/gcc/c-lex.c
+++ b/gcc/c-lex.c
@@ -22,10 +22,6 @@ Boston, MA 02111-1307, USA. */
#include "system.h"
#include <setjmp.h>
-#if HAVE_LIMITS_H
-# include <limits.h>
-#endif
-
#include "rtl.h"
#include "tree.h"
#include "input.h"
@@ -38,10 +34,6 @@ Boston, MA 02111-1307, USA. */
#include "toplev.h"
#include "intl.h"
-#ifdef MAP_CHARACTER
-#include <ctype.h>
-#endif
-
/* MULTIBYTE_CHARS support only works for native compilers.
??? Ideally what we want is to model widechar support after
the current floating point support. */
@@ -132,7 +124,7 @@ static int handle_generic_pragma PROTO((int));
static int whitespace_cr PROTO((int));
static int skip_white_space PROTO((int));
static int skip_white_space_on_line PROTO((void));
-static char *extend_token_buffer PROTO((char *));
+static char *extend_token_buffer PROTO((const char *));
static int readescape PROTO((int *));
/* Do not insert generated code into the source, instead, include it.
@@ -237,8 +229,6 @@ finish_parse ()
void
init_lex ()
{
- char *p;
-
/* Make identifier nodes long enough for the language-specific slots. */
set_identifier_size (sizeof (struct lang_identifier));
@@ -494,7 +484,7 @@ skip_white_space_on_line ()
static char *
extend_token_buffer (p)
- char *p;
+ const char *p;
{
int offset = p - token_buffer;
@@ -1059,9 +1049,9 @@ readescape (ignore_ptr)
void
yyerror (msgid)
- char *msgid;
+ const char *msgid;
{
- char *string = _(msgid);
+ const char *string = _(msgid);
/* We can't print string and character constants well
because the token_buffer contains the result of processing escapes. */
diff --git a/gcc/c-lex.h b/gcc/c-lex.h
index 255de21..7d73ab5 100644
--- a/gcc/c-lex.h
+++ b/gcc/c-lex.h
@@ -81,7 +81,7 @@ extern void position_after_white_space PROTO((void));
extern int check_newline PROTO((void));
extern int yylex PROTO((void));
-extern void yyerror PROTO((char *));
+extern void yyerror PROTO((const char *));
extern void forget_protocol_qualifiers PROTO((void));
extern void remember_protocol_qualifiers PROTO((void));
diff --git a/gcc/c-pragma.c b/gcc/c-pragma.c
index f9bfbe7..d83789d 100644
--- a/gcc/c-pragma.c
+++ b/gcc/c-pragma.c
@@ -231,7 +231,7 @@ add_weak (name, value)
int
handle_pragma_token (string, token)
- char * string;
+ const char * string;
tree token;
{
static enum pragma_state state = ps_start;
diff --git a/gcc/c-pragma.h b/gcc/c-pragma.h
index 685f54a..195f175 100644
--- a/gcc/c-pragma.h
+++ b/gcc/c-pragma.h
@@ -94,7 +94,7 @@ enum pragma_state
};
/* Handle a C style pragma */
-extern int handle_pragma_token PROTO((char *, tree));
+extern int handle_pragma_token PROTO((const char *, tree));
#endif /* HANDLE_GENERIC_PRAGMAS */
#endif /* _C_PRAGMA_H */
diff --git a/gcc/c-tree.h b/gcc/c-tree.h
index e9c1c28..bcf325b 100644
--- a/gcc/c-tree.h
+++ b/gcc/c-tree.h
@@ -170,7 +170,7 @@ extern int maybe_objc_comptypes PROTO((tree, tree, int));
extern tree maybe_building_objc_message_expr PROTO((void));
extern tree maybe_objc_method_name PROTO((tree));
extern int recognize_objc_keyword PROTO((void));
-extern tree build_objc_string PROTO((int, char *));
+extern tree build_objc_string PROTO((int, const char *));
/* in c-aux-info.c */
extern void gen_aux_info_record PROTO((tree, int, int, int));
@@ -282,7 +282,7 @@ extern tree boolean_false_node;
extern tree build_enumerator PROTO((tree, tree));
/* Declare a predefined function. Return the declaration. */
-extern tree builtin_function PROTO((char *, tree, enum built_in_function function_, char *));
+extern tree builtin_function PROTO((const char *, tree, enum built_in_function function_, const char *));
/* Add qualifiers to a type, in the fashion for C. */
extern tree c_build_qualified_type PROTO((tree, int));
#define c_build_type_variant(TYPE, CONST_P, VOLATILE_P) \
@@ -307,7 +307,7 @@ extern tree get_parm_info PROTO((int));
extern tree getdecls PROTO((void));
extern tree gettags PROTO((void));
extern int global_bindings_p PROTO((void));
-extern tree grokfield PROTO((char *, int, tree, tree, tree));
+extern tree grokfield PROTO((const char *, int, tree, tree, tree));
extern tree groktypename PROTO((tree));
extern tree groktypename_in_parm_context PROTO((tree));
extern tree implicitly_declare PROTO((tree));
@@ -365,7 +365,7 @@ extern tree c_alignof PROTO((tree));
extern tree c_alignof_expr PROTO((tree));
extern tree default_conversion PROTO((tree));
extern tree build_component_ref PROTO((tree, tree));
-extern tree build_indirect_ref PROTO((tree, char *));
+extern tree build_indirect_ref PROTO((tree, const char *));
extern tree build_array_ref PROTO((tree, tree));
extern tree build_function_call PROTO((tree, tree));
extern tree parser_build_binary_op PROTO((enum tree_code,
@@ -375,8 +375,8 @@ extern tree build_binary_op PROTO((enum tree_code,
extern tree build_unary_op PROTO((enum tree_code,
tree, int));
extern int lvalue_p PROTO((tree));
-extern int lvalue_or_else PROTO((tree, char *));
-extern void readonly_warning PROTO((tree, char *));
+extern int lvalue_or_else PROTO((tree, const char *));
+extern void readonly_warning PROTO((tree, const char *));
extern int mark_addressable PROTO((tree));
extern tree build_conditional_expr PROTO((tree, tree, tree));
extern tree build_compound_expr PROTO((tree));
@@ -385,8 +385,8 @@ extern tree build_modify_expr PROTO((tree, enum tree_code,
tree));
extern tree initializer_constant_valid_p PROTO((tree, tree));
extern void store_init_value PROTO((tree, tree));
-extern void error_init PROTO((char *));
-extern void pedwarn_init PROTO((char *));
+extern void error_init PROTO((const char *));
+extern void pedwarn_init PROTO((const char *));
extern void start_init PROTO((tree, tree, int));
extern void finish_init PROTO((void));
extern void really_start_incremental_init PROTO((tree));
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index c065dc4..5133719 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -56,16 +56,17 @@ static tree pointer_diff PROTO((tree, tree));
static tree unary_complex_lvalue PROTO((enum tree_code, tree));
static void pedantic_lvalue_warning PROTO((enum tree_code));
static tree internal_build_compound_expr PROTO((tree, int));
-static tree convert_for_assignment PROTO((tree, tree, char *, tree,
+static tree convert_for_assignment PROTO((tree, tree, const char *, tree,
+ tree, int));
+static void warn_for_assignment PROTO((const char *, const char *,
tree, int));
-static void warn_for_assignment PROTO((char *, char *, tree, int));
static tree valid_compound_expr_initializer PROTO((tree, tree));
-static void push_string PROTO((char *));
+static void push_string PROTO((const char *));
static void push_member_name PROTO((tree));
static void push_array_bounds PROTO((int));
static int spelling_length PROTO((void));
static char *print_spelling PROTO((char *));
-static void warning_init PROTO((char *));
+static void warning_init PROTO((const char *));
static tree digest_init PROTO((tree, tree, int, int));
static void check_init_type_bitfields PROTO((tree));
static void output_init_element PROTO((tree, tree, tree, int));
@@ -100,7 +101,7 @@ incomplete_type_error (value, type)
tree value;
tree type;
{
- char *type_code_string;
+ const char *type_code_string;
/* Avoid duplicate error message. */
if (TREE_CODE (type) == ERROR_MARK)
@@ -1321,7 +1322,7 @@ build_component_ref (datum, component)
tree
build_indirect_ref (ptr, errorstring)
tree ptr;
- char *errorstring;
+ const char *errorstring;
{
register tree pointer = default_conversion (ptr);
register tree type = TREE_TYPE (pointer);
@@ -3231,7 +3232,7 @@ lvalue_p (ref)
int
lvalue_or_else (ref, msgid)
tree ref;
- char *msgid;
+ const char *msgid;
{
int win = lvalue_p (ref);
if (! win)
@@ -3300,7 +3301,7 @@ pedantic_lvalue_warning (code)
void
readonly_warning (arg, msgid)
tree arg;
- char *msgid;
+ const char *msgid;
{
/* Forbid assignments to iterators. */
if (TREE_CODE (arg) == VAR_DECL && ITERATOR_P (arg))
@@ -3723,7 +3724,7 @@ build_c_cast (type, expr)
if (field)
{
- char *name;
+ const char *name;
tree t;
if (pedantic)
@@ -4029,7 +4030,7 @@ build_modify_expr (lhs, modifycode, rhs)
static tree
convert_for_assignment (type, rhs, errtype, fundecl, funname, parmnum)
tree type, rhs;
- char *errtype;
+ const char *errtype;
tree fundecl, funname;
int parmnum;
{
@@ -4288,14 +4289,15 @@ convert_for_assignment (type, rhs, errtype, fundecl, funname, parmnum)
static void
warn_for_assignment (msgid, opname, function, argnum)
- char *msgid;
- char *opname;
+ const char *msgid;
+ const char *opname;
tree function;
int argnum;
{
if (opname == 0)
{
tree selector = maybe_building_objc_message_expr ();
+ char * new_opname;
if (selector && argnum > 2)
{
@@ -4305,18 +4307,21 @@ warn_for_assignment (msgid, opname, function, argnum)
if (function)
{
/* Function name is known; supply it. */
- char *argstring = _("passing arg %d of `%s'");
- opname = (char *) alloca (IDENTIFIER_LENGTH (function)
- + strlen (argstring) + 1 + 25 /*%d*/ + 1);
- sprintf (opname, argstring, argnum, IDENTIFIER_POINTER (function));
+ const char *argstring = _("passing arg %d of `%s'");
+ new_opname = (char *) alloca (IDENTIFIER_LENGTH (function)
+ + strlen (argstring) + 1 + 25
+ /*%d*/ + 1);
+ sprintf (new_opname, argstring, argnum,
+ IDENTIFIER_POINTER (function));
}
else
{
- /* Function name unknown (call through ptr); just give arg number. */
- char *argnofun = _("passing arg %d of pointer to function");
- opname = (char *) alloca (strlen (argnofun) + 1 + 25 /*%d*/ + 1);
- sprintf (opname, argnofun, argnum);
+ /* Function name unknown (call through ptr); just give arg number.*/
+ const char *argnofun = _("passing arg %d of pointer to function");
+ new_opname = (char *) alloca (strlen (argnofun) + 1 + 25 /*%d*/ + 1);
+ sprintf (new_opname, argnofun, argnum);
}
+ opname = new_opname;
}
pedwarn (msgid, opname);
}
@@ -4557,7 +4562,7 @@ struct spelling
union
{
int i;
- char *s;
+ const char *s;
} u;
};
@@ -4613,7 +4618,7 @@ static int spelling_size; /* Size of the spelling stack. */
static void
push_string (string)
- char *string;
+ const char *string;
{
PUSH_SPELLING (SPELLING_STRING, string, u.s);
}
@@ -4625,7 +4630,7 @@ push_member_name (decl)
tree decl;
{
- char *string
+ const char *string
= DECL_NAME (decl) ? IDENTIFIER_POINTER (DECL_NAME (decl)) : "<anonymous>";
PUSH_SPELLING (SPELLING_MEMBER, string, u.s);
}
@@ -4665,7 +4670,6 @@ print_spelling (buffer)
register char *buffer;
{
register char *d = buffer;
- register char *s;
register struct spelling *p;
for (p = spelling_base; p < spelling; p++)
@@ -4676,6 +4680,7 @@ print_spelling (buffer)
}
else
{
+ register const char *s;
if (p->kind == SPELLING_MEMBER)
*d++ = '.';
for (s = p->u.s; (*d = *s++); d++)
@@ -4691,7 +4696,7 @@ print_spelling (buffer)
void
error_init (msgid)
- char *msgid;
+ const char *msgid;
{
char *ofwhat;
@@ -4707,7 +4712,7 @@ error_init (msgid)
void
pedwarn_init (msgid)
- char *msgid;
+ const char *msgid;
{
char *ofwhat;
@@ -4723,7 +4728,7 @@ pedwarn_init (msgid)
static void
warning_init (msgid)
- char *msgid;
+ const char *msgid;
{
char *ofwhat;
@@ -5103,7 +5108,7 @@ start_init (decl, asmspec_tree, top_level)
tree asmspec_tree;
int top_level;
{
- char *locus;
+ const char *locus;
struct initializer_stack *p
= (struct initializer_stack *) xmalloc (sizeof (struct initializer_stack));
char *asmspec = 0;
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index 7f53d17..2ff65d1 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -1320,7 +1320,7 @@ my_build_string (len, str)
tree
build_objc_string (len, str)
int len;
- char *str;
+ const char *str;
{
tree s = build_string (len, str);
diff --git a/gcc/print-tree.c b/gcc/print-tree.c
index 9500250..18ec929 100644
--- a/gcc/print-tree.c
+++ b/gcc/print-tree.c
@@ -64,7 +64,7 @@ debug_tree (node)
void
print_node_brief (file, prefix, node, indent)
FILE *file;
- char *prefix;
+ const char *prefix;
tree node;
int indent;
{
@@ -176,7 +176,7 @@ indent_to (file, column)
void
print_node (file, prefix, node, indent)
FILE *file;
- char *prefix;
+ const char *prefix;
tree node;
int indent;
{
diff --git a/gcc/tree.h b/gcc/tree.h
index 9965a2e..88d6cf1 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -1672,7 +1672,7 @@ extern int staticp PROTO((tree));
/* Gets an error if argument X is not an lvalue.
Also returns 1 if X is an lvalue, 0 if not. */
-extern int lvalue_or_else PROTO((tree, char *));
+extern int lvalue_or_else PROTO((tree, const char *));
/* save_expr (EXP) returns an expression equivalent to EXP
but it can be used multiple times within context CTX
@@ -2209,8 +2209,8 @@ extern void print_rtl PROTO ((FILE *, struct rtx_def *));
/* In print-tree.c */
extern void debug_tree PROTO ((tree));
#ifdef BUFSIZ
-extern void print_node PROTO ((FILE *, char *, tree, int));
-extern void print_node_brief PROTO ((FILE *, char *, tree, int));
+extern void print_node PROTO ((FILE *, const char *, tree, int));
+extern void print_node_brief PROTO ((FILE *, const char *, tree, int));
extern void indent_to PROTO ((FILE *, int));
#endif