diff options
author | Zack Weinberg <zack@wolery.cumb.org> | 2000-05-09 19:56:01 +0000 |
---|---|---|
committer | Zack Weinberg <zack@gcc.gnu.org> | 2000-05-09 19:56:01 +0000 |
commit | 3b304f5b7d7e2140665ee8bac980e800ade8c04b (patch) | |
tree | 11478b672b9b1d6e7c70820a940f550161e9a1a5 /gcc/cp | |
parent | aa9e158d7ac4e85cede46a969c62cc7dada16060 (diff) | |
download | gcc-3b304f5b7d7e2140665ee8bac980e800ade8c04b.zip gcc-3b304f5b7d7e2140665ee8bac980e800ade8c04b.tar.gz gcc-3b304f5b7d7e2140665ee8bac980e800ade8c04b.tar.bz2 |
top level:
* Makefile.in (WARN_CFLAGS): Add -Wwrite-strings.
(tree.o): Depend on output.h.
* c-decl.c (pending_invalid_xref_file,
current_function_prototype_file): Constify.
(pushdecl): Constify a local char *.
(define_label): Constify filename parameter.
* c-lex.c (init_parse): Constify parameter and return value.
* c-typeck.c (c_expand_asm_operands): Constify filename parameter.
* c-tree.h: Update prototypes.
* c-parse.in: Constify filename member of %union, and if_stmt_file.
* c-parse.y, c-parse.c, c-parse.h, objc/objc-parse.y,
objc/objc-parse.c: Regenerate.
* dwarfout.c (dwarfout_init): Constify main_input_filename parameter.
* dwarfout.h: Update prototypes.
* expr.c (expand_expr): Constify a local char *.
* flags.h: Constify main_input_filename.
* function.c (expand_function_end): Constify filename parameter.
* genrecog.c (make_insn_sequence): Use a character array for
c_test_pos.
(main): Remove unused variables.
* input.h: Constify input_filename, main_input_filename, and
file_stack.name. Update prototypes.
* output.h: Declare first_global_object_name and
weak_global_object_name here, as const char *.
* stmt.c (expand_asm_operands): Constify filename parameter.
* toplev.c (compile_file, push_srcloc, debug_start_source_file):
Constify filename parameter.
(input_filename, main_input_filename): Constify.
* toplev.h: Update prototypes.
* tree.c: Include output.h. Don't declare
first_global_object_name or weak_global_object_name. Clean up string
bashing in get_file_function_name_long.
* tree.h (struct tree_decl): Constify filename member.
(input_filename): Constify.
Update prototypes.
* varasm.c (first_global_object_name, weak_global_object_name):
Constify.
(assemble_start_function, assemble_variable): Clean up string bashing.
* gcc.c: Constify all spec-related strings initialized,
transitively, from string constants. Constify all strings
and string variables related to multilibs.
(set_spec, read_specs): Cast argument to free to PTR.
(used_arg): Do not modify multilib_matches. Use strncmp plus
length comparison to compare multilib switches.
* genmultilib: Constify everything declared in multilib.h.
ch:
* ch-tree.h: Update prototypes. Remove prototypes for
functions declared elsewhere.
* decl.c (define_label): Constify filename parameter.
* grant.c (globalize_decl, set_default_grant_file): Constify
local char * variables. Don't declare
first_global_object_name or asm_out_file.
* lang.c (chill_real_input_filename): Constify.
* lex.c (init_parse): Constify parameter and return value.
* parse.c: Don't declare input_filename.
(ch_expand_asm_operands): Constify filename parameter.
(parse_multi_dimension_case_action): Constify local char *.
* satisfy.c (safe_satisfy_decl): Constify local char *.
cp:
* cp-tree.h: Constify tree_srcloc.filename, tinst_level.file,
and pending_inline.filename. Update prototypes.
* decl.c (define_label): Constify filename parameter.
* decl2.c (warn_if_unknown_interface): Constify local char *.
* input.c Constify input_source.filename. Don't declare
input_filename or lineno. Constify filename parameter to feed_input.
* lex.c (init_parse): Constify parameter and return value.
(cp_pragma_interface, cp_pragma_implementation): Constify
filename argument.
(reinit_parse_for_method, reinit_parse_for_block,
reinit_parse_for_expr, feed_defarg, handle_cp_pragma):
Constify local char *.
* pt.c: Don't declare lineno or input_filename.
(print_template_context, tsubst_friend_function, tsubst_decl,
tsubst, instantiate_decl): Constify local char *.
* semantics.c (expand_body): Constify local char *.
* tree.c (build_srcloc): Constify filename parameter.
* typeck.c (c_expand_asm_operands): Constify filename
parameter.
f:
* com.c (ffecom_subscript_check_): Constify array_name
parameter. Clean up string bashing.
(ffecom_arrayref_, ffecom_char_args_x_): Constify array_name
parameter.
(ffecom_do_entry_, ffecom_gen_sfuncdef_, ffecom_start_progunit_,
ffecom_sym_transform_, ffecom_sym_transform_assign_): Constify
local char *.
(init_parse): Constify parameter and return value.
* lex.c: Include dwarfout.h instead of prototyping dwarfout_*
functions here.
(ffelex_file_pop_, ffelex_file_push_): Constify filename parameter.
(ffelex_hash_, ffelex_include_): Constify local char *.
* std.c (ffestd_exec_end): Constify local char *.
* where.c (ffewhere_file_new): Constify filename parameter.
* where.h: Update prototypes.
java:
* check_init.c (check_init): Constify local char *.
* class.c (push_class): Constify local char *.
* java_tree.h: Update prototypes.
* jcf-io.c (open_class): Constify filename parameter and
return value.
(find_class): Remove redundant string copy. Cast return from
open_class.
* jcf-parse.c (read_class, parse_class_file, yyparse):
Constify local char *.
* jcf-write.c (generate_bytecode_insns, generate_classfile):
Constify local char *.
* jcf.h (JCF): Constify filename and classname.
(JCF_FINISH): Cast args to FREE to char * when appropriate.
* lang.c (init_parse): Constify parameter and return value.
* lex.c (java_get_line_col): Constify filename parameter.
* parse.h: Constify parser_ctxt.filename. Update prototypes.
* parse.y (java_parser_context_suspend,
issue_warning_error_from_context, safe_layout_class): Constify
local char *.
* parse.c: Regenerate.
From-SVN: r33804
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 22 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 10 | ||||
-rw-r--r-- | gcc/cp/decl.c | 2 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 2 | ||||
-rw-r--r-- | gcc/cp/input.c | 9 | ||||
-rw-r--r-- | gcc/cp/lex.c | 24 | ||||
-rw-r--r-- | gcc/cp/pt.c | 13 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 2 | ||||
-rw-r--r-- | gcc/cp/tree.c | 4 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 2 |
10 files changed, 53 insertions, 37 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index fa1c7f1..bd7f0ea 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,25 @@ +2000-05-09 Zack Weinberg <zack@wolery.cumb.org> + + * cp-tree.h: Constify tree_srcloc.filename, tinst_level.file, + and pending_inline.filename. Update prototypes. + * decl.c (define_label): Constify filename parameter. + * decl2.c (warn_if_unknown_interface): Constify local char *. + * input.c Constify input_source.filename. Don't declare + input_filename or lineno. Constify filename parameter to feed_input. + * lex.c (init_parse): Constify parameter and return value. + (cp_pragma_interface, cp_pragma_implementation): Constify + filename argument. + (reinit_parse_for_method, reinit_parse_for_block, + reinit_parse_for_expr, feed_defarg, handle_cp_pragma): + Constify local char *. + * pt.c: Don't declare lineno or input_filename. + (print_template_context, tsubst_friend_function, tsubst_decl, + tsubst, instantiate_decl): Constify local char *. + * semantics.c (expand_body): Constify local char *. + * tree.c (build_srcloc): Constify filename parameter. + * typeck.c (c_expand_asm_operands): Constify filename + parameter. + 2000-05-08 Nathan Sidwell <nathan@codesourcery.com> * tinfo.cc (__dynamic_cast): Use a reinterpret_cast. Fix diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index cb46967..c7c0933 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -399,7 +399,7 @@ struct tree_wrapper struct tree_srcloc { char common[sizeof (struct tree_common)]; - char *filename; + const char *filename; int linenum; }; @@ -3338,7 +3338,7 @@ struct tinst_level { tree decl; int line; - char *file; + const char *file; struct tinst_level *next; }; @@ -3533,7 +3533,7 @@ struct pending_inline { struct pending_inline *next; /* pointer to next in chain */ int lineno; /* line number we got the text from */ - char *filename; /* name of file we were processing */ + const char *filename; /* name of file we were processing */ tree fndecl; /* FUNCTION_DECL that brought us here */ int token; /* token we were scanning */ int token_value; /* value of token we were scanning (YYSTYPE) */ @@ -3910,7 +3910,7 @@ extern void push_class_level_binding PARAMS ((tree, tree)); extern tree implicitly_declare PARAMS ((tree)); extern tree lookup_label PARAMS ((tree)); extern tree declare_local_label PARAMS ((tree)); -extern tree define_label PARAMS ((char *, int, tree)); +extern tree define_label PARAMS ((const char *, int, tree)); extern void push_switch PARAMS ((void)); extern void pop_switch PARAMS ((void)); extern void define_case_label PARAMS ((void)); @@ -4593,7 +4593,7 @@ extern tree build_x_modify_expr PARAMS ((tree, enum tree_code, tree)); extern tree build_modify_expr PARAMS ((tree, enum tree_code, tree)); extern tree dubious_conversion_warnings PARAMS ((tree, tree, const char *, tree, int)); extern tree convert_for_initialization PARAMS ((tree, tree, tree, int, const char *, tree, int)); -extern void c_expand_asm_operands PARAMS ((tree, tree, tree, tree, int, char *, int)); +extern void c_expand_asm_operands PARAMS ((tree, tree, tree, tree, int, const char *, int)); extern void c_expand_return PARAMS ((tree)); extern tree c_expand_start_case PARAMS ((tree)); extern int comp_ptr_ttypes PARAMS ((tree, tree)); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 81203b4..b951773 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -4794,7 +4794,7 @@ declare_local_label (id) tree define_label (filename, line, name) - char *filename; + const char *filename; int line; tree name; { diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 85bc908..ca660e0 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -867,7 +867,7 @@ warn_if_unknown_interface (decl) { struct tinst_level *til = tinst_for_decl (); int sl = lineno; - char *sf = input_filename; + const char *sf = input_filename; if (til) { diff --git a/gcc/cp/input.c b/gcc/cp/input.c index 3236158..8c96c37 100644 --- a/gcc/cp/input.c +++ b/gcc/cp/input.c @@ -54,7 +54,7 @@ struct input_source { /* values to restore after reading all of current string */ struct pending_input *input; #if !USE_CPPLIB - char *filename; + const char *filename; int lineno; struct putback_buffer putback; #endif @@ -62,15 +62,12 @@ struct input_source { static struct input_source *input, *free_inputs; -extern char *input_filename; -extern int lineno; - #if USE_CPPLIB extern unsigned char *yy_cur, *yy_lim; extern int yy_get_token (); #endif -extern void feed_input PARAMS ((char *, int, char *, int)); +extern void feed_input PARAMS ((char *, int, const char *, int)); extern void put_input PARAMS ((int)); extern void put_back PARAMS ((int)); extern int getch PARAMS ((void)); @@ -114,7 +111,7 @@ void feed_input (str, len, file, line) char *str; int len; - char *file; + const char *file; int line; { struct input_source *inp = allocate_input (); diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index ba32971..34fea7e 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -65,8 +65,8 @@ static void feed_defarg PARAMS ((tree, tree)); static void store_pending_inline PARAMS ((tree, struct pending_inline *)); static void reinit_parse_for_expr PARAMS ((struct obstack *)); static int *init_cpp_parse PARAMS ((void)); -static void cp_pragma_interface PARAMS ((char *)); -static void cp_pragma_implementation PARAMS ((char *)); +static void cp_pragma_interface PARAMS ((const char *)); +static void cp_pragma_implementation PARAMS ((const char *)); static int handle_cp_pragma PARAMS ((const char *)); #ifdef HANDLE_GENERIC_PRAGMAS static int handle_generic_pragma PARAMS ((int)); @@ -510,9 +510,9 @@ init_cpp_parse () return token_count; } -char * +const char * init_parse (filename) - char *filename; + const char *filename; { extern int flag_no_gnu_keywords; extern int flag_operator_names; @@ -1188,7 +1188,7 @@ interface_strcmp (s) static void cp_pragma_interface (main_filename) - char *main_filename; + const char *main_filename; { tree fileinfo = TIME_IDENTIFIER_FILEINFO (get_time_identifier (input_filename)); @@ -1235,7 +1235,7 @@ cp_pragma_interface (main_filename) static void cp_pragma_implementation (main_filename) - char *main_filename; + const char *main_filename; { struct impl_files *ifiles = impl_file_chain; for (; ifiles; ifiles = ifiles->next) @@ -1514,7 +1514,7 @@ reinit_parse_for_method (yychar, decl) { int len; int starting_lineno = lineno; - char *starting_filename = input_filename; + const char *starting_filename = input_filename; reinit_parse_for_block (yychar, &inline_text_obstack); @@ -1562,7 +1562,7 @@ reinit_parse_for_block (pyychar, obstackp) register int c; int blev = 1; int starting_lineno = lineno; - char *starting_filename = input_filename; + const char *starting_filename = input_filename; int len; int look_for_semicolon = 0; int look_for_lbrac = 0; @@ -1728,7 +1728,7 @@ reinit_parse_for_expr (obstackp) { register int c; int starting_lineno = lineno; - char *starting_filename = input_filename; + const char *starting_filename = input_filename; int len; int plev = 0; @@ -1868,7 +1868,7 @@ feed_defarg (f, p) tree f, p; { tree d = TREE_PURPOSE (p); - char *file; + const char *file; int line; if (TREE_CODE (f) == FUNCTION_DECL) { @@ -2589,7 +2589,7 @@ handle_cp_pragma (pname) } else if (! strcmp (pname, "interface")) { - char *main_filename = input_filename; + const char *main_filename = input_filename; main_filename = file_name_nondirectory (main_filename); @@ -2616,7 +2616,7 @@ handle_cp_pragma (pname) } else if (! strcmp (pname, "implementation")) { - char *main_filename = main_input_filename ? main_input_filename : input_filename; + const char *main_filename = main_input_filename ? main_input_filename : input_filename; main_filename = file_name_nondirectory (main_filename); diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 2e077c9..3b3f786 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -51,9 +51,6 @@ typedef int (*tree_fn_t) PARAMS ((tree, void*)); extern struct obstack permanent_obstack; -extern int lineno; -extern char *input_filename; - /* The PENDING_TEMPLATES is a TREE_LIST of templates whose instantiations have been deferred, either because their definitions were not yet available, or because we were putting off doing the @@ -4240,7 +4237,7 @@ print_template_context (err) { struct tinst_level *p = current_tinst_level; int line = lineno; - char *file = input_filename; + const char *file = input_filename; if (err && p) { @@ -4375,7 +4372,7 @@ tsubst_friend_function (decl, args) { tree new_friend; int line = lineno; - char *file = input_filename; + const char *file = input_filename; lineno = DECL_SOURCE_LINE (decl); input_filename = DECL_SOURCE_FILE (decl); @@ -5389,7 +5386,7 @@ tsubst_decl (t, args, type, in_decl) tree in_decl; { int saved_lineno; - char* saved_filename; + const char *saved_filename; tree r = NULL_TREE; /* Set the filename and linenumber to improve error-reporting. */ @@ -6454,7 +6451,7 @@ tsubst (t, args, complain, in_decl) || (code == REFERENCE_TYPE && TREE_CODE (type) == VOID_TYPE)) { static int last_line = 0; - static char* last_file = 0; + static const char* last_file = 0; /* We keep track of the last time we issued this error message to avoid spewing a ton of messages during a @@ -9434,7 +9431,7 @@ instantiate_decl (d, defer_ok) tree gen_tmpl; int pattern_defined; int line = lineno; - char *file = input_filename; + const char *file = input_filename; /* This function should only be used to instantiate templates for functions and static member variables. */ diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index d6d493f..afa9ff2 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -2694,7 +2694,7 @@ expand_body (fn) tree fn; { int saved_lineno; - char *saved_input_filename; + const char *saved_input_filename; /* When the parser calls us after finishing the body of a template function, we don't really want to expand the body. When we're diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 712e40d..078558e 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -40,7 +40,7 @@ static int list_hash PARAMS ((tree, tree, tree)); static tree list_hash_lookup PARAMS ((int, tree, tree, tree)); static cp_lvalue_kind lvalue_p_1 PARAMS ((tree, int)); static tree no_linkage_helper PARAMS ((tree *, int *, void *)); -static tree build_srcloc PARAMS ((char *, int)); +static tree build_srcloc PARAMS ((const char *, int)); static void mark_list_hash PARAMS ((void *)); static int statement_code_p PARAMS ((enum tree_code)); static tree mark_local_for_remap_r PARAMS ((tree *, int *, void *)); @@ -1989,7 +1989,7 @@ build_int_wrapper (i) static tree build_srcloc (file, line) - char *file; + const char *file; int line; { tree t; diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 7d75d6f..671a666 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -6638,7 +6638,7 @@ void c_expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line) tree string, outputs, inputs, clobbers; int vol; - char *filename; + const char *filename; int line; { int noutputs = list_length (outputs); |