This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Add casts to memory allocation related calls
- From: Simon Marchi <simark at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 25 Sep 2015 18:09:52 -0000
- Subject: [binutils-gdb] Add casts to memory allocation related calls
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=224c3ddb89a43bf8db06c373d4ff429477833c0f
commit 224c3ddb89a43bf8db06c373d4ff429477833c0f
Author: Simon Marchi <simon.marchi@ericsson.com>
Date: Fri Sep 25 14:08:06 2015 -0400
Add casts to memory allocation related calls
Most allocation functions (if not all) return a void* pointing to the
allocated memory. In C++, we need to add an explicit cast when
assigning the result to a pointer to another type (which is the case
more often than not).
The content of this patch is taken from Pedro's branch, from commit
"(mostly) auto-generated patch to insert casts needed for C++". I
validated that the changes make sense and manually reflowed the code to
make it respect the coding style. I also found multiple places where I
could use XNEW/XNEWVEC/XRESIZEVEC/etc.
Thanks a lot to whoever did that automated script to insert casts, doing
it completely by hand would have taken a ridiculous amount of time.
Only files built on x86 with --enable-targets=all are modified. This
means that all other -nat.c files are untouched and will have to be
dealt with later by using appropiate compilers. Or maybe we can try to
build them with a regular g++ just to know where to add casts, I don't
know.
I built-tested this with --enable-targets=all and reg-tested.
Here's the changelog entry, which was not too bad to make despite the
size, thanks to David Malcom's script. I fixed some bits by hand, but
there might be some wrong parts left (hopefully not).
gdb/ChangeLog:
* aarch64-linux-tdep.c (aarch64_stap_parse_special_token): Add cast
to allocation result assignment.
* ada-exp.y (write_object_renaming): Likewise.
(write_ambiguous_var): Likewise.
(ada_nget_field_index): Likewise.
(write_var_or_type): Likewise.
* ada-lang.c (ada_decode_symbol): Likewise.
(ada_value_assign): Likewise.
(value_pointer): Likewise.
(cache_symbol): Likewise.
(add_nonlocal_symbols): Likewise.
(ada_name_for_lookup): Likewise.
(symbol_completion_add): Likewise.
(ada_to_fixed_type_1): Likewise.
(ada_get_next_arg): Likewise.
(defns_collected): Likewise.
* ada-lex.l (processId): Likewise.
(processString): Likewise.
* ada-tasks.c (read_known_tasks_array): Likewise.
(read_known_tasks_list): Likewise.
* ada-typeprint.c (decoded_type_name): Likewise.
* addrmap.c (addrmap_mutable_create_fixed): Likewise.
* amd64-tdep.c (amd64_push_arguments): Likewise.
(amd64_displaced_step_copy_insn): Likewise.
(amd64_classify_insn_at): Likewise.
(amd64_relocate_instruction): Likewise.
* amd64obsd-tdep.c (amd64obsd_sigtramp_p): Likewise.
* arch-utils.c (simple_displaced_step_copy_insn): Likewise.
(initialize_current_architecture): Likewise.
* arm-linux-tdep.c (arm_stap_parse_special_token): Likewise.
* arm-symbian-tdep.c (arm_symbian_osabi_sniffer): Likewise.
* arm-tdep.c (arm_exidx_new_objfile): Likewise.
(arm_push_dummy_call): Likewise.
(extend_buffer_earlier): Likewise.
(arm_adjust_breakpoint_address): Likewise.
(arm_skip_stub): Likewise.
* auto-load.c (filename_is_in_pattern): Likewise.
(maybe_add_script_file): Likewise.
(maybe_add_script_text): Likewise.
(auto_load_objfile_script_1): Likewise.
* auxv.c (ld_so_xfer_auxv): Likewise.
* ax-general.c (new_agent_expr): Likewise.
(grow_expr): Likewise.
(ax_reg_mask): Likewise.
* bcache.c (bcache_full): Likewise.
* breakpoint.c (program_breakpoint_here_p): Likewise.
* btrace.c (parse_xml_raw): Likewise.
* build-id.c (build_id_to_debug_bfd): Likewise.
* buildsym.c (end_symtab_with_blockvector): Likewise.
* c-exp.y (string_exp): Likewise.
(qualified_name): Likewise.
(write_destructor_name): Likewise.
(operator_stoken): Likewise.
(parse_number): Likewise.
(scan_macro_expansion): Likewise.
(yylex): Likewise.
(c_print_token): Likewise.
* c-lang.c (c_get_string): Likewise.
(emit_numeric_character): Likewise.
* charset.c (wchar_iterate): Likewise.
* cli/cli-cmds.c (complete_command): Likewise.
(make_command): Likewise.
* cli/cli-dump.c (restore_section_callback): Likewise.
(restore_binary_file): Likewise.
* cli/cli-interp.c (cli_interpreter_exec): Likewise.
* cli/cli-script.c (execute_control_command): Likewise.
* cli/cli-setshow.c (do_set_command): Likewise.
* coff-pe-read.c (add_pe_forwarded_sym): Likewise.
(read_pe_exported_syms): Likewise.
* coffread.c (coff_read_struct_type): Likewise.
(coff_read_enum_type): Likewise.
* common/btrace-common.c (btrace_data_append): Likewise.
* common/buffer.c (buffer_grow): Likewise.
* common/filestuff.c (gdb_fopen_cloexec): Likewise.
* common/format.c (parse_format_string): Likewise.
* common/gdb_vecs.c (delim_string_to_char_ptr_vec_append): Likewise.
* common/xml-utils.c (xml_escape_text): Likewise.
* compile/compile-object-load.c (copy_sections): Likewise.
(compile_object_load): Likewise.
* compile/compile-object-run.c (compile_object_run): Likewise.
* completer.c (filename_completer): Likewise.
* corefile.c (read_memory_typed_address): Likewise.
(write_memory_unsigned_integer): Likewise.
(write_memory_signed_integer): Likewise.
(complete_set_gnutarget): Likewise.
* corelow.c (get_core_register_section): Likewise.
* cp-name-parser.y (d_grab): Likewise.
(allocate_info): Likewise.
(cp_new_demangle_parse_info): Likewise.
* cp-namespace.c (cp_scan_for_anonymous_namespaces): Likewise.
(cp_lookup_symbol_in_namespace): Likewise.
(lookup_namespace_scope): Likewise.
(find_symbol_in_baseclass): Likewise.
(cp_lookup_nested_symbol): Likewise.
(cp_lookup_transparent_type_loop): Likewise.
* cp-support.c (copy_string_to_obstack): Likewise.
(make_symbol_overload_list): Likewise.
(make_symbol_overload_list_namespace): Likewise.
(make_symbol_overload_list_adl_namespace): Likewise.
(first_component_command): Likewise.
* cp-valprint.c (cp_print_value): Likewise.
* ctf.c (ctf_xfer_partial): Likewise.
* d-exp.y (StringExp): Likewise.
* d-namespace.c (d_lookup_symbol_in_module): Likewise.
(lookup_module_scope): Likewise.
(find_symbol_in_baseclass): Likewise.
(d_lookup_nested_symbol): Likewise.
* dbxread.c (find_stab_function_addr): Likewise.
(read_dbx_symtab): Likewise.
(dbx_end_psymtab): Likewise.
(cp_set_block_scope): Likewise.
* dcache.c (dcache_alloc): Likewise.
* demangle.c (_initialize_demangler): Likewise.
* dicos-tdep.c (dicos_load_module_p): Likewise.
* dictionary.c (dict_create_hashed_expandable): Likewise.
(dict_create_linear_expandable): Likewise.
(expand_hashtable): Likewise.
(add_symbol_linear_expandable): Likewise.
* dwarf2-frame.c (add_cie): Likewise.
(add_fde): Likewise.
(dwarf2_build_frame_info): Likewise.
* dwarf2expr.c (dwarf_expr_grow_stack): Likewise.
(dwarf_expr_fetch_address): Likewise.
(add_piece): Likewise.
(execute_stack_op): Likewise.
* dwarf2loc.c (chain_candidate): Likewise.
(dwarf_entry_parameter_to_value): Likewise.
(read_pieced_value): Likewise.
(write_pieced_value): Likewise.
* dwarf2read.c (dwarf2_read_section): Likewise.
(add_type_unit): Likewise.
(read_comp_units_from_section): Likewise.
(fixup_go_packaging): Likewise.
(dwarf2_compute_name): Likewise.
(dwarf2_physname): Likewise.
(create_dwo_unit_in_dwp_v1): Likewise.
(create_dwo_unit_in_dwp_v2): Likewise.
(read_func_scope): Likewise.
(read_call_site_scope): Likewise.
(dwarf2_attach_fields_to_type): Likewise.
(process_structure_scope): Likewise.
(mark_common_block_symbol_computed): Likewise.
(read_common_block): Likewise.
(abbrev_table_read_table): Likewise.
(guess_partial_die_structure_name): Likewise.
(fixup_partial_die): Likewise.
(add_file_name): Likewise.
(dwarf2_const_value_data): Likewise.
(dwarf2_const_value_attr): Likewise.
(build_error_marker_type): Likewise.
(guess_full_die_structure_name): Likewise.
(anonymous_struct_prefix): Likewise.
(typename_concat): Likewise.
(dwarf2_canonicalize_name): Likewise.
(dwarf2_name): Likewise.
(write_constant_as_bytes): Likewise.
(dwarf2_fetch_constant_bytes): Likewise.
(copy_string): Likewise.
(parse_macro_definition): Likewise.
* elfread.c (elf_symfile_segments): Likewise.
(elf_rel_plt_read): Likewise.
(elf_gnu_ifunc_resolve_by_cache): Likewise.
(elf_gnu_ifunc_resolve_by_got): Likewise.
(elf_read_minimal_symbols): Likewise.
(elf_gnu_ifunc_record_cache): Likewise.
* event-top.c (top_level_prompt): Likewise.
(command_line_handler): Likewise.
* exec.c (resize_section_table): Likewise.
* expprint.c (print_subexp_standard): Likewise.
* fbsd-tdep.c (fbsd_collect_regset_section_cb): Likewise.
* findcmd.c (parse_find_args): Likewise.
* findvar.c (address_from_register): Likewise.
* frame.c (get_prev_frame_always): Likewise.
* gdb_bfd.c (gdb_bfd_ref): Likewise.
(get_section_descriptor): Likewise.
* gdb_obstack.c (obconcat): Likewise.
(obstack_strdup): Likewise.
* gdbtypes.c (lookup_function_type_with_arguments): Likewise.
(create_set_type): Likewise.
(lookup_unsigned_typename): Likewise.
(lookup_signed_typename): Likewise.
(resolve_dynamic_union): Likewise.
(resolve_dynamic_struct): Likewise.
(add_dyn_prop): Likewise.
(copy_dynamic_prop_list): Likewise.
(arch_flags_type): Likewise.
(append_composite_type_field_raw): Likewise.
* gdbtypes.h (INIT_FUNC_SPECIFIC): Likewise.
* gnu-v3-abi.c (gnuv3_rtti_type): Likewise.
* go-exp.y (string_exp): Likewise.
* go-lang.c (go_demangle): Likewise.
* guile/guile.c (compute_scheme_string): Likewise.
* guile/scm-cmd.c (gdbscm_parse_command_name): Likewise.
(gdbscm_canonicalize_command_name): Likewise.
* guile/scm-ports.c (ioscm_init_stdio_buffers): Likewise.
(ioscm_init_memory_port): Likewise.
(ioscm_reinit_memory_port): Likewise.
* guile/scm-utils.c (gdbscm_gc_xstrdup): Likewise.
(gdbscm_gc_dup_argv): Likewise.
* h8300-tdep.c (h8300_push_dummy_call): Likewise.
* hppa-tdep.c (internalize_unwinds): Likewise.
(read_unwind_info): Likewise.
* i386-cygwin-tdep.c (core_process_module_section): Likewise.
(windows_core_xfer_shared_libraries): Likewise.
* i386-tdep.c (i386_displaced_step_copy_insn): Likewise.
(i386_stap_parse_special_token_triplet): Likewise.
(i386_stap_parse_special_token_three_arg_disp): Likewise.
* i386obsd-tdep.c (i386obsd_sigtramp_p): Likewise.
* inf-child.c (inf_child_fileio_readlink): Likewise.
* inf-ptrace.c (inf_ptrace_fetch_register): Likewise.
(inf_ptrace_store_register): Likewise.
* infrun.c (follow_exec): Likewise.
(displaced_step_prepare_throw): Likewise.
(save_stop_context): Likewise.
(save_infcall_suspend_state): Likewise.
* jit.c (jit_read_descriptor): Likewise.
(jit_read_code_entry): Likewise.
(jit_symtab_line_mapping_add_impl): Likewise.
(finalize_symtab): Likewise.
(jit_unwind_reg_get_impl): Likewise.
* jv-exp.y (QualifiedName): Likewise.
* jv-lang.c (get_java_utf8_name): Likewise.
(type_from_class): Likewise.
(java_demangle_type_signature): Likewise.
(java_class_name_from_physname): Likewise.
* jv-typeprint.c (java_type_print_base): Likewise.
* jv-valprint.c (java_value_print): Likewise.
* language.c (add_language): Likewise.
* linespec.c (add_sal_to_sals_basic): Likewise.
(add_sal_to_sals): Likewise.
(decode_objc): Likewise.
(find_linespec_symbols): Likewise.
* linux-fork.c (fork_save_infrun_state): Likewise.
* linux-nat.c (linux_nat_detach): Likewise.
(linux_nat_fileio_readlink): Likewise.
* linux-record.c (record_linux_sockaddr): Likewise.
(record_linux_msghdr): Likewise.
(Do): Likewise.
* linux-tdep.c (linux_core_info_proc_mappings): Likewise.
(linux_collect_regset_section_cb): Likewise.
(linux_get_siginfo_data): Likewise.
* linux-thread-db.c (try_thread_db_load_from_pdir_1): Likewise.
(try_thread_db_load_from_dir): Likewise.
(thread_db_load_search): Likewise.
(info_auto_load_libthread_db): Likewise.
* m32c-tdep.c (m32c_m16c_address_to_pointer): Likewise.
(m32c_m16c_pointer_to_address): Likewise.
* m68hc11-tdep.c (m68hc11_pseudo_register_write): Likewise.
* m68k-tdep.c (m68k_get_longjmp_target): Likewise.
* machoread.c (macho_check_dsym): Likewise.
* macroexp.c (resize_buffer): Likewise.
(gather_arguments): Likewise.
(maybe_expand): Likewise.
* macrotab.c (new_macro_key): Likewise.
(new_source_file): Likewise.
(new_macro_definition): Likewise.
* mdebugread.c (parse_symbol): Likewise.
(parse_type): Likewise.
(parse_partial_symbols): Likewise.
(psymtab_to_symtab_1): Likewise.
* mem-break.c (default_memory_insert_breakpoint): Likewise.
* mi/mi-cmd-break.c (mi_argv_to_format): Likewise.
* mi/mi-main.c (mi_cmd_data_read_memory): Likewise.
(mi_cmd_data_read_memory_bytes): Likewise.
(mi_cmd_data_write_memory_bytes): Likewise.
(mi_cmd_trace_frame_collected): Likewise.
* mi/mi-parse.c (mi_parse_argv): Likewise.
(mi_parse): Likewise.
* minidebug.c (lzma_open): Likewise.
(lzma_pread): Likewise.
* mips-tdep.c (mips_read_fp_register_single): Likewise.
(mips_print_fp_register): Likewise.
* mipsnbsd-tdep.c (mipsnbsd_get_longjmp_target): Likewise.
* mipsread.c (read_alphacoff_dynamic_symtab): Likewise.
* mt-tdep.c (mt_register_name): Likewise.
(mt_registers_info): Likewise.
(mt_push_dummy_call): Likewise.
* namespace.c (add_using_directive): Likewise.
* nat/linux-btrace.c (perf_event_read): Likewise.
(linux_enable_bts): Likewise.
* nat/linux-osdata.c (linux_common_core_of_thread): Likewise.
* nat/linux-ptrace.c (linux_ptrace_test_ret_to_nx): Likewise.
* nto-tdep.c (nto_find_and_open_solib): Likewise.
(nto_parse_redirection): Likewise.
* objc-lang.c (objc_demangle): Likewise.
(find_methods): Likewise.
* objfiles.c (get_objfile_bfd_data): Likewise.
(set_objfile_main_name): Likewise.
(allocate_objfile): Likewise.
(objfile_relocate): Likewise.
(update_section_map): Likewise.
* osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Likewise.
* p-exp.y (exp): Likewise.
(yylex): Likewise.
* p-valprint.c (pascal_object_print_value): Likewise.
* parse.c (initialize_expout): Likewise.
(mark_completion_tag): Likewise.
(copy_name): Likewise.
(parse_float): Likewise.
(type_stack_reserve): Likewise.
* ppc-linux-tdep.c (ppc_stap_parse_special_token): Likewise.
(ppu2spu_prev_register): Likewise.
* ppc-ravenscar-thread.c (supply_register_at_address): Likewise.
* printcmd.c (printf_wide_c_string): Likewise.
(printf_pointer): Likewise.
* probe.c (parse_probes): Likewise.
* python/py-cmd.c (gdbpy_parse_command_name): Likewise.
(cmdpy_init): Likewise.
* python/py-gdb-readline.c (gdbpy_readline_wrapper): Likewise.
* python/py-symtab.c (set_sal): Likewise.
* python/py-unwind.c (pyuw_sniffer): Likewise.
* python/python.c (python_interactive_command): Likewise.
(compute_python_string): Likewise.
* ravenscar-thread.c (get_running_thread_id): Likewise.
* record-full.c (record_full_exec_insn): Likewise.
(record_full_core_open_1): Likewise.
* regcache.c (regcache_raw_read_signed): Likewise.
(regcache_raw_read_unsigned): Likewise.
(regcache_cooked_read_signed): Likewise.
(regcache_cooked_read_unsigned): Likewise.
* remote-fileio.c (remote_fileio_func_open): Likewise.
(remote_fileio_func_rename): Likewise.
(remote_fileio_func_unlink): Likewise.
(remote_fileio_func_stat): Likewise.
(remote_fileio_func_system): Likewise.
* remote-mips.c (mips_xfer_memory): Likewise.
(mips_load_srec): Likewise.
(pmon_end_download): Likewise.
* remote.c (new_remote_state): Likewise.
(map_regcache_remote_table): Likewise.
(remote_register_number_and_offset): Likewise.
(init_remote_state): Likewise.
(get_memory_packet_size): Likewise.
(remote_pass_signals): Likewise.
(remote_program_signals): Likewise.
(remote_start_remote): Likewise.
(remote_check_symbols): Likewise.
(remote_query_supported): Likewise.
(extended_remote_attach): Likewise.
(process_g_packet): Likewise.
(store_registers_using_G): Likewise.
(putpkt_binary): Likewise.
(read_frame): Likewise.
(compare_sections_command): Likewise.
(remote_hostio_pread): Likewise.
(remote_hostio_readlink): Likewise.
(remote_file_put): Likewise.
(remote_file_get): Likewise.
(remote_pid_to_exec_file): Likewise.
(_initialize_remote): Likewise.
* rs6000-aix-tdep.c (rs6000_aix_ld_info_to_xml): Likewise.
(rs6000_aix_core_xfer_shared_libraries_aix): Likewise.
* rs6000-tdep.c (ppc_displaced_step_copy_insn): Likewise.
(bfd_uses_spe_extensions): Likewise.
* s390-linux-tdep.c (s390_displaced_step_copy_insn): Likewise.
* score-tdep.c (score7_malloc_and_get_memblock): Likewise.
* solib-dsbt.c (decode_loadmap): Likewise.
(fetch_loadmap): Likewise.
(scan_dyntag): Likewise.
(enable_break): Likewise.
(dsbt_relocate_main_executable): Likewise.
* solib-frv.c (fetch_loadmap): Likewise.
(enable_break2): Likewise.
(frv_relocate_main_executable): Likewise.
* solib-spu.c (spu_relocate_main_executable): Likewise.
(spu_bfd_open): Likewise.
* solib-svr4.c (lm_info_read): Likewise.
(read_program_header): Likewise.
(find_program_interpreter): Likewise.
(scan_dyntag): Likewise.
(elf_locate_base): Likewise.
(open_symbol_file_object): Likewise.
(read_program_headers_from_bfd): Likewise.
(svr4_relocate_main_executable): Likewise.
* solib-target.c (solib_target_relocate_section_addresses): Likewise.
* solib.c (solib_find_1): Likewise.
(exec_file_find): Likewise.
(solib_find): Likewise.
* source.c (openp): Likewise.
(print_source_lines_base): Likewise.
(forward_search_command): Likewise.
* sparc-ravenscar-thread.c (supply_register_at_address): Likewise.
* spu-tdep.c (spu2ppu_prev_register): Likewise.
(spu_get_overlay_table): Likewise.
* stabsread.c (patch_block_stabs): Likewise.
(define_symbol): Likewise.
(again:): Likewise.
(read_member_functions): Likewise.
(read_one_struct_field): Likewise.
(read_enum_type): Likewise.
(common_block_start): Likewise.
* stack.c (read_frame_arg): Likewise.
(backtrace_command): Likewise.
* stap-probe.c (stap_parse_register_operand): Likewise.
* symfile.c (syms_from_objfile_1): Likewise.
(find_separate_debug_file): Likewise.
(load_command): Likewise.
(load_progress): Likewise.
(load_section_callback): Likewise.
(reread_symbols): Likewise.
(add_filename_language): Likewise.
(allocate_compunit_symtab): Likewise.
(read_target_long_array): Likewise.
(simple_read_overlay_table): Likewise.
* symtab.c (symbol_set_names): Likewise.
(resize_symbol_cache): Likewise.
(rbreak_command): Likewise.
(completion_list_add_name): Likewise.
(completion_list_objc_symbol): Likewise.
(add_filename_to_list): Likewise.
* target-descriptions.c (maint_print_c_tdesc_cmd): Likewise.
* target-memory.c (target_write_memory_blocks): Likewise.
* target.c (target_read_string): Likewise.
(read_whatever_is_readable): Likewise.
(target_read_alloc_1): Likewise.
(simple_search_memory): Likewise.
(target_fileio_read_alloc_1): Likewise.
* tilegx-tdep.c (tilegx_push_dummy_call): Likewise.
* top.c (command_line_input): Likewise.
* tracefile-tfile.c (tfile_fetch_registers): Likewise.
* tracefile.c (tracefile_fetch_registers): Likewise.
* tracepoint.c (add_memrange): Likewise.
(init_collection_list): Likewise.
(add_aexpr): Likewise.
(trace_dump_actions): Likewise.
(parse_trace_status): Likewise.
(parse_tracepoint_definition): Likewise.
(parse_tsv_definition): Likewise.
(parse_static_tracepoint_marker_definition): Likewise.
* tui/tui-file.c (tui_sfileopen): Likewise.
(tui_file_adjust_strbuf): Likewise.
* tui/tui-io.c (tui_expand_tabs): Likewise.
* tui/tui-source.c (tui_set_source_content): Likewise.
* typeprint.c (find_global_typedef): Likewise.
* ui-file.c (do_ui_file_xstrdup): Likewise.
(ui_file_obsavestring): Likewise.
(mem_file_write): Likewise.
* utils.c (make_hex_string): Likewise.
(get_regcomp_error): Likewise.
(puts_filtered_tabular): Likewise.
(gdb_realpath_keepfile): Likewise.
(ldirname): Likewise.
(gdb_bfd_errmsg): Likewise.
(substitute_path_component): Likewise.
* valops.c (search_struct_method): Likewise.
(find_oload_champ_namespace_loop): Likewise.
* valprint.c (print_decimal_chars): Likewise.
(read_string): Likewise.
(generic_emit_char): Likewise.
* varobj.c (varobj_delete): Likewise.
(varobj_value_get_print_value): Likewise.
* vaxobsd-tdep.c (vaxobsd_sigtramp_sniffer): Likewise.
* windows-tdep.c (display_one_tib): Likewise.
* xcoffread.c (read_xcoff_symtab): Likewise.
(process_xcoff_symbol): Likewise.
(swap_sym): Likewise.
(scan_xcoff_symtab): Likewise.
(xcoff_initial_scan): Likewise.
* xml-support.c (gdb_xml_end_element): Likewise.
(xml_process_xincludes): Likewise.
(xml_fetch_content_from_file): Likewise.
* xml-syscall.c (xml_list_of_syscalls): Likewise.
* xstormy16-tdep.c (xstormy16_push_dummy_call): Likewise.
gdb/gdbserver/ChangeLog:
* ax.c (gdb_parse_agent_expr): Add cast to allocation result
assignment.
(gdb_unparse_agent_expr): Likewise.
* hostio.c (require_data): Likewise.
(handle_pread): Likewise.
* linux-low.c (disable_regset): Likewise.
(fetch_register): Likewise.
(store_register): Likewise.
(get_dynamic): Likewise.
(linux_qxfer_libraries_svr4): Likewise.
* mem-break.c (delete_fast_tracepoint_jump): Likewise.
(set_fast_tracepoint_jump): Likewise.
(uninsert_fast_tracepoint_jumps_at): Likewise.
(reinsert_fast_tracepoint_jumps_at): Likewise.
(validate_inserted_breakpoint): Likewise.
(clone_agent_expr): Likewise.
* regcache.c (init_register_cache): Likewise.
* remote-utils.c (putpkt_binary_1): Likewise.
(decode_M_packet): Likewise.
(decode_X_packet): Likewise.
(look_up_one_symbol): Likewise.
(relocate_instruction): Likewise.
(monitor_output): Likewise.
* server.c (handle_search_memory): Likewise.
(handle_qxfer_exec_file): Likewise.
(handle_qxfer_libraries): Likewise.
(handle_qxfer): Likewise.
(handle_query): Likewise.
(handle_v_cont): Likewise.
(handle_v_run): Likewise.
(captured_main): Likewise.
* target.c (write_inferior_memory): Likewise.
* thread-db.c (try_thread_db_load_from_dir): Likewise.
* tracepoint.c (init_trace_buffer): Likewise.
(add_tracepoint_action): Likewise.
(add_traceframe): Likewise.
(add_traceframe_block): Likewise.
(cmd_qtdpsrc): Likewise.
(cmd_qtdv): Likewise.
(cmd_qtstatus): Likewise.
(response_source): Likewise.
(response_tsv): Likewise.
(cmd_qtnotes): Likewise.
(gdb_collect): Likewise.
(initialize_tracepoint): Likewise.
Diff:
---
gdb/ChangeLog | 466 ++++++++++++++++++++++++++++++++++++++
gdb/aarch64-linux-tdep.c | 2 +-
gdb/ada-exp.y | 23 +-
gdb/ada-lang.c | 27 ++-
gdb/ada-lex.l | 4 +-
gdb/ada-tasks.c | 4 +-
gdb/ada-typeprint.c | 2 +-
gdb/addrmap.c | 8 +-
gdb/amd64-tdep.c | 11 +-
gdb/amd64obsd-tdep.c | 2 +-
gdb/arch-utils.c | 4 +-
gdb/arm-linux-tdep.c | 2 +-
gdb/arm-symbian-tdep.c | 2 +-
gdb/arm-tdep.c | 17 +-
gdb/auto-load.c | 18 +-
gdb/auxv.c | 2 +-
gdb/ax-general.c | 13 +-
gdb/bcache.c | 3 +-
gdb/breakpoint.c | 2 +-
gdb/btrace.c | 2 +-
gdb/build-id.c | 7 +-
gdb/buildsym.c | 6 +-
gdb/c-exp.y | 28 +--
gdb/c-lang.c | 4 +-
gdb/charset.c | 3 +-
gdb/cli/cli-cmds.c | 4 +-
gdb/cli/cli-dump.c | 4 +-
gdb/cli/cli-interp.c | 3 +-
gdb/cli/cli-script.c | 4 +-
gdb/cli/cli-setshow.c | 2 +-
gdb/coff-pe-read.c | 8 +-
gdb/coffread.c | 12 +-
gdb/common/btrace-common.c | 2 +-
gdb/common/buffer.c | 2 +-
gdb/common/filestuff.c | 2 +-
gdb/common/format.c | 2 +-
gdb/common/gdb_vecs.c | 2 +-
gdb/common/xml-utils.c | 2 +-
gdb/compile/compile-object-load.c | 5 +-
gdb/compile/compile-object-run.c | 3 +-
gdb/completer.c | 4 +-
gdb/corefile.c | 8 +-
gdb/corelow.c | 2 +-
gdb/cp-name-parser.y | 6 +-
gdb/cp-namespace.c | 16 +-
gdb/cp-support.c | 10 +-
gdb/cp-valprint.c | 2 +-
gdb/ctf.c | 2 +-
gdb/d-exp.y | 8 +-
gdb/d-namespace.c | 10 +-
gdb/dbxread.c | 16 +-
gdb/dcache.c | 5 +-
gdb/demangle.c | 2 +-
gdb/dicos-tdep.c | 2 +-
gdb/dictionary.c | 20 +-
gdb/dwarf2-frame.c | 18 +-
gdb/dwarf2expr.c | 14 +-
gdb/dwarf2loc.c | 11 +-
gdb/dwarf2read.c | 128 ++++++-----
gdb/elfread.c | 18 +-
gdb/event-top.c | 5 +-
gdb/exec.c | 4 +-
gdb/expprint.c | 4 +-
gdb/fbsd-tdep.c | 2 +-
gdb/findcmd.c | 4 +-
gdb/findvar.c | 2 +-
gdb/frame.c | 2 +-
gdb/gdb_bfd.c | 6 +-
gdb/gdb_obstack.c | 4 +-
gdb/gdbserver/ChangeLog | 48 ++++
gdb/gdbserver/ax.c | 4 +-
gdb/gdbserver/hostio.c | 4 +-
gdb/gdbserver/linux-low.c | 12 +-
gdb/gdbserver/mem-break.c | 14 +-
gdb/gdbserver/regcache.c | 6 +-
gdb/gdbserver/remote-utils.c | 12 +-
gdb/gdbserver/server.c | 28 +--
gdb/gdbserver/target.c | 2 +-
gdb/gdbserver/thread-db.c | 2 +-
gdb/gdbserver/tracepoint.c | 61 ++---
gdb/gdbtypes.c | 35 +--
gdb/gdbtypes.h | 6 +-
gdb/gnu-v3-abi.c | 2 +-
gdb/go-exp.y | 8 +-
gdb/go-lang.c | 2 +-
gdb/guile/guile.c | 2 +-
gdb/guile/scm-cmd.c | 7 +-
gdb/guile/scm-ports.c | 14 +-
gdb/guile/scm-utils.c | 8 +-
gdb/h8300-tdep.c | 2 +-
gdb/hppa-tdep.c | 4 +-
gdb/i386-cygwin-tdep.c | 4 +-
gdb/i386-tdep.c | 8 +-
gdb/i386obsd-tdep.c | 2 +-
gdb/inf-child.c | 2 +-
gdb/inf-ptrace.c | 4 +-
gdb/infrun.c | 8 +-
gdb/jit.c | 25 +-
gdb/jv-exp.y | 2 +-
gdb/jv-lang.c | 8 +-
gdb/jv-typeprint.c | 2 +-
gdb/jv-valprint.c | 3 +-
gdb/language.c | 5 +-
gdb/linespec.c | 13 +-
gdb/linux-fork.c | 3 +-
gdb/linux-nat.c | 4 +-
gdb/linux-record.c | 26 +--
gdb/linux-tdep.c | 6 +-
gdb/linux-thread-db.c | 13 +-
gdb/m32c-tdep.c | 4 +-
gdb/m68hc11-tdep.c | 4 +-
gdb/m68k-tdep.c | 2 +-
gdb/machoread.c | 2 +-
gdb/macroexp.c | 9 +-
gdb/macrotab.c | 10 +-
gdb/mdebugread.c | 31 +--
gdb/mem-break.c | 2 +-
gdb/mi/mi-cmd-break.c | 2 +-
gdb/mi/mi-main.c | 17 +-
gdb/mi/mi-parse.c | 10 +-
gdb/minidebug.c | 6 +-
gdb/mips-tdep.c | 7 +-
gdb/mipsnbsd-tdep.c | 2 +-
gdb/mipsread.c | 8 +-
gdb/mt-tdep.c | 8 +-
gdb/namespace.c | 22 +-
gdb/nat/linux-btrace.c | 5 +-
gdb/nat/linux-osdata.c | 2 +-
gdb/nat/linux-ptrace.c | 3 +-
gdb/nto-tdep.c | 6 +-
gdb/objc-lang.c | 4 +-
gdb/objfiles.c | 19 +-
gdb/osabi.c | 2 +-
gdb/p-exp.y | 8 +-
gdb/p-valprint.c | 2 +-
gdb/parse.c | 15 +-
gdb/ppc-linux-tdep.c | 4 +-
gdb/ppc-ravenscar-thread.c | 2 +-
gdb/printcmd.c | 4 +-
gdb/probe.c | 5 +-
gdb/python/py-cmd.c | 6 +-
gdb/python/py-gdb-readline.c | 4 +-
gdb/python/py-symtab.c | 5 +-
gdb/python/py-unwind.c | 6 +-
gdb/python/python.c | 4 +-
gdb/ravenscar-thread.c | 2 +-
gdb/record-full.c | 4 +-
gdb/regcache.c | 8 +-
gdb/remote-fileio.c | 12 +-
gdb/remote-mips.c | 7 +-
gdb/remote.c | 47 ++--
gdb/rs6000-aix-tdep.c | 4 +-
gdb/rs6000-tdep.c | 4 +-
gdb/s390-linux-tdep.c | 2 +-
gdb/score-tdep.c | 2 +-
gdb/solib-dsbt.c | 14 +-
gdb/solib-frv.c | 10 +-
gdb/solib-spu.c | 7 +-
gdb/solib-svr4.c | 20 +-
gdb/solib-target.c | 4 +-
gdb/solib.c | 9 +-
gdb/source.c | 16 +-
gdb/sparc-ravenscar-thread.c | 2 +-
gdb/spu-tdep.c | 4 +-
gdb/stabsread.c | 37 +--
gdb/stack.c | 6 +-
gdb/stap-probe.c | 2 +-
gdb/symfile.c | 43 ++--
gdb/symtab.c | 51 +++--
gdb/target-descriptions.c | 2 +-
gdb/target-memory.c | 2 +-
gdb/target.c | 18 +-
gdb/tilegx-tdep.c | 2 +-
gdb/top.c | 8 +-
gdb/tracefile-tfile.c | 2 +-
gdb/tracefile.c | 2 +-
gdb/tracepoint.c | 36 ++-
gdb/tui/tui-file.c | 7 +-
gdb/tui/tui-io.c | 2 +-
gdb/tui/tui-source.c | 2 +-
gdb/typeprint.c | 5 +-
gdb/ui-file.c | 11 +-
gdb/utils.c | 15 +-
gdb/valops.c | 4 +-
gdb/valprint.c | 6 +-
gdb/varobj.c | 4 +-
gdb/vaxobsd-tdep.c | 2 +-
gdb/windows-tdep.c | 2 +-
gdb/xcoffread.c | 19 +-
gdb/xml-support.c | 8 +-
gdb/xml-syscall.c | 2 +-
gdb/xstormy16-tdep.c | 2 +-
192 files changed, 1411 insertions(+), 796 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 38a49e0..fb66ae8 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,469 @@
+2015-09-25 Simon Marchi <simon.marchi@ericsson.com>
+
+ * aarch64-linux-tdep.c (aarch64_stap_parse_special_token): Add cast
+ to allocation result assignment.
+ * ada-exp.y (write_object_renaming): Likewise.
+ (write_ambiguous_var): Likewise.
+ (ada_nget_field_index): Likewise.
+ (write_var_or_type): Likewise.
+ * ada-lang.c (ada_decode_symbol): Likewise.
+ (ada_value_assign): Likewise.
+ (value_pointer): Likewise.
+ (cache_symbol): Likewise.
+ (add_nonlocal_symbols): Likewise.
+ (ada_name_for_lookup): Likewise.
+ (symbol_completion_add): Likewise.
+ (ada_to_fixed_type_1): Likewise.
+ (ada_get_next_arg): Likewise.
+ (defns_collected): Likewise.
+ * ada-lex.l (processId): Likewise.
+ (processString): Likewise.
+ * ada-tasks.c (read_known_tasks_array): Likewise.
+ (read_known_tasks_list): Likewise.
+ * ada-typeprint.c (decoded_type_name): Likewise.
+ * addrmap.c (addrmap_mutable_create_fixed): Likewise.
+ * amd64-tdep.c (amd64_push_arguments): Likewise.
+ (amd64_displaced_step_copy_insn): Likewise.
+ (amd64_classify_insn_at): Likewise.
+ (amd64_relocate_instruction): Likewise.
+ * amd64obsd-tdep.c (amd64obsd_sigtramp_p): Likewise.
+ * arch-utils.c (simple_displaced_step_copy_insn): Likewise.
+ (initialize_current_architecture): Likewise.
+ * arm-linux-tdep.c (arm_stap_parse_special_token): Likewise.
+ * arm-symbian-tdep.c (arm_symbian_osabi_sniffer): Likewise.
+ * arm-tdep.c (arm_exidx_new_objfile): Likewise.
+ (arm_push_dummy_call): Likewise.
+ (extend_buffer_earlier): Likewise.
+ (arm_adjust_breakpoint_address): Likewise.
+ (arm_skip_stub): Likewise.
+ * auto-load.c (filename_is_in_pattern): Likewise.
+ (maybe_add_script_file): Likewise.
+ (maybe_add_script_text): Likewise.
+ (auto_load_objfile_script_1): Likewise.
+ * auxv.c (ld_so_xfer_auxv): Likewise.
+ * ax-general.c (new_agent_expr): Likewise.
+ (grow_expr): Likewise.
+ (ax_reg_mask): Likewise.
+ * bcache.c (bcache_full): Likewise.
+ * breakpoint.c (program_breakpoint_here_p): Likewise.
+ * btrace.c (parse_xml_raw): Likewise.
+ * build-id.c (build_id_to_debug_bfd): Likewise.
+ * buildsym.c (end_symtab_with_blockvector): Likewise.
+ * c-exp.y (string_exp): Likewise.
+ (qualified_name): Likewise.
+ (write_destructor_name): Likewise.
+ (operator_stoken): Likewise.
+ (parse_number): Likewise.
+ (scan_macro_expansion): Likewise.
+ (yylex): Likewise.
+ (c_print_token): Likewise.
+ * c-lang.c (c_get_string): Likewise.
+ (emit_numeric_character): Likewise.
+ * charset.c (wchar_iterate): Likewise.
+ * cli/cli-cmds.c (complete_command): Likewise.
+ (make_command): Likewise.
+ * cli/cli-dump.c (restore_section_callback): Likewise.
+ (restore_binary_file): Likewise.
+ * cli/cli-interp.c (cli_interpreter_exec): Likewise.
+ * cli/cli-script.c (execute_control_command): Likewise.
+ * cli/cli-setshow.c (do_set_command): Likewise.
+ * coff-pe-read.c (add_pe_forwarded_sym): Likewise.
+ (read_pe_exported_syms): Likewise.
+ * coffread.c (coff_read_struct_type): Likewise.
+ (coff_read_enum_type): Likewise.
+ * common/btrace-common.c (btrace_data_append): Likewise.
+ * common/buffer.c (buffer_grow): Likewise.
+ * common/filestuff.c (gdb_fopen_cloexec): Likewise.
+ * common/format.c (parse_format_string): Likewise.
+ * common/gdb_vecs.c (delim_string_to_char_ptr_vec_append): Likewise.
+ * common/xml-utils.c (xml_escape_text): Likewise.
+ * compile/compile-object-load.c (copy_sections): Likewise.
+ (compile_object_load): Likewise.
+ * compile/compile-object-run.c (compile_object_run): Likewise.
+ * completer.c (filename_completer): Likewise.
+ * corefile.c (read_memory_typed_address): Likewise.
+ (write_memory_unsigned_integer): Likewise.
+ (write_memory_signed_integer): Likewise.
+ (complete_set_gnutarget): Likewise.
+ * corelow.c (get_core_register_section): Likewise.
+ * cp-name-parser.y (d_grab): Likewise.
+ (allocate_info): Likewise.
+ (cp_new_demangle_parse_info): Likewise.
+ * cp-namespace.c (cp_scan_for_anonymous_namespaces): Likewise.
+ (cp_lookup_symbol_in_namespace): Likewise.
+ (lookup_namespace_scope): Likewise.
+ (find_symbol_in_baseclass): Likewise.
+ (cp_lookup_nested_symbol): Likewise.
+ (cp_lookup_transparent_type_loop): Likewise.
+ * cp-support.c (copy_string_to_obstack): Likewise.
+ (make_symbol_overload_list): Likewise.
+ (make_symbol_overload_list_namespace): Likewise.
+ (make_symbol_overload_list_adl_namespace): Likewise.
+ (first_component_command): Likewise.
+ * cp-valprint.c (cp_print_value): Likewise.
+ * ctf.c (ctf_xfer_partial): Likewise.
+ * d-exp.y (StringExp): Likewise.
+ * d-namespace.c (d_lookup_symbol_in_module): Likewise.
+ (lookup_module_scope): Likewise.
+ (find_symbol_in_baseclass): Likewise.
+ (d_lookup_nested_symbol): Likewise.
+ * dbxread.c (find_stab_function_addr): Likewise.
+ (read_dbx_symtab): Likewise.
+ (dbx_end_psymtab): Likewise.
+ (cp_set_block_scope): Likewise.
+ * dcache.c (dcache_alloc): Likewise.
+ * demangle.c (_initialize_demangler): Likewise.
+ * dicos-tdep.c (dicos_load_module_p): Likewise.
+ * dictionary.c (dict_create_hashed_expandable): Likewise.
+ (dict_create_linear_expandable): Likewise.
+ (expand_hashtable): Likewise.
+ (add_symbol_linear_expandable): Likewise.
+ * dwarf2-frame.c (add_cie): Likewise.
+ (add_fde): Likewise.
+ (dwarf2_build_frame_info): Likewise.
+ * dwarf2expr.c (dwarf_expr_grow_stack): Likewise.
+ (dwarf_expr_fetch_address): Likewise.
+ (add_piece): Likewise.
+ (execute_stack_op): Likewise.
+ * dwarf2loc.c (chain_candidate): Likewise.
+ (dwarf_entry_parameter_to_value): Likewise.
+ (read_pieced_value): Likewise.
+ (write_pieced_value): Likewise.
+ * dwarf2read.c (dwarf2_read_section): Likewise.
+ (add_type_unit): Likewise.
+ (read_comp_units_from_section): Likewise.
+ (fixup_go_packaging): Likewise.
+ (dwarf2_compute_name): Likewise.
+ (dwarf2_physname): Likewise.
+ (create_dwo_unit_in_dwp_v1): Likewise.
+ (create_dwo_unit_in_dwp_v2): Likewise.
+ (read_func_scope): Likewise.
+ (read_call_site_scope): Likewise.
+ (dwarf2_attach_fields_to_type): Likewise.
+ (process_structure_scope): Likewise.
+ (mark_common_block_symbol_computed): Likewise.
+ (read_common_block): Likewise.
+ (abbrev_table_read_table): Likewise.
+ (guess_partial_die_structure_name): Likewise.
+ (fixup_partial_die): Likewise.
+ (add_file_name): Likewise.
+ (dwarf2_const_value_data): Likewise.
+ (dwarf2_const_value_attr): Likewise.
+ (build_error_marker_type): Likewise.
+ (guess_full_die_structure_name): Likewise.
+ (anonymous_struct_prefix): Likewise.
+ (typename_concat): Likewise.
+ (dwarf2_canonicalize_name): Likewise.
+ (dwarf2_name): Likewise.
+ (write_constant_as_bytes): Likewise.
+ (dwarf2_fetch_constant_bytes): Likewise.
+ (copy_string): Likewise.
+ (parse_macro_definition): Likewise.
+ * elfread.c (elf_symfile_segments): Likewise.
+ (elf_rel_plt_read): Likewise.
+ (elf_gnu_ifunc_resolve_by_cache): Likewise.
+ (elf_gnu_ifunc_resolve_by_got): Likewise.
+ (elf_read_minimal_symbols): Likewise.
+ (elf_gnu_ifunc_record_cache): Likewise.
+ * event-top.c (top_level_prompt): Likewise.
+ (command_line_handler): Likewise.
+ * exec.c (resize_section_table): Likewise.
+ * expprint.c (print_subexp_standard): Likewise.
+ * fbsd-tdep.c (fbsd_collect_regset_section_cb): Likewise.
+ * findcmd.c (parse_find_args): Likewise.
+ * findvar.c (address_from_register): Likewise.
+ * frame.c (get_prev_frame_always): Likewise.
+ * gdb_bfd.c (gdb_bfd_ref): Likewise.
+ (get_section_descriptor): Likewise.
+ * gdb_obstack.c (obconcat): Likewise.
+ (obstack_strdup): Likewise.
+ * gdbtypes.c (lookup_function_type_with_arguments): Likewise.
+ (create_set_type): Likewise.
+ (lookup_unsigned_typename): Likewise.
+ (lookup_signed_typename): Likewise.
+ (resolve_dynamic_union): Likewise.
+ (resolve_dynamic_struct): Likewise.
+ (add_dyn_prop): Likewise.
+ (copy_dynamic_prop_list): Likewise.
+ (arch_flags_type): Likewise.
+ (append_composite_type_field_raw): Likewise.
+ * gdbtypes.h (INIT_FUNC_SPECIFIC): Likewise.
+ * gnu-v3-abi.c (gnuv3_rtti_type): Likewise.
+ * go-exp.y (string_exp): Likewise.
+ * go-lang.c (go_demangle): Likewise.
+ * guile/guile.c (compute_scheme_string): Likewise.
+ * guile/scm-cmd.c (gdbscm_parse_command_name): Likewise.
+ (gdbscm_canonicalize_command_name): Likewise.
+ * guile/scm-ports.c (ioscm_init_stdio_buffers): Likewise.
+ (ioscm_init_memory_port): Likewise.
+ (ioscm_reinit_memory_port): Likewise.
+ * guile/scm-utils.c (gdbscm_gc_xstrdup): Likewise.
+ (gdbscm_gc_dup_argv): Likewise.
+ * h8300-tdep.c (h8300_push_dummy_call): Likewise.
+ * hppa-tdep.c (internalize_unwinds): Likewise.
+ (read_unwind_info): Likewise.
+ * i386-cygwin-tdep.c (core_process_module_section): Likewise.
+ (windows_core_xfer_shared_libraries): Likewise.
+ * i386-tdep.c (i386_displaced_step_copy_insn): Likewise.
+ (i386_stap_parse_special_token_triplet): Likewise.
+ (i386_stap_parse_special_token_three_arg_disp): Likewise.
+ * i386obsd-tdep.c (i386obsd_sigtramp_p): Likewise.
+ * inf-child.c (inf_child_fileio_readlink): Likewise.
+ * inf-ptrace.c (inf_ptrace_fetch_register): Likewise.
+ (inf_ptrace_store_register): Likewise.
+ * infrun.c (follow_exec): Likewise.
+ (displaced_step_prepare_throw): Likewise.
+ (save_stop_context): Likewise.
+ (save_infcall_suspend_state): Likewise.
+ * jit.c (jit_read_descriptor): Likewise.
+ (jit_read_code_entry): Likewise.
+ (jit_symtab_line_mapping_add_impl): Likewise.
+ (finalize_symtab): Likewise.
+ (jit_unwind_reg_get_impl): Likewise.
+ * jv-exp.y (QualifiedName): Likewise.
+ * jv-lang.c (get_java_utf8_name): Likewise.
+ (type_from_class): Likewise.
+ (java_demangle_type_signature): Likewise.
+ (java_class_name_from_physname): Likewise.
+ * jv-typeprint.c (java_type_print_base): Likewise.
+ * jv-valprint.c (java_value_print): Likewise.
+ * language.c (add_language): Likewise.
+ * linespec.c (add_sal_to_sals_basic): Likewise.
+ (add_sal_to_sals): Likewise.
+ (decode_objc): Likewise.
+ (find_linespec_symbols): Likewise.
+ * linux-fork.c (fork_save_infrun_state): Likewise.
+ * linux-nat.c (linux_nat_detach): Likewise.
+ (linux_nat_fileio_readlink): Likewise.
+ * linux-record.c (record_linux_sockaddr): Likewise.
+ (record_linux_msghdr): Likewise.
+ (Do): Likewise.
+ * linux-tdep.c (linux_core_info_proc_mappings): Likewise.
+ (linux_collect_regset_section_cb): Likewise.
+ (linux_get_siginfo_data): Likewise.
+ * linux-thread-db.c (try_thread_db_load_from_pdir_1): Likewise.
+ (try_thread_db_load_from_dir): Likewise.
+ (thread_db_load_search): Likewise.
+ (info_auto_load_libthread_db): Likewise.
+ * m32c-tdep.c (m32c_m16c_address_to_pointer): Likewise.
+ (m32c_m16c_pointer_to_address): Likewise.
+ * m68hc11-tdep.c (m68hc11_pseudo_register_write): Likewise.
+ * m68k-tdep.c (m68k_get_longjmp_target): Likewise.
+ * machoread.c (macho_check_dsym): Likewise.
+ * macroexp.c (resize_buffer): Likewise.
+ (gather_arguments): Likewise.
+ (maybe_expand): Likewise.
+ * macrotab.c (new_macro_key): Likewise.
+ (new_source_file): Likewise.
+ (new_macro_definition): Likewise.
+ * mdebugread.c (parse_symbol): Likewise.
+ (parse_type): Likewise.
+ (parse_partial_symbols): Likewise.
+ (psymtab_to_symtab_1): Likewise.
+ * mem-break.c (default_memory_insert_breakpoint): Likewise.
+ * mi/mi-cmd-break.c (mi_argv_to_format): Likewise.
+ * mi/mi-main.c (mi_cmd_data_read_memory): Likewise.
+ (mi_cmd_data_read_memory_bytes): Likewise.
+ (mi_cmd_data_write_memory_bytes): Likewise.
+ (mi_cmd_trace_frame_collected): Likewise.
+ * mi/mi-parse.c (mi_parse_argv): Likewise.
+ (mi_parse): Likewise.
+ * minidebug.c (lzma_open): Likewise.
+ (lzma_pread): Likewise.
+ * mips-tdep.c (mips_read_fp_register_single): Likewise.
+ (mips_print_fp_register): Likewise.
+ * mipsnbsd-tdep.c (mipsnbsd_get_longjmp_target): Likewise.
+ * mipsread.c (read_alphacoff_dynamic_symtab): Likewise.
+ * mt-tdep.c (mt_register_name): Likewise.
+ (mt_registers_info): Likewise.
+ (mt_push_dummy_call): Likewise.
+ * namespace.c (add_using_directive): Likewise.
+ * nat/linux-btrace.c (perf_event_read): Likewise.
+ (linux_enable_bts): Likewise.
+ * nat/linux-osdata.c (linux_common_core_of_thread): Likewise.
+ * nat/linux-ptrace.c (linux_ptrace_test_ret_to_nx): Likewise.
+ * nto-tdep.c (nto_find_and_open_solib): Likewise.
+ (nto_parse_redirection): Likewise.
+ * objc-lang.c (objc_demangle): Likewise.
+ (find_methods): Likewise.
+ * objfiles.c (get_objfile_bfd_data): Likewise.
+ (set_objfile_main_name): Likewise.
+ (allocate_objfile): Likewise.
+ (objfile_relocate): Likewise.
+ (update_section_map): Likewise.
+ * osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Likewise.
+ * p-exp.y (exp): Likewise.
+ (yylex): Likewise.
+ * p-valprint.c (pascal_object_print_value): Likewise.
+ * parse.c (initialize_expout): Likewise.
+ (mark_completion_tag): Likewise.
+ (copy_name): Likewise.
+ (parse_float): Likewise.
+ (type_stack_reserve): Likewise.
+ * ppc-linux-tdep.c (ppc_stap_parse_special_token): Likewise.
+ (ppu2spu_prev_register): Likewise.
+ * ppc-ravenscar-thread.c (supply_register_at_address): Likewise.
+ * printcmd.c (printf_wide_c_string): Likewise.
+ (printf_pointer): Likewise.
+ * probe.c (parse_probes): Likewise.
+ * python/py-cmd.c (gdbpy_parse_command_name): Likewise.
+ (cmdpy_init): Likewise.
+ * python/py-gdb-readline.c (gdbpy_readline_wrapper): Likewise.
+ * python/py-symtab.c (set_sal): Likewise.
+ * python/py-unwind.c (pyuw_sniffer): Likewise.
+ * python/python.c (python_interactive_command): Likewise.
+ (compute_python_string): Likewise.
+ * ravenscar-thread.c (get_running_thread_id): Likewise.
+ * record-full.c (record_full_exec_insn): Likewise.
+ (record_full_core_open_1): Likewise.
+ * regcache.c (regcache_raw_read_signed): Likewise.
+ (regcache_raw_read_unsigned): Likewise.
+ (regcache_cooked_read_signed): Likewise.
+ (regcache_cooked_read_unsigned): Likewise.
+ * remote-fileio.c (remote_fileio_func_open): Likewise.
+ (remote_fileio_func_rename): Likewise.
+ (remote_fileio_func_unlink): Likewise.
+ (remote_fileio_func_stat): Likewise.
+ (remote_fileio_func_system): Likewise.
+ * remote-mips.c (mips_xfer_memory): Likewise.
+ (mips_load_srec): Likewise.
+ (pmon_end_download): Likewise.
+ * remote.c (new_remote_state): Likewise.
+ (map_regcache_remote_table): Likewise.
+ (remote_register_number_and_offset): Likewise.
+ (init_remote_state): Likewise.
+ (get_memory_packet_size): Likewise.
+ (remote_pass_signals): Likewise.
+ (remote_program_signals): Likewise.
+ (remote_start_remote): Likewise.
+ (remote_check_symbols): Likewise.
+ (remote_query_supported): Likewise.
+ (extended_remote_attach): Likewise.
+ (process_g_packet): Likewise.
+ (store_registers_using_G): Likewise.
+ (putpkt_binary): Likewise.
+ (read_frame): Likewise.
+ (compare_sections_command): Likewise.
+ (remote_hostio_pread): Likewise.
+ (remote_hostio_readlink): Likewise.
+ (remote_file_put): Likewise.
+ (remote_file_get): Likewise.
+ (remote_pid_to_exec_file): Likewise.
+ (_initialize_remote): Likewise.
+ * rs6000-aix-tdep.c (rs6000_aix_ld_info_to_xml): Likewise.
+ (rs6000_aix_core_xfer_shared_libraries_aix): Likewise.
+ * rs6000-tdep.c (ppc_displaced_step_copy_insn): Likewise.
+ (bfd_uses_spe_extensions): Likewise.
+ * s390-linux-tdep.c (s390_displaced_step_copy_insn): Likewise.
+ * score-tdep.c (score7_malloc_and_get_memblock): Likewise.
+ * solib-dsbt.c (decode_loadmap): Likewise.
+ (fetch_loadmap): Likewise.
+ (scan_dyntag): Likewise.
+ (enable_break): Likewise.
+ (dsbt_relocate_main_executable): Likewise.
+ * solib-frv.c (fetch_loadmap): Likewise.
+ (enable_break2): Likewise.
+ (frv_relocate_main_executable): Likewise.
+ * solib-spu.c (spu_relocate_main_executable): Likewise.
+ (spu_bfd_open): Likewise.
+ * solib-svr4.c (lm_info_read): Likewise.
+ (read_program_header): Likewise.
+ (find_program_interpreter): Likewise.
+ (scan_dyntag): Likewise.
+ (elf_locate_base): Likewise.
+ (open_symbol_file_object): Likewise.
+ (read_program_headers_from_bfd): Likewise.
+ (svr4_relocate_main_executable): Likewise.
+ * solib-target.c (solib_target_relocate_section_addresses): Likewise.
+ * solib.c (solib_find_1): Likewise.
+ (exec_file_find): Likewise.
+ (solib_find): Likewise.
+ * source.c (openp): Likewise.
+ (print_source_lines_base): Likewise.
+ (forward_search_command): Likewise.
+ * sparc-ravenscar-thread.c (supply_register_at_address): Likewise.
+ * spu-tdep.c (spu2ppu_prev_register): Likewise.
+ (spu_get_overlay_table): Likewise.
+ * stabsread.c (patch_block_stabs): Likewise.
+ (define_symbol): Likewise.
+ (again:): Likewise.
+ (read_member_functions): Likewise.
+ (read_one_struct_field): Likewise.
+ (read_enum_type): Likewise.
+ (common_block_start): Likewise.
+ * stack.c (read_frame_arg): Likewise.
+ (backtrace_command): Likewise.
+ * stap-probe.c (stap_parse_register_operand): Likewise.
+ * symfile.c (syms_from_objfile_1): Likewise.
+ (find_separate_debug_file): Likewise.
+ (load_command): Likewise.
+ (load_progress): Likewise.
+ (load_section_callback): Likewise.
+ (reread_symbols): Likewise.
+ (add_filename_language): Likewise.
+ (allocate_compunit_symtab): Likewise.
+ (read_target_long_array): Likewise.
+ (simple_read_overlay_table): Likewise.
+ * symtab.c (symbol_set_names): Likewise.
+ (resize_symbol_cache): Likewise.
+ (rbreak_command): Likewise.
+ (completion_list_add_name): Likewise.
+ (completion_list_objc_symbol): Likewise.
+ (add_filename_to_list): Likewise.
+ * target-descriptions.c (maint_print_c_tdesc_cmd): Likewise.
+ * target-memory.c (target_write_memory_blocks): Likewise.
+ * target.c (target_read_string): Likewise.
+ (read_whatever_is_readable): Likewise.
+ (target_read_alloc_1): Likewise.
+ (simple_search_memory): Likewise.
+ (target_fileio_read_alloc_1): Likewise.
+ * tilegx-tdep.c (tilegx_push_dummy_call): Likewise.
+ * top.c (command_line_input): Likewise.
+ * tracefile-tfile.c (tfile_fetch_registers): Likewise.
+ * tracefile.c (tracefile_fetch_registers): Likewise.
+ * tracepoint.c (add_memrange): Likewise.
+ (init_collection_list): Likewise.
+ (add_aexpr): Likewise.
+ (trace_dump_actions): Likewise.
+ (parse_trace_status): Likewise.
+ (parse_tracepoint_definition): Likewise.
+ (parse_tsv_definition): Likewise.
+ (parse_static_tracepoint_marker_definition): Likewise.
+ * tui/tui-file.c (tui_sfileopen): Likewise.
+ (tui_file_adjust_strbuf): Likewise.
+ * tui/tui-io.c (tui_expand_tabs): Likewise.
+ * tui/tui-source.c (tui_set_source_content): Likewise.
+ * typeprint.c (find_global_typedef): Likewise.
+ * ui-file.c (do_ui_file_xstrdup): Likewise.
+ (ui_file_obsavestring): Likewise.
+ (mem_file_write): Likewise.
+ * utils.c (make_hex_string): Likewise.
+ (get_regcomp_error): Likewise.
+ (puts_filtered_tabular): Likewise.
+ (gdb_realpath_keepfile): Likewise.
+ (ldirname): Likewise.
+ (gdb_bfd_errmsg): Likewise.
+ (substitute_path_component): Likewise.
+ * valops.c (search_struct_method): Likewise.
+ (find_oload_champ_namespace_loop): Likewise.
+ * valprint.c (print_decimal_chars): Likewise.
+ (read_string): Likewise.
+ (generic_emit_char): Likewise.
+ * varobj.c (varobj_delete): Likewise.
+ (varobj_value_get_print_value): Likewise.
+ * vaxobsd-tdep.c (vaxobsd_sigtramp_sniffer): Likewise.
+ * windows-tdep.c (display_one_tib): Likewise.
+ * xcoffread.c (read_xcoff_symtab): Likewise.
+ (process_xcoff_symbol): Likewise.
+ (swap_sym): Likewise.
+ (scan_xcoff_symtab): Likewise.
+ (xcoff_initial_scan): Likewise.
+ * xml-support.c (gdb_xml_end_element): Likewise.
+ (xml_process_xincludes): Likewise.
+ (xml_fetch_content_from_file): Likewise.
+ * xml-syscall.c (xml_list_of_syscalls): Likewise.
+ * xstormy16-tdep.c (xstormy16_push_dummy_call): Likewise.
+
2015-09-23 James Bowman <james.bowman@ftdichip.com>
* ft32-tdep.c (ft32_register_type): Return gdbarch_tdep (gdbarch)->pc_type
diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c
index 07ee1ea..aaf6608 100644
--- a/gdb/aarch64-linux-tdep.c
+++ b/gdb/aarch64-linux-tdep.c
@@ -279,7 +279,7 @@ aarch64_stap_parse_special_token (struct gdbarch *gdbarch,
return 0;
len = tmp - start;
- regname = alloca (len + 2);
+ regname = (char *) alloca (len + 2);
strncpy (regname, start, len);
regname[len] = '\0';
diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y
index 1c45bcb..e64463e 100644
--- a/gdb/ada-exp.y
+++ b/gdb/ada-exp.y
@@ -876,7 +876,8 @@ write_object_renaming (struct parser_state *par_state,
if (orig_left_context == NULL)
orig_left_context = get_selected_block (NULL);
- name = obstack_copy0 (&temp_parse_space, renamed_entity, renamed_entity_len);
+ name = (char *) obstack_copy0 (&temp_parse_space, renamed_entity,
+ renamed_entity_len);
ada_lookup_encoded_symbol (name, orig_left_context, VAR_DOMAIN, &sym_info);
if (sym_info.symbol == NULL)
error (_("Could not find renamed variable: %s"), ada_decode (name));
@@ -945,9 +946,9 @@ write_object_renaming (struct parser_state *par_state,
if (end == NULL)
end = renaming_expr + strlen (renaming_expr);
- index_name =
- obstack_copy0 (&temp_parse_space, renaming_expr,
- end - renaming_expr);
+ index_name
+ = (char *) obstack_copy0 (&temp_parse_space, renaming_expr,
+ end - renaming_expr);
renaming_expr = end;
ada_lookup_encoded_symbol (index_name, NULL, VAR_DOMAIN,
@@ -989,7 +990,7 @@ write_object_renaming (struct parser_state *par_state,
if (end == NULL)
end = renaming_expr + strlen (renaming_expr);
field_name.length = end - renaming_expr;
- buf = malloc (end - renaming_expr + 1);
+ buf = (char *) malloc (end - renaming_expr + 1);
field_name.ptr = buf;
strncpy (buf, renaming_expr, end - renaming_expr);
buf[end - renaming_expr] = '\000';
@@ -1167,7 +1168,8 @@ write_ambiguous_var (struct parser_state *par_state,
memset (sym, 0, sizeof (struct symbol));
SYMBOL_DOMAIN (sym) = UNDEF_DOMAIN;
- SYMBOL_LINKAGE_NAME (sym) = obstack_copy0 (&temp_parse_space, name, len);
+ SYMBOL_LINKAGE_NAME (sym)
+ = (const char *) obstack_copy0 (&temp_parse_space, name, len);
SYMBOL_LANGUAGE (sym) = language_ada;
write_exp_elt_opcode (par_state, OP_VAR_VALUE);
@@ -1184,7 +1186,7 @@ static int
ada_nget_field_index (const struct type *type, const char *field_name0,
int field_name_len, int maybe_missing)
{
- char *field_name = alloca ((field_name_len + 1) * sizeof (char));
+ char *field_name = (char *) alloca ((field_name_len + 1) * sizeof (char));
strncpy (field_name, field_name0, field_name_len);
field_name[field_name_len] = '\0';
@@ -1265,7 +1267,8 @@ write_var_or_type (struct parser_state *par_state,
encoded_name = ada_encode (name0.ptr);
name_len = strlen (encoded_name);
- encoded_name = obstack_copy0 (&temp_parse_space, encoded_name, name_len);
+ encoded_name
+ = (char *) obstack_copy0 (&temp_parse_space, encoded_name, name_len);
for (depth = 0; depth < MAX_RENAMING_CHAIN_LENGTH; depth += 1)
{
int tail_index;
@@ -1318,9 +1321,9 @@ write_var_or_type (struct parser_state *par_state,
case ADA_EXCEPTION_RENAMING:
case ADA_SUBPROGRAM_RENAMING:
{
+ int alloc_len = renaming_len + name_len - tail_index + 1;
char *new_name
- = obstack_alloc (&temp_parse_space,
- renaming_len + name_len - tail_index + 1);
+ = (char *) obstack_alloc (&temp_parse_space, alloc_len);
strncpy (new_name, renaming, renaming_len);
strcpy (new_name + renaming_len, encoded_name + tail_index);
encoded_name = new_name;
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 8089a32..0b463e2 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -1424,7 +1424,8 @@ ada_decode_symbol (const struct general_symbol_info *arg)
gsymbol->ada_mangled = 1;
if (obstack != NULL)
- *resultp = obstack_copy0 (obstack, decoded, strlen (decoded));
+ *resultp
+ = (const char *) obstack_copy0 (obstack, decoded, strlen (decoded));
else
{
/* Sometimes, we can't find a corresponding objfile, in
@@ -2657,7 +2658,7 @@ ada_value_assign (struct value *toval, struct value *fromval)
int len = (value_bitpos (toval)
+ bits + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT;
int from_size;
- gdb_byte *buffer = alloca (len);
+ gdb_byte *buffer = (gdb_byte *) alloca (len);
struct value *val;
CORE_ADDR to_addr = value_address (toval);
@@ -4401,7 +4402,7 @@ value_pointer (struct value *value, struct type *type)
{
struct gdbarch *gdbarch = get_type_arch (type);
unsigned len = TYPE_LENGTH (type);
- gdb_byte *buf = alloca (len);
+ gdb_byte *buf = (gdb_byte *) alloca (len);
CORE_ADDR addr;
addr = value_address (value);
@@ -4596,7 +4597,8 @@ cache_symbol (const char *name, domain_enum domain, struct symbol *sym,
sizeof (*e));
e->next = sym_cache->root[h];
sym_cache->root[h] = e;
- e->name = copy = obstack_alloc (&sym_cache->cache_space, strlen (name) + 1);
+ e->name = copy
+ = (char *) obstack_alloc (&sym_cache->cache_space, strlen (name) + 1);
strcpy (copy, name);
e->sym = sym;
e->domain = domain;
@@ -4767,7 +4769,7 @@ static struct block_symbol *
defns_collected (struct obstack *obstackp, int finish)
{
if (finish)
- return obstack_finish (obstackp);
+ return (struct block_symbol *) obstack_finish (obstackp);
else
return (struct block_symbol *) obstack_base (obstackp);
}
@@ -5535,7 +5537,7 @@ add_nonlocal_symbols (struct obstack *obstackp, const char *name,
{
ALL_OBJFILES (objfile)
{
- char *name1 = alloca (strlen (name) + sizeof ("_ada_"));
+ char *name1 = (char *) alloca (strlen (name) + sizeof ("_ada_"));
strcpy (name1, "_ada_");
strcpy (name1 + sizeof ("_ada_") - 1, name);
data.objfile = objfile;
@@ -5728,7 +5730,7 @@ ada_name_for_lookup (const char *name)
if (name[0] == '<' && name[nlen - 1] == '>')
{
- canon = xmalloc (nlen - 1);
+ canon = (char *) xmalloc (nlen - 1);
memcpy (canon, name + 1, nlen - 2);
canon[nlen - 2] = '\0';
}
@@ -6329,19 +6331,19 @@ symbol_completion_add (VEC(char_ptr) **sv,
if (word == orig_text)
{
- completion = xmalloc (strlen (match) + 5);
+ completion = (char *) xmalloc (strlen (match) + 5);
strcpy (completion, match);
}
else if (word > orig_text)
{
/* Return some portion of sym_name. */
- completion = xmalloc (strlen (match) + 5);
+ completion = (char *) xmalloc (strlen (match) + 5);
strcpy (completion, match + (word - orig_text));
}
else
{
/* Return some of ORIG_TEXT plus sym_name. */
- completion = xmalloc (strlen (match) + (orig_text - word) + 5);
+ completion = (char *) xmalloc (strlen (match) + (orig_text - word) + 5);
strncpy (completion, word, orig_text - word);
completion[orig_text - word] = '\0';
strcat (completion, match);
@@ -8869,7 +8871,8 @@ ada_to_fixed_type_1 (struct type *type, const gdb_byte *valaddr,
else if (ada_type_name (fixed_record_type) != NULL)
{
const char *name = ada_type_name (fixed_record_type);
- char *xvz_name = alloca (strlen (name) + 7 /* "___XVZ\0" */);
+ char *xvz_name
+ = (char *) alloca (strlen (name) + 7 /* "___XVZ\0" */);
int xvz_found = 0;
LONGEST size;
@@ -12688,7 +12691,7 @@ ada_get_next_arg (char **argsp)
/* Make a copy of the current argument and return it. */
- result = xmalloc (end - args + 1);
+ result = (char *) xmalloc (end - args + 1);
strncpy (result, args, end - args);
result[end - args] = '\0';
diff --git a/gdb/ada-lex.l b/gdb/ada-lex.l
index 1a93a5c..97f9b2d 100644
--- a/gdb/ada-lex.l
+++ b/gdb/ada-lex.l
@@ -428,7 +428,7 @@ processReal (struct parser_state *par_state, const char *num0)
static struct stoken
processId (const char *name0, int len)
{
- char *name = obstack_alloc (&temp_parse_space, len + 11);
+ char *name = (char *) obstack_alloc (&temp_parse_space, len + 11);
int i0, i;
struct stoken result;
@@ -499,7 +499,7 @@ processString (const char *text, int len)
const char *lim = text + len;
struct stoken result;
- q = obstack_alloc (&temp_parse_space, len);
+ q = (char *) obstack_alloc (&temp_parse_space, len);
result.ptr = q;
p = text;
while (p < lim)
diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index c97057e..fbe67aa 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -784,7 +784,7 @@ read_known_tasks_array (struct ada_tasks_inferior_data *data)
{
const int target_ptr_byte = TYPE_LENGTH (data->known_tasks_element);
const int known_tasks_size = target_ptr_byte * data->known_tasks_length;
- gdb_byte *known_tasks = alloca (known_tasks_size);
+ gdb_byte *known_tasks = (gdb_byte *) alloca (known_tasks_size);
int i;
/* Build a new list by reading the ATCBs from the Known_Tasks array
@@ -810,7 +810,7 @@ static int
read_known_tasks_list (struct ada_tasks_inferior_data *data)
{
const int target_ptr_byte = TYPE_LENGTH (data->known_tasks_element);
- gdb_byte *known_tasks = alloca (target_ptr_byte);
+ gdb_byte *known_tasks = (gdb_byte *) alloca (target_ptr_byte);
CORE_ADDR task_id;
const struct ada_tasks_pspace_data *pspace_data
= get_ada_tasks_pspace_data (current_program_space);
diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c
index 1fb0f0e..11fdc70 100644
--- a/gdb/ada-typeprint.c
+++ b/gdb/ada-typeprint.c
@@ -64,7 +64,7 @@ decoded_type_name (struct type *type)
if (name_buffer == NULL || name_buffer_len <= strlen (raw_name))
{
name_buffer_len = 16 + 2 * strlen (raw_name);
- name_buffer = xrealloc (name_buffer, name_buffer_len);
+ name_buffer = (char *) xrealloc (name_buffer, name_buffer_len);
}
strcpy (name_buffer, raw_name);
diff --git a/gdb/addrmap.c b/gdb/addrmap.c
index a124aea..a526167 100644
--- a/gdb/addrmap.c
+++ b/gdb/addrmap.c
@@ -427,6 +427,7 @@ addrmap_mutable_create_fixed (struct addrmap *self, struct obstack *obstack)
struct addrmap_mutable *mutable_obj = (struct addrmap_mutable *) self;
struct addrmap_fixed *fixed;
size_t num_transitions;
+ size_t alloc_len;
/* Count the number of transitions in the tree. */
num_transitions = 0;
@@ -436,10 +437,9 @@ addrmap_mutable_create_fixed (struct addrmap *self, struct obstack *obstack)
maps have, but mutable maps do not.) */
num_transitions++;
- fixed = obstack_alloc (obstack,
- (sizeof (*fixed)
- + (num_transitions
- * sizeof (fixed->transitions[0]))));
+ alloc_len = sizeof (*fixed)
+ + (num_transitions * sizeof (fixed->transitions[0]));
+ fixed = (struct addrmap_fixed *) obstack_alloc (obstack, alloc_len);
fixed->addrmap.funcs = &addrmap_fixed_funcs;
fixed->num_transitions = 1;
fixed->transitions[0].addr = 0;
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index a672cde..a2179ce 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -850,7 +850,7 @@ amd64_push_arguments (struct regcache *regcache, int nargs,
AMD64_XMM0_REGNUM + 4, AMD64_XMM0_REGNUM + 5,
AMD64_XMM0_REGNUM + 6, AMD64_XMM0_REGNUM + 7,
};
- struct value **stack_args = alloca (nargs * sizeof (struct value *));
+ struct value **stack_args = XALLOCAVEC (struct value *, nargs);
int num_stack_args = 0;
int num_elements = 0;
int element = 0;
@@ -1351,8 +1351,9 @@ amd64_displaced_step_copy_insn (struct gdbarch *gdbarch,
/* Extra space for sentinels so fixup_{riprel,displaced_copy} don't have to
continually watch for running off the end of the buffer. */
int fixup_sentinel_space = len;
- struct displaced_step_closure *dsc =
- xmalloc (sizeof (*dsc) + len + fixup_sentinel_space);
+ struct displaced_step_closure *dsc
+ = ((struct displaced_step_closure *)
+ xmalloc (sizeof (*dsc) + len + fixup_sentinel_space));
gdb_byte *buf = &dsc->insn_buf[0];
struct amd64_insn *details = &dsc->insn_details;
@@ -1514,7 +1515,7 @@ amd64_classify_insn_at (struct gdbarch *gdbarch, CORE_ADDR addr,
int len, classification;
len = gdbarch_max_insn_length (gdbarch);
- buf = alloca (len);
+ buf = (gdb_byte *) alloca (len);
read_code (addr, buf, len);
amd64_get_insn_details (buf, &details);
@@ -1711,7 +1712,7 @@ amd64_relocate_instruction (struct gdbarch *gdbarch,
int len = gdbarch_max_insn_length (gdbarch);
/* Extra space for sentinels. */
int fixup_sentinel_space = len;
- gdb_byte *buf = xmalloc (len + fixup_sentinel_space);
+ gdb_byte *buf = (gdb_byte *) xmalloc (len + fixup_sentinel_space);
struct amd64_insn insn_details;
int offset = 0;
LONGEST rel32, newrel;
diff --git a/gdb/amd64obsd-tdep.c b/gdb/amd64obsd-tdep.c
index d6c7e90..46bf7c5 100644
--- a/gdb/amd64obsd-tdep.c
+++ b/gdb/amd64obsd-tdep.c
@@ -114,7 +114,7 @@ amd64obsd_sigtramp_p (struct frame_info *this_frame)
return 0;
/* If we can't read the instructions at START_PC, return zero. */
- buf = alloca ((sizeof sigreturn) + 1);
+ buf = (gdb_byte *) alloca ((sizeof sigreturn) + 1);
if (!safe_frame_unwind_memory (this_frame, start_pc + 6, buf, buflen))
return 0;
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index 7df5570..bb93fbe 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -44,7 +44,7 @@ simple_displaced_step_copy_insn (struct gdbarch *gdbarch,
struct regcache *regs)
{
size_t len = gdbarch_max_insn_length (gdbarch);
- gdb_byte *buf = xmalloc (len);
+ gdb_byte *buf = (gdb_byte *) xmalloc (len);
read_memory (from, buf, len);
write_memory (to, buf, len);
@@ -684,7 +684,7 @@ initialize_current_architecture (void)
/* Append ``auto''. */
int nr;
for (nr = 0; arches[nr] != NULL; nr++);
- arches = xrealloc (arches, sizeof (char*) * (nr + 2));
+ arches = XRESIZEVEC (const char *, arches, nr + 2);
arches[nr + 0] = "auto";
arches[nr + 1] = NULL;
add_setshow_enum_cmd ("architecture", class_support,
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
index bc2cec4..46d59ba 100644
--- a/gdb/arm-linux-tdep.c
+++ b/gdb/arm-linux-tdep.c
@@ -1179,7 +1179,7 @@ arm_stap_parse_special_token (struct gdbarch *gdbarch,
return 0;
len = tmp - start;
- regname = alloca (len + 2);
+ regname = (char *) alloca (len + 2);
offset = 0;
if (isdigit (*start))
diff --git a/gdb/arm-symbian-tdep.c b/gdb/arm-symbian-tdep.c
index 02811ed..5a94293 100644
--- a/gdb/arm-symbian-tdep.c
+++ b/gdb/arm-symbian-tdep.c
@@ -108,7 +108,7 @@ arm_symbian_osabi_sniffer (bfd *abfd)
if (phdrs_size == -1)
return GDB_OSABI_UNKNOWN;
- phdrs = alloca (phdrs_size);
+ phdrs = (Elf_Internal_Phdr *) alloca (phdrs_size);
num_phdrs = bfd_get_elf_phdrs (abfd, phdrs);
if (num_phdrs == -1)
return GDB_OSABI_UNKNOWN;
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index bcee29c..cb47fa7 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -2230,7 +2230,7 @@ arm_exidx_new_objfile (struct objfile *objfile)
{
exidx_vma = bfd_section_vma (objfile->obfd, exidx);
exidx_size = bfd_get_section_size (exidx);
- exidx_data = xmalloc (exidx_size);
+ exidx_data = (gdb_byte *) xmalloc (exidx_size);
make_cleanup (xfree, exidx_data);
if (!bfd_get_section_contents (objfile->obfd, exidx,
@@ -2246,7 +2246,7 @@ arm_exidx_new_objfile (struct objfile *objfile)
{
extab_vma = bfd_section_vma (objfile->obfd, extab);
extab_size = bfd_get_section_size (extab);
- extab_data = xmalloc (extab_size);
+ extab_data = (gdb_byte *) xmalloc (extab_size);
make_cleanup (xfree, extab_data);
if (!bfd_get_section_contents (objfile->obfd, extab,
@@ -2383,8 +2383,9 @@ arm_exidx_new_objfile (struct objfile *objfile)
extab section starting at ADDR. */
if (n_bytes || n_words)
{
- gdb_byte *p = entry = obstack_alloc (&objfile->objfile_obstack,
- n_bytes + n_words * 4 + 1);
+ gdb_byte *p = entry
+ = (gdb_byte *) obstack_alloc (&objfile->objfile_obstack,
+ n_bytes + n_words * 4 + 1);
while (n_bytes--)
*p++ = (gdb_byte) ((word >> (8 * n_bytes)) & 0xff);
@@ -3883,7 +3884,7 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
CORE_ADDR regval = extract_unsigned_integer (val, len, byte_order);
if (arm_pc_is_thumb (gdbarch, regval))
{
- bfd_byte *copy = alloca (len);
+ bfd_byte *copy = (bfd_byte *) alloca (len);
store_unsigned_integer (copy, len, byte_order,
MAKE_THUMB_ADDR (regval));
val = copy;
@@ -5325,7 +5326,7 @@ extend_buffer_earlier (gdb_byte *buf, CORE_ADDR endaddr,
gdb_byte *new_buf;
int bytes_to_read = new_len - old_len;
- new_buf = xmalloc (new_len);
+ new_buf = (gdb_byte *) xmalloc (new_len);
memcpy (new_buf + bytes_to_read, buf, old_len);
xfree (buf);
if (target_read_memory (endaddr - new_len, new_buf, bytes_to_read) != 0)
@@ -5391,7 +5392,7 @@ arm_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr)
/* No room for an IT instruction. */
return bpaddr;
- buf = xmalloc (buf_len);
+ buf = (gdb_byte *) xmalloc (buf_len);
if (target_read_memory (bpaddr - buf_len, buf, buf_len) != 0)
return bpaddr;
any = 0;
@@ -9353,7 +9354,7 @@ arm_skip_stub (struct frame_info *frame, CORE_ADDR pc)
else
target_len -= strlen ("_from_arm");
- target_name = alloca (target_len + 1);
+ target_name = (char *) alloca (target_len + 1);
memcpy (target_name, name + 2, target_len);
target_name[target_len] = '\0';
diff --git a/gdb/auto-load.c b/gdb/auto-load.c
index 7da288f..119c673 100644
--- a/gdb/auto-load.c
+++ b/gdb/auto-load.c
@@ -408,9 +408,9 @@ filename_is_in_pattern (const char *filename, const char *pattern)
{
char *filename_copy, *pattern_copy;
- filename_copy = alloca (strlen (filename) + 1);
+ filename_copy = (char *) alloca (strlen (filename) + 1);
strcpy (filename_copy, filename);
- pattern_copy = alloca (strlen (pattern) + 1);
+ pattern_copy = (char *) alloca (strlen (pattern) + 1);
strcpy (pattern_copy, pattern);
return filename_is_in_pattern_1 (filename_copy, pattern_copy);
@@ -693,9 +693,10 @@ maybe_add_script_file (struct auto_load_pspace_info *pspace_info, int loaded,
char *p;
/* Allocate all space in one chunk so it's easier to free. */
- *slot = xmalloc (sizeof (**slot)
- + strlen (name) + 1
- + (full_path != NULL ? (strlen (full_path) + 1) : 0));
+ *slot = ((struct loaded_script *)
+ xmalloc (sizeof (**slot)
+ + strlen (name) + 1
+ + (full_path != NULL ? (strlen (full_path) + 1) : 0)));
p = ((char*) *slot) + sizeof (**slot);
strcpy (p, name);
(*slot)->name = p;
@@ -740,7 +741,8 @@ maybe_add_script_text (struct auto_load_pspace_info *pspace_info,
char *p;
/* Allocate all space in one chunk so it's easier to free. */
- *slot = xmalloc (sizeof (**slot) + strlen (name) + 1);
+ *slot = ((struct loaded_script *)
+ xmalloc (sizeof (**slot) + strlen (name) + 1));
p = ((char*) *slot) + sizeof (**slot);
strcpy (p, name);
(*slot)->name = p;
@@ -787,7 +789,7 @@ auto_load_objfile_script_1 (struct objfile *objfile, const char *realname,
const char *suffix = ext_lang_auto_load_suffix (language);
len = strlen (realname);
- filename = xmalloc (len + strlen (suffix) + 1);
+ filename = (char *) xmalloc (len + strlen (suffix) + 1);
memcpy (filename, realname, len);
strcpy (filename + len, suffix);
@@ -818,7 +820,7 @@ auto_load_objfile_script_1 (struct objfile *objfile, const char *realname,
for (ix = 0; VEC_iterate (char_ptr, vec, ix, dir); ++ix)
{
- debugfile = xmalloc (strlen (dir) + strlen (filename) + 1);
+ debugfile = (char *) xmalloc (strlen (dir) + strlen (filename) + 1);
strcpy (debugfile, dir);
/* FILENAME is absolute, so we don't need a "/" here. */
diff --git a/gdb/auxv.c b/gdb/auxv.c
index fff34ff..f99da36 100644
--- a/gdb/auxv.c
+++ b/gdb/auxv.c
@@ -90,7 +90,7 @@ ld_so_xfer_auxv (gdb_byte *readbuf,
struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
size_t ptr_size = TYPE_LENGTH (ptr_type);
size_t auxv_pair_size = 2 * ptr_size;
- gdb_byte *ptr_buf = alloca (ptr_size);
+ gdb_byte *ptr_buf = (gdb_byte *) alloca (ptr_size);
LONGEST retval;
size_t block;
diff --git a/gdb/ax-general.c b/gdb/ax-general.c
index 8dbe572..49afee6 100644
--- a/gdb/ax-general.c
+++ b/gdb/ax-general.c
@@ -46,15 +46,14 @@ new_agent_expr (struct gdbarch *gdbarch, CORE_ADDR scope)
x->len = 0;
x->size = 1; /* Change this to a larger value once
reallocation code is tested. */
- x->buf = xmalloc (x->size);
+ x->buf = (unsigned char *) xmalloc (x->size);
x->gdbarch = gdbarch;
x->scope = scope;
/* Bit vector for registers used. */
x->reg_mask_len = 1;
- x->reg_mask = xmalloc (x->reg_mask_len * sizeof (x->reg_mask[0]));
- memset (x->reg_mask, 0, x->reg_mask_len * sizeof (x->reg_mask[0]));
+ x->reg_mask = XCNEWVEC (unsigned char, x->reg_mask_len);
x->tracing = 0;
x->trace_string = 0;
@@ -94,7 +93,7 @@ grow_expr (struct agent_expr *x, int n)
x->size *= 2;
if (x->size < x->len + n)
x->size = x->len + n + 10;
- x->buf = xrealloc (x->buf, x->size);
+ x->buf = (unsigned char *) xrealloc (x->buf, x->size);
}
}
@@ -458,9 +457,9 @@ ax_reg_mask (struct agent_expr *ax, int reg)
/* It's not appropriate to double here. This isn't a
string buffer. */
int new_len = byte + 1;
- unsigned char *new_reg_mask = xrealloc (ax->reg_mask,
- new_len
- * sizeof (ax->reg_mask[0]));
+ unsigned char *new_reg_mask
+ = XRESIZEVEC (unsigned char, ax->reg_mask, new_len);
+
memset (new_reg_mask + ax->reg_mask_len, 0,
(new_len - ax->reg_mask_len) * sizeof (ax->reg_mask[0]));
ax->reg_mask_len = new_len;
diff --git a/gdb/bcache.c b/gdb/bcache.c
index f3abc12..6db56d2 100644
--- a/gdb/bcache.c
+++ b/gdb/bcache.c
@@ -265,7 +265,8 @@ bcache_full (const void *addr, int length, struct bcache *bcache, int *added)
/* The user's string isn't in the list. Insert it after *ps. */
{
struct bstring *newobj
- = obstack_alloc (&bcache->cache, BSTRING_SIZE (length));
+ = (struct bstring *) obstack_alloc (&bcache->cache,
+ BSTRING_SIZE (length));
memcpy (&newobj->d.data, addr, length);
newobj->length = length;
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 520793a..c09d56a 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -8982,7 +8982,7 @@ program_breakpoint_here_p (struct gdbarch *gdbarch, CORE_ADDR address)
if (bpoint == NULL)
return 0;
- target_mem = alloca (len);
+ target_mem = (gdb_byte *) alloca (len);
/* Enable the automatic memory restoration from breakpoints while
we read the memory. Otherwise we could say about our temporary
diff --git a/gdb/btrace.c b/gdb/btrace.c
index e205ea8..4292dc7 100644
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -1441,7 +1441,7 @@ parse_xml_raw (struct gdb_xml_parser *parser, const char *body_text,
size = len / 2;
- bin = data = xmalloc (size);
+ bin = data = (gdb_byte *) xmalloc (size);
cleanup = make_cleanup (xfree, data);
/* We use hex encoding - see common/rsp-low.h. */
diff --git a/gdb/build-id.c b/gdb/build-id.c
index c89cd55..c7c718c 100644
--- a/gdb/build-id.c
+++ b/gdb/build-id.c
@@ -75,10 +75,13 @@ build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id)
struct cleanup *back_to;
int ix;
bfd *abfd = NULL;
+ int alloc_len;
/* DEBUG_FILE_DIRECTORY/.build-id/ab/cdef */
- link = alloca (strlen (debug_file_directory) + (sizeof "/.build-id/" - 1) + 1
- + 2 * build_id_len + (sizeof ".debug" - 1) + 1);
+ alloc_len = (strlen (debug_file_directory)
+ + (sizeof "/.build-id/" - 1) + 1
+ + 2 * build_id_len + (sizeof ".debug" - 1) + 1);
+ link = (char *) alloca (alloc_len);
/* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will
cause "/.build-id/..." lookups. */
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index 54c1d03..5f463ac 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -1429,9 +1429,9 @@ end_symtab_with_blockvector (struct block *static_block,
{
/* Reallocate the dirname on the symbol obstack. */
COMPUNIT_DIRNAME (cu)
- = obstack_copy0 (&objfile->objfile_obstack,
- buildsym_compunit->comp_dir,
- strlen (buildsym_compunit->comp_dir));
+ = (const char *) obstack_copy0 (&objfile->objfile_obstack,
+ buildsym_compunit->comp_dir,
+ strlen (buildsym_compunit->comp_dir));
}
/* Save the debug format string (if any) in the symtab. */
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 351505e..e37a0b1 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -839,7 +839,7 @@ string_exp:
vec->type = $1.type;
vec->length = $1.length;
- vec->ptr = malloc ($1.length + 1);
+ vec->ptr = (char *) malloc ($1.length + 1);
memcpy (vec->ptr, $1.ptr, $1.length + 1);
}
@@ -849,10 +849,10 @@ string_exp:
for convenience. */
char *p;
++$$.len;
- $$.tokens = realloc ($$.tokens,
- $$.len * sizeof (struct typed_stoken));
+ $$.tokens = XRESIZEVEC (struct typed_stoken,
+ $$.tokens, $$.len);
- p = malloc ($2.length + 1);
+ p = (char *) malloc ($2.length + 1);
memcpy (p, $2.ptr, $2.length + 1);
$$.tokens[$$.len - 1].type = $2.type;
@@ -1006,7 +1006,7 @@ qualified_name: TYPENAME COLONCOLON name
if (!type_aggregate_p (type))
error (_("`%s' is not defined as an aggregate type."),
TYPE_SAFE_NAME (type));
- buf = alloca ($4.length + 2);
+ buf = (char *) alloca ($4.length + 2);
tmp_token.ptr = buf;
tmp_token.length = $4.length + 1;
buf[0] = '~';
@@ -1664,7 +1664,7 @@ name_not_typename : NAME
static void
write_destructor_name (struct parser_state *par_state, struct stoken token)
{
- char *copy = alloca (token.length + 1);
+ char *copy = (char *) alloca (token.length + 1);
copy[0] = '~';
memcpy (©[1], token.ptr, token.length);
@@ -1686,7 +1686,7 @@ operator_stoken (const char *op)
char *buf;
st.length = strlen (operator_string) + strlen (op);
- buf = malloc (st.length + 1);
+ buf = (char *) malloc (st.length + 1);
strcpy (buf, operator_string);
strcat (buf, op);
st.ptr = buf;
@@ -1771,7 +1771,7 @@ parse_number (struct parser_state *par_state,
struct type *unsigned_type;
char *p;
- p = alloca (len);
+ p = (char *) alloca (len);
memcpy (p, buf, len);
if (parsed_float)
@@ -2399,7 +2399,8 @@ scan_macro_expansion (char *expansion)
/* Copy to the obstack, and then free the intermediate
expansion. */
- copy = obstack_copy0 (&expansion_obstack, expansion, strlen (expansion));
+ copy = (char *) obstack_copy0 (&expansion_obstack, expansion,
+ strlen (expansion));
xfree (expansion);
/* Save the old lexptr value, so we can return to it when we're done
@@ -3196,9 +3197,10 @@ yylex (void)
the FIFO, and delete the other constituent tokens. */
if (checkpoint > 0)
{
- current.value.sval.ptr = obstack_copy0 (&expansion_obstack,
- current.value.sval.ptr,
- current.value.sval.length);
+ current.value.sval.ptr
+ = (const char *) obstack_copy0 (&expansion_obstack,
+ current.value.sval.ptr,
+ current.value.sval.length);
VEC_replace (token_and_value, token_fifo, 0, ¤t);
if (checkpoint > 1)
@@ -3278,7 +3280,7 @@ c_print_token (FILE *file, int type, YYSTYPE value)
case CHAR:
case STRING:
{
- char *copy = alloca (value.tsval.length + 1);
+ char *copy = (char *) alloca (value.tsval.length + 1);
memcpy (copy, value.tsval.ptr, value.tsval.length);
copy[value.tsval.length] = '\0';
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index f38af47..6731b43 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -302,7 +302,7 @@ c_get_string (struct value *value, gdb_byte **buffer,
/* I is now either a user-defined length, the number of non-null
characters, or FETCHLIMIT. */
*length = i * width;
- *buffer = xmalloc (*length);
+ *buffer = (gdb_byte *) xmalloc (*length);
memcpy (*buffer, contents, *length);
err = 0;
}
@@ -412,7 +412,7 @@ emit_numeric_character (struct type *type, unsigned long value,
{
gdb_byte *buffer;
- buffer = alloca (TYPE_LENGTH (type));
+ buffer = (gdb_byte *) alloca (TYPE_LENGTH (type));
pack_long (buffer, type, value);
obstack_grow (output, buffer, TYPE_LENGTH (type));
}
diff --git a/gdb/charset.c b/gdb/charset.c
index 669d689..afd9220 100644
--- a/gdb/charset.c
+++ b/gdb/charset.c
@@ -687,8 +687,7 @@ wchar_iterate (struct wchar_iterator *iter,
if (out_request > iter->out_size)
{
iter->out_size = out_request;
- iter->out = xrealloc (iter->out,
- out_request * sizeof (gdb_wchar_t));
+ iter->out = XRESIZEVEC (gdb_wchar_t, iter->out, out_request);
}
continue;
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index aa9a9a5..424bf5e 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -277,7 +277,7 @@ complete_command (char *arg, int from_tty)
point--;
}
- arg_prefix = alloca (point - arg + 1);
+ arg_prefix = (char *) alloca (point - arg + 1);
memcpy (arg_prefix, arg, point - arg);
arg_prefix[point - arg] = 0;
@@ -1295,7 +1295,7 @@ make_command (char *arg, int from_tty)
p = "make";
else
{
- p = xmalloc (sizeof ("make ") + strlen (arg));
+ p = (char *) xmalloc (sizeof ("make ") + strlen (arg));
strcpy (p, "make ");
strcpy (p + sizeof ("make ") - 1, arg);
}
diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c
index 2449dc5..aabe3e3 100644
--- a/gdb/cli/cli-dump.c
+++ b/gdb/cli/cli-dump.c
@@ -482,7 +482,7 @@ restore_section_callback (bfd *ibfd, asection *isec, void *args)
sec_load_count -= sec_end - data->load_end;
/* Get the data. */
- buf = xmalloc (size);
+ buf = (gdb_byte *) xmalloc (size);
old_chain = make_cleanup (xfree, buf);
if (!bfd_get_section_contents (ibfd, isec, buf, 0, size))
error (_("Failed to read bfd file %s: '%s'."), bfd_get_filename (ibfd),
@@ -553,7 +553,7 @@ restore_binary_file (const char *filename, struct callback_data *data)
perror_with_name (filename);
/* Now allocate a buffer and read the file contents. */
- buf = xmalloc (len);
+ buf = (gdb_byte *) xmalloc (len);
make_cleanup (xfree, buf);
if (fread (buf, 1, len, file) != len)
perror_with_name (filename);
diff --git a/gdb/cli/cli-interp.c b/gdb/cli/cli-interp.c
index 174a10b..7df7c14 100644
--- a/gdb/cli/cli-interp.c
+++ b/gdb/cli/cli-interp.c
@@ -174,7 +174,8 @@ cli_interpreter_exec (void *data, const char *command_str)
/* FIXME: cagney/2003-02-01: Need to const char *propogate
safe_execute_command. */
- char *str = strcpy (alloca (strlen (command_str) + 1), command_str);
+ char *str = (char *) alloca (strlen (command_str) + 1);
+ strcpy (str, command_str);
/* gdb_stdout could change between the time cli_uiout was
initialized and now. Since we're probably using a different
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index 1717240..624a493 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -484,7 +484,7 @@ execute_control_command (struct command_line *cmd)
case while_control:
{
int len = strlen (cmd->line) + 7;
- char *buffer = alloca (len);
+ char *buffer = (char *) alloca (len);
xsnprintf (buffer, len, "while %s", cmd->line);
print_command_trace (buffer);
@@ -553,7 +553,7 @@ execute_control_command (struct command_line *cmd)
case if_control:
{
int len = strlen (cmd->line) + 4;
- char *buffer = alloca (len);
+ char *buffer = (char *) alloca (len);
xsnprintf (buffer, len, "if %s", cmd->line);
print_command_trace (buffer);
diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c
index 64f09f2..9439f48fb 100644
--- a/gdb/cli/cli-setshow.c
+++ b/gdb/cli/cli-setshow.c
@@ -373,7 +373,7 @@ do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
for (i = 0; c->enums[i]; i++)
msg_len += strlen (c->enums[i]) + 2;
- msg = xmalloc (msg_len);
+ msg = (char *) xmalloc (msg_len);
*msg = '\0';
make_cleanup (xfree, msg);
diff --git a/gdb/coff-pe-read.c b/gdb/coff-pe-read.c
index 2154c35..2d780b9 100644
--- a/gdb/coff-pe-read.c
+++ b/gdb/coff-pe-read.c
@@ -211,7 +211,7 @@ add_pe_forwarded_sym (const char *sym_name, const char *forward_dll_name,
int forward_dll_name_len = strlen (forward_dll_name);
int forward_func_name_len = strlen (forward_func_name);
int forward_len = forward_dll_name_len + forward_func_name_len + 2;
- char *forward_qualified_name = alloca (forward_len);
+ char *forward_qualified_name = (char *) alloca (forward_len);
short section;
xsnprintf (forward_qualified_name, forward_len, "%s!%s", forward_dll_name,
@@ -492,8 +492,8 @@ read_pe_exported_syms (struct objfile *objfile)
{
char *name;
- section_data = xrealloc (section_data, (otherix + 1)
- * sizeof (struct read_pe_section_data));
+ section_data = XRESIZEVEC (struct read_pe_section_data, section_data,
+ otherix + 1);
name = xstrdup (sec_name);
section_data[otherix].section_name = name;
make_cleanup (xfree, name);
@@ -575,7 +575,7 @@ read_pe_exported_syms (struct objfile *objfile)
{
int len = (int) (sep - forward_name);
- forward_dll_name = alloca (len + 1);
+ forward_dll_name = (char *) alloca (len + 1);
strncpy (forward_dll_name, forward_name, len);
forward_dll_name[len] = '\0';
forward_func_name = ++sep;
diff --git a/gdb/coffread.c b/gdb/coffread.c
index a5033d1..9d20eebdc 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -2104,7 +2104,8 @@ coff_read_struct_type (int index, int length, int lastsym,
list = newobj;
/* Save the data. */
- list->field.name = obstack_copy0 (&objfile->objfile_obstack,
+ list->field.name
+ = (const char *) obstack_copy0 (&objfile->objfile_obstack,
name, strlen (name));
FIELD_TYPE (list->field) = decode_type (ms, ms->c_type,
&sub_aux, objfile);
@@ -2121,7 +2122,8 @@ coff_read_struct_type (int index, int length, int lastsym,
list = newobj;
/* Save the data. */
- list->field.name = obstack_copy0 (&objfile->objfile_obstack,
+ list->field.name
+ = (const char *) obstack_copy0 (&objfile->objfile_obstack,
name, strlen (name));
FIELD_TYPE (list->field) = decode_type (ms, ms->c_type,
&sub_aux, objfile);
@@ -2192,9 +2194,9 @@ coff_read_enum_type (int index, int length, int lastsym,
case C_MOE:
sym = allocate_symbol (objfile);
- SYMBOL_SET_LINKAGE_NAME (sym,
- obstack_copy0 (&objfile->objfile_obstack,
- name, strlen (name)));
+ name = (char *) obstack_copy0 (&objfile->objfile_obstack, name,
+ strlen (name));
+ SYMBOL_SET_LINKAGE_NAME (sym, name);
SYMBOL_ACLASS_INDEX (sym) = LOC_CONST;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
SYMBOL_VALUE (sym) = ms->c_value;
diff --git a/gdb/common/btrace-common.c b/gdb/common/btrace-common.c
index 9d6c4a7..7d65ab2 100644
--- a/gdb/common/btrace-common.c
+++ b/gdb/common/btrace-common.c
@@ -161,7 +161,7 @@ btrace_data_append (struct btrace_data *dst,
size_t size;
size = src->variant.pt.size + dst->variant.pt.size;
- data = xmalloc (size);
+ data = (gdb_byte *) xmalloc (size);
memcpy (data, dst->variant.pt.data, dst->variant.pt.size);
memcpy (data + dst->variant.pt.size, src->variant.pt.data,
diff --git a/gdb/common/buffer.c b/gdb/common/buffer.c
index ca1636d..684fb6e 100644
--- a/gdb/common/buffer.c
+++ b/gdb/common/buffer.c
@@ -37,7 +37,7 @@ buffer_grow (struct buffer *buffer, const char *data, size_t size)
while (buffer->used_size + size > new_buffer_size)
new_buffer_size *= 2;
- new_buffer = xrealloc (buffer->buffer, new_buffer_size);
+ new_buffer = (char *) xrealloc (buffer->buffer, new_buffer_size);
memcpy (new_buffer + buffer->used_size, data, size);
buffer->buffer = new_buffer;
buffer->buffer_size = new_buffer_size;
diff --git a/gdb/common/filestuff.c b/gdb/common/filestuff.c
index c829a89..4348527 100644
--- a/gdb/common/filestuff.c
+++ b/gdb/common/filestuff.c
@@ -316,7 +316,7 @@ gdb_fopen_cloexec (const char *filename, const char *opentype)
{
char *copy;
- copy = alloca (strlen (opentype) + 2);
+ copy = (char *) alloca (strlen (opentype) + 2);
strcpy (copy, opentype);
/* This is a glibc extension but we try it unconditionally on
this path. */
diff --git a/gdb/common/format.c b/gdb/common/format.c
index 1602e53..52c6b81 100644
--- a/gdb/common/format.c
+++ b/gdb/common/format.c
@@ -99,7 +99,7 @@ parse_format_string (const char **arg)
/* Need extra space for the '\0's. Doubling the size is sufficient. */
- current_substring = xmalloc (strlen (string) * 2 + 1000);
+ current_substring = (char *) xmalloc (strlen (string) * 2 + 1000);
max_pieces = strlen (string) + 2;
diff --git a/gdb/common/gdb_vecs.c b/gdb/common/gdb_vecs.c
index 84424f8..63766db 100644
--- a/gdb/common/gdb_vecs.c
+++ b/gdb/common/gdb_vecs.c
@@ -60,7 +60,7 @@ delim_string_to_char_ptr_vec_append (VEC (char_ptr) **vecp,
next_field++;
}
- this_field = xmalloc (this_len + 1);
+ this_field = (char *) xmalloc (this_len + 1);
memcpy (this_field, str, this_len);
this_field[this_len] = '\0';
VEC_safe_push (char_ptr, *vecp, this_field);
diff --git a/gdb/common/xml-utils.c b/gdb/common/xml-utils.c
index e928afb..00e0356 100644
--- a/gdb/common/xml-utils.c
+++ b/gdb/common/xml-utils.c
@@ -49,7 +49,7 @@ xml_escape_text (const char *text)
}
/* Expand the result. */
- result = xmalloc (i + special + 1);
+ result = (char *) xmalloc (i + special + 1);
for (i = 0, special = 0; text[i] != '\0'; i++)
switch (text[i])
{
diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c
index 73868c2..ea1a19a 100644
--- a/gdb/compile/compile-object-load.c
+++ b/gdb/compile/compile-object-load.c
@@ -386,7 +386,7 @@ copy_sections (bfd *abfd, asection *sect, void *data)
link_order.size = bfd_get_section_size (sect);
link_order.u.indirect.section = sect;
- sect_data = xmalloc (bfd_get_section_size (sect));
+ sect_data = (bfd_byte *) xmalloc (bfd_get_section_size (sect));
make_cleanup (xfree, sect_data);
sect_data_got = bfd_get_relocated_section_contents (abfd, &link_info,
@@ -718,7 +718,8 @@ compile_object_load (const char *object_file, const char *source_file,
/* The memory may be later needed
by bfd_generic_get_relocated_section_contents
called from default_symfile_relocate. */
- symbol_table = obstack_alloc (&objfile->objfile_obstack, storage_needed);
+ symbol_table = (asymbol **) obstack_alloc (&objfile->objfile_obstack,
+ storage_needed);
number_of_symbols = bfd_canonicalize_symtab (abfd, symbol_table);
if (number_of_symbols < 0)
error (_("Cannot parse symbols of compiled module \"%s\": %s"),
diff --git a/gdb/compile/compile-object-run.c b/gdb/compile/compile-object-run.c
index 6a39d13..6bc96b9 100644
--- a/gdb/compile/compile-object-run.c
+++ b/gdb/compile/compile-object-run.c
@@ -125,7 +125,8 @@ compile_object_run (struct compile_module *module)
CORE_ADDR regs_addr = module->regs_addr;
struct objfile *objfile = module->objfile;
- data = xmalloc (sizeof (*data) + strlen (objfile_name_s));
+ data = (struct do_module_cleanup *) xmalloc (sizeof (*data)
+ + strlen (objfile_name_s));
data->executedp = &executed;
data->source_file = xstrdup (module->source_file);
strcpy (data->objfile_name_string, objfile_name_s);
diff --git a/gdb/completer.c b/gdb/completer.c
index 821f882..f13289a 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -165,14 +165,14 @@ filename_completer (struct cmd_list_element *ignore,
else if (word > text)
{
/* Return some portion of p. */
- q = xmalloc (strlen (p) + 5);
+ q = (char *) xmalloc (strlen (p) + 5);
strcpy (q, p + (word - text));
xfree (p);
}
else
{
/* Return some of TEXT plus p. */
- q = xmalloc (strlen (p) + (text - word) + 5);
+ q = (char *) xmalloc (strlen (p) + (text - word) + 5);
strncpy (q, word, text - word);
q[text - word] = '\0';
strcat (q, p);
diff --git a/gdb/corefile.c b/gdb/corefile.c
index eba36d6..31301cf 100644
--- a/gdb/corefile.c
+++ b/gdb/corefile.c
@@ -376,7 +376,7 @@ read_memory_string (CORE_ADDR memaddr, char *buffer, int max_len)
CORE_ADDR
read_memory_typed_address (CORE_ADDR addr, struct type *type)
{
- gdb_byte *buf = alloca (TYPE_LENGTH (type));
+ gdb_byte *buf = (gdb_byte *) alloca (TYPE_LENGTH (type));
read_memory (addr, buf, TYPE_LENGTH (type));
return extract_typed_address (buf, type);
@@ -412,7 +412,7 @@ write_memory_unsigned_integer (CORE_ADDR addr, int len,
enum bfd_endian byte_order,
ULONGEST value)
{
- gdb_byte *buf = alloca (len);
+ gdb_byte *buf = (gdb_byte *) alloca (len);
store_unsigned_integer (buf, len, byte_order, value);
write_memory (addr, buf, len);
@@ -425,7 +425,7 @@ write_memory_signed_integer (CORE_ADDR addr, int len,
enum bfd_endian byte_order,
LONGEST value)
{
- gdb_byte *buf = alloca (len);
+ gdb_byte *buf = (gdb_byte *) alloca (len);
store_signed_integer (buf, len, byte_order, value);
write_memory (addr, buf, len);
@@ -480,7 +480,7 @@ complete_set_gnutarget (struct cmd_list_element *cmd,
for (last = 0; bfd_targets[last] != NULL; ++last)
;
- bfd_targets = xrealloc (bfd_targets, (last + 2) * sizeof (const char **));
+ bfd_targets = XRESIZEVEC (const char *, bfd_targets, last + 2);
bfd_targets[last] = "auto";
bfd_targets[last + 1] = NULL;
}
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 9218003..5462e02 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -547,7 +547,7 @@ get_core_register_section (struct regcache *regcache,
section_name);
}
- contents = alloca (size);
+ contents = (char *) alloca (size);
if (! bfd_get_section_contents (core_bfd, section, contents,
(file_ptr) 0, size))
{
diff --git a/gdb/cp-name-parser.y b/gdb/cp-name-parser.y
index 0657a52..cbbb0e8 100644
--- a/gdb/cp-name-parser.y
+++ b/gdb/cp-name-parser.y
@@ -69,7 +69,7 @@ d_grab (void)
{
if (demangle_info->next == NULL)
{
- more = malloc (sizeof (struct demangle_info));
+ more = XNEW (struct demangle_info);
more->next = NULL;
demangle_info->next = more;
}
@@ -1977,7 +1977,7 @@ yyerror (char *msg)
static struct demangle_info *
allocate_info (void)
{
- struct demangle_info *info = malloc (sizeof (struct demangle_info));
+ struct demangle_info *info = XNEW (struct demangle_info);
info->next = NULL;
info->used = 0;
@@ -2007,7 +2007,7 @@ cp_new_demangle_parse_info (void)
{
struct demangle_parse_info *info;
- info = malloc (sizeof (struct demangle_parse_info));
+ info = XNEW (struct demangle_parse_info);
info->info = NULL;
info->tree = NULL;
obstack_init (&info->obstack);
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index b8b19ed..acd4845 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -79,8 +79,8 @@ cp_scan_for_anonymous_namespaces (const struct symbol *const symbol,
? 0 : previous_component - 2);
int src_len = next_component;
- char *dest = alloca (dest_len + 1);
- char *src = alloca (src_len + 1);
+ char *dest = (char *) alloca (dest_len + 1);
+ char *src = (char *) alloca (src_len + 1);
memcpy (dest, name, dest_len);
memcpy (src, name, src_len);
@@ -308,8 +308,8 @@ cp_lookup_symbol_in_namespace (const char *the_namespace, const char *name,
if (the_namespace[0] != '\0')
{
- concatenated_name = alloca (strlen (the_namespace) + 2
- + strlen (name) + 1);
+ concatenated_name
+ = (char *) alloca (strlen (the_namespace) + 2 + strlen (name) + 1);
strcpy (concatenated_name, the_namespace);
strcat (concatenated_name, "::");
strcat (concatenated_name, name);
@@ -740,7 +740,7 @@ lookup_namespace_scope (const struct language_defn *langdef,
if (scope_len == 0 && strchr (name, ':') == NULL)
return cp_lookup_bare_symbol (langdef, name, block, domain, 1);
- the_namespace = alloca (scope_len + 1);
+ the_namespace = (char *) alloca (scope_len + 1);
strncpy (the_namespace, scope, scope_len);
the_namespace[scope_len] = '\0';
return cp_lookup_symbol_in_namespace (the_namespace, name,
@@ -846,7 +846,7 @@ find_symbol_in_baseclass (struct type *parent_type, const char *name,
continue;
len = strlen (base_name) + 2 + strlen (name) + 1;
- concatenated_name = xrealloc (concatenated_name, len);
+ concatenated_name = (char *) xrealloc (concatenated_name, len);
xsnprintf (concatenated_name, len, "%s::%s", base_name, name);
sym = cp_lookup_nested_symbol_1 (base_type, name, concatenated_name,
@@ -977,7 +977,7 @@ cp_lookup_nested_symbol (struct type *parent_type,
int is_in_anonymous;
size = strlen (parent_name) + 2 + strlen (nested_name) + 1;
- concatenated_name = alloca (size);
+ concatenated_name = (char *) alloca (size);
xsnprintf (concatenated_name, size, "%s::%s",
parent_name, nested_name);
is_in_anonymous = cp_is_in_anonymous (concatenated_name);
@@ -1076,7 +1076,7 @@ cp_lookup_transparent_type_loop (const char *name,
return retval;
}
- full_name = alloca (scope_length + 2 + strlen (name) + 1);
+ full_name = (char *) alloca (scope_length + 2 + strlen (name) + 1);
strncpy (full_name, scope, scope_length);
strncpy (full_name + scope_length, "::", 2);
strcpy (full_name + scope_length + 2, name);
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index d3e26ad..0e3c948 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -92,7 +92,7 @@ copy_string_to_obstack (struct obstack *obstack, const char *string,
long *len)
{
*len = strlen (string);
- return obstack_copy (obstack, string, *len);
+ return (char *) obstack_copy (obstack, string, *len);
}
/* A cleanup wrapper for cp_demangled_name_parse_free. */
@@ -1204,7 +1204,7 @@ make_symbol_overload_list (const char *func_name,
else
{
char *concatenated_name
- = alloca (strlen (the_namespace) + 2 + strlen (func_name) + 1);
+ = (char *) alloca (strlen (the_namespace) + 2 + strlen (func_name) + 1);
strcpy (concatenated_name, the_namespace);
strcat (concatenated_name, "::");
strcat (concatenated_name, func_name);
@@ -1246,7 +1246,7 @@ make_symbol_overload_list_namespace (const char *func_name,
else
{
char *concatenated_name
- = alloca (strlen (the_namespace) + 2 + strlen (func_name) + 1);
+ = (char *) alloca (strlen (the_namespace) + 2 + strlen (func_name) + 1);
strcpy (concatenated_name, the_namespace);
strcat (concatenated_name, "::");
@@ -1297,7 +1297,7 @@ make_symbol_overload_list_adl_namespace (struct type *type,
if (prefix_len != 0)
{
- the_namespace = alloca (prefix_len + 1);
+ the_namespace = (char *) alloca (prefix_len + 1);
strncpy (the_namespace, type_name, prefix_len);
the_namespace[prefix_len] = '\0';
@@ -1646,7 +1646,7 @@ first_component_command (char *arg, int from_tty)
return;
len = cp_find_first_component (arg);
- prefix = alloca (len + 1);
+ prefix = (char *) alloca (len + 1);
memcpy (prefix, arg, len);
prefix[len] = '\0';
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 0c32f04..a3e9426 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -535,7 +535,7 @@ cp_print_value (struct type *type, struct type *real_type,
gdb_byte *buf;
struct cleanup *back_to;
- buf = xmalloc (TYPE_LENGTH (baseclass));
+ buf = (gdb_byte *) xmalloc (TYPE_LENGTH (baseclass));
back_to = make_cleanup (xfree, buf);
if (target_read_memory (address + boffset, buf,
diff --git a/gdb/ctf.c b/gdb/ctf.c
index 6e7c616..6c1aede 100644
--- a/gdb/ctf.c
+++ b/gdb/ctf.c
@@ -1338,7 +1338,7 @@ ctf_xfer_partial (struct target_ops *ops, enum target_object object,
gdb_byte *contents;
int k;
- contents = xmalloc (mlen);
+ contents = (gdb_byte *) xmalloc (mlen);
for (k = 0; k < mlen; k++)
{
diff --git a/gdb/d-exp.y b/gdb/d-exp.y
index dd87d8a..30ff480 100644
--- a/gdb/d-exp.y
+++ b/gdb/d-exp.y
@@ -640,7 +640,7 @@ StringExp:
vec->type = $1.type;
vec->length = $1.length;
- vec->ptr = malloc ($1.length + 1);
+ vec->ptr = (char *) malloc ($1.length + 1);
memcpy (vec->ptr, $1.ptr, $1.length + 1);
}
| StringExp STRING_LITERAL
@@ -648,10 +648,10 @@ StringExp:
for convenience. */
char *p;
++$$.len;
- $$.tokens = realloc ($$.tokens,
- $$.len * sizeof (struct typed_stoken));
+ $$.tokens
+ = XRESIZEVEC (struct typed_stoken, $$.tokens, $$.len);
- p = malloc ($2.length + 1);
+ p = (char *) malloc ($2.length + 1);
memcpy (p, $2.ptr, $2.length + 1);
$$.tokens[$$.len - 1].type = $2.type;
diff --git a/gdb/d-namespace.c b/gdb/d-namespace.c
index bed8d5b..e142e11 100644
--- a/gdb/d-namespace.c
+++ b/gdb/d-namespace.c
@@ -166,8 +166,8 @@ d_lookup_symbol_in_module (const char *module, const char *name,
if (module[0] != '\0')
{
- concatenated_name = alloca (strlen (module)
- + strlen (name) + 2);
+ concatenated_name
+ = (char *) alloca (strlen (module) + strlen (name) + 2);
strcpy (concatenated_name, module);
strcat (concatenated_name, ".");
strcat (concatenated_name, name);
@@ -219,7 +219,7 @@ lookup_module_scope (const char *name, const struct block *block,
/* Okay, we didn't find a match in our children, so look for the
name in the current module. */
- module = alloca (scope_len + 1);
+ module = (char *) alloca (scope_len + 1);
strncpy (module, scope, scope_len);
module[scope_len] = '\0';
return d_lookup_symbol_in_module (module, name,
@@ -261,7 +261,7 @@ find_symbol_in_baseclass (struct type *parent_type, const char *name,
things like typedefs in the class. First search in this symtab,
what we want is possibly there. */
len = strlen (base_name) + strlen (name) + 2;
- concatenated_name = xrealloc (concatenated_name, len);
+ concatenated_name = (char *) xrealloc (concatenated_name, len);
xsnprintf (concatenated_name, len, "%s.%s", base_name, name);
sym = lookup_symbol_in_static_block (concatenated_name, block,
VAR_DOMAIN);
@@ -327,7 +327,7 @@ d_lookup_nested_symbol (struct type *parent_type,
module search is already not D compliant and more assumptions
could make it too magic. */
size = strlen (parent_name) + strlen (nested_name) + 2;
- concatenated_name = alloca (size);
+ concatenated_name = (char *) alloca (size);
xsnprintf (concatenated_name, size, "%s.%s",
parent_name, nested_name);
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index dd81ec8..1f003b2 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -1125,7 +1125,7 @@ find_stab_function_addr (char *namestring, const char *filename,
if (p == NULL)
p = namestring;
n = p - namestring;
- p = alloca (n + 2);
+ p = (char *) alloca (n + 2);
strncpy (p, namestring, n);
p[n] = 0;
@@ -1663,7 +1663,7 @@ read_dbx_symtab (struct objfile *objfile)
sym_name = NULL; /* pacify "gcc -Werror" */
if (psymtab_language == language_cplus)
{
- char *new_name, *name = xmalloc (p - namestring + 1);
+ char *new_name, *name = (char *) xmalloc (p - namestring + 1);
memcpy (name, namestring, p - namestring);
name[p - namestring] = '\0';
@@ -1671,8 +1671,8 @@ read_dbx_symtab (struct objfile *objfile)
if (new_name != NULL)
{
sym_len = strlen (new_name);
- sym_name = obstack_copy0 (&objfile->objfile_obstack,
- new_name, sym_len);
+ sym_name = (char *) obstack_copy0 (&objfile->objfile_obstack,
+ new_name, sym_len);
xfree (new_name);
}
xfree (name);
@@ -1836,7 +1836,7 @@ read_dbx_symtab (struct objfile *objfile)
if (! pst)
{
int name_len = p - namestring;
- char *name = xmalloc (name_len + 1);
+ char *name = (char *) xmalloc (name_len + 1);
memcpy (name, namestring, name_len);
name[name_len] = '\0';
@@ -1905,7 +1905,7 @@ read_dbx_symtab (struct objfile *objfile)
if (! pst)
{
int name_len = p - namestring;
- char *name = xmalloc (name_len + 1);
+ char *name = (char *) xmalloc (name_len + 1);
memcpy (name, namestring, name_len);
name[name_len] = '\0';
@@ -2229,7 +2229,7 @@ dbx_end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
if (p == NULL)
p = last_function_name;
n = p - last_function_name;
- p = alloca (n + 2);
+ p = (char *) alloca (n + 2);
strncpy (p, last_function_name, n);
p[n] = 0;
@@ -2646,7 +2646,7 @@ cp_set_block_scope (const struct symbol *symbol,
unsigned int prefix_len = cp_entire_prefix_len (name);
block_set_scope (block,
- obstack_copy0 (obstack, name, prefix_len),
+ (const char *) obstack_copy0 (obstack, name, prefix_len),
obstack);
}
}
diff --git a/gdb/dcache.c b/gdb/dcache.c
index f1cabb0..6b65401 100644
--- a/gdb/dcache.c
+++ b/gdb/dcache.c
@@ -370,8 +370,9 @@ dcache_alloc (DCACHE *dcache, CORE_ADDR addr)
if (db)
remove_block (&dcache->freelist, db);
else
- db = xmalloc (offsetof (struct dcache_block, data) +
- dcache->line_size);
+ db = ((struct dcache_block *)
+ xmalloc (offsetof (struct dcache_block, data)
+ + dcache->line_size));
dcache->size++;
}
diff --git a/gdb/demangle.c b/gdb/demangle.c
index c0027be..ded4a25 100644
--- a/gdb/demangle.c
+++ b/gdb/demangle.c
@@ -240,7 +240,7 @@ _initialize_demangler (void)
libiberty_demanglers[ndems].demangling_style != unknown_demangling;
ndems++)
;
- demangling_style_names = xcalloc (ndems + 1, sizeof (char *));
+ demangling_style_names = XCNEWVEC (const char *, ndems + 1);
for (i = 0;
libiberty_demanglers[i].demangling_style != unknown_demangling;
i++)
diff --git a/gdb/dicos-tdep.c b/gdb/dicos-tdep.c
index 633cd8d..82c6c11 100644
--- a/gdb/dicos-tdep.c
+++ b/gdb/dicos-tdep.c
@@ -90,7 +90,7 @@ dicos_load_module_p (bfd *abfd, int header_size)
{
long i, symcount;
- symbol_table = xmalloc (storage_needed);
+ symbol_table = (asymbol **) xmalloc (storage_needed);
symcount = bfd_canonicalize_symtab (abfd, symbol_table);
if (symcount < 0)
diff --git a/gdb/dictionary.c b/gdb/dictionary.c
index 1829b12..68f4f7d 100644
--- a/gdb/dictionary.c
+++ b/gdb/dictionary.c
@@ -403,8 +403,8 @@ dict_create_hashed_expandable (void)
DICT_VECTOR (retval) = &dict_hashed_expandable_vector;
DICT_HASHED_NBUCKETS (retval) = DICT_EXPANDABLE_INITIAL_CAPACITY;
- DICT_HASHED_BUCKETS (retval) = xcalloc (DICT_EXPANDABLE_INITIAL_CAPACITY,
- sizeof (struct symbol *));
+ DICT_HASHED_BUCKETS (retval) = XCNEWVEC (struct symbol *,
+ DICT_EXPANDABLE_INITIAL_CAPACITY);
DICT_HASHED_EXPANDABLE_NSYMS (retval) = 0;
return retval;
@@ -467,11 +467,9 @@ dict_create_linear_expandable (void)
DICT_VECTOR (retval) = &dict_linear_expandable_vector;
DICT_LINEAR_NSYMS (retval) = 0;
- DICT_LINEAR_EXPANDABLE_CAPACITY (retval)
- = DICT_EXPANDABLE_INITIAL_CAPACITY;
+ DICT_LINEAR_EXPANDABLE_CAPACITY (retval) = DICT_EXPANDABLE_INITIAL_CAPACITY;
DICT_LINEAR_SYMS (retval)
- = xmalloc (DICT_LINEAR_EXPANDABLE_CAPACITY (retval)
- * sizeof (struct symbol *));
+ = XNEWVEC (struct symbol *, DICT_LINEAR_EXPANDABLE_CAPACITY (retval));
return retval;
}
@@ -752,9 +750,8 @@ expand_hashtable (struct dictionary *dict)
{
int old_nbuckets = DICT_HASHED_NBUCKETS (dict);
struct symbol **old_buckets = DICT_HASHED_BUCKETS (dict);
- int new_nbuckets = 2*old_nbuckets + 1;
- struct symbol **new_buckets = xcalloc (new_nbuckets,
- sizeof (struct symbol *));
+ int new_nbuckets = 2 * old_nbuckets + 1;
+ struct symbol **new_buckets = XCNEWVEC (struct symbol *, new_nbuckets);
int i;
DICT_HASHED_NBUCKETS (dict) = new_nbuckets;
@@ -940,9 +937,8 @@ add_symbol_linear_expandable (struct dictionary *dict,
{
DICT_LINEAR_EXPANDABLE_CAPACITY (dict) *= 2;
DICT_LINEAR_SYMS (dict)
- = xrealloc (DICT_LINEAR_SYMS (dict),
- DICT_LINEAR_EXPANDABLE_CAPACITY (dict)
- * sizeof (struct symbol *));
+ = XRESIZEVEC (struct symbol *, DICT_LINEAR_SYMS (dict),
+ DICT_LINEAR_EXPANDABLE_CAPACITY (dict));
}
DICT_LINEAR_SYM (dict, nsyms - 1) = sym;
diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
index f9afe0b..0613d06 100644
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -1736,8 +1736,8 @@ add_cie (struct dwarf2_cie_table *cie_table, struct dwarf2_cie *cie)
gdb_assert (n < 1
|| cie_table->entries[n - 1]->cie_pointer < cie->cie_pointer);
- cie_table->entries =
- xrealloc (cie_table->entries, (n + 1) * sizeof (cie_table->entries[0]));
+ cie_table->entries
+ = XRESIZEVEC (struct dwarf2_cie *, cie_table->entries, n + 1);
cie_table->entries[n] = cie;
cie_table->num_entries = n + 1;
}
@@ -1811,9 +1811,8 @@ add_fde (struct dwarf2_fde_table *fde_table, struct dwarf2_fde *fde)
return;
fde_table->num_entries += 1;
- fde_table->entries =
- xrealloc (fde_table->entries,
- fde_table->num_entries * sizeof (fde_table->entries[0]));
+ fde_table->entries = XRESIZEVEC (struct dwarf2_fde *, fde_table->entries,
+ fde_table->num_entries);
fde_table->entries[fde_table->num_entries - 1] = fde;
}
@@ -2371,9 +2370,9 @@ dwarf2_build_frame_info (struct objfile *objfile)
}
else
{
- fde_table.entries = xrealloc (fde_table.entries,
- fde_table.num_entries *
- sizeof (fde_table.entries[0]));
+ fde_table.entries
+ = XRESIZEVEC (struct dwarf2_fde *, fde_table.entries,
+ fde_table.num_entries);
}
}
fde_table.num_entries = num_old_fde_entries;
@@ -2454,7 +2453,8 @@ dwarf2_build_frame_info (struct objfile *objfile)
++fde_table2->num_entries;
fde_prev = fde;
}
- fde_table2->entries = obstack_finish (&objfile->objfile_obstack);
+ fde_table2->entries
+ = (struct dwarf2_fde **) obstack_finish (&objfile->objfile_obstack);
/* Discard the original fde_table. */
xfree (fde_table.entries);
diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c
index 09b56b6..819a5f1 100644
--- a/gdb/dwarf2expr.c
+++ b/gdb/dwarf2expr.c
@@ -140,8 +140,7 @@ dwarf_expr_grow_stack (struct dwarf_expr_context *ctx, size_t need)
{
size_t newlen = ctx->stack_len + need + 10;
- ctx->stack = xrealloc (ctx->stack,
- newlen * sizeof (struct dwarf_stack_value));
+ ctx->stack = XRESIZEVEC (struct dwarf_stack_value, ctx->stack, newlen);
ctx->stack_allocated = newlen;
}
}
@@ -270,7 +269,7 @@ dwarf_expr_fetch_address (struct dwarf_expr_context *ctx, int n)
for those architectures which require it. */
if (gdbarch_integer_to_address_p (ctx->gdbarch))
{
- gdb_byte *buf = alloca (ctx->addr_size);
+ gdb_byte *buf = (gdb_byte *) alloca (ctx->addr_size);
struct type *int_type = get_unsigned_type (ctx->gdbarch,
value_type (result_val));
@@ -309,9 +308,8 @@ add_piece (struct dwarf_expr_context *ctx, ULONGEST size, ULONGEST offset)
ctx->num_pieces++;
- ctx->pieces = xrealloc (ctx->pieces,
- (ctx->num_pieces
- * sizeof (struct dwarf_expr_piece)));
+ ctx->pieces
+ = XRESIZEVEC (struct dwarf_expr_piece, ctx->pieces, ctx->num_pieces);
p = &ctx->pieces[ctx->num_pieces - 1];
p->location = ctx->location;
@@ -1025,7 +1023,7 @@ execute_stack_op (struct dwarf_expr_context *ctx,
case DW_OP_GNU_deref_type:
{
int addr_size = (op == DW_OP_deref ? ctx->addr_size : *op_ptr++);
- gdb_byte *buf = alloca (addr_size);
+ gdb_byte *buf = (gdb_byte *) alloca (addr_size);
CORE_ADDR addr = dwarf_expr_fetch_address (ctx, 0);
struct type *type;
@@ -1051,7 +1049,7 @@ execute_stack_op (struct dwarf_expr_context *ctx,
ULONGEST result =
extract_unsigned_integer (buf, addr_size, byte_order);
- buf = alloca (TYPE_LENGTH (type));
+ buf = (gdb_byte *) alloca (TYPE_LENGTH (type));
store_unsigned_integer (buf, TYPE_LENGTH (type),
byte_order, result);
}
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index dd8dd0b..c2c0c59 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -823,8 +823,9 @@ chain_candidate (struct gdbarch *gdbarch, struct call_site_chain **resultp,
{
/* Create the initial chain containing all the passed PCs. */
- result = xmalloc (sizeof (*result) + sizeof (*result->call_site)
- * (length - 1));
+ result = ((struct call_site_chain *)
+ xmalloc (sizeof (*result)
+ + sizeof (*result->call_site) * (length - 1)));
result->length = length;
result->callers = result->callees = length;
if (!VEC_empty (call_sitep, chain))
@@ -1232,7 +1233,7 @@ dwarf_entry_parameter_to_value (struct call_site_parameter *parameter,
/* DW_AT_GNU_call_site_value is a DWARF expression, not a DWARF
location. Postprocessing of DWARF_VALUE_MEMORY would lose the type from
DWARF block. */
- data = alloca (size + 1);
+ data = (gdb_byte *) alloca (size + 1);
memcpy (data, data_src, size);
data[size] = DW_OP_stack_value;
@@ -1744,7 +1745,7 @@ read_pieced_value (struct value *v)
if (buffer_size < this_size)
{
buffer_size = this_size;
- buffer = xrealloc (buffer, buffer_size);
+ buffer = (gdb_byte *) xrealloc (buffer, buffer_size);
}
intermediate_buffer = buffer;
@@ -1935,7 +1936,7 @@ write_pieced_value (struct value *to, struct value *from)
if (buffer_size < this_size)
{
buffer_size = this_size;
- buffer = xrealloc (buffer, buffer_size);
+ buffer = (gdb_byte *) xrealloc (buffer, buffer_size);
}
source_buffer = buffer;
need_bitwise = 1;
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 90e581a..4aa2f6d 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -2324,7 +2324,7 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info)
return;
}
- buf = obstack_alloc (&objfile->objfile_obstack, info->size);
+ buf = (gdb_byte *) obstack_alloc (&objfile->objfile_obstack, info->size);
info->buffer = buf;
/* When debugging .o files, we may need to apply relocations; see
@@ -4806,9 +4806,9 @@ add_type_unit (ULONGEST sig, void **slot)
dwarf2_per_objfile->n_allocated_type_units = 1;
dwarf2_per_objfile->n_allocated_type_units *= 2;
dwarf2_per_objfile->all_type_units
- = xrealloc (dwarf2_per_objfile->all_type_units,
- dwarf2_per_objfile->n_allocated_type_units
- * sizeof (struct signatured_type *));
+ = XRESIZEVEC (struct signatured_type *,
+ dwarf2_per_objfile->all_type_units,
+ dwarf2_per_objfile->n_allocated_type_units);
++dwarf2_per_objfile->tu_stats.nr_all_type_units_reallocs;
}
dwarf2_per_objfile->n_type_units = n_type_units;
@@ -6571,9 +6571,8 @@ read_comp_units_from_section (struct objfile *objfile,
if (*n_comp_units == *n_allocated)
{
*n_allocated *= 2;
- *all_comp_units = xrealloc (*all_comp_units,
- *n_allocated
- * sizeof (struct dwarf2_per_cu_data *));
+ *all_comp_units = XRESIZEVEC (struct dwarf2_per_cu_data *,
+ *all_comp_units, *n_allocated);
}
(*all_comp_units)[*n_comp_units] = this_cu;
++*n_comp_units;
@@ -7829,9 +7828,9 @@ fixup_go_packaging (struct dwarf2_cu *cu)
{
struct objfile *objfile = cu->objfile;
const char *saved_package_name
- = obstack_copy0 (&objfile->per_bfd->storage_obstack,
- package_name,
- strlen (package_name));
+ = (const char *) obstack_copy0 (&objfile->per_bfd->storage_obstack,
+ package_name,
+ strlen (package_name));
struct type *type = init_type (TYPE_CODE_MODULE, 0, 0,
saved_package_name, objfile);
struct symbol *sym;
@@ -8649,9 +8648,10 @@ dwarf2_compute_name (const char *name,
INTERMEDIATE_NAME is already canonical, then we need to
copy it to the appropriate obstack. */
if (canonical_name == NULL || canonical_name == intermediate_name)
- name = obstack_copy0 (&objfile->per_bfd->storage_obstack,
- intermediate_name,
- strlen (intermediate_name));
+ name = ((const char *)
+ obstack_copy0 (&objfile->per_bfd->storage_obstack,
+ intermediate_name,
+ strlen (intermediate_name)));
else
name = canonical_name;
@@ -8777,8 +8777,9 @@ dwarf2_physname (const char *name, struct die_info *die, struct dwarf2_cu *cu)
retval = canon;
if (need_copy)
- retval = obstack_copy0 (&objfile->per_bfd->storage_obstack,
- retval, strlen (retval));
+ retval = ((const char *)
+ obstack_copy0 (&objfile->per_bfd->storage_obstack,
+ retval, strlen (retval)));
do_cleanups (back_to);
return retval;
@@ -10105,9 +10106,10 @@ create_dwo_unit_in_dwp_v1 (struct dwp_file *dwp_file,
virtual_dwo_name);
}
dwo_file = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct dwo_file);
- dwo_file->dwo_name = obstack_copy0 (&objfile->objfile_obstack,
- virtual_dwo_name,
- strlen (virtual_dwo_name));
+ dwo_file->dwo_name
+ = (const char *) obstack_copy0 (&objfile->objfile_obstack,
+ virtual_dwo_name,
+ strlen (virtual_dwo_name));
dwo_file->comp_dir = comp_dir;
dwo_file->sections.abbrev = sections.abbrev;
dwo_file->sections.line = sections.line;
@@ -10306,9 +10308,10 @@ create_dwo_unit_in_dwp_v2 (struct dwp_file *dwp_file,
virtual_dwo_name);
}
dwo_file = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct dwo_file);
- dwo_file->dwo_name = obstack_copy0 (&objfile->objfile_obstack,
- virtual_dwo_name,
- strlen (virtual_dwo_name));
+ dwo_file->dwo_name
+ = (const char *) obstack_copy0 (&objfile->objfile_obstack,
+ virtual_dwo_name,
+ strlen (virtual_dwo_name));
dwo_file->comp_dir = comp_dir;
dwo_file->sections.abbrev =
create_dwp_v2_section (&dwp_file->sections.abbrev,
@@ -11393,8 +11396,8 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
attr = dwarf2_attr (die, DW_AT_static_link, cu);
if (attr)
{
- newobj->static_link = obstack_alloc (&objfile->objfile_obstack,
- sizeof (*newobj->static_link));
+ newobj->static_link
+ = XOBNEW (&objfile->objfile_obstack, struct dynamic_prop);
attr_to_dynamic_prop (attr, die, cu, newobj->static_link);
}
@@ -11615,10 +11618,11 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
nparams++;
}
- call_site = obstack_alloc (&objfile->objfile_obstack,
- (sizeof (*call_site)
- + (sizeof (*call_site->parameter)
- * (nparams - 1))));
+ call_site
+ = ((struct call_site *)
+ obstack_alloc (&objfile->objfile_obstack,
+ sizeof (*call_site)
+ + (sizeof (*call_site->parameter) * (nparams - 1))));
*slot = call_site;
memset (call_site, 0, sizeof (*call_site) - sizeof (*call_site->parameter));
call_site->pc = pc;
@@ -12692,7 +12696,7 @@ dwarf2_attach_fields_to_type (struct field_info *fip, struct type *type,
unsigned char *pointer;
ALLOCATE_CPLUS_STRUCT_TYPE (type);
- pointer = TYPE_ALLOC (type, num_bytes);
+ pointer = (unsigned char *) TYPE_ALLOC (type, num_bytes);
TYPE_FIELD_VIRTUAL_BITS (type) = pointer;
B_CLRALL (TYPE_FIELD_VIRTUAL_BITS (type), fip->nbaseclasses);
TYPE_N_BASECLASSES (type) = fip->nbaseclasses;
@@ -13383,7 +13387,8 @@ process_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
ALLOCATE_CPLUS_STRUCT_TYPE (type);
TYPE_TYPEDEF_FIELD_ARRAY (type)
- = TYPE_ALLOC (type, sizeof (TYPE_TYPEDEF_FIELD (type, 0)) * i);
+ = ((struct typedef_field *)
+ TYPE_ALLOC (type, sizeof (TYPE_TYPEDEF_FIELD (type, 0)) * i));
TYPE_TYPEDEF_FIELD_COUNT (type) = i;
/* Reverse the list order to keep the debug info elements order. */
@@ -13904,7 +13909,7 @@ mark_common_block_symbol_computed (struct symbol *sym,
else
baton->size += DW_BLOCK (member_loc)->size;
- ptr = obstack_alloc (&objfile->objfile_obstack, baton->size);
+ ptr = (gdb_byte *) obstack_alloc (&objfile->objfile_obstack, baton->size);
baton->data = ptr;
*ptr++ = DW_OP_call4;
@@ -13980,7 +13985,9 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
size = (sizeof (struct common_block)
+ (n_entries - 1) * sizeof (struct symbol *));
- common_block = obstack_alloc (&objfile->objfile_obstack, size);
+ common_block
+ = (struct common_block *) obstack_alloc (&objfile->objfile_obstack,
+ size);
memset (common_block->contents, 0, n_entries * sizeof (struct symbol *));
common_block->n_entries = 0;
@@ -15360,8 +15367,7 @@ abbrev_table_read_table (struct dwarf2_section_info *section,
{
allocated_attrs += ATTR_ALLOC_CHUNK;
cur_attrs
- = xrealloc (cur_attrs, (allocated_attrs
- * sizeof (struct attr_abbrev)));
+ = XRESIZEVEC (struct attr_abbrev, cur_attrs, allocated_attrs);
}
cur_attrs[cur_abbrev->num_attrs].name
@@ -16098,9 +16104,10 @@ guess_partial_die_structure_name (struct partial_die_info *struct_pdi,
if (actual_class_name != NULL)
{
struct_pdi->name
- = obstack_copy0 (&cu->objfile->per_bfd->storage_obstack,
- actual_class_name,
- strlen (actual_class_name));
+ = ((const char *)
+ obstack_copy0 (&cu->objfile->per_bfd->storage_obstack,
+ actual_class_name,
+ strlen (actual_class_name)));
xfree (actual_class_name);
}
break;
@@ -16185,8 +16192,9 @@ fixup_partial_die (struct partial_die_info *part_die,
base = demangled;
part_die->name
- = obstack_copy0 (&cu->objfile->per_bfd->storage_obstack,
- base, strlen (base));
+ = ((const char *)
+ obstack_copy0 (&cu->objfile->per_bfd->storage_obstack,
+ base, strlen (base)));
xfree (demangled);
}
}
@@ -17233,9 +17241,8 @@ add_file_name (struct line_header *lh,
else if (lh->num_file_names >= lh->file_names_size)
{
lh->file_names_size *= 2;
- lh->file_names = xrealloc (lh->file_names,
- (lh->file_names_size
- * sizeof (*lh->file_names)));
+ lh->file_names
+ = XRESIZEVEC (struct file_entry, lh->file_names, lh->file_names_size);
}
fe = &lh->file_names[lh->num_file_names++];
@@ [...]
[diff truncated at 100000 bytes]