From 9a356c3ca056d67c691d384ad5d78e235715dc63 Mon Sep 17 00:00:00 2001 From: ghazi Date: Tue, 7 Mar 2000 20:39:10 +0000 Subject: [PATCH] * rtl.h (rtunion_def): Constify member `rtstr'. (emit_line_note_after, emit_line_note, emit_line_note_force, emit_note, decode_asm_operands): Constify. * cse.c (canon_hash): Likewise. * dbxout.c (dbxout_block): Likewise. * diagnostic.c (file_and_line_for_asm, v_error_for_asm, v_warning_for_asm): Likewise. * dwarfout.c (function_start_label): Likewise. * emit-rtl.c (emit_line_note_after, emit_line_note, emit_note, emit_line_note_force): Likewise. * final.c (last_filename, asm_insn_count, final_scan_insn, output_source_line): Likewise. * function.h (struct emit_status): Likewise. * gcse.c (hash_expr_1): Likewise. * genattr.c (gen_attr, main): Likewise. * genattrtab.c (struct function_unit, current_alternative_string, write_attr_valueq, n_comma_elts, next_comma_elt, attr_eq, attr_numeral, check_attr_test, check_attr_value, convert_set_attr_alternative, convert_set_attr, compute_alternative_mask, simplify_by_exploding, gen_attr, gen_unit): Likewise. * genflags.c (gen_insn): Likewise. * gengenrtl.c (type_from_format): Likewise. * genopinit.c (gen_insn): Likewise. * genoutput.c (n_occurrences, process_template, process_template): Likewise. * ggc-page.c (ggc_set_mark, ggc_mark_if_gcable, ggc_get_size): Likewise. * ggc-simple.c (ggc_set_mark, ggc_mark_if_gcable, ggc_get_size): Likewise. * ggc.h (ggc_mark_string, ggc_mark, ggc_mark_if_gcable, ggc_set_mark, ggc_get_size): Likewise. * objc/objc-act.c (build_module_descriptor, finish_objc): Likewise. * optabs.c (init_one_libfunc): Likewise. * output.h (assemble_start_function): Likewise. * recog.c (decode_asm_operands): Likewise. * toplev.c (rest_of_compilation): Likewise. * tree.h (emit_line_note_after, emit_line_note, emit_line_note_force): Likewise. * varasm.c (asm_output_bss, asm_output_aligned_bss, asm_emit_uninitialised, assemble_start_function, assemble_variable, const_hash, compare_constant_1, find_pool_constant, mark_constant_pool, assemble_alias): Likewise. * xcoffout.h (DBX_FINISH_SYMBOL): Likewise. * alpha/alpha.md (call_vms, call_value_vms): Likewise. * arm/aof.h (ASM_OUTPUT_ASCII): Likewise. * arm/aout.h (ASM_OUTPUT_ASCII): Likewise. * arm/arm-protos.h (output_ascii_pseudo_op, arm_dllexport_name_p, arm_dllimport_name_p): Likewise. * arm/arm.c (arm_encode_call_attribute, output_ascii_pseudo_op): Likewise. * arm/arm.h (ASM_OUTPUT_MI_THUNK): Likewise. * arm/elf.h (ASM_FINISH_DECLARE_OBJECT): Likewise. * arm/pe.c (arm_dllexport_name_p, arm_dllimport_name_p, arm_mark_dllexport, arm_mark_dllimport, arm_pe_encode_section_info): Likewise. * arm/telf.h (ASM_OUTPUT_DEF_FROM_DECLS, ASM_FINISH_DECLARE_OBJECT): Likewise. * arm/thumb.c (thumb_function_prologue): Likewise. * arm/thumb.h (ASM_OUTPUT_ASCII): Likewise. * avr/avr.h (ASM_FINISH_DECLARE_OBJECT): Likewise. * clipper/clix.h (ASM_OUTPUT_ASCII): Likewise. * fx80/fx80.h (ASM_OUTPUT_ASCII): Likewise. * i386/cygwin.h (ASM_OUTPUT_SECTION_NAME): Likewise. * i386/freebsd.h (ASM_FINISH_DECLARE_OBJECT): Likewise. * i386/i386-interix.h (ASM_OUTPUT_LIMITED_STRING, ASM_OUTPUT_ASCII, ASM_OUTPUT_SECTION_NAME): Likewise. * i386/i386-protos.h (asm_output_function_prefix): Likewise. * i386/i386.c (asm_output_function_prefix): Likewise. * i386/i386elf.h (ASM_OUTPUT_ASCII): Likewise. * i386/osfrose.h (ASM_FINISH_DECLARE_OBJECT): Likewise. * i386/ptx4-i.h (ASM_OUTPUT_ASCII): Likewise. * i386/sco5.h (ASM_FINISH_DECLARE_OBJECT, ASM_OUTPUT_LIMITED_STRING, ASM_OUTPUT_ASCII, ASM_OUTPUT_SECTION_NAME): Likewise. * i386/sysv4.h (ASM_OUTPUT_ASCII): Likewise. * i860/paragon.h (ASM_OUTPUT_ASCII): Likewise. * i860/sysv3.h (ASM_OUTPUT_ASCII): Likewise. * m32r/m32r.c (m32r_encode_section_info): Likewise. * mcore-elf.h (ASM_FINISH_DECLARE_OBJECT): Likewise. * mcore/mcore.c (mcore_encode_section_info): Likewise. * mips/elf.h (ASM_FINISH_DECLARE_OBJECT): Likewise. * mips/elf64.h (ASM_FINISH_DECLARE_OBJECT): Likewise. * mips/iris6.h (ASM_FINISH_DECLARE_OBJECT): Likewise. * mips/mips.h (ASM_OUTPUT_IDENT): Likewise. * mips/mips.md (movdi, movsi): Likewise. * mips/netbsd.h (ASM_FINISH_DECLARE_OBJECT): Likewise. * netbsd.h (ASM_FINISH_DECLARE_OBJECT): Likewise. * openbsd.h (ASM_FINISH_DECLARE_OBJECT): Likewise. * ptx4.h (ASM_FINISH_DECLARE_OBJECT, ASM_OUTPUT_LIMITED_STRING, ASM_OUTPUT_ASCII): Likewise. * rs6000/rs6000.c (rs6000_allocate_stack_space, output_epilog, output_mi_thunk, output_toc): Likewise. * rs6000/rs6000.md (movsi): Likewise. * rs6000/sysv4.h (ASM_OUTPUT_INT, ASM_OUTPUT_SECTION_NAME): Likewise. * tahoe/harris.h (ASM_OUTPUT_ASCII): Likewise. * v850/v850.c (print_operand, print_operand_address, v850_encode_data_area): Likewise. ch: * grant.c (globalize_decl): Constify a char*. cp: * decl2.c (finish_objects): Constify a char*. * method.c (emit_thunk): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32388 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 169 +++++++++++++++++++++++++++++++++++++++++ gcc/ch/ChangeLog | 4 + gcc/ch/grant.c | 2 +- gcc/config/alpha/alpha.md | 6 +- gcc/config/arm/aof.h | 2 +- gcc/config/arm/aout.h | 2 +- gcc/config/arm/arm-protos.h | 6 +- gcc/config/arm/arm.c | 4 +- gcc/config/arm/arm.h | 2 +- gcc/config/arm/elf.h | 2 +- gcc/config/arm/pe.c | 10 +-- gcc/config/arm/telf.h | 6 +- gcc/config/arm/thumb.c | 2 +- gcc/config/arm/thumb.h | 2 +- gcc/config/avr/avr.h | 2 +- gcc/config/clipper/clix.h | 4 +- gcc/config/fx80/fx80.h | 2 +- gcc/config/i386/cygwin.h | 2 +- gcc/config/i386/freebsd.h | 2 +- gcc/config/i386/i386-interix.h | 12 +-- gcc/config/i386/i386-protos.h | 2 +- gcc/config/i386/i386.c | 2 +- gcc/config/i386/i386elf.h | 7 +- gcc/config/i386/osfrose.h | 2 +- gcc/config/i386/ptx4-i.h | 7 +- gcc/config/i386/sco5.h | 16 ++-- gcc/config/i386/sysv4.h | 7 +- gcc/config/i860/paragon.h | 4 +- gcc/config/i860/sysv3.h | 4 +- gcc/config/m32r/m32r.c | 2 +- gcc/config/mcore/mcore-elf.h | 2 +- gcc/config/mcore/mcore.c | 2 +- gcc/config/mips/elf.h | 2 +- gcc/config/mips/elf64.h | 2 +- gcc/config/mips/iris6.h | 2 +- gcc/config/mips/mips.h | 2 +- gcc/config/mips/mips.md | 4 +- gcc/config/mips/netbsd.h | 2 +- gcc/config/netbsd.h | 2 +- gcc/config/openbsd.h | 2 +- gcc/config/ptx4.h | 12 +-- gcc/config/rs6000/rs6000.c | 8 +- gcc/config/rs6000/rs6000.md | 2 +- gcc/config/rs6000/sysv4.h | 4 +- gcc/config/tahoe/harris.h | 2 +- gcc/config/v850/v850.c | 18 ++--- gcc/cp/ChangeLog | 6 ++ gcc/cp/decl2.c | 2 +- gcc/cp/method.c | 2 +- gcc/cse.c | 4 +- gcc/dbxout.c | 2 +- gcc/diagnostic.c | 8 +- gcc/dwarfout.c | 6 +- gcc/emit-rtl.c | 8 +- gcc/final.c | 8 +- gcc/function.h | 2 +- gcc/gcse.c | 5 +- gcc/genattr.c | 4 +- gcc/genattrtab.c | 42 +++++----- gcc/genflags.c | 4 +- gcc/gengenrtl.c | 2 +- gcc/genopinit.c | 2 +- gcc/genoutput.c | 11 ++- gcc/ggc-page.c | 8 +- gcc/ggc-simple.c | 12 +-- gcc/ggc.h | 10 +-- gcc/objc/objc-act.c | 6 +- gcc/optabs.c | 2 +- gcc/output.h | 2 +- gcc/recog.c | 4 +- gcc/rtl.h | 12 +-- gcc/toplev.c | 2 +- gcc/tree.h | 8 +- gcc/varasm.c | 39 +++++----- gcc/xcoffout.h | 2 +- 75 files changed, 393 insertions(+), 196 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d0ab6462bf5..675e24ae345 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,172 @@ +2000-03-07 Kaveh R. Ghazi + + * rtl.h (rtunion_def): Constify member `rtstr'. + (emit_line_note_after, emit_line_note, emit_line_note_force, + emit_note, decode_asm_operands): Constify. + + * cse.c (canon_hash): Likewise. + + * dbxout.c (dbxout_block): Likewise. + + * diagnostic.c (file_and_line_for_asm, v_error_for_asm, + v_warning_for_asm): Likewise. + + * dwarfout.c (function_start_label): Likewise. + + * emit-rtl.c (emit_line_note_after, emit_line_note, emit_note, + emit_line_note_force): Likewise. + + * final.c (last_filename, asm_insn_count, final_scan_insn, + output_source_line): Likewise. + + * function.h (struct emit_status): Likewise. + + * gcse.c (hash_expr_1): Likewise. + + * genattr.c (gen_attr, main): Likewise. + + * genattrtab.c (struct function_unit, current_alternative_string, + write_attr_valueq, n_comma_elts, next_comma_elt, attr_eq, + attr_numeral, check_attr_test, check_attr_value, + convert_set_attr_alternative, convert_set_attr, + compute_alternative_mask, simplify_by_exploding, gen_attr, + gen_unit): Likewise. + + * genflags.c (gen_insn): Likewise. + + * gengenrtl.c (type_from_format): Likewise. + + * genopinit.c (gen_insn): Likewise. + + * genoutput.c (n_occurrences, process_template, process_template): + Likewise. + + * ggc-page.c (ggc_set_mark, ggc_mark_if_gcable, ggc_get_size): + Likewise. + + * ggc-simple.c (ggc_set_mark, ggc_mark_if_gcable, ggc_get_size): + Likewise. + + * ggc.h (ggc_mark_string, ggc_mark, ggc_mark_if_gcable, + ggc_set_mark, ggc_get_size): Likewise. + + * objc/objc-act.c (build_module_descriptor, finish_objc): Likewise. + + * optabs.c (init_one_libfunc): Likewise. + + * output.h (assemble_start_function): Likewise. + + * recog.c (decode_asm_operands): Likewise. + + * toplev.c (rest_of_compilation): Likewise. + + * tree.h (emit_line_note_after, emit_line_note, + emit_line_note_force): Likewise. + + * varasm.c (asm_output_bss, asm_output_aligned_bss, + asm_emit_uninitialised, assemble_start_function, + assemble_variable, const_hash, compare_constant_1, + find_pool_constant, mark_constant_pool, assemble_alias): Likewise. + + * xcoffout.h (DBX_FINISH_SYMBOL): Likewise. + + * alpha/alpha.md (call_vms, call_value_vms): Likewise. + + * arm/aof.h (ASM_OUTPUT_ASCII): Likewise. + + * arm/aout.h (ASM_OUTPUT_ASCII): Likewise. + + * arm/arm-protos.h (output_ascii_pseudo_op, arm_dllexport_name_p, + arm_dllimport_name_p): Likewise. + + * arm/arm.c (arm_encode_call_attribute, output_ascii_pseudo_op): + Likewise. + + * arm/arm.h (ASM_OUTPUT_MI_THUNK): Likewise. + + * arm/elf.h (ASM_FINISH_DECLARE_OBJECT): Likewise. + + * arm/pe.c (arm_dllexport_name_p, arm_dllimport_name_p, + arm_mark_dllexport, arm_mark_dllimport, + arm_pe_encode_section_info): Likewise. + + * arm/telf.h (ASM_OUTPUT_DEF_FROM_DECLS, + ASM_FINISH_DECLARE_OBJECT): Likewise. + + * arm/thumb.c (thumb_function_prologue): Likewise. + + * arm/thumb.h (ASM_OUTPUT_ASCII): Likewise. + + * avr/avr.h (ASM_FINISH_DECLARE_OBJECT): Likewise. + + * clipper/clix.h (ASM_OUTPUT_ASCII): Likewise. + + * fx80/fx80.h (ASM_OUTPUT_ASCII): Likewise. + + * i386/cygwin.h (ASM_OUTPUT_SECTION_NAME): Likewise. + + * i386/freebsd.h (ASM_FINISH_DECLARE_OBJECT): Likewise. + + * i386/i386-interix.h (ASM_OUTPUT_LIMITED_STRING, + ASM_OUTPUT_ASCII, ASM_OUTPUT_SECTION_NAME): Likewise. + + * i386/i386-protos.h (asm_output_function_prefix): Likewise. + + * i386/i386.c (asm_output_function_prefix): Likewise. + + * i386/i386elf.h (ASM_OUTPUT_ASCII): Likewise. + + * i386/osfrose.h (ASM_FINISH_DECLARE_OBJECT): Likewise. + + * i386/ptx4-i.h (ASM_OUTPUT_ASCII): Likewise. + + * i386/sco5.h (ASM_FINISH_DECLARE_OBJECT, + ASM_OUTPUT_LIMITED_STRING, ASM_OUTPUT_ASCII, + ASM_OUTPUT_SECTION_NAME): Likewise. + + * i386/sysv4.h (ASM_OUTPUT_ASCII): Likewise. + + * i860/paragon.h (ASM_OUTPUT_ASCII): Likewise. + + * i860/sysv3.h (ASM_OUTPUT_ASCII): Likewise. + + * m32r/m32r.c (m32r_encode_section_info): Likewise. + + * mcore-elf.h (ASM_FINISH_DECLARE_OBJECT): Likewise. + + * mcore/mcore.c (mcore_encode_section_info): Likewise. + + * mips/elf.h (ASM_FINISH_DECLARE_OBJECT): Likewise. + + * mips/elf64.h (ASM_FINISH_DECLARE_OBJECT): Likewise. + + * mips/iris6.h (ASM_FINISH_DECLARE_OBJECT): Likewise. + + * mips/mips.h (ASM_OUTPUT_IDENT): Likewise. + + * mips/mips.md (movdi, movsi): Likewise. + + * mips/netbsd.h (ASM_FINISH_DECLARE_OBJECT): Likewise. + + * netbsd.h (ASM_FINISH_DECLARE_OBJECT): Likewise. + + * openbsd.h (ASM_FINISH_DECLARE_OBJECT): Likewise. + + * ptx4.h (ASM_FINISH_DECLARE_OBJECT, ASM_OUTPUT_LIMITED_STRING, + ASM_OUTPUT_ASCII): Likewise. + + * rs6000/rs6000.c (rs6000_allocate_stack_space, output_epilog, + output_mi_thunk, output_toc): Likewise. + + * rs6000/rs6000.md (movsi): Likewise. + + * rs6000/sysv4.h (ASM_OUTPUT_INT, ASM_OUTPUT_SECTION_NAME): Likewise. + + * tahoe/harris.h (ASM_OUTPUT_ASCII): Likewise. + + * v850/v850.c (print_operand, print_operand_address, + v850_encode_data_area): Likewise. + 2000-03-07 Clinton Popetz * config/mips/mips.md (zero_extendsidi2): Always force operand diff --git a/gcc/ch/ChangeLog b/gcc/ch/ChangeLog index 360fcc12a59..3a4e22f66e3 100644 --- a/gcc/ch/ChangeLog +++ b/gcc/ch/ChangeLog @@ -1,3 +1,7 @@ +2000-03-07 Kaveh R. Ghazi + + * grant.c (globalize_decl): Constify a char*. + Mon Mar 6 17:52:48 2000 Richard Kenner * actions.c (chill_convert_for_assignment): INDEX is unsigned diff --git a/gcc/ch/grant.c b/gcc/ch/grant.c index b0e7e5c9660..ddd8f936443 100644 --- a/gcc/ch/grant.c +++ b/gcc/ch/grant.c @@ -2546,7 +2546,7 @@ globalize_decl (decl) { extern FILE *asm_out_file; extern char *first_global_object_name; - char *name = XSTR (XEXP (DECL_RTL (decl), 0), 0); + const char *name = XSTR (XEXP (DECL_RTL (decl), 0), 0); if (!first_global_object_name) first_global_object_name = name + (name[0] == '*'); diff --git a/gcc/config/alpha/alpha.md b/gcc/config/alpha/alpha.md index 129352f6bfb..ed4abe069a3 100644 --- a/gcc/config/alpha/alpha.md +++ b/gcc/config/alpha/alpha.md @@ -3766,7 +3766,8 @@ if (GET_CODE (operands[0]) == SYMBOL_REF) { extern char *savealloc (); - char *linksym, *symbol = XSTR (operands[0], 0); + const char *symbol = XSTR (operands[0], 0); + char *linksym; rtx linkage; if (*symbol == '*') @@ -3874,7 +3875,8 @@ if (GET_CODE (operands[1]) == SYMBOL_REF) { extern char *savealloc (); - char *linksym, *symbol = XSTR (operands[1], 0); + const char *symbol = XSTR (operands[1], 0); + char *linksym; rtx linkage; if (*symbol == '*') diff --git a/gcc/config/arm/aof.h b/gcc/config/arm/aof.h index 9f67fc39c9d..a25a311b832 100644 --- a/gcc/config/arm/aof.h +++ b/gcc/config/arm/aof.h @@ -272,7 +272,7 @@ do { \ #define ASM_OUTPUT_ASCII(STREAM,PTR,LEN) \ { \ int i; \ - char *ptr = (PTR); \ + const char *ptr = (PTR); \ fprintf ((STREAM), "\tDCB"); \ for (i = 0; i < (LEN); i++) \ fprintf ((STREAM), " &%02x%s", \ diff --git a/gcc/config/arm/aout.h b/gcc/config/arm/aout.h index 79003d28b08..850a681e0ff 100644 --- a/gcc/config/arm/aout.h +++ b/gcc/config/arm/aout.h @@ -252,7 +252,7 @@ Boston, MA 02111-1307, USA. */ fprintf (STREAM, "\t.byte\t%d\n", VALUE) #define ASM_OUTPUT_ASCII(STREAM, PTR, LEN) \ - output_ascii_pseudo_op (STREAM, (unsigned char *)(PTR), LEN) + output_ascii_pseudo_op (STREAM, (const unsigned char *)(PTR), LEN) /* Output a gap. In fact we fill it with nulls. */ #define ASM_OUTPUT_SKIP(STREAM, NBYTES) \ diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h index d19aa71d8b6..141400354c0 100644 --- a/gcc/config/arm/arm-protos.h +++ b/gcc/config/arm/arm-protos.h @@ -30,7 +30,7 @@ extern int arm_regno_class PARAMS ((int)); extern int arm_volatile_func PARAMS ((void)); extern int const_ok_for_arm PARAMS ((HOST_WIDE_INT)); extern void output_arm_prologue PARAMS ((FILE *, int)); -extern void output_ascii_pseudo_op PARAMS ((FILE *, unsigned char *, int)); +extern void output_ascii_pseudo_op PARAMS ((FILE *, const unsigned char *, int)); extern void output_func_epilogue PARAMS ((int)); extern void output_func_prologue PARAMS ((FILE *, int)); extern int use_return_insn PARAMS ((int)); @@ -44,8 +44,8 @@ extern void aof_dump_pic_table PARAMS ((FILE *)); extern char * aof_text_section PARAMS ((void)); #endif /* AOF_ASSEMBLER */ /* Defined in pe.c */ -extern int arm_dllexport_name_p PARAMS ((char *)); -extern int arm_dllimport_name_p PARAMS ((char *)); +extern int arm_dllexport_name_p PARAMS ((const char *)); +extern int arm_dllimport_name_p PARAMS ((const char *)); #define Mmode enum machine_mode diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index ffa26bb0cc8..beabef7ca45 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -1638,7 +1638,7 @@ arm_encode_call_attribute (decl, flag) tree decl; char flag; { - char * str = XSTR (XEXP (DECL_RTL (decl), 0), 0); + const char * str = XSTR (XEXP (DECL_RTL (decl), 0), 0); int len = strlen (str); char * newstr; @@ -5544,7 +5544,7 @@ int_log2 (power) void output_ascii_pseudo_op (stream, p, len) FILE * stream; - unsigned char * p; + const unsigned char * p; int len; { int i; diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index c20d82bb615..9ad97c2f045 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -2240,7 +2240,7 @@ extern struct rtx_def * arm_compare_op1; do \ { \ int mi_delta = (DELTA); \ - char * mi_op = mi_delta < 0 ? "sub" : "add"; \ + const char *mi_op = mi_delta < 0 ? "sub" : "add"; \ int shift = 0; \ int this_regno = (aggregate_value_p (TREE_TYPE (TREE_TYPE (FUNCTION))) \ ? 1 : 0); \ diff --git a/gcc/config/arm/elf.h b/gcc/config/arm/elf.h index b95c7fbecc0..893350f04a1 100644 --- a/gcc/config/arm/elf.h +++ b/gcc/config/arm/elf.h @@ -106,7 +106,7 @@ Boston, MA 02111-1307, USA. */ #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ do \ { \ - char * name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ + const char * name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ && ! AT_END && TOP_LEVEL \ && DECL_INITIAL (DECL) == error_mark_node \ diff --git a/gcc/config/arm/pe.c b/gcc/config/arm/pe.c index 90158ff6f27..bb01fd24d18 100644 --- a/gcc/config/arm/pe.c +++ b/gcc/config/arm/pe.c @@ -237,7 +237,7 @@ arm_dllimport_p (decl) int arm_dllexport_name_p (symbol) - char * symbol; + const char * symbol; { return symbol[0] == ARM_PE_FLAG_CHAR && symbol[1] == 'e' && symbol[2] == '.'; } @@ -246,7 +246,7 @@ arm_dllexport_name_p (symbol) int arm_dllimport_name_p (symbol) - char * symbol; + const char * symbol; { return symbol[0] == ARM_PE_FLAG_CHAR && symbol[1] == 'i' && symbol[2] == '.'; } @@ -258,7 +258,7 @@ void arm_mark_dllexport (decl) tree decl; { - char * oldname; + const char * oldname; char * newname; rtx rtlname; tree idp; @@ -296,7 +296,7 @@ void arm_mark_dllimport (decl) tree decl; { - char * oldname; + const char * oldname; char * newname; tree idp; rtx rtlname, newrtl; @@ -395,7 +395,7 @@ arm_pe_encode_section_info (decl) && GET_CODE (XEXP (XEXP (DECL_RTL (decl), 0), 0)) == SYMBOL_REF && arm_dllimport_name_p (XSTR (XEXP (XEXP (DECL_RTL (decl), 0), 0), 0))) { - char *oldname = XSTR (XEXP (XEXP (DECL_RTL (decl), 0), 0), 0); + const char *oldname = XSTR (XEXP (XEXP (DECL_RTL (decl), 0), 0), 0); tree idp = get_identifier (oldname + 9); rtx newrtl = gen_rtx (SYMBOL_REF, Pmode, IDENTIFIER_POINTER (idp)); diff --git a/gcc/config/arm/telf.h b/gcc/config/arm/telf.h index bb199ac8d29..e1a5cb1be66 100644 --- a/gcc/config/arm/telf.h +++ b/gcc/config/arm/telf.h @@ -175,8 +175,8 @@ extern int arm_structure_size_boundary; #define ASM_OUTPUT_DEF_FROM_DECLS(FILE,DECL1,DECL2) \ do \ { \ - char * LABEL1 = XSTR (XEXP (DECL_RTL (decl), 0), 0); \ - char * LABEL2 = IDENTIFIER_POINTER (DECL2); \ + const char * LABEL1 = XSTR (XEXP (DECL_RTL (decl), 0), 0);\ + const char * LABEL2 = IDENTIFIER_POINTER (DECL2); \ \ if (TREE_CODE (DECL1) == FUNCTION_DECL) \ { \ @@ -427,7 +427,7 @@ dtors_section () \ #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)\ do \ { \ - char * name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ + const char * name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ && ! AT_END && TOP_LEVEL \ && DECL_INITIAL (DECL) == error_mark_node \ diff --git a/gcc/config/arm/thumb.c b/gcc/config/arm/thumb.c index 30545e5b25b..79de0b6ca2d 100644 --- a/gcc/config/arm/thumb.c +++ b/gcc/config/arm/thumb.c @@ -1289,7 +1289,7 @@ thumb_function_prologue (f, frame_size) if (is_called_in_ARM_mode (current_function_decl)) { - char * name; + const char * name; if (GET_CODE (DECL_RTL (current_function_decl)) != MEM) abort(); diff --git a/gcc/config/arm/thumb.h b/gcc/config/arm/thumb.h index 2366e14c356..4837504a3cf 100644 --- a/gcc/config/arm/thumb.h +++ b/gcc/config/arm/thumb.h @@ -251,7 +251,7 @@ do { char dstr[30]; \ #define ASM_OUTPUT_ASCII(STREAM, STRING, LEN) \ do { \ register int i, c, len = (LEN), cur_pos = 17; \ - register unsigned char *string = (unsigned char *)(STRING); \ + register const unsigned char *string = (const unsigned char *)(STRING); \ fprintf ((STREAM), "\t.ascii\t\""); \ for (i = 0; i < len; i++) \ { \ diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h index 270ae1f389e..38e214f3593 100644 --- a/gcc/config/avr/avr.h +++ b/gcc/config/avr/avr.h @@ -2373,7 +2373,7 @@ do { \ #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ do { \ - char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ + const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ && ! AT_END && TOP_LEVEL \ && DECL_INITIAL (DECL) == error_mark_node \ diff --git a/gcc/config/clipper/clix.h b/gcc/config/clipper/clix.h index 43aeadb7e21..a3e04ac5d77 100644 --- a/gcc/config/clipper/clix.h +++ b/gcc/config/clipper/clix.h @@ -35,9 +35,9 @@ Boston, MA 02111-1307, USA. */ #define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \ do { \ - unsigned char *s; \ + const unsigned char *s; \ int i; \ - for (i = 0, s = (unsigned char *)(PTR); i < (LEN); s++, i++) \ + for (i = 0, s = (const unsigned char *)(PTR); i < (LEN); s++, i++) \ { \ if ((i % 8) == 0) \ fputs ("\n\t.byte\t", (FILE)); \ diff --git a/gcc/config/fx80/fx80.h b/gcc/config/fx80/fx80.h index c416d5c8765..35a9211dadc 100644 --- a/gcc/config/fx80/fx80.h +++ b/gcc/config/fx80/fx80.h @@ -1118,7 +1118,7 @@ do { union { float f; long l;} tem; \ fprintf (FILE, "\n")) #define ASM_OUTPUT_ASCII(FILE,PTR,SIZE) \ -do { int i; unsigned char *pp = (unsigned char *) (PTR); \ +do { int i; const unsigned char *pp = (const unsigned char *) (PTR); \ fprintf((FILE), "\t.byte %d", (unsigned int)*pp++); \ for (i = 1; i < (SIZE); ++i, ++pp) { \ if ((i % 8) == 0) \ diff --git a/gcc/config/i386/cygwin.h b/gcc/config/i386/cygwin.h index f9be343c772..6dd386714f2 100644 --- a/gcc/config/i386/cygwin.h +++ b/gcc/config/i386/cygwin.h @@ -390,7 +390,7 @@ do { \ enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \ } *sections; \ struct section_info *s; \ - char *mode; \ + const char *mode; \ enum sect_enum type; \ \ for (s = sections; s; s = s->next) \ diff --git a/gcc/config/i386/freebsd.h b/gcc/config/i386/freebsd.h index a03b43ea093..b8342355603 100644 --- a/gcc/config/i386/freebsd.h +++ b/gcc/config/i386/freebsd.h @@ -197,7 +197,7 @@ Boston, MA 02111-1307, USA. */ #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ do { \ - char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ + const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ && ! AT_END && TOP_LEVEL \ && DECL_INITIAL (DECL) == error_mark_node \ diff --git a/gcc/config/i386/i386-interix.h b/gcc/config/i386/i386-interix.h index 9804ea3bd62..8bc43f365ad 100644 --- a/gcc/config/i386/i386-interix.h +++ b/gcc/config/i386/i386-interix.h @@ -152,7 +152,8 @@ Boston, MA 02111-1307, USA. */ #define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \ do \ { \ - register unsigned char *_limited_str = (unsigned char *) (STR); \ + register const unsigned char *_limited_str = \ + (const unsigned char *) (STR); \ register unsigned ch; \ fprintf ((FILE), "\t%s\t\"", STRING_ASM_OP); \ for (; (ch = *_limited_str); _limited_str++) \ @@ -187,12 +188,13 @@ Boston, MA 02111-1307, USA. */ #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \ do \ { \ - register unsigned char *_ascii_bytes = (unsigned char *) (STR); \ - register unsigned char *limit = _ascii_bytes + (LENGTH); \ + register const unsigned char *_ascii_bytes = \ + (const unsigned char *) (STR); \ + register const unsigned char *limit = _ascii_bytes + (LENGTH); \ register unsigned bytes_in_chunk = 0; \ for (; _ascii_bytes < limit; _ascii_bytes++) \ { \ - register unsigned char *p; \ + register const unsigned char *p; \ if (bytes_in_chunk >= 64) \ { \ fputc ('\n', (FILE)); \ @@ -524,7 +526,7 @@ do { \ enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \ } *sections; \ struct section_info *s; \ - char *mode; \ + const char *mode; \ enum sect_enum type; \ \ for (s = sections; s; s = s->next) \ diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h index b2eda317b6a..d489ec9a6cb 100644 --- a/gcc/config/i386/i386-protos.h +++ b/gcc/config/i386/i386-protos.h @@ -26,7 +26,7 @@ extern void optimization_options PARAMS ((int, int)); extern int ix86_can_use_return_insn_p PARAMS ((void)); -extern void asm_output_function_prefix PARAMS ((FILE *, char *)); +extern void asm_output_function_prefix PARAMS ((FILE *, const char *)); extern void load_pic_register PARAMS ((void)); extern HOST_WIDE_INT ix86_initial_elimination_offset PARAMS((int, int)); extern void ix86_expand_prologue PARAMS ((void)); diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 84bda81d56a..b977c32cc57 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -1594,7 +1594,7 @@ static char *global_offset_table_name; void asm_output_function_prefix (file, name) FILE *file; - char *name ATTRIBUTE_UNUSED; + const char *name ATTRIBUTE_UNUSED; { rtx xops[2]; int pic_reg_used = flag_pic && (current_function_uses_pic_offset_table diff --git a/gcc/config/i386/i386elf.h b/gcc/config/i386/i386elf.h index 40ea9db63b8..21712da301c 100644 --- a/gcc/config/i386/i386elf.h +++ b/gcc/config/i386/i386elf.h @@ -127,12 +127,13 @@ do { long value[3]; \ #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \ do \ { \ - register unsigned char *_ascii_bytes = (unsigned char *) (STR); \ - register unsigned char *limit = _ascii_bytes + (LENGTH); \ + register const unsigned char *_ascii_bytes = \ + (const unsigned char *) (STR); \ + register const unsigned char *limit = _ascii_bytes + (LENGTH); \ register unsigned bytes_in_chunk = 0; \ for (; _ascii_bytes < limit; _ascii_bytes++) \ { \ - register unsigned char *p; \ + register const unsigned char *p; \ if (bytes_in_chunk >= 64) \ { \ fputc ('\n', (FILE)); \ diff --git a/gcc/config/i386/osfrose.h b/gcc/config/i386/osfrose.h index e9b4d6ff13c..3e0dd07e718 100644 --- a/gcc/config/i386/osfrose.h +++ b/gcc/config/i386/osfrose.h @@ -666,7 +666,7 @@ while (0) #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ do { \ - char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ + const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ if (TARGET_ELF \ && !flag_inhibit_size_directive && DECL_SIZE (DECL) \ && ! AT_END && TOP_LEVEL \ diff --git a/gcc/config/i386/ptx4-i.h b/gcc/config/i386/ptx4-i.h index 6b0a49ba616..a8594a2cef0 100644 --- a/gcc/config/i386/ptx4-i.h +++ b/gcc/config/i386/ptx4-i.h @@ -121,12 +121,13 @@ do { long value[3]; \ #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \ do \ { \ - register unsigned char *_ascii_bytes = (unsigned char *) (STR); \ - register unsigned char *limit = _ascii_bytes + (LENGTH); \ + register const unsigned char *_ascii_bytes = \ + (const unsigned char *) (STR); \ + register const unsigned char *limit = _ascii_bytes + (LENGTH); \ register unsigned bytes_in_chunk = 0; \ for (; _ascii_bytes < limit; _ascii_bytes++) \ { \ - register unsigned char *p; \ + register const unsigned char *p; \ if (bytes_in_chunk >= 64) \ { \ fputc ('\n', (FILE)); \ diff --git a/gcc/config/i386/sco5.h b/gcc/config/i386/sco5.h index 0c6d74758c9..df40cb25914 100644 --- a/gcc/config/i386/sco5.h +++ b/gcc/config/i386/sco5.h @@ -222,7 +222,7 @@ do { \ #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ do { \ if (TARGET_ELF) { \ - char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ + const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ && ! AT_END && TOP_LEVEL \ && DECL_INITIAL (DECL) == error_mark_node \ @@ -313,7 +313,8 @@ asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) #define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \ do \ { \ - register unsigned char *_limited_str = (unsigned char *) (STR); \ + register const unsigned char *_limited_str = \ + (const unsigned char *) (STR); \ register unsigned ch; \ fprintf ((FILE), "%s\t\"", STRING_ASM_OP); \ for (; (ch = *_limited_str); _limited_str++) \ @@ -341,12 +342,13 @@ asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) #undef ASM_OUTPUT_ASCII #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \ do { \ - register unsigned char *_ascii_bytes = (unsigned char *) (STR); \ - register unsigned char *limit = _ascii_bytes + (LENGTH); \ + register const unsigned char *_ascii_bytes = \ + (const unsigned char *) (STR); \ + register const unsigned char *limit = _ascii_bytes + (LENGTH); \ register unsigned bytes_in_chunk = 0; \ for (; _ascii_bytes < limit; _ascii_bytes++) \ { \ - register unsigned char *p; \ + register unsigned const char *p; \ if (bytes_in_chunk >= 64) \ { \ fputc ('\n', (FILE)); \ @@ -468,9 +470,9 @@ do { \ enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \ } *sections; \ struct section_info *s; \ - char *mode; \ + const char *mode; \ enum sect_enum type; \ - char *sname = NAME ; \ + const char *sname = NAME ; \ if (strcmp(NAME, ".gcc_except_table") == 0) sname = ".gccexc" ; \ \ for (s = sections; s; s = s->next) \ diff --git a/gcc/config/i386/sysv4.h b/gcc/config/i386/sysv4.h index 1bc6f048ffc..24dccd9a866 100644 --- a/gcc/config/i386/sysv4.h +++ b/gcc/config/i386/sysv4.h @@ -119,12 +119,13 @@ do { long value[3]; \ #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \ do \ { \ - register unsigned char *_ascii_bytes = (unsigned char *) (STR); \ - register unsigned char *limit = _ascii_bytes + (LENGTH); \ + register const unsigned char *_ascii_bytes = \ + (const unsigned char *) (STR); \ + register const unsigned char *limit = _ascii_bytes + (LENGTH); \ register unsigned bytes_in_chunk = 0; \ for (; _ascii_bytes < limit; _ascii_bytes++) \ { \ - register unsigned char *p; \ + register const unsigned char *p; \ if (bytes_in_chunk >= 64) \ { \ fputc ('\n', (FILE)); \ diff --git a/gcc/config/i860/paragon.h b/gcc/config/i860/paragon.h index d44505c348d..7517f4b55ca 100644 --- a/gcc/config/i860/paragon.h +++ b/gcc/config/i860/paragon.h @@ -122,8 +122,8 @@ Boston, MA 02111-1307, USA. */ #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \ do \ { \ - register unsigned char *str = (unsigned char *) (STR); \ - register unsigned char *limit = str + (LENGTH); \ + register const unsigned char *str = (const unsigned char *) (STR); \ + register const unsigned char *limit = str + (LENGTH); \ register unsigned bytes_in_chunk = 0; \ for (; str < limit; str++) \ { \ diff --git a/gcc/config/i860/sysv3.h b/gcc/config/i860/sysv3.h index 56f8e49a3e7..81e302510cd 100644 --- a/gcc/config/i860/sysv3.h +++ b/gcc/config/i860/sysv3.h @@ -104,8 +104,8 @@ extern char *current_function_original_name; #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \ do \ { \ - register unsigned char *str = (unsigned char *) (STR); \ - register unsigned char *limit = str + (LENGTH); \ + register const unsigned char *str = (const unsigned char *) (STR); \ + register const unsigned char *limit = str + (LENGTH); \ register unsigned bytes_in_chunk = 0; \ for (; str < limit; str++) \ { \ diff --git a/gcc/config/m32r/m32r.c b/gcc/config/m32r/m32r.c index e8845c99705..ee0ac4cc033 100644 --- a/gcc/config/m32r/m32r.c +++ b/gcc/config/m32r/m32r.c @@ -434,7 +434,7 @@ m32r_encode_section_info (decl) { rtx rtl = (TREE_CODE_CLASS (TREE_CODE (decl)) != 'd' ? TREE_CST_RTL (decl) : DECL_RTL (decl)); - char *str = XSTR (XEXP (rtl, 0), 0); + const char *str = XSTR (XEXP (rtl, 0), 0); int len = strlen (str); char *newstr = savealloc (len + 2); strcpy (newstr + 1, str); diff --git a/gcc/config/mcore/mcore-elf.h b/gcc/config/mcore/mcore-elf.h index f8623904e14..f7c8414eeaa 100644 --- a/gcc/config/mcore/mcore-elf.h +++ b/gcc/config/mcore/mcore-elf.h @@ -168,7 +168,7 @@ exports_section () \ #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ do \ { \ - char * name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ + const char * name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ && ! AT_END && TOP_LEVEL \ && DECL_INITIAL (DECL) == error_mark_node \ diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c index 2fa8c818311..5381269f00d 100644 --- a/gcc/config/mcore/mcore.c +++ b/gcc/config/mcore/mcore.c @@ -3423,7 +3423,7 @@ mcore_encode_section_info (decl) && GET_CODE (XEXP (XEXP (DECL_RTL (decl), 0), 0)) == SYMBOL_REF && mcore_dllimport_name_p (XSTR (XEXP (XEXP (DECL_RTL (decl), 0), 0), 0))) { - char * oldname = XSTR (XEXP (XEXP (DECL_RTL (decl), 0), 0), 0); + const char * oldname = XSTR (XEXP (XEXP (DECL_RTL (decl), 0), 0), 0); tree idp = get_identifier (oldname + 9); rtx newrtl = gen_rtx (SYMBOL_REF, Pmode, IDENTIFIER_POINTER (idp)); diff --git a/gcc/config/mips/elf.h b/gcc/config/mips/elf.h index 14c14327844..5a723ed70cf 100644 --- a/gcc/config/mips/elf.h +++ b/gcc/config/mips/elf.h @@ -161,7 +161,7 @@ do { \ #undef ASM_FINISH_DECLARE_OBJECT #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ do { \ - char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ + const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ && ! AT_END && TOP_LEVEL \ && DECL_INITIAL (DECL) == error_mark_node \ diff --git a/gcc/config/mips/elf64.h b/gcc/config/mips/elf64.h index 25c88f669c9..c0c706ae2c3 100644 --- a/gcc/config/mips/elf64.h +++ b/gcc/config/mips/elf64.h @@ -142,7 +142,7 @@ do { \ #undef ASM_FINISH_DECLARE_OBJECT #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ do { \ - char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ + const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ && ! AT_END && TOP_LEVEL \ && DECL_INITIAL (DECL) == error_mark_node \ diff --git a/gcc/config/mips/iris6.h b/gcc/config/mips/iris6.h index 44f6ac8765f..2b66e4ae109 100644 --- a/gcc/config/mips/iris6.h +++ b/gcc/config/mips/iris6.h @@ -458,7 +458,7 @@ while (0) #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ do { \ - char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ + const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ && ! AT_END && TOP_LEVEL \ && DECL_INITIAL (DECL) == error_mark_node \ diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index cd384e42afd..c79ad1e7e65 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -4527,7 +4527,7 @@ do { \ /* Output #ident as a in the read-only data section. */ #define ASM_OUTPUT_IDENT(FILE, STRING) \ { \ - char *p = STRING; \ + const char *p = STRING; \ int size = strlen (p) + 1; \ rdata_section (); \ assemble_string (p, size); \ diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md index c50f62a7960..d56e6424c79 100644 --- a/gcc/config/mips/mips.md +++ b/gcc/config/mips/mips.md @@ -4775,7 +4775,7 @@ move\\t%0,%z4\\n\\ && GET_CODE (operands[1]) == SYMBOL_REF && SYMBOL_REF_FLAG (operands[1])) { - char *name = XSTR (operands[1], 0); + const char *name = XSTR (operands[1], 0); if (name[0] != '*' || strncmp (name + 1, LOCAL_LABEL_PREFIX, @@ -5197,7 +5197,7 @@ move\\t%0,%z4\\n\\ && GET_CODE (operands[1]) == SYMBOL_REF && SYMBOL_REF_FLAG (operands[1])) { - char *name = XSTR (operands[1], 0); + const char *name = XSTR (operands[1], 0); if (name[0] != '*' || strncmp (name + 1, LOCAL_LABEL_PREFIX, diff --git a/gcc/config/mips/netbsd.h b/gcc/config/mips/netbsd.h index 3c90dcaf94e..81e5eaed488 100644 --- a/gcc/config/mips/netbsd.h +++ b/gcc/config/mips/netbsd.h @@ -166,7 +166,7 @@ Boston, MA 02111-1307, USA. */ #undef ASM_FINISH_DECLARE_OBJECT #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ do { \ - char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ + const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ && ! AT_END && TOP_LEVEL \ && DECL_INITIAL (DECL) == error_mark_node \ diff --git a/gcc/config/netbsd.h b/gcc/config/netbsd.h index 7ba135bd24e..49ff03618f2 100644 --- a/gcc/config/netbsd.h +++ b/gcc/config/netbsd.h @@ -169,7 +169,7 @@ #undef ASM_FINISH_DECLARE_OBJECT #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ do { \ - char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ + const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ && ! AT_END && TOP_LEVEL \ && DECL_INITIAL (DECL) == error_mark_node \ diff --git a/gcc/config/openbsd.h b/gcc/config/openbsd.h index 60ebfab540b..1d813ddbda6 100644 --- a/gcc/config/openbsd.h +++ b/gcc/config/openbsd.h @@ -251,7 +251,7 @@ Boston, MA 02111-1307, USA. */ #undef ASM_FINISH_DECLARE_OBJECT #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ do { \ - char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ + const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ && ! AT_END && TOP_LEVEL \ && DECL_INITIAL (DECL) == error_mark_node \ diff --git a/gcc/config/ptx4.h b/gcc/config/ptx4.h index 5580ed96138..7701f963af6 100644 --- a/gcc/config/ptx4.h +++ b/gcc/config/ptx4.h @@ -680,7 +680,7 @@ dtors_section () \ #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ do { \ - char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ + const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ && ! AT_END && TOP_LEVEL \ && DECL_INITIAL (DECL) == error_mark_node \ @@ -764,7 +764,8 @@ do { \ #define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \ do \ { \ - register unsigned char *_limited_str = (unsigned char *) (STR); \ + register const unsigned char *_limited_str = \ + (const unsigned char *) (STR); \ register unsigned ch; \ fprintf ((FILE), "\t%s\t\"", STRING_ASM_OP); \ for (; ch = *_limited_str; _limited_str++) \ @@ -799,12 +800,13 @@ do { \ #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \ do \ { \ - register unsigned char *_ascii_bytes = (unsigned char *) (STR); \ - register unsigned char *limit = _ascii_bytes + (LENGTH); \ + register const unsigned char *_ascii_bytes = \ + (const unsigned char *) (STR); \ + register const unsigned char *limit = _ascii_bytes + (LENGTH); \ register unsigned bytes_in_chunk = 0; \ for (; _ascii_bytes < limit; _ascii_bytes++) \ { \ - register unsigned char *p; \ + register const unsigned char *p; \ if (bytes_in_chunk >= 60) \ { \ fprintf ((FILE), "\"\n"); \ diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index f50616be864..a408d7e5921 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -4209,7 +4209,7 @@ rs6000_allocate_stack_space (file, size, copy_r12) else if (GET_CODE (stack_limit_rtx) == SYMBOL_REF && (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)) { - char * l_name = XSTR (stack_limit_rtx, 0); + const char * l_name = XSTR (stack_limit_rtx, 0); const char * stripped_name; STRIP_NAME_ENCODING (stripped_name, l_name); @@ -4662,7 +4662,7 @@ output_epilog (file, size) different traceback table. */ if (DEFAULT_ABI == ABI_AIX && ! flag_inhibit_size_directive) { - char *fname = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0); + const char *fname = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0); int fixed_parms, float_parms, parm_info; int i; @@ -4895,7 +4895,7 @@ output_mi_thunk (file, thunk_fndecl, delta, function) { const char *this_reg = reg_names[ aggregate_value_p (TREE_TYPE (TREE_TYPE (function))) ? 4 : 3 ]; const char *prefix; - char *fname; + const char *fname; const char *r0 = reg_names[0]; const char *sp = reg_names[1]; const char *toc = reg_names[2]; @@ -5097,7 +5097,7 @@ output_toc (file, x, labelno) int labelno; { char buf[256]; - char *name = buf; + const char *name = buf; const char *real_name; rtx base = x; int offset = 0; diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index c5db4b4c976..5620eb443bf 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -6018,7 +6018,7 @@ && GET_CODE (operands[1]) == SYMBOL_REF && XSTR (operands[1], 0)[0] == '.') { - char *name = XSTR (operands[1], 0); + const char *name = XSTR (operands[1], 0); rtx new_ref; while (*name == '.') name++; diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h index 65b6cd5f104..13922045e09 100644 --- a/gcc/config/rs6000/sysv4.h +++ b/gcc/config/rs6000/sysv4.h @@ -804,7 +804,7 @@ do { \ && XSTR (VALUE, 0)[0] == '.' \ && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_NT)) \ { \ - char *name = XSTR (VALUE, 0); \ + const char *name = XSTR (VALUE, 0); \ while (*name == '.') \ name++; \ \ @@ -890,7 +890,7 @@ do { \ enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \ } *sections; \ struct section_info *s; \ - char *mode; \ + const char *mode; \ enum sect_enum type; \ \ for (s = sections; s; s = s->next) \ diff --git a/gcc/config/tahoe/harris.h b/gcc/config/tahoe/harris.h index 9226445ed98..80d05e6e67f 100644 --- a/gcc/config/tahoe/harris.h +++ b/gcc/config/tahoe/harris.h @@ -67,7 +67,7 @@ Boston, MA 02111-1307, USA. */ #define ASM_OUTPUT_ASCII(FILE, PTR, SIZE) \ do { \ - unsigned char *_p = (PTR); \ + const unsigned char *_p = (PTR); \ int _thissize = (SIZE); \ fprintf ((FILE), "\t.ascii \""); \ for (i = 0; i < _thissize; i++) \ diff --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c index e39751b6cd2..c3b6cf1dc77 100644 --- a/gcc/config/v850/v850.c +++ b/gcc/config/v850/v850.c @@ -411,7 +411,7 @@ print_operand (file, x, code) case 'O': if (special_symbolref_operand (x, VOIDmode)) { - char* name; + const char *name; if (GET_CODE (x) == SYMBOL_REF) name = XSTR (x, 0); @@ -596,9 +596,9 @@ print_operand_address (file, addr) case SYMBOL_REF: if (ENCODED_NAME_P (XSTR (addr, 0))) { - char* name = XSTR (addr, 0); - char* off_name; - char* reg_name; + const char *name = XSTR (addr, 0); + const char *off_name; + const char *reg_name; if (ZDA_NAME_P (name)) { @@ -628,9 +628,9 @@ print_operand_address (file, addr) case CONST: if (special_symbolref_operand (addr, VOIDmode)) { - char* name = XSTR (XEXP (XEXP (addr, 0), 0), 0); - char* off_name; - char* reg_name; + const char *name = XSTR (XEXP (XEXP (addr, 0), 0), 0); + const char *off_name; + const char *reg_name; if (ZDA_NAME_P (name)) { @@ -2090,7 +2090,7 @@ void v850_encode_data_area (decl) tree decl; { - char * str = XSTR (XEXP (DECL_RTL (decl), 0), 0); + const char *str = XSTR (XEXP (DECL_RTL (decl), 0), 0); int len = strlen (str); char * newstr; @@ -2099,7 +2099,7 @@ v850_encode_data_area (decl) { if (DECL_SECTION_NAME (decl)) { - char * name = TREE_STRING_POINTER (DECL_SECTION_NAME (decl)); + const char *name = TREE_STRING_POINTER (DECL_SECTION_NAME (decl)); if (streq (name, ".zdata") || streq (name, ".zbss")) v850_set_data_area (decl, DATA_AREA_ZDA); diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e6f17ead128..bf8dd2aa16a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2000-03-07 Kaveh R. Ghazi + + * decl2.c (finish_objects): Constify a char*. + + * method.c (emit_thunk): Likewise. + 2000-03-06 Nathan Sidwell * typeck.c (dubious_conversion_warnings): Look through diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 8e66bb6bc3c..7f5ba6a3901 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -2840,7 +2840,7 @@ finish_objects (method_type, initp, body) int method_type, initp; tree body; { - char *fnname; + const char *fnname; tree fn; /* Finish up. */ diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 4a41e5ab80b..6e869f1e88c 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -2098,7 +2098,7 @@ emit_thunk (thunk_fndecl) #ifdef ASM_OUTPUT_MI_THUNK if (!flag_syntax_only) { - char *fnname; + const char *fnname; current_function_decl = thunk_fndecl; /* Make sure we build up its RTL before we go onto the temporary obstack. */ diff --git a/gcc/cse.c b/gcc/cse.c index 944d86f3be8..8c2e9fc580a 100644 --- a/gcc/cse.c +++ b/gcc/cse.c @@ -2252,7 +2252,9 @@ canon_hash (x, mode) hash += canon_hash (XVECEXP (x, i, j), 0); else if (fmt[i] == 's') { - register unsigned char *p = (unsigned char *) XSTR (x, i); + register const unsigned char *p = + (const unsigned char *) XSTR (x, i); + if (p) while (*p) hash += *p++; diff --git a/gcc/dbxout.c b/gcc/dbxout.c index 4c84c31184d..ada8c76a5a8 100644 --- a/gcc/dbxout.c +++ b/gcc/dbxout.c @@ -2627,7 +2627,7 @@ dbxout_block (block, depth, args) int ignored; #if DBX_BLOCKS_FUNCTION_RELATIVE - char *begin_label; + const char *begin_label; if (current_function_func_begin_label != NULL_TREE) begin_label = IDENTIFIER_POINTER (current_function_func_begin_label); else diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index 503bee9dc2c..1b404625f7b 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -78,7 +78,7 @@ static void notice PARAMS ((const char *s, ...)) ATTRIBUTE_PRINTF_1; static void v_message_with_file_and_line PARAMS ((const char *, int, int, const char *, va_list)); static void v_message_with_decl PARAMS ((tree, int, const char *, va_list)); -static void file_and_line_for_asm PARAMS ((rtx, char **, int *)); +static void file_and_line_for_asm PARAMS ((rtx, const char **, int *)); static void v_error_with_file_and_line PARAMS ((const char *, int, const char *, va_list)); static void v_error_with_decl PARAMS ((tree, const char *, va_list)); @@ -574,7 +574,7 @@ v_message_with_decl (decl, warn, msgid, ap) static void file_and_line_for_asm (insn, pfile, pline) rtx insn; - char **pfile; + const char **pfile; int *pline; { rtx body = PATTERN (insn); @@ -649,7 +649,7 @@ v_error_for_asm (insn, msgid, ap) const char *msgid; va_list ap; { - char *file; + const char *file; int line; count_error (0); @@ -737,7 +737,7 @@ v_warning_for_asm (insn, msgid, ap) { if (count_error (1)) { - char *file; + const char *file; int line; file_and_line_for_asm (insn, &file, &line); diff --git a/gcc/dwarfout.c b/gcc/dwarfout.c index 9d4137915b1..0c0b7f28b08 100644 --- a/gcc/dwarfout.c +++ b/gcc/dwarfout.c @@ -383,7 +383,7 @@ static char *type_tag PARAMS ((tree)); static inline void dienum_push PARAMS ((void)); static inline void dienum_pop PARAMS ((void)); static inline tree member_declared_type PARAMS ((tree)); -static char *function_start_label PARAMS ((tree)); +static const char *function_start_label PARAMS ((tree)); static void output_array_type_die PARAMS ((void *)); static void output_set_type_die PARAMS ((void *)); #if 0 @@ -3205,12 +3205,12 @@ member_declared_type (member) This may be different from the DECL_NAME name used in the source file. */ -static char * +static const char * function_start_label (decl) register tree decl; { rtx x; - char *fnname; + const char *fnname; x = DECL_RTL (decl); if (GET_CODE (x) != MEM) diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 27b837447f0..3d6f73b69ac 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -3009,7 +3009,7 @@ emit_note_after (subtype, after) rtx emit_line_note_after (file, line, after) - char *file; + const char *file; int line; rtx after; { @@ -3208,7 +3208,7 @@ emit_barrier () rtx emit_line_note (file, line) - char *file; + const char *file; int line; { set_file_and_line_for_stmt (file, line); @@ -3228,7 +3228,7 @@ emit_line_note (file, line) rtx emit_note (file, line) - char *file; + const char *file; int line; { register rtx note; @@ -3260,7 +3260,7 @@ emit_note (file, line) rtx emit_line_note_force (file, line) - char *file; + const char *file; int line; { last_linenum = -1; diff --git a/gcc/final.c b/gcc/final.c index 948ecd33e5d..01dd1ba6b83 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -147,7 +147,7 @@ static int high_block_linenum; static int high_function_linenum; /* Filename of last NOTE. */ -static char *last_filename; +static const char *last_filename; /* Number of basic blocks seen so far; used if profile_block_flag is set. */ @@ -1537,7 +1537,7 @@ static int asm_insn_count (body) rtx body; { - char *template; + const char *template; int count = 1; if (GET_CODE (body) == ASM_INPUT) @@ -2532,7 +2532,7 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) { unsigned int noperands = asm_noperands (body); rtx *ops = (rtx *) alloca (noperands * sizeof (rtx)); - char *string; + const char *string; /* There's no telling what that did to the condition codes. */ CC_STATUS_INIT; @@ -2972,7 +2972,7 @@ output_source_line (file, insn) FILE *file ATTRIBUTE_UNUSED; rtx insn; { - register char *filename = NOTE_SOURCE_FILE (insn); + register const char *filename = NOTE_SOURCE_FILE (insn); /* Remember filename for basic block profiling. Filenames are allocated on the permanent obstack diff --git a/gcc/function.h b/gcc/function.h index 9ede7a73d08..8b26ec2e371 100644 --- a/gcc/function.h +++ b/gcc/function.h @@ -95,7 +95,7 @@ struct emit_status /* Line number and source file of the last line-number NOTE emitted. This is used to avoid generating duplicates. */ int x_last_linenum; - char *x_last_filename; + const char *x_last_filename; /* A vector indexed by pseudo reg number. The allocated length of this vector is regno_pointer_flag_length. Since this diff --git a/gcc/gcse.c b/gcc/gcse.c index aaa2f6d2591..d3e00b83c20 100644 --- a/gcc/gcse.c +++ b/gcc/gcse.c @@ -1416,7 +1416,7 @@ hash_expr_1 (x, mode, do_not_record_p) final assembler. This also avoids differences in the dump files between various stages. */ unsigned int h = 0; - unsigned char *p = (unsigned char *) XSTR (x, 0); + const unsigned char *p = (const unsigned char *) XSTR (x, 0); while (*p) h += (h << 7) + *p++; /* ??? revisit */ @@ -1488,7 +1488,8 @@ hash_expr_1 (x, mode, do_not_record_p) else if (fmt[i] == 's') { - register unsigned char *p = (unsigned char *) XSTR (x, i); + register const unsigned char *p = + (const unsigned char *) XSTR (x, i); if (p) while (*p) diff --git a/gcc/genattr.c b/gcc/genattr.c index 1a3abcd4055..30160a44379 100644 --- a/gcc/genattr.c +++ b/gcc/genattr.c @@ -91,7 +91,7 @@ static void gen_attr (attr) rtx attr; { - char *p; + const char *p; int is_const = GET_CODE (XEXP (attr, 2)) == CONST; printf ("#define HAVE_ATTR_%s\n", XSTR (attr, 0)); @@ -306,7 +306,7 @@ from the machine description file `md'. */\n\n"); else if (GET_CODE (desc) == DEFINE_FUNCTION_UNIT) { - char *name = XSTR (desc, 0); + const char *name = XSTR (desc, 0); int multiplicity = XINT (desc, 1); int simultaneity = XINT (desc, 2); int ready_cost = MAX (XINT (desc, 4), 1); diff --git a/gcc/genattrtab.c b/gcc/genattrtab.c index ebf6ea1de6b..a656f1fc995 100644 --- a/gcc/genattrtab.c +++ b/gcc/genattrtab.c @@ -216,7 +216,7 @@ struct function_unit_op struct function_unit { - char *name; /* Function unit name. */ + const char *name; /* Function unit name. */ struct function_unit *next; /* Next function unit. */ int num; /* Ordinal of this unit type. */ int multiplicity; /* Number of units of this type. */ @@ -316,7 +316,7 @@ static int *insn_alternatives; This is the hashed, unique string for the numeral whose value is chosen alternative. */ -static char *current_alternative_string; +static const char *current_alternative_string; /* Used to simplify expressions. */ @@ -432,7 +432,7 @@ static void write_attr_set PARAMS ((struct attr_desc *, int, rtx, static void write_attr_case PARAMS ((struct attr_desc *, struct attr_value *, int, const char *, const char *, int, rtx)); static void write_unit_name PARAMS ((const char *, int, const char *)); -static void write_attr_valueq PARAMS ((struct attr_desc *, char *)); +static void write_attr_valueq PARAMS ((struct attr_desc *, const char *)); static void write_attr_value PARAMS ((struct attr_desc *, rtx)); static void write_upcase PARAMS ((const char *)); static void write_indent PARAMS ((int)); @@ -443,16 +443,16 @@ static void write_complex_function PARAMS ((struct function_unit *, const char * static int write_expr_attr_cache PARAMS ((rtx, struct attr_desc *)); static void write_toplevel_expr PARAMS ((rtx)); static void write_const_num_delay_slots PARAMS ((void)); -static int n_comma_elts PARAMS ((char *)); -static char *next_comma_elt PARAMS ((char **)); +static int n_comma_elts PARAMS ((const char *)); +static char *next_comma_elt PARAMS ((const char **)); static struct attr_desc *find_attr PARAMS ((const char *, int)); static void make_internal_attr PARAMS ((const char *, rtx, int)); static struct attr_value *find_most_used PARAMS ((struct attr_desc *)); static rtx find_single_value PARAMS ((struct attr_desc *)); static rtx make_numeric_value PARAMS ((int)); static void extend_range PARAMS ((struct range *, int, int)); -static rtx attr_eq PARAMS ((char *, char *)); -static char *attr_numeral PARAMS ((int)); +static rtx attr_eq PARAMS ((const char *, const char *)); +static const char *attr_numeral PARAMS ((int)); static int attr_equal_p PARAMS ((rtx, rtx)); static rtx attr_copy_rtx PARAMS ((rtx)); @@ -765,13 +765,13 @@ attr_printf VPARAMS ((register int len, const char *fmt, ...)) static rtx attr_eq (name, value) - char *name, *value; + const char *name, *value; { return attr_rtx (EQ_ATTR, attr_string (name, strlen (name)), attr_string (value, strlen (value))); } -static char * +static const char * attr_numeral (n) int n; { @@ -932,7 +932,7 @@ check_attr_test (exp, is_const) { struct attr_desc *attr; struct attr_value *av; - char *name_ptr, *p; + const char *name_ptr, *p; rtx orexp, newexp; switch (GET_CODE (exp)) @@ -1079,7 +1079,7 @@ check_attr_value (exp, attr) struct attr_desc *attr; { struct attr_value *av; - char *p; + const char *p; int i; switch (GET_CODE (exp)) @@ -1217,7 +1217,7 @@ convert_set_attr_alternative (exp, num_alt, insn_index) for (i = 0; i < num_alt - 1; i++) { - char *p; + const char *p; p = attr_numeral (i); XVECEXP (condexp, 0, 2 * i) = attr_eq (alternative_name, p); @@ -1245,7 +1245,7 @@ convert_set_attr (exp, num_alt, insn_index) int insn_index; { rtx newexp; - char *name_ptr; + const char *name_ptr; char *p; int n; @@ -2761,7 +2761,7 @@ compute_alternative_mask (exp, code) rtx exp; enum rtx_code code; { - char *string; + const char *string; if (GET_CODE (exp) == code) return compute_alternative_mask (XEXP (exp, 0), code) | compute_alternative_mask (XEXP (exp, 1), code); @@ -3608,7 +3608,7 @@ simplify_by_exploding (exp) { /* Pull the first attribute value from the list and record that attribute as another dimension in the attribute space. */ - char *name = XSTR (XEXP (list, 0), 0); + const char *name = XSTR (XEXP (list, 0), 0); rtx *prev; if ((space[ndim].attr = find_attr (name, 0)) == 0 @@ -4140,7 +4140,7 @@ gen_attr (exp) { struct attr_desc *attr; struct attr_value *av; - char *name_ptr; + const char *name_ptr; char *p; /* Make a new attribute structure. Check for duplicate by looking at @@ -4374,7 +4374,7 @@ gen_unit (def) { struct function_unit *unit; struct function_unit_op *op; - char *name = XSTR (def, 0); + const char *name = XSTR (def, 0); int multiplicity = XINT (def, 1); int simultaneity = XINT (def, 2); rtx condexp = XEXP (def, 3); @@ -5253,7 +5253,7 @@ write_unit_name (prefix, num, suffix) static void write_attr_valueq (attr, s) struct attr_desc *attr; - char *s; + const char *s; { if (attr->is_numeric) { @@ -5673,7 +5673,7 @@ write_complex_function (unit, name, connection) static int n_comma_elts (s) - char *s; + const char *s; { int n; @@ -5693,10 +5693,10 @@ n_comma_elts (s) static char * next_comma_elt (pstr) - char **pstr; + const char **pstr; { char *out_str; - char *p; + const char *p; if (**pstr == '\0') return NULL; diff --git a/gcc/genflags.c b/gcc/genflags.c index 085c7450a2e..d1f19e08b81 100644 --- a/gcc/genflags.c +++ b/gcc/genflags.c @@ -134,8 +134,8 @@ static void gen_insn (insn) rtx insn; { - char *name = XSTR (insn, 0); - char *p; + const char *name = XSTR (insn, 0); + const char *p; struct obstack *obstack_ptr; int len; diff --git a/gcc/gengenrtl.c b/gcc/gengenrtl.c index 96b1d277d13..2eec4592699 100644 --- a/gcc/gengenrtl.c +++ b/gcc/gengenrtl.c @@ -115,7 +115,7 @@ type_from_format (c) return "HOST_WIDE_INT "; case 's': - return "char *"; + return "const char *"; case 'e': case 'u': return "rtx "; diff --git a/gcc/genopinit.c b/gcc/genopinit.c index 2fd1a4f1021..ac5debbb30f 100644 --- a/gcc/genopinit.c +++ b/gcc/genopinit.c @@ -128,7 +128,7 @@ static void gen_insn (insn) rtx insn; { - char *name = XSTR (insn, 0); + const char *name = XSTR (insn, 0); int m1 = 0, m2 = 0, op = 0; size_t pindex; int i; diff --git a/gcc/genoutput.c b/gcc/genoutput.c index 2170174bf5b..2935f66d4e9 100644 --- a/gcc/genoutput.c +++ b/gcc/genoutput.c @@ -103,7 +103,7 @@ struct obstack *rtl_obstack = &obstack; #define obstack_chunk_alloc xmalloc #define obstack_chunk_free free -static int n_occurrences PARAMS ((int, char *)); +static int n_occurrences PARAMS ((int, const char *)); static void strip_whitespace PARAMS ((char *)); /* insns in the machine description are assigned sequential code numbers @@ -185,13 +185,12 @@ static void scan_operands PARAMS ((struct data *, rtx, int, int)); static int compare_operands PARAMS ((struct operand_data *, struct operand_data *)); static void place_operands PARAMS ((struct data *)); -static void process_template PARAMS ((struct data *, char *)); +static void process_template PARAMS ((struct data *, const char *)); static void validate_insn_alternatives PARAMS ((struct data *)); static void gen_insn PARAMS ((rtx)); static void gen_peephole PARAMS ((rtx)); static void gen_expand PARAMS ((rtx)); static void gen_split PARAMS ((rtx)); -static int n_occurrences PARAMS ((int, char *)); const char * get_insn_name (index) @@ -637,9 +636,9 @@ place_operands (d) static void process_template (d, template) struct data *d; - char *template; + const char *template; { - register char *cp; + register const char *cp; register int i; /* Templates starting with * contain straight code to be run. */ @@ -969,7 +968,7 @@ main (argc, argv) static int n_occurrences (c, s) int c; - char *s; + const char *s; { int n = 0; while (*s) diff --git a/gcc/ggc-page.c b/gcc/ggc-page.c index 7dcf64edfae..a7490f3cad1 100644 --- a/gcc/ggc-page.c +++ b/gcc/ggc-page.c @@ -730,7 +730,7 @@ ggc_alloc_obj (size, zero) int ggc_set_mark (p) - void *p; + const void *p; { page_entry *entry; unsigned bit, word; @@ -746,7 +746,7 @@ ggc_set_mark (p) /* Calculate the index of the object on the page; this is its bit position in the in_use_p bitmap. */ - bit = (((char *) p) - entry->page) >> entry->order; + bit = (((const char *) p) - entry->page) >> entry->order; word = bit / HOST_BITS_PER_LONG; mask = (unsigned long) 1 << (bit % HOST_BITS_PER_LONG); @@ -770,7 +770,7 @@ ggc_set_mark (p) void ggc_mark_if_gcable (p) - void *p; + const void *p; { if (p && ggc_allocated_p (p)) ggc_set_mark (p); @@ -780,7 +780,7 @@ ggc_mark_if_gcable (p) size_t ggc_get_size (p) - void *p; + const void *p; { page_entry *pe = lookup_page_table_entry (p); return 1 << pe->order; diff --git a/gcc/ggc-simple.c b/gcc/ggc-simple.c index 6608d8c9841..6d1545c4112 100644 --- a/gcc/ggc-simple.c +++ b/gcc/ggc-simple.c @@ -217,11 +217,11 @@ ggc_alloc_obj (size, zero) int ggc_set_mark (p) - void *p; + const void *p; { struct ggc_mem *x; - x = (struct ggc_mem *) ((char *)p - offsetof (struct ggc_mem, u)); + x = (struct ggc_mem *) ((const char *)p - offsetof (struct ggc_mem, u)); #ifdef GGC_ALWAYS_VERIFY if (! tree_lookup (x)) abort (); @@ -241,14 +241,14 @@ ggc_set_mark (p) void ggc_mark_if_gcable (p) - void *p; + const void *p; { struct ggc_mem *x; if (p == NULL) return; - x = (struct ggc_mem *) ((char *)p - offsetof (struct ggc_mem, u)); + x = (struct ggc_mem *) ((const char *)p - offsetof (struct ggc_mem, u)); if (! tree_lookup (x)) return; @@ -264,10 +264,10 @@ ggc_mark_if_gcable (p) size_t ggc_get_size (p) - void *p; + const void *p; { struct ggc_mem *x - = (struct ggc_mem *) ((char *)p - offsetof (struct ggc_mem, u)); + = (struct ggc_mem *) ((const char *)p - offsetof (struct ggc_mem, u)); return x->size; } diff --git a/gcc/ggc.h b/gcc/ggc.h index 781c15afa1d..32f40965c6e 100644 --- a/gcc/ggc.h +++ b/gcc/ggc.h @@ -94,20 +94,20 @@ extern void ggc_mark_tree_children PARAMS ((union tree_node *)); #define ggc_mark_string(EXPR) \ do { \ - char *s__ = (EXPR); \ + const char *s__ = (EXPR); \ if (s__ != NULL) \ ggc_set_mark (s__); \ } while (0) #define ggc_mark(EXPR) \ do { \ - void *a__ = (EXPR); \ + const void *a__ = (EXPR); \ if (a__ != NULL) \ ggc_set_mark (a__); \ } while (0) /* Mark, but only if it was allocated in collectable memory. */ -extern void ggc_mark_if_gcable PARAMS ((void *)); +extern void ggc_mark_if_gcable PARAMS ((const void *)); /* A GC implementation must provide these functions. */ @@ -151,7 +151,7 @@ void ggc_collect PARAMS ((void)); returns zero if the object was not previously marked; non-zero if the object was already marked, or if, for any other reason, pointers in this data structure should not be traversed. */ -int ggc_set_mark PARAMS ((void *)); +int ggc_set_mark PARAMS ((const void *)); /* Callbacks to the languages. */ @@ -200,7 +200,7 @@ typedef struct ggc_statistics } ggc_statistics; /* Return the number of bytes allocated at the indicated address. */ -size_t ggc_get_size PARAMS ((void *)); +size_t ggc_get_size PARAMS ((const void *)); /* Used by the various collectors to gather and print statistics that do not depend on the collector in use. */ diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 71da53a331b..1817904fdaf 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -161,7 +161,7 @@ static void finish_objc PARAMS ((void)); static void synth_module_prologue PARAMS ((void)); static tree build_constructor PARAMS ((tree, tree)); -static char *build_module_descriptor PARAMS ((void)); +static const char *build_module_descriptor PARAMS ((void)); static tree init_module_descriptor PARAMS ((tree)); static tree build_objc_method_call PARAMS ((int, tree, tree, tree, tree, tree)); @@ -1681,7 +1681,7 @@ init_module_descriptor (type) struct objc_module { ... } _OBJC_MODULE = { ... }; */ -static char * +static const char * build_module_descriptor () { tree decl_specs, field_decl, field_decl_chain; @@ -8189,7 +8189,7 @@ finish_objc () || meth_var_names_chain || meth_var_types_chain || sel_ref_chain) { /* Arrange for Objc data structures to be initialized at run time. */ - char *init_name = build_module_descriptor (); + const char *init_name = build_module_descriptor (); if (init_name) assemble_constructor (init_name); } diff --git a/gcc/optabs.c b/gcc/optabs.c index c1366d17f42..6474a533a7b 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -4432,7 +4432,7 @@ init_one_libfunc (name) if (ggc_p) name = ggc_alloc_string (name, -1); - return gen_rtx_SYMBOL_REF (Pmode, (char *) name); + return gen_rtx_SYMBOL_REF (Pmode, name); } /* Mark ARG (which is really an OPTAB *) for GC. */ diff --git a/gcc/output.h b/gcc/output.h index 79084c035fb..160f1243c47 100644 --- a/gcc/output.h +++ b/gcc/output.h @@ -251,7 +251,7 @@ extern void assemble_asm PARAMS ((tree)); with defining the name of the function. DECL describes the function. NAME is the function's name. For the constant pool, we use the current constant pool data. */ -extern void assemble_start_function PARAMS ((tree, char *)); +extern void assemble_start_function PARAMS ((tree, const char *)); /* Output assembler code associated with defining the size of the function. DECL describes the function. NAME is the function's name. */ diff --git a/gcc/recog.c b/gcc/recog.c index c0ea1973f61..56f86345b21 100644 --- a/gcc/recog.c +++ b/gcc/recog.c @@ -1405,7 +1405,7 @@ asm_noperands (body) If MODES, OPERAND_LOCS, CONSTRAINTS or OPERANDS is 0, we don't store that info. */ -char * +const char * decode_asm_operands (body, operands, operand_locs, constraints, modes) rtx body; rtx *operands; @@ -1415,7 +1415,7 @@ decode_asm_operands (body, operands, operand_locs, constraints, modes) { register int i; int noperands; - char *template = 0; + const char *template = 0; if (GET_CODE (body) == SET && GET_CODE (SET_SRC (body)) == ASM_OPERANDS) { diff --git a/gcc/rtl.h b/gcc/rtl.h index 52f81521c93..7fc1a1c751f 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -87,7 +87,7 @@ typedef union rtunion_def { HOST_WIDE_INT rtwint; int rtint; - char *rtstr; + const char *rtstr; struct rtx_def *rtx; struct rtvec_def *rtvec; enum machine_mode rttype; @@ -1031,7 +1031,7 @@ extern rtx emit_jump_insn_after PARAMS ((rtx, rtx)); extern rtx emit_barrier_after PARAMS ((rtx)); extern rtx emit_label_after PARAMS ((rtx, rtx)); extern rtx emit_note_after PARAMS ((int, rtx)); -extern rtx emit_line_note_after PARAMS ((char *, int, rtx)); +extern rtx emit_line_note_after PARAMS ((const char *, int, rtx)); extern rtx emit_insn PARAMS ((rtx)); extern rtx emit_insns PARAMS ((rtx)); extern rtx emit_insns_before PARAMS ((rtx, rtx)); @@ -1040,9 +1040,9 @@ extern rtx emit_jump_insn PARAMS ((rtx)); extern rtx emit_call_insn PARAMS ((rtx)); extern rtx emit_label PARAMS ((rtx)); extern rtx emit_barrier PARAMS ((void)); -extern rtx emit_line_note PARAMS ((char *, int)); -extern rtx emit_note PARAMS ((char *, int)); -extern rtx emit_line_note_force PARAMS ((char *, int)); +extern rtx emit_line_note PARAMS ((const char *, int)); +extern rtx emit_note PARAMS ((const char *, int)); +extern rtx emit_line_note_force PARAMS ((const char *, int)); extern rtx make_insn_raw PARAMS ((rtx)); extern rtx previous_insn PARAMS ((rtx)); extern rtx next_insn PARAMS ((rtx)); @@ -1163,7 +1163,7 @@ extern void free_reg_info PARAMS ((void)); /* recog.c */ extern int asm_noperands PARAMS ((rtx)); -extern char *decode_asm_operands PARAMS ((rtx, rtx *, rtx **, +extern const char *decode_asm_operands PARAMS ((rtx, rtx *, rtx **, const char **, enum machine_mode *)); diff --git a/gcc/toplev.c b/gcc/toplev.c index 17fa6556ceb..f10e1e2f551 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -3683,7 +3683,7 @@ rest_of_compilation (decl) TIMEVAR (final_time, { rtx x; - char *fnname; + const char *fnname; /* Get the function's name, as described by its RTL. This may be different from the DECL_NAME name used diff --git a/gcc/tree.h b/gcc/tree.h index 549ab44b3b8..635756268eb 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -2496,10 +2496,10 @@ extern void check_max_integer_computation_mode PARAMS ((tree)); /* In emit-rtl.c */ extern void start_sequence_for_rtl_expr PARAMS ((tree)); -extern struct rtx_def *emit_line_note_after PARAMS ((char *, int, - struct rtx_def *)); -extern struct rtx_def *emit_line_note PARAMS ((char *, int)); -extern struct rtx_def *emit_line_note_force PARAMS ((char *, int)); +extern struct rtx_def *emit_line_note_after PARAMS ((const char *, int, + struct rtx_def *)); +extern struct rtx_def *emit_line_note PARAMS ((const char *, int)); +extern struct rtx_def *emit_line_note_force PARAMS ((const char *, int)); /* In calls.c */ extern void special_function_p PARAMS ((tree, int *, int *, diff --git a/gcc/varasm.c b/gcc/varasm.c index b90322084a7..7805c1d4c22 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -178,17 +178,18 @@ static void output_constructor PARAMS ((tree, int)); static void remove_from_pending_weak_list PARAMS ((char *)); #endif #ifdef ASM_OUTPUT_BSS -static void asm_output_bss PARAMS ((FILE *, tree, char *, int, int)); +static void asm_output_bss PARAMS ((FILE *, tree, const char *, int, int)); #endif #ifdef BSS_SECTION_ASM_OP #ifdef ASM_OUTPUT_ALIGNED_BSS -static void asm_output_aligned_bss PARAMS ((FILE *, tree, char *, int, int)); +static void asm_output_aligned_bss PARAMS ((FILE *, tree, const char *, + int, int)); #endif #endif /* BSS_SECTION_ASM_OP */ static void mark_pool_constant PARAMS ((struct pool_constant *)); static void mark_pool_sym_hash_table PARAMS ((struct pool_sym **)); static void mark_const_hash_entry PARAMS ((void *)); -static void asm_emit_uninitialised PARAMS ((tree, char *, int, int)); +static void asm_emit_uninitialised PARAMS ((tree, const char*, int, int)); static enum in_section { no_section, in_text, in_data, in_named #ifdef BSS_SECTION_ASM_OP @@ -377,7 +378,7 @@ static void asm_output_bss (file, decl, name, size, rounded) FILE *file; tree decl ATTRIBUTE_UNUSED; - char *name; + const char *name; int size ATTRIBUTE_UNUSED, rounded; { ASM_GLOBALIZE_LABEL (file, name); @@ -405,7 +406,7 @@ static void asm_output_aligned_bss (file, decl, name, size, align) FILE *file; tree decl; - char *name; + const char *name; int size, align; { ASM_GLOBALIZE_LABEL (file, name); @@ -997,7 +998,7 @@ assemble_gc_entry (name) void assemble_start_function (decl, fnname) tree decl; - char *fnname; + const char *fnname; { int align; @@ -1239,7 +1240,7 @@ assemble_string (p, size) static void asm_emit_uninitialised (decl, name, size, rounded) tree decl; - char * name; + const char * name; int size ATTRIBUTE_UNUSED; int rounded ATTRIBUTE_UNUSED; { @@ -1328,7 +1329,7 @@ assemble_variable (decl, top_level, at_end, dont_output_data) int at_end ATTRIBUTE_UNUSED; int dont_output_data; { - register char *name; + register const char *name; unsigned int align; tree size_tree = NULL_TREE; int reloc = 0; @@ -2375,7 +2376,7 @@ static int const_hash (exp) tree exp; { - register char *p; + register const char *p; register int len, hi, i; register enum tree_code code = TREE_CODE (exp); @@ -2406,9 +2407,12 @@ const_hash (exp) case CONSTRUCTOR: if (TREE_CODE (TREE_TYPE (exp)) == SET_TYPE) { + char *tmp; + len = int_size_in_bytes (TREE_TYPE (exp)); - p = (char *) alloca (len); - get_set_constructor_bytes (exp, (unsigned char *) p, len); + tmp = (char *) alloca (len); + get_set_constructor_bytes (exp, (unsigned char *) tmp, len); + p = tmp; break; } else @@ -2509,7 +2513,7 @@ compare_constant_1 (exp, p) tree exp; char *p; { - register char *strp; + register const char *strp; register int len; register enum tree_code code = TREE_CODE (exp); @@ -2566,9 +2570,10 @@ compare_constant_1 (exp, p) if (TREE_CODE (TREE_TYPE (exp)) == SET_TYPE) { int xlen = len = int_size_in_bytes (TREE_TYPE (exp)); + unsigned char *tmp = (unsigned char *) alloca (len); - strp = (char *) alloca (len); - get_set_constructor_bytes (exp, (unsigned char *) strp, len); + get_set_constructor_bytes (exp, (unsigned char *) tmp, len); + strp = tmp; if (bcmp ((char *) &xlen, p, sizeof xlen)) return 0; @@ -3683,7 +3688,7 @@ find_pool_constant (f, addr) rtx addr; { struct pool_sym *sym; - char *label = XSTR (addr, 0); + const char *label = XSTR (addr, 0); for (sym = f->varasm->x_const_rtx_sym_hash_table[SYMHASH (label)]; sym; sym = sym->next) if (sym->label == label) @@ -3873,7 +3878,7 @@ mark_constant_pool () for (pool = first_pool; pool; pool = pool->next) { struct pool_sym *sym; - char *label; + const char *label; /* skip unmarked entries; no insn refers to them. */ if (!pool->mark) @@ -4702,7 +4707,7 @@ void assemble_alias (decl, target) tree decl, target ATTRIBUTE_UNUSED; { - char *name; + const char *name; make_decl_rtl (decl, (char *) 0, 1); name = XSTR (XEXP (DECL_RTL (decl), 0), 0); diff --git a/gcc/xcoffout.h b/gcc/xcoffout.h index 91885396bff..5e912be2f3d 100644 --- a/gcc/xcoffout.h +++ b/gcc/xcoffout.h @@ -103,7 +103,7 @@ Boston, MA 02111-1307, USA. */ if (current_sym_addr && current_sym_code == N_FUN \ && GET_CODE (current_sym_addr) == SYMBOL_REF) \ { \ - char *_p = XSTR (current_sym_addr, 0); \ + const char *_p = XSTR (current_sym_addr, 0); \ if (*_p == '*') \ fprintf (asmfile, "%s", _p+1); \ else \ -- 2.11.4.GIT