]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Add casts to memory allocation related calls
authorSimon Marchi <simon.marchi@ericsson.com>
Fri, 25 Sep 2015 18:08:06 +0000 (14:08 -0400)
committerSimon Marchi <simon.marchi@ericsson.com>
Fri, 25 Sep 2015 18:08:06 +0000 (14:08 -0400)
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.

192 files changed:
gdb/ChangeLog
gdb/aarch64-linux-tdep.c
gdb/ada-exp.y
gdb/ada-lang.c
gdb/ada-lex.l
gdb/ada-tasks.c
gdb/ada-typeprint.c
gdb/addrmap.c
gdb/amd64-tdep.c
gdb/amd64obsd-tdep.c
gdb/arch-utils.c
gdb/arm-linux-tdep.c
gdb/arm-symbian-tdep.c
gdb/arm-tdep.c
gdb/auto-load.c
gdb/auxv.c
gdb/ax-general.c
gdb/bcache.c
gdb/breakpoint.c
gdb/btrace.c
gdb/build-id.c
gdb/buildsym.c
gdb/c-exp.y
gdb/c-lang.c
gdb/charset.c
gdb/cli/cli-cmds.c
gdb/cli/cli-dump.c
gdb/cli/cli-interp.c
gdb/cli/cli-script.c
gdb/cli/cli-setshow.c
gdb/coff-pe-read.c
gdb/coffread.c
gdb/common/btrace-common.c
gdb/common/buffer.c
gdb/common/filestuff.c
gdb/common/format.c
gdb/common/gdb_vecs.c
gdb/common/xml-utils.c
gdb/compile/compile-object-load.c
gdb/compile/compile-object-run.c
gdb/completer.c
gdb/corefile.c
gdb/corelow.c
gdb/cp-name-parser.y
gdb/cp-namespace.c
gdb/cp-support.c
gdb/cp-valprint.c
gdb/ctf.c
gdb/d-exp.y
gdb/d-namespace.c
gdb/dbxread.c
gdb/dcache.c
gdb/demangle.c
gdb/dicos-tdep.c
gdb/dictionary.c
gdb/dwarf2-frame.c
gdb/dwarf2expr.c
gdb/dwarf2loc.c
gdb/dwarf2read.c
gdb/elfread.c
gdb/event-top.c
gdb/exec.c
gdb/expprint.c
gdb/fbsd-tdep.c
gdb/findcmd.c
gdb/findvar.c
gdb/frame.c
gdb/gdb_bfd.c
gdb/gdb_obstack.c
gdb/gdbserver/ChangeLog
gdb/gdbserver/ax.c
gdb/gdbserver/hostio.c
gdb/gdbserver/linux-low.c
gdb/gdbserver/mem-break.c
gdb/gdbserver/regcache.c
gdb/gdbserver/remote-utils.c
gdb/gdbserver/server.c
gdb/gdbserver/target.c
gdb/gdbserver/thread-db.c
gdb/gdbserver/tracepoint.c
gdb/gdbtypes.c
gdb/gdbtypes.h
gdb/gnu-v3-abi.c
gdb/go-exp.y
gdb/go-lang.c
gdb/guile/guile.c
gdb/guile/scm-cmd.c
gdb/guile/scm-ports.c
gdb/guile/scm-utils.c
gdb/h8300-tdep.c
gdb/hppa-tdep.c
gdb/i386-cygwin-tdep.c
gdb/i386-tdep.c
gdb/i386obsd-tdep.c
gdb/inf-child.c
gdb/inf-ptrace.c
gdb/infrun.c
gdb/jit.c
gdb/jv-exp.y
gdb/jv-lang.c
gdb/jv-typeprint.c
gdb/jv-valprint.c
gdb/language.c
gdb/linespec.c
gdb/linux-fork.c
gdb/linux-nat.c
gdb/linux-record.c
gdb/linux-tdep.c
gdb/linux-thread-db.c
gdb/m32c-tdep.c
gdb/m68hc11-tdep.c
gdb/m68k-tdep.c
gdb/machoread.c
gdb/macroexp.c
gdb/macrotab.c
gdb/mdebugread.c
gdb/mem-break.c
gdb/mi/mi-cmd-break.c
gdb/mi/mi-main.c
gdb/mi/mi-parse.c
gdb/minidebug.c
gdb/mips-tdep.c
gdb/mipsnbsd-tdep.c
gdb/mipsread.c
gdb/mt-tdep.c
gdb/namespace.c
gdb/nat/linux-btrace.c
gdb/nat/linux-osdata.c
gdb/nat/linux-ptrace.c
gdb/nto-tdep.c
gdb/objc-lang.c
gdb/objfiles.c
gdb/osabi.c
gdb/p-exp.y
gdb/p-valprint.c
gdb/parse.c
gdb/ppc-linux-tdep.c
gdb/ppc-ravenscar-thread.c
gdb/printcmd.c
gdb/probe.c
gdb/python/py-cmd.c
gdb/python/py-gdb-readline.c
gdb/python/py-symtab.c
gdb/python/py-unwind.c
gdb/python/python.c
gdb/ravenscar-thread.c
gdb/record-full.c
gdb/regcache.c
gdb/remote-fileio.c
gdb/remote-mips.c
gdb/remote.c
gdb/rs6000-aix-tdep.c
gdb/rs6000-tdep.c
gdb/s390-linux-tdep.c
gdb/score-tdep.c
gdb/solib-dsbt.c
gdb/solib-frv.c
gdb/solib-spu.c
gdb/solib-svr4.c
gdb/solib-target.c
gdb/solib.c
gdb/source.c
gdb/sparc-ravenscar-thread.c
gdb/spu-tdep.c
gdb/stabsread.c
gdb/stack.c
gdb/stap-probe.c
gdb/symfile.c
gdb/symtab.c
gdb/target-descriptions.c
gdb/target-memory.c
gdb/target.c
gdb/tilegx-tdep.c
gdb/top.c
gdb/tracefile-tfile.c
gdb/tracefile.c
gdb/tracepoint.c
gdb/tui/tui-file.c
gdb/tui/tui-io.c
gdb/tui/tui-source.c
gdb/typeprint.c
gdb/ui-file.c
gdb/utils.c
gdb/valops.c
gdb/valprint.c
gdb/varobj.c
gdb/vaxobsd-tdep.c
gdb/windows-tdep.c
gdb/xcoffread.c
gdb/xml-support.c
gdb/xml-syscall.c
gdb/xstormy16-tdep.c

index 38a49e0ffbc884bb61bdf4ca33a52aa504c2b3fd..fb66ae82b786994a8b563b3d596fe96a54b97c47 100644 (file)
@@ -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
index 07ee1eade8d46a45335a87498efc680fafba2959..aaf66088a78a33bcbc8e56bc54399629eeb5713e 100644 (file)
@@ -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';
index 1c45bcbc747d2e5c2b0a7c31c6eec074e91328ff..e64463eacb236f402448240802ab1c0e2d76a73f 100644 (file)
@@ -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;
index 8089a3228feb1a5ecab3fe28aa540adc41b5c1fa..0b463e2cf416a7e9a056643687a4ce552014d6c9 100644 (file)
@@ -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';
   
index 1a93a5ce96051b4af172ad99a3d59870a7b9cd6d..97f9b2dfa8ff3440250e6dba9734e02ac70f1efa 100644 (file)
@@ -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)
index c97057ef2b9bfcc34eaf9f1776130b52fb915d65..fbe67aa1cf68b15145f94db2822ae54c78ced9d9 100644 (file)
@@ -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);
index 1fb0f0e168d305174d29ddccce327499461c3393..11fdc7090be67fa6f7450682371fcaf0516c5d35 100644 (file)
@@ -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);
 
index a124aeaaab363764a18d2f6875011476cba45565..a526167d9a01c8ec16d090450814be8219a3dacc 100644 (file)
@@ -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;
index a672cdef1a6b213142ad53a22f79684394609627..a2179ce74b16b5811cfce4e4ae50676d8b34a1bd 100644 (file)
@@ -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;
index d6c7e90a016a2158f1f22cbcb4e0021bda9c0af0..46bf7c5699bbb554916b490140ed3933eaf2e837 100644 (file)
@@ -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;
 
index 7df55705c25748ec4e1719f0694c53b8f6d346a6..bb93fbe76f2a04b93c2af991560bfd44caface98 100644 (file)
@@ -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,
index bc2cec4197c523a27f29aed4891f350d72baf19c..46d59ba3406d275143c8754d2aa7736bc6dd68df 100644 (file)
@@ -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))
index 02811edd6c57f8f013039a6752a89c5f9e9f48b3..5a94293fe761013e16290f578b55f85f95dea682 100644 (file)
@@ -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;
index bcee29cca44652256d4b54adc9a9bc720b2fcb11..cb47fa7645875097ccd7a1001df0f08da9c77cab 100644 (file)
@@ -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';
 
index 7da288ffe7905c171cb72119e2996c141374897f..119c67306ccf5840f0b60d6bd91d6daf12ca0538 100644 (file)
@@ -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.  */
index fff34ff80cd8b013adcc50095990f93e060aed60..f99da364023a4726401d5b921d023f597e6f5e91 100644 (file)
@@ -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;
 
index 8dbe5729c019e30cfced004cc783dd5456d73a69..49afee6c1b980a45566dc0a8df8cc67f0d7fd55c 100644 (file)
@@ -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;
index f3abc12a10e2351db126c4da253865ee707d71e1..6db56d2990cbd1cff1232931a3802d2e8f1c7aac 100644 (file)
@@ -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;
index 520793a72e1107c9aa4a26bbb108535533a6e4b9..c09d56af899001252ea3949f08bdd6f35c54ad85 100644 (file)
@@ -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
index e205ea867c4e318009f0a36a0b197452e32c90dc..4292dc7784d8c95a303ce4d0530f7c0ed5e6b4cc 100644 (file)
@@ -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.  */
index c89cd55c262ab9bbc10f282b36b811a08f0fb9d3..c7c718ca909435ebbaee37ba2cf106f0e36bd245 100644 (file)
@@ -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.  */
index 54c1d0328b66c641ea798dd96fc2a9f1a52b3515..5f463ac8088c966332fdc4c4b8a4b2ab7be9e891 100644 (file)
@@ -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.  */
index 351505e4fff9982a9d5f956593e389e8472dd631..e37a0b1109afc51fd5ee53ffbd2c02977507817e 100644 (file)
@@ -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 (&copy[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, &current);
       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';
index f38af47490ce68d4658d3694a11163c955c76576..6731b43d21dbefd382306c7e259e701a9c8cd95e 100644 (file)
@@ -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));
 }
index 669d6896e79ceab036b0f53fb78ccde1605a7552..afd9220e6b6bb8e5a3f1c07731f88990c39e2bf9 100644 (file)
@@ -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;
 
index aa9a9a58d56a0819d1fda94c92c36e4ba2f47a71..424bf5e90e6d34ba93f089888a304353c09659db 100644 (file)
@@ -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);
     }
index 2449dc5d89cadf1bf4d1a235767cdb023756da91..aabe3e3b2cd6ea93d08d63e075535ba25bc4f00f 100644 (file)
@@ -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);
index 174a10bbe622133cf248e233a5e94cd2f49c87f3..7df7c14d796a38843a1df6501e4a43fbdffeb56a 100644 (file)
@@ -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
index 1717240d68dcd7795b5007455ea61e30fa56ea25..624a493ddae762297793ebe94346ce3b8d5f2c00 100644 (file)
@@ -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);
index 64f09f21b2509d675f3307e00615e6218e2d06ec..9439f48fb1a3bf87791a6a29da9d4ca97d70de93 100644 (file)
@@ -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);
 
index 2154c3577ea47192ae874fd29fa6c99e83a73e59..2d780b97a045a1452f8fca911aafd049fa23ca79 100644 (file)
@@ -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;
index a5033d1666a8d26c06ad8cc768318eecd2a11345..9d20eebdc9a9fb9ee0c7aa7c80f826a4387b93c2 100644 (file)
@@ -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;
index 9d6c4a7933e233904b108bdb10986d11f7327782..7d65ab2b4c736bcdb05717e788208eb3a77bb751 100644 (file)
@@ -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,
index ca1636dcd73bddef6b45be5a37771024347b0dad..684fb6ef52d35f38c73be6d2ceea509bd0acc9a8 100644 (file)
@@ -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;
index c829a8928321eda3ed28e809a1a619603104d3ff..4348527917a88792f186469c1c99e475fb9beab7 100644 (file)
@@ -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.  */
index 1602e53a295b36d443af221d580ec2cfe2c31dbc..52c6b81d052070ff7bdb721b8b232d3aac81be12 100644 (file)
@@ -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;
 
index 84424f87b7bec65118f6d098db8b207c30875c3f..63766db00115ab75bce5fb5179f4f0cfa7902c25 100644 (file)
@@ -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);
index e928afb653a3e527ee8b612d441f8290bb6ca0bf..00e035621e6174b2c875c07dbbd8fe43534f5dd4 100644 (file)
@@ -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])
       {
index 73868c2f5123a489e392fa64524fae2fc64a61dd..ea1a19a95e330d2465a3e5c39484d7fdd15b8aaa 100644 (file)
@@ -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"),
index 6a39d13f50db0a73909b926cc4ad075ffa4fc271..6bc96b9e9bce6603dc990325ed8a9bf45d848a28 100644 (file)
@@ -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);
index 821f882562365e40b66ef0e81dee89076a2035c5..f13289a61bb7eed41231ececaf1f6ca70568ccf7 100644 (file)
@@ -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);
index eba36d6419aa76bc9d5be4c7a14cf328a4a6f1b3..31301cf4777f4b582c14b09b366bc2ab05963bd5 100644 (file)
@@ -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;
     }
index 92180036771dae3aebf27bc3d49a9917466549f7..5462e0297782dd34483aa6f57b922af34b8e3a20 100644 (file)
@@ -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))
     {
index 0657a527a8e879aed98ab8dbd3d4c1cfdca1a37d..cbbb0e88edb6d2a50bb1624edfaeff06ae288f1a 100644 (file)
@@ -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);
index b8b19ed7af6fa59b08e0f7d748dca0a28aa8dba7..acd484539f23d58bc6818b5446d02c8541184e7e 100644 (file)
@@ -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);
index d3e26ad35b7c577f3abaf2b1d3072ea47e646af7..0e3c94811ad9a9b31be7e0356d84be995102ef64 100644 (file)
@@ -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';
index 0c32f04286abc8134cba77a3a1124dbaf63873df..a3e94261b4a6bc8b5c06972517fc24ea8264156d 100644 (file)
@@ -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,
index 6e7c6163ba3b3324c88c68c8b0a057167b7dbf90..6c1aedea75718568683006f76f38ec5cd82fe04b 100644 (file)
--- 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++)
                {
index dd87d8aa18849ed14d7a773de824ee1bfb706cd8..30ff480daef07fcbf246bb1fa1a06de95a3084c0 100644 (file)
@@ -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;
index bed8d5b1cc8f8c298abef6be3c4e43b744abf8b2..e142e11c4797dfaaded303e598f78ea718525292 100644 (file)
@@ -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);
index dd81ec8c49e8b3169fee6b11824f144eb7c324e0..1f003b2e51f7e7bebb35f01945e6dea6c70844d0 100644 (file)
@@ -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);
     }
 }
index f1cabb02aebe2d15f2afd1d550b0a5cad6d0b487..6b654013e42361083437b2dafe7c4c1eeb8d73dc 100644 (file)
@@ -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++;
     }
index c0027be841e6155170056cf241f83d884f2d40a3..ded4a25ab15e454706ec63fca71834da57a217f8 100644 (file)
@@ -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++)
index 633cd8d47cf032fee51ed80cb45ea4a955745350..82c6c11f401e5465c06f37aceff986f9c4c86b69 100644 (file)
@@ -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)
index 1829b1280782ec790efd8b203611523dcdc2ad56..68f4f7de2821ef6108a196dcd1d194756d0c90e8 100644 (file)
@@ -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;
index f9afe0b105b55907b798ad0f07b7e08030540fcd..0613d06735342da3ab648e6fcbc9e0dc7c1c90db 100644 (file)
@@ -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);
index 09b56b6755711ed74d6a89ff0cdae4c967ff9178..819a5f178837a764ca90671f065dc752d70a5bce 100644 (file)
@@ -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);
              }
index dd8dd0bbcd45525e52d760e542a16d6a835f49d5..c2c0c5940d46ff433ef3a74279d0d5d0e5420165 100644 (file)
@@ -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;
index 90e581a0888654042c9efe34a32c3619b59ede28..4aa2f6dd1346538294e58cbce7d77f70b0612abc 100644 (file)
@@ -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++];
@@ -18703,7 +18710,7 @@ dwarf2_const_value_data (const struct attribute *attr, struct obstack *obstack,
     *value = l;
   else
     {
-      gdb_byte *bytes = obstack_alloc (obstack, bits / 8);
+      gdb_byte *bytes = (gdb_byte *) obstack_alloc (obstack, bits / 8);
       store_unsigned_integer (bytes, bits / 8, byte_order, l);
       return bytes;
     }
@@ -18753,7 +18760,7 @@ dwarf2_const_value_attr (const struct attribute *attr, struct type *type,
        gdb_assert ((*baton)->per_cu);
 
        (*baton)->size = 2 + cu_header->addr_size;
-       data = obstack_alloc (obstack, (*baton)->size);
+       data = (gdb_byte *) obstack_alloc (obstack, (*baton)->size);
        (*baton)->data = data;
 
        data[0] = DW_OP_addr;
@@ -18947,8 +18954,8 @@ build_error_marker_type (struct dwarf2_cu *cu, struct die_info *die)
                        objfile_name (objfile),
                        cu->header.offset.sect_off,
                        die->offset.sect_off);
-  saved = obstack_copy0 (&objfile->objfile_obstack,
-                        message, strlen (message));
+  saved = (char *) obstack_copy0 (&objfile->objfile_obstack,
+                                 message, strlen (message));
   xfree (message);
 
   return init_type (TYPE_CODE_ERROR, 0, 0, saved, objfile);
@@ -19187,10 +19194,9 @@ guess_full_die_structure_name (struct die_info *die, struct dwarf2_cu *cu)
                      if (actual_name_len > die_name_len + 2
                          && actual_name[actual_name_len
                                         - die_name_len - 1] == ':')
-                       name =
-                         obstack_copy0 (&cu->objfile->per_bfd->storage_obstack,
-                                        actual_name,
-                                        actual_name_len - die_name_len - 2);
+                       name = (char *) obstack_copy0 (
+                         &cu->objfile->per_bfd->storage_obstack,
+                         actual_name, actual_name_len - die_name_len - 2);
                    }
                }
              xfree (actual_name);
@@ -19233,8 +19239,9 @@ anonymous_struct_prefix (struct die_info *die, struct dwarf2_cu *cu)
   if (base == NULL || base == DW_STRING (attr) || base[-1] != ':')
     return "";
 
-  return obstack_copy0 (&cu->objfile->per_bfd->storage_obstack,
-                       DW_STRING (attr), &base[-1] - DW_STRING (attr));
+  return (char *) obstack_copy0 (&cu->objfile->per_bfd->storage_obstack,
+                                DW_STRING (attr),
+                                &base[-1] - DW_STRING (attr));
 }
 
 /* Return the name of the namespace/class that DIE is defined within,
@@ -19448,7 +19455,8 @@ typename_concat (struct obstack *obs, const char *prefix, const char *suffix,
   if (obs == NULL)
     {
       char *retval
-       = xmalloc (strlen (prefix) + MAX_SEP_LEN + strlen (suffix) + 1);
+       = ((char *)
+          xmalloc (strlen (prefix) + MAX_SEP_LEN + strlen (suffix) + 1));
 
       strcpy (retval, lead);
       strcat (retval, prefix);
@@ -19484,7 +19492,8 @@ dwarf2_canonicalize_name (const char *name, struct dwarf2_cu *cu,
       if (canon_name != NULL)
        {
          if (strcmp (canon_name, name) != 0)
-           name = obstack_copy0 (obstack, canon_name, strlen (canon_name));
+           name = (const char *) obstack_copy0 (obstack, canon_name,
+                                                strlen (canon_name));
          xfree (canon_name);
        }
     }
@@ -19593,8 +19602,9 @@ dwarf2_name (struct die_info *die, struct dwarf2_cu *cu)
 
              /* FIXME: we already did this for the partial symbol... */
              DW_STRING (attr)
-               = obstack_copy0 (&cu->objfile->per_bfd->storage_obstack,
-                                demangled, strlen (demangled));
+               = ((const char *)
+                  obstack_copy0 (&cu->objfile->per_bfd->storage_obstack,
+                                 demangled, strlen (demangled)));
              DW_STRING_IS_CANONICAL (attr) = 1;
              xfree (demangled);
 
@@ -20122,7 +20132,7 @@ write_constant_as_bytes (struct obstack *obstack,
   gdb_byte *result;
 
   *len = TYPE_LENGTH (type);
-  result = obstack_alloc (obstack, *len);
+  result = (gdb_byte *) obstack_alloc (obstack, *len);
   store_unsigned_integer (result, *len, byte_order, value);
 
   return result;
@@ -20181,7 +20191,7 @@ dwarf2_fetch_constant_bytes (sect_offset offset,
        gdb_byte *tem;
 
        *len = cu->header.addr_size;
-       tem = obstack_alloc (obstack, *len);
+       tem = (gdb_byte *) obstack_alloc (obstack, *len);
        store_unsigned_integer (tem, *len, byte_order, DW_ADDR (attr));
        result = tem;
       }
@@ -20911,7 +20921,7 @@ macro_start_file (int file, int line,
 static char *
 copy_string (const char *buf, int len)
 {
-  char *s = xmalloc (len + 1);
+  char *s = (char *) xmalloc (len + 1);
 
   memcpy (s, buf, len);
   s[len] = '\0';
@@ -21022,7 +21032,7 @@ parse_macro_definition (struct macro_source_file *file, int line,
               if (argc >= argv_size)
                 {
                   argv_size *= 2;
-                  argv = xrealloc (argv, argv_size * sizeof (*argv));
+                  argv = XRESIZEVEC (char *, argv, argv_size);
                 }
 
               argv[argc++] = copy_string (arg_start, p - arg_start);
index fa900a09b76c7a2db2a154df743b8831de6a0048..a018cdd2a9ec762e6d48dbb181945fc5165fb241 100644 (file)
@@ -89,7 +89,7 @@ elf_symfile_segments (bfd *abfd)
   if (phdrs_size == -1)
     return NULL;
 
-  phdrs = alloca (phdrs_size);
+  phdrs = (Elf_Internal_Phdr *) alloca (phdrs_size);
   num_phdrs = bfd_get_elf_phdrs (abfd, phdrs);
   if (num_phdrs == -1)
     return NULL;
@@ -603,7 +603,7 @@ elf_rel_plt_read (struct objfile *objfile, asymbol **dyn_symbol_table)
       if (string_buffer_size < name_len + got_suffix_len + 1)
        {
          string_buffer_size = 2 * (name_len + got_suffix_len);
-         string_buffer = xrealloc (string_buffer, string_buffer_size);
+         string_buffer = (char *) xrealloc (string_buffer, string_buffer_size);
        }
       memcpy (string_buffer, name, name_len);
       memcpy (&string_buffer[name_len], SYMBOL_GOT_PLT_SUFFIX,
@@ -702,7 +702,8 @@ elf_gnu_ifunc_record_cache (const char *name, CORE_ADDR addr)
   obstack_grow (&objfile->objfile_obstack, &entry_local,
                offsetof (struct elf_gnu_ifunc_cache, name));
   obstack_grow_str0 (&objfile->objfile_obstack, name);
-  entry_p = obstack_finish (&objfile->objfile_obstack);
+  entry_p
+    = (struct elf_gnu_ifunc_cache *) obstack_finish (&objfile->objfile_obstack);
 
   slot = htab_find_slot (htab, entry_p, INSERT);
   if (*slot != NULL)
@@ -750,7 +751,8 @@ elf_gnu_ifunc_resolve_by_cache (const char *name, CORE_ADDR *addr_p)
       if (htab == NULL)
        continue;
 
-      entry_p = alloca (sizeof (*entry_p) + strlen (name));
+      entry_p = ((struct elf_gnu_ifunc_cache *)
+                alloca (sizeof (*entry_p) + strlen (name)));
       strcpy (entry_p->name, name);
 
       slot = htab_find_slot (htab, entry_p, NO_INSERT);
@@ -782,7 +784,7 @@ elf_gnu_ifunc_resolve_by_got (const char *name, CORE_ADDR *addr_p)
   struct objfile *objfile;
   const size_t got_suffix_len = strlen (SYMBOL_GOT_PLT_SUFFIX);
 
-  name_got_plt = alloca (strlen (name) + got_suffix_len + 1);
+  name_got_plt = (char *) alloca (strlen (name) + got_suffix_len + 1);
   sprintf (name_got_plt, "%s" SYMBOL_GOT_PLT_SUFFIX, name);
 
   ALL_PSPACE_OBJFILES (current_program_space, objfile)
@@ -793,7 +795,7 @@ elf_gnu_ifunc_resolve_by_got (const char *name, CORE_ADDR *addr_p)
       size_t ptr_size = TYPE_LENGTH (ptr_type);
       CORE_ADDR pointer_address, addr;
       asection *plt;
-      gdb_byte *buf = alloca (ptr_size);
+      gdb_byte *buf = (gdb_byte *) alloca (ptr_size);
       struct bound_minimal_symbol msym;
 
       msym = lookup_minimal_symbol (name_got_plt, NULL, objfile);
@@ -1058,7 +1060,7 @@ elf_read_minimal_symbols (struct objfile *objfile, int symfile_flags,
       /* Memory gets permanently referenced from ABFD after
         bfd_canonicalize_symtab so it must not get freed before ABFD gets.  */
 
-      symbol_table = bfd_alloc (abfd, storage_needed);
+      symbol_table = (asymbol **) bfd_alloc (abfd, storage_needed);
       symcount = bfd_canonicalize_symtab (objfile->obfd, symbol_table);
 
       if (symcount < 0)
@@ -1082,7 +1084,7 @@ elf_read_minimal_symbols (struct objfile *objfile, int symfile_flags,
         done by _bfd_elf_get_synthetic_symtab which is all a bfd
         implementation detail, though.  */
 
-      dyn_symbol_table = bfd_alloc (abfd, storage_needed);
+      dyn_symbol_table = (asymbol **) bfd_alloc (abfd, storage_needed);
       dynsymcount = bfd_canonicalize_dynamic_symtab (objfile->obfd,
                                                     dyn_symbol_table);
 
index 84650ca471787a334c71710da8ae915ee81b19bf..3f98c059590c1fbc07b2301e2e55d9463a4c257a 100644 (file)
@@ -397,7 +397,7 @@ top_level_prompt (void)
     }
 
   prompt_length = strlen (prefix) + strlen (prompt) + strlen (suffix);
-  composed_prompt = xmalloc (prompt_length + 1);
+  composed_prompt = (char *) xmalloc (prompt_length + 1);
 
   strcpy (composed_prompt, prefix);
   strcat (composed_prompt, prompt);
@@ -681,7 +681,8 @@ command_line_handler (char *rl)
     {
       if (linelength > saved_command_line_size)
        {
-         saved_command_line = xrealloc (saved_command_line, linelength);
+         saved_command_line
+           = (char *) xrealloc (saved_command_line, linelength);
          saved_command_line_size = linelength;
        }
       strcpy (saved_command_line, linebuffer);
index 8ddb3df01d67737ae996c6b688e42cfabc4ea2c6..3089bb4f42a8bcdf5dd695d522e8f2e42a2a4796 100644 (file)
@@ -453,8 +453,8 @@ resize_section_table (struct target_section_table *table, int adjustment)
 
   if (new_count)
     {
-      table->sections = xrealloc (table->sections,
-                                 sizeof (struct target_section) * new_count);
+      table->sections = XRESIZEVEC (struct target_section, table->sections,
+                                   new_count);
       table->sections_end = table->sections + new_count;
     }
   else
index b098c4b879935b78f3d89ec2c4cee79247c46a0d..41de19003826a8af66ea890f0082aeeaf0f517c4 100644 (file)
@@ -240,7 +240,7 @@ print_subexp_standard (struct expression *exp, int *pos,
          {
            char *s, *nextS;
 
-           s = alloca (strlen (selector) + 1);
+           s = (char *) alloca (strlen (selector) + 1);
            strcpy (s, selector);
            for (tem = 0; tem < nargs; tem++)
              {
@@ -280,7 +280,7 @@ print_subexp_standard (struct expression *exp, int *pos,
             a simple string, revert back to array printing.  Note that
             the last expression element is an explicit null terminator
             byte, which doesn't get printed.  */
-         tempstr = alloca (nargs);
+         tempstr = (char *) alloca (nargs);
          pc += 4;
          while (tem < nargs)
            {
index 9609cd8f8e4f73e81f3f313c88db5e7e31673c94..32310227c718a999170c06fdd894cedd3c3db012 100644 (file)
@@ -68,7 +68,7 @@ fbsd_collect_regset_section_cb (const char *sect_name, int size,
 
   gdb_assert (regset->collect_regset);
 
-  buf = xmalloc (size);
+  buf = (char *) xmalloc (size);
   regset->collect_regset (regset, data->regcache, -1, buf, size);
 
   /* PRSTATUS still needs to be treated specially.  */
index 99cecb33348cd0a78d1c18fff894750c12e0fe6c..f3e2305ccdc3516e21633ce9b83e8d60bc7128b0 100644 (file)
@@ -75,7 +75,7 @@ parse_find_args (char *args, ULONGEST *max_countp,
   if (args == NULL)
     error (_("Missing search parameters."));
 
-  pattern_buf = xmalloc (pattern_buf_size);
+  pattern_buf = (gdb_byte *) xmalloc (pattern_buf_size);
   pattern_buf_end = pattern_buf;
   old_cleanups = make_cleanup (free_current_contents, &pattern_buf);
 
@@ -184,7 +184,7 @@ parse_find_args (char *args, ULONGEST *max_countp,
          size_t current_offset = pattern_buf_end - pattern_buf;
 
          pattern_buf_size = pattern_buf_size_need * 2;
-         pattern_buf = xrealloc (pattern_buf, pattern_buf_size);
+         pattern_buf = (gdb_byte *) xrealloc (pattern_buf, pattern_buf_size);
          pattern_buf_end = pattern_buf + current_offset;
        }
 
index 11325cfed14445e29024114aaf2d74f77e6c5c70..0f46e53cd38a4e973f4199e161730a26f4063d1b 100644 (file)
@@ -939,7 +939,7 @@ address_from_register (int regnum, struct frame_info *frame)
      pointer types.  Avoid constructing a value object in those cases.  */
   if (gdbarch_convert_register_p (gdbarch, regnum, type))
     {
-      gdb_byte *buf = alloca (TYPE_LENGTH (type));
+      gdb_byte *buf = (gdb_byte *) alloca (TYPE_LENGTH (type));
       int optim, unavail, ok;
 
       ok = gdbarch_register_to_value (gdbarch, frame, regnum, type,
index 745e0072e215995335f840366b221682a70a9001..8b804cd98ce2ee87fd2e11a3824d601619f82606 100644 (file)
@@ -1985,7 +1985,7 @@ get_prev_frame_always (struct frame_info *this_frame)
                 pointer to the frame, this allows the STOP_STRING on the
                 frame to be of type 'const char *'.  */
              size = strlen (ex.message) + 1;
-             stop_string = frame_obstack_zalloc (size);
+             stop_string = (char *) frame_obstack_zalloc (size);
              memcpy (stop_string, ex.message, size);
              this_frame->stop_string = stop_string;
            }
index 64712da479f458c60774835decdff2cc725436b0..af5560df173c8a38be17990e3f2da4d3eb954315 100644 (file)
@@ -523,7 +523,8 @@ gdb_bfd_ref (struct bfd *abfd)
   /* Ask BFD to decompress sections in bfd_get_full_section_contents.  */
   abfd->flags |= BFD_DECOMPRESS;
 
-  gdata = bfd_zalloc (abfd, sizeof (struct gdb_bfd_data));
+  gdata
+    = (struct gdb_bfd_data *) bfd_zalloc (abfd, sizeof (struct gdb_bfd_data));
   gdata->refc = 1;
   gdata->mtime = bfd_get_mtime (abfd);
   gdata->size = bfd_get_size (abfd);
@@ -630,7 +631,8 @@ get_section_descriptor (asection *section)
 
   if (result == NULL)
     {
-      result = bfd_zalloc (section->owner, sizeof (*result));
+      result = ((struct gdb_bfd_section_data *)
+               bfd_zalloc (section->owner, sizeof (*result)));
       bfd_set_section_userdata (section->owner, section, result);
     }
 
index d8d03df06034f8436160a059c8bc6b92cdabe1a0..5545242f2b312986fd3932e7701eb9e2774e0030 100644 (file)
@@ -43,7 +43,7 @@ obconcat (struct obstack *obstackp, ...)
   va_end (ap);
   obstack_1grow (obstackp, 0);
 
-  return obstack_finish (obstackp);
+  return (char *) obstack_finish (obstackp);
 }
 
 /* See gdb_obstack.h.  */
@@ -51,7 +51,7 @@ obconcat (struct obstack *obstackp, ...)
 char *
 obstack_strdup (struct obstack *obstackp, const char *string)
 {
-  char *obstring = obstack_alloc (obstackp, strlen (string) + 1);
+  char *obstring = (char *) obstack_alloc (obstackp, strlen (string) + 1);
   strcpy (obstring, string);
   return obstring;
 }
index d09c454b0224d9fdd812a5ca65301f81467b1fe7..d6ce174113ee161545e6c4a0d82dbbc1fdc96e4a 100644 (file)
@@ -1,3 +1,51 @@
+2015-09-25  Simon Marchi  <simon.marchi@ericsson.com>
+
+       * 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.
+
 2015-09-21  Pierre Langlois  <pierre.langlois@arm.com>
 
        * linux-aarch64-low-.c: Include ax.h and tracepoint.h.
index 3d0d93d152d403c87b8a49933bb767666749bb13..4c9dadc4440fdb37a201b50a09058f4b3521c749 100644 (file)
@@ -106,7 +106,7 @@ gdb_parse_agent_expr (char **actparm)
   ++act;  /* skip a comma */
   aexpr = XNEW (struct agent_expr);
   aexpr->length = xlen;
-  aexpr->bytes = xmalloc (xlen);
+  aexpr->bytes = (unsigned char *) xmalloc (xlen);
   hex2bin (act, aexpr->bytes, xlen);
   *actparm = act + (xlen * 2);
   return aexpr;
@@ -131,7 +131,7 @@ gdb_unparse_agent_expr (struct agent_expr *aexpr)
 {
   char *rslt;
 
-  rslt = xmalloc (2 * aexpr->length + 1);
+  rslt = (char *) xmalloc (2 * aexpr->length + 1);
   bin2hex (aexpr->bytes, rslt, aexpr->length);
   return rslt;
 }
index a631d9e771c04d8be23d4fa8b5f685edd0618e7d..48fa6f3753d821bb9eb4fb92fca1f4f2b481c9a7 100644 (file)
@@ -126,7 +126,7 @@ require_data (char *p, int p_len, char **data, int *data_len)
 {
   int input_index, output_index, escaped;
 
-  *data = xmalloc (p_len);
+  *data = (char *) xmalloc (p_len);
 
   output_index = 0;
   escaped = 0;
@@ -371,7 +371,7 @@ handle_pread (char *own_buf, int *new_packet_len)
   if (len > max_reply_size)
     len = max_reply_size;
 
-  data = xmalloc (len);
+  data = (char *) xmalloc (len);
 #ifdef HAVE_PREAD
   ret = pread (fd, data, len, offset);
 #else
index f5b64ab254aba278fa3a184a14c8647b3d5d3bd3..12a2332ae6a2c6789bf1132c9f037bba4dc10a62 100644 (file)
@@ -4896,7 +4896,7 @@ disable_regset (struct regsets_info *info, struct regset_info *regset)
 
   dr_offset = regset - info->regsets;
   if (info->disabled_regsets == NULL)
-    info->disabled_regsets = xcalloc (1, info->num_regsets);
+    info->disabled_regsets = (char *) xcalloc (1, info->num_regsets);
   info->disabled_regsets[dr_offset] = 1;
 }
 
@@ -5119,7 +5119,7 @@ fetch_register (const struct usrregs_info *usrregs,
   size = ((register_size (regcache->tdesc, regno)
           + sizeof (PTRACE_XFER_TYPE) - 1)
          & -sizeof (PTRACE_XFER_TYPE));
-  buf = alloca (size);
+  buf = (char *) alloca (size);
 
   pid = lwpid_of (current_thread);
   for (i = 0; i < size; i += sizeof (PTRACE_XFER_TYPE))
@@ -5163,7 +5163,7 @@ store_register (const struct usrregs_info *usrregs,
   size = ((register_size (regcache->tdesc, regno)
           + sizeof (PTRACE_XFER_TYPE) - 1)
          & -sizeof (PTRACE_XFER_TYPE));
-  buf = alloca (size);
+  buf = (char *) alloca (size);
   memset (buf, 0, size);
 
   if (the_low_target.collect_ptrace_register)
@@ -6324,7 +6324,7 @@ get_dynamic (const int pid, const int is_elf64)
     return 0;
 
   gdb_assert (num_phdr < 100);  /* Basic sanity check.  */
-  phdr_buf = alloca (num_phdr * phdr_size);
+  phdr_buf = (unsigned char *) alloca (num_phdr * phdr_size);
 
   if (linux_read_memory (phdr_memaddr, phdr_buf, num_phdr * phdr_size))
     return 0;
@@ -6653,7 +6653,7 @@ linux_qxfer_libraries_svr4 (const char *annex, unsigned char *readbuf,
        }
     }
 
-  document = xmalloc (allocated);
+  document = (char *) xmalloc (allocated);
   strcpy (document, "<library-list-svr4 version=\"1.0\"");
   p = document + strlen (document);
 
@@ -6714,7 +6714,7 @@ linux_qxfer_libraries_svr4 (const char *annex, unsigned char *readbuf,
                  /* Expand to guarantee sufficient storage.  */
                  uintptr_t document_len = p - document;
 
-                 document = xrealloc (document, 2 * allocated);
+                 document = (char *) xrealloc (document, 2 * allocated);
                  allocated *= 2;
                  p = document + document_len;
                }
index 93567413867416a818411ea55c93677eaf259140..f077497b77eebd788df7fec7ca4d88e73aa8fe51 100644 (file)
@@ -527,7 +527,7 @@ delete_fast_tracepoint_jump (struct fast_tracepoint_jump *todel)
                 pass the current shadow contents, because
                 write_inferior_memory updates any shadow memory with
                 what we pass here, and we want that to be a nop.  */
-             buf = alloca (bp->length);
+             buf = (unsigned char *) alloca (bp->length);
              memcpy (buf, fast_tracepoint_jump_shadow (bp), bp->length);
              ret = write_inferior_memory (bp->pc, buf, bp->length);
              if (ret != 0)
@@ -585,12 +585,12 @@ set_fast_tracepoint_jump (CORE_ADDR where,
   /* We don't, so create a new object.  Double the length, because the
      flexible array member holds both the jump insn, and the
      shadow.  */
-  jp = xcalloc (1, sizeof (*jp) + (length * 2));
+  jp = (struct fast_tracepoint_jump *) xcalloc (1, sizeof (*jp) + (length * 2));
   jp->pc = where;
   jp->length = length;
   memcpy (fast_tracepoint_jump_insn (jp), insn, length);
   jp->refcount = 1;
-  buf = alloca (length);
+  buf = (unsigned char *) alloca (length);
 
   /* Note that there can be trap breakpoints inserted in the same
      address range.  To access the original memory contents, we use
@@ -670,7 +670,7 @@ uninsert_fast_tracepoint_jumps_at (CORE_ADDR pc)
         pass the current shadow contents, because
         write_inferior_memory updates any shadow memory with what we
         pass here, and we want that to be a nop.  */
-      buf = alloca (jp->length);
+      buf = (unsigned char *) alloca (jp->length);
       memcpy (buf, fast_tracepoint_jump_shadow (jp), jp->length);
       err = write_inferior_memory (jp->pc, buf, jp->length);
       if (err != 0)
@@ -717,7 +717,7 @@ reinsert_fast_tracepoint_jumps_at (CORE_ADDR where)
      to pass the current shadow contents, because
      write_inferior_memory updates any shadow memory with what we pass
      here, and we want that to be a nop.  */
-  buf = alloca (jp->length);
+  buf = (unsigned char *) alloca (jp->length);
   memcpy (buf, fast_tracepoint_jump_shadow (jp), jp->length);
   err = write_inferior_memory (where, buf, jp->length);
   if (err != 0)
@@ -1669,7 +1669,7 @@ validate_inserted_breakpoint (struct raw_breakpoint *bp)
   gdb_assert (bp->inserted);
   gdb_assert (bp->raw_type == raw_bkpt_type_sw);
 
-  buf = alloca (breakpoint_len);
+  buf = (unsigned char *) alloca (breakpoint_len);
   err = (*the_target->read_memory) (bp->pc, buf, breakpoint_len);
   if (err || memcmp (buf, breakpoint_data, breakpoint_len) != 0)
     {
@@ -1939,7 +1939,7 @@ clone_agent_expr (const struct agent_expr *src_ax)
 
   ax = XCNEW (struct agent_expr);
   ax->length = src_ax->length;
-  ax->bytes = xcalloc (ax->length, 1);
+  ax->bytes = (unsigned char *) xcalloc (ax->length, 1);
   memcpy (ax->bytes, src_ax->bytes, ax->length);
   return ax;
 }
index 59bdc530d8ce5cb32eef51e6eeb762ee3af36f60..f79063c4993b5c8dc298aa1084c760c82d68ff7f 100644 (file)
@@ -131,9 +131,11 @@ init_register_cache (struct regcache *regcache,
         fetches.  This way they'll read as zero instead of
         garbage.  */
       regcache->tdesc = tdesc;
-      regcache->registers = xcalloc (1, tdesc->registers_size);
+      regcache->registers
+       = (unsigned char *) xcalloc (1, tdesc->registers_size);
       regcache->registers_owned = 1;
-      regcache->register_status = xcalloc (1, tdesc->num_registers);
+      regcache->register_status
+       = (unsigned char *) xcalloc (1, tdesc->num_registers);
       gdb_assert (REG_UNAVAILABLE == 0);
 #else
       gdb_assert_not_reached ("can't allocate memory from the heap");
index 7cf66cc7d981fe7b83351a19dfbe0211b20ef545..e36609176afa336c2d8a206f322052480b0472ad 100644 (file)
@@ -622,7 +622,7 @@ putpkt_binary_1 (char *buf, int cnt, int is_notif)
   char *p;
   int cc;
 
-  buf2 = xmalloc (strlen ("$") + cnt + strlen ("#nn") + 1);
+  buf2 = (char *) xmalloc (strlen ("$") + cnt + strlen ("#nn") + 1);
 
   /* Copy the packet into buffer BUF2, encapsulating it
      and giving it a checksum.  */
@@ -1325,7 +1325,7 @@ decode_M_packet (char *from, CORE_ADDR *mem_addr_ptr, unsigned int *len_ptr,
     }
 
   if (*to_p == NULL)
-    *to_p = xmalloc (*len_ptr);
+    *to_p = (unsigned char *) xmalloc (*len_ptr);
 
   hex2bin (&from[i++], *to_p, *len_ptr);
 }
@@ -1351,7 +1351,7 @@ decode_X_packet (char *from, int packet_len, CORE_ADDR *mem_addr_ptr,
     }
 
   if (*to_p == NULL)
-    *to_p = xmalloc (*len_ptr);
+    *to_p = (unsigned char *) xmalloc (*len_ptr);
 
   if (remote_unescape_input ((const gdb_byte *) &from[i], packet_len - i,
                             *to_p, *len_ptr) != *len_ptr)
@@ -1478,7 +1478,7 @@ look_up_one_symbol (const char *name, CORE_ADDR *addrp, int may_ask_gdb)
       unsigned int mem_len;
 
       decode_m_packet (&own_buf[1], &mem_addr, &mem_len);
-      mem_buf = xmalloc (mem_len);
+      mem_buf = (unsigned char *) xmalloc (mem_len);
       if (read_inferior_memory (mem_addr, mem_buf, mem_len) == 0)
        bin2hex (mem_buf, own_buf, mem_len);
       else
@@ -1562,7 +1562,7 @@ relocate_instruction (CORE_ADDR *to, CORE_ADDR oldloc)
       if (own_buf[0] == 'm')
        {
          decode_m_packet (&own_buf[1], &mem_addr, &mem_len);
-         mem_buf = xmalloc (mem_len);
+         mem_buf = (unsigned char *) xmalloc (mem_len);
          if (read_inferior_memory (mem_addr, mem_buf, mem_len) == 0)
            bin2hex (mem_buf, own_buf, mem_len);
          else
@@ -1617,7 +1617,7 @@ void
 monitor_output (const char *msg)
 {
   int len = strlen (msg);
-  char *buf = xmalloc (len * 2 + 2);
+  char *buf = (char *) xmalloc (len * 2 + 2);
 
   buf[0] = 'O';
   bin2hex ((const gdb_byte *) msg, buf + 1, len);
index 827316f3741117ad9ece35df3d63635f5344339c..53763e50ced5b6ac8f34478f67c20e80d75b709c 100644 (file)
@@ -959,7 +959,7 @@ handle_search_memory (char *own_buf, int packet_len)
   CORE_ADDR found_addr;
   int cmd_name_len = sizeof ("qSearch:memory:") - 1;
 
-  pattern = malloc (packet_len);
+  pattern = (gdb_byte *) malloc (packet_len);
   if (pattern == NULL)
     {
       error ("Unable to allocate memory to perform the search");
@@ -983,7 +983,7 @@ handle_search_memory (char *own_buf, int packet_len)
   if (search_space_len < search_buf_size)
     search_buf_size = search_space_len;
 
-  search_buf = malloc (search_buf_size);
+  search_buf = (gdb_byte *) malloc (search_buf_size);
   if (search_buf == NULL)
     {
       free (pattern);
@@ -1211,7 +1211,7 @@ handle_qxfer_exec_file (const char *const_annex,
     }
   else
     {
-      char *annex = alloca (strlen (const_annex) + 1);
+      char *annex = (char *) alloca (strlen (const_annex) + 1);
 
       strcpy (annex, const_annex);
       annex = unpack_varlen_hex (annex, &pid);
@@ -1334,7 +1334,7 @@ handle_qxfer_libraries (const char *annex,
   for_each_inferior_with_data (&all_dlls, accumulate_file_name_length,
                               &total_len);
 
-  document = malloc (total_len);
+  document = (char *) malloc (total_len);
   if (document == NULL)
     return -1;
 
@@ -1795,7 +1795,7 @@ handle_qxfer (char *own_buf, int packet_len, int *new_packet_len_p)
                 more.  */
              if (len > PBUFSIZ - 2)
                len = PBUFSIZ - 2;
-             data = malloc (len + 1);
+             data = (unsigned char *) malloc (len + 1);
              if (data == NULL)
                {
                  write_enn (own_buf);
@@ -1829,7 +1829,7 @@ handle_qxfer (char *own_buf, int packet_len, int *new_packet_len_p)
              unsigned char *data;
 
              strcpy (own_buf, "E00");
-             data = malloc (packet_len - (offset - own_buf));
+             data = (unsigned char *) malloc (packet_len - (offset - own_buf));
              if (data == NULL)
                {
                  write_enn (own_buf);
@@ -2071,7 +2071,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
               p = strtok (NULL, ";"))
            {
              count++;
-             qsupported = xrealloc (qsupported, count * sizeof (char *));
+             qsupported = XRESIZEVEC (char *, qsupported, count);
              qsupported[count - 1] = xstrdup (p);
            }
 
@@ -2334,7 +2334,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
   /* Handle "monitor" commands.  */
   if (startswith (own_buf, "qRcmd,"))
     {
-      char *mon = malloc (PBUFSIZ);
+      char *mon = (char *) malloc (PBUFSIZ);
       int len = strlen (own_buf + 6);
 
       if (mon == NULL)
@@ -2523,7 +2523,7 @@ handle_v_cont (char *own_buf)
       p = strchr (p, ';');
     }
 
-  resume_info = malloc (n * sizeof (resume_info[0]));
+  resume_info = (struct thread_resume *) malloc (n * sizeof (resume_info[0]));
   if (resume_info == NULL)
     goto err;
 
@@ -2718,7 +2718,7 @@ handle_v_run (char *own_buf)
       new_argc++;
     }
 
-  new_argv = calloc (new_argc + 2, sizeof (char *));
+  new_argv = (char **) calloc (new_argc + 2, sizeof (char *));
   if (new_argv == NULL)
     {
       write_enn (own_buf);
@@ -2737,7 +2737,7 @@ handle_v_run (char *own_buf)
       else
        {
          /* FIXME: Fail request if out of memory instead of dying.  */
-         new_argv[i] = xmalloc (1 + (next_p - p) / 2);
+         new_argv[i] = (char *) xmalloc (1 + (next_p - p) / 2);
          hex2bin (p, (gdb_byte *) new_argv[i], (next_p - p) / 2);
          new_argv[i][(next_p - p) / 2] = '\0';
        }
@@ -3524,15 +3524,15 @@ captured_main (int argc, char *argv[])
     initialize_tracepoint ();
   initialize_notif ();
 
-  own_buf = xmalloc (PBUFSIZ + 1);
-  mem_buf = xmalloc (PBUFSIZ);
+  own_buf = (char *) xmalloc (PBUFSIZ + 1);
+  mem_buf = (unsigned char *) xmalloc (PBUFSIZ);
 
   if (pid == 0 && *next_arg != NULL)
     {
       int i, n;
 
       n = argc - (next_arg - argv);
-      program_argv = xmalloc (sizeof (char *) * (n + 1));
+      program_argv = XNEWVEC (char *, n + 1);
       for (i = 0; i < n; i++)
        program_argv[i] = xstrdup (next_arg[i]);
       program_argv[i] = NULL;
index 17ff7a67cae3c07b80f3620ff9e635af72540034..301f90eb24710a588d60ea7efbd87fb9746da3c9 100644 (file)
@@ -75,7 +75,7 @@ write_inferior_memory (CORE_ADDR memaddr, const unsigned char *myaddr,
   if (buffer != NULL)
     free (buffer);
 
-  buffer = xmalloc (len);
+  buffer = (unsigned char *) xmalloc (len);
   memcpy (buffer, myaddr, len);
   check_mem_write (memaddr, buffer, myaddr, len);
   res = (*the_target->write_memory) (memaddr, buffer, len);
index cd07c52d197a82d04442c13cc04b1aeb16aacf76..f5fdf10ef3f09852b6af87f2f9ceb5b809ff4a95 100644 (file)
@@ -749,7 +749,7 @@ try_thread_db_load_from_dir (const char *dir, size_t dir_len)
 
   if (dir_len + 1 + strlen (LIBTHREAD_DB_SO) + 1 > sizeof (path))
     {
-      char *cp = xmalloc (dir_len + 1);
+      char *cp = (char *) xmalloc (dir_len + 1);
 
       memcpy (cp, dir, dir_len);
       cp[dir_len] = '\0';
index 6b50f266f39733049b8d8c60168f5a65e31487e7..1b3a5d033b8ef8a5a8bb5a66b6fbef914d6466a5 100644 (file)
@@ -1497,7 +1497,7 @@ init_trace_buffer (LONGEST bufsize)
      marker.  */
   alloc_size = (bufsize < TRACEFRAME_EOB_MARKER_SIZE
                ? TRACEFRAME_EOB_MARKER_SIZE : bufsize);
-  trace_buffer_lo = xrealloc (trace_buffer_lo, alloc_size);
+  trace_buffer_lo = (unsigned char *) xrealloc (trace_buffer_lo, alloc_size);
 
   trace_buffer_hi = trace_buffer_lo + trace_buffer_size;
 
@@ -2024,13 +2024,11 @@ add_tracepoint_action (struct tracepoint *tpoint, char *packet)
          tpoint->num_step_actions++;
 
          tpoint->step_actions
-           = xrealloc (tpoint->step_actions,
-                       (sizeof (*tpoint->step_actions)
-                        * tpoint->num_step_actions));
+           = XRESIZEVEC (struct tracepoint_action *, tpoint->step_actions,
+                         tpoint->num_step_actions);
          tpoint->step_actions_str
-           = xrealloc (tpoint->step_actions_str,
-                       (sizeof (*tpoint->step_actions_str)
-                        * tpoint->num_step_actions));
+           = XRESIZEVEC (char *, tpoint->step_actions_str,
+                         tpoint->num_step_actions);
          tpoint->step_actions[tpoint->num_step_actions - 1] = action;
          tpoint->step_actions_str[tpoint->num_step_actions - 1]
            = savestring (act_start, act - act_start);
@@ -2039,11 +2037,10 @@ add_tracepoint_action (struct tracepoint *tpoint, char *packet)
        {
          tpoint->numactions++;
          tpoint->actions
-           = xrealloc (tpoint->actions,
-                       sizeof (*tpoint->actions) * tpoint->numactions);
+           = XRESIZEVEC (struct tracepoint_action *, tpoint->actions,
+                         tpoint->numactions);
          tpoint->actions_str
-           = xrealloc (tpoint->actions_str,
-                       sizeof (*tpoint->actions_str) * tpoint->numactions);
+           = XRESIZEVEC (char *, tpoint->actions_str, tpoint->numactions);
          tpoint->actions[tpoint->numactions - 1] = action;
          tpoint->actions_str[tpoint->numactions - 1]
            = savestring (act_start, act - act_start);
@@ -2201,7 +2198,8 @@ add_traceframe (struct tracepoint *tpoint)
 {
   struct traceframe *tframe;
 
-  tframe = trace_buffer_alloc (sizeof (struct traceframe));
+  tframe
+    = (struct traceframe *) trace_buffer_alloc (sizeof (struct traceframe));
 
   if (tframe == NULL)
     return NULL;
@@ -2223,7 +2221,7 @@ add_traceframe_block (struct traceframe *tframe,
   if (!tframe)
     return NULL;
 
-  block = trace_buffer_alloc (amt);
+  block = (unsigned char *) trace_buffer_alloc (amt);
 
   if (!block)
     return NULL;
@@ -2685,7 +2683,7 @@ cmd_qtdpsrc (char *own_buf)
 
   saved = packet;
   packet = strchr (packet, ':');
-  srctype = xmalloc (packet - saved + 1);
+  srctype = (char *) xmalloc (packet - saved + 1);
   memcpy (srctype, saved, packet - saved);
   srctype[packet - saved] = '\0';
   ++packet;
@@ -2693,7 +2691,7 @@ cmd_qtdpsrc (char *own_buf)
   ++packet; /* skip a colon */
   packet = unpack_varlen_hex (packet, &slen);
   ++packet; /* skip a colon */
-  src = xmalloc (slen + 1);
+  src = (char *) xmalloc (slen + 1);
   nbytes = hex2bin (packet, (gdb_byte *) src, strlen (packet) / 2);
   src[nbytes] = '\0';
 
@@ -2735,7 +2733,7 @@ cmd_qtdv (char *own_buf)
   ++packet; /* skip a colon */
 
   nbytes = strlen (packet) / 2;
-  varname = xmalloc (nbytes + 1);
+  varname = (char *) xmalloc (nbytes + 1);
   nbytes = hex2bin (packet, (gdb_byte *) varname, nbytes);
   varname[nbytes] = '\0';
 
@@ -3659,7 +3657,8 @@ cmd_qtstatus (char *packet)
 
       result_name = stop_reason_rsp + strlen ("terror:");
       hexstr_len = strlen (result_name) * 2;
-      p = stop_reason_rsp = alloca (strlen ("terror:") + hexstr_len + 1);
+      p = stop_reason_rsp
+       = (char *) alloca (strlen ("terror:") + hexstr_len + 1);
       strcpy (p, "terror:");
       p += strlen (p);
       bin2hex ((gdb_byte *) result_name, p, strlen (result_name));
@@ -3668,7 +3667,7 @@ cmd_qtstatus (char *packet)
   /* If this was a forced stop, include any stop note that was supplied.  */
   if (strcmp (stop_reason_rsp, "tstop") == 0)
     {
-      stop_reason_rsp = alloca (strlen ("tstop:") + strlen (buf3) + 1);
+      stop_reason_rsp = (char *) alloca (strlen ("tstop:") + strlen (buf3) + 1);
       strcpy (stop_reason_rsp, "tstop:");
       strcat (stop_reason_rsp, buf3);
     }
@@ -3780,7 +3779,7 @@ response_source (char *packet,
   int len;
 
   len = strlen (src->str);
-  buf = alloca (len * 2 + 1);
+  buf = (char *) alloca (len * 2 + 1);
   bin2hex ((gdb_byte *) src->str, buf, len);
 
   sprintf (packet, "Z%x:%s:%s:%x:%x:%s",
@@ -3869,7 +3868,7 @@ response_tsv (char *packet, struct trace_state_variable *tsv)
   if (tsv->name)
     {
       namelen = strlen (tsv->name);
-      buf = alloca (namelen * 2 + 1);
+      buf = (char *) alloca (namelen * 2 + 1);
       bin2hex ((gdb_byte *) tsv->name, buf, namelen);
     }
 
@@ -4110,7 +4109,7 @@ cmd_qtnotes (char *own_buf)
          saved = packet;
          packet = strchr (packet, ';');
          nbytes = (packet - saved) / 2;
-         user = xmalloc (nbytes + 1);
+         user = (char *) xmalloc (nbytes + 1);
          nbytes = hex2bin (saved, (gdb_byte *) user, nbytes);
          user[nbytes] = '\0';
          ++packet; /* skip the semicolon */
@@ -4124,7 +4123,7 @@ cmd_qtnotes (char *own_buf)
          saved = packet;
          packet = strchr (packet, ';');
          nbytes = (packet - saved) / 2;
-         notes = xmalloc (nbytes + 1);
+         notes = (char *) xmalloc (nbytes + 1);
          nbytes = hex2bin (saved, (gdb_byte *) notes, nbytes);
          notes[nbytes] = '\0';
          ++packet; /* skip the semicolon */
@@ -4138,7 +4137,7 @@ cmd_qtnotes (char *own_buf)
          saved = packet;
          packet = strchr (packet, ';');
          nbytes = (packet - saved) / 2;
-         stopnote = xmalloc (nbytes + 1);
+         stopnote = (char *) xmalloc (nbytes + 1);
          nbytes = hex2bin (saved, (gdb_byte *) stopnote, nbytes);
          stopnote[nbytes] = '\0';
          ++packet; /* skip the semicolon */
@@ -5800,7 +5799,7 @@ gdb_collect (struct tracepoint *tpoint, unsigned char *regs)
   ctx.regcache_initted = 0;
   /* Wrap the regblock in a register cache (in the stack, we don't
      want to malloc here).  */
-  ctx.regspace = alloca (ipa_tdesc->registers_size);
+  ctx.regspace = (unsigned char *) alloca (ipa_tdesc->registers_size);
   if (ctx.regspace == NULL)
     {
       trace_debug ("Trace buffer block allocation failed, skipping");
@@ -7365,7 +7364,7 @@ initialize_tracepoint (void)
     if (pagesize == -1)
       perror_with_name ("sysconf");
 
-    gdb_tp_heap_buffer = xmalloc (5 * 1024 * 1024);
+    gdb_tp_heap_buffer = (char *) xmalloc (5 * 1024 * 1024);
 
 #define SCRATCH_BUFFER_NPAGES 20
 
@@ -7373,10 +7372,12 @@ initialize_tracepoint (void)
        address (close to the main executable's code).  */
     for (addr = pagesize; addr != 0; addr += pagesize)
       {
-       gdb_jump_pad_buffer = mmap ((void *) addr, pagesize * SCRATCH_BUFFER_NPAGES,
-                                   PROT_READ | PROT_WRITE | PROT_EXEC,
-                                   MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED,
-                                   -1, 0);
+       gdb_jump_pad_buffer
+         = (char *) mmap ((void *) addr,
+                          pagesize * SCRATCH_BUFFER_NPAGES,
+                          PROT_READ | PROT_WRITE | PROT_EXEC,
+                          MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED,
+                          -1, 0);
        if (gdb_jump_pad_buffer != MAP_FAILED)
          break;
       }
@@ -7393,7 +7394,7 @@ initialize_tracepoint (void)
      buffer setup, but it can be mysterious, so create a channel to
      report back on what went wrong, using a fixed size since we may
      not be able to allocate space later when the problem occurs.  */
-  gdb_trampoline_buffer_error = xmalloc (IPA_BUFSIZ);
+  gdb_trampoline_buffer_error = (char *) xmalloc (IPA_BUFSIZ);
 
   strcpy (gdb_trampoline_buffer_error, "No errors reported");
 
index 12ff014ea698b215452e567b084eeaad1a398688..063dcf2a354e7b9ebb0616e79471034eb9e30320 100644 (file)
@@ -525,7 +525,8 @@ lookup_function_type_with_arguments (struct type *type,
     }
 
   TYPE_NFIELDS (fn) = nparams;
-  TYPE_FIELDS (fn) = TYPE_ZALLOC (fn, nparams * sizeof (struct field));
+  TYPE_FIELDS (fn)
+    = (struct field *) TYPE_ZALLOC (fn, nparams * sizeof (struct field));
   for (i = 0; i < nparams; ++i)
     TYPE_FIELD_TYPE (fn, i) = param_types[i];
 
@@ -1191,7 +1192,8 @@ create_set_type (struct type *result_type, struct type *domain_type)
 
   TYPE_CODE (result_type) = TYPE_CODE_SET;
   TYPE_NFIELDS (result_type) = 1;
-  TYPE_FIELDS (result_type) = TYPE_ZALLOC (result_type, sizeof (struct field));
+  TYPE_FIELDS (result_type)
+    = (struct field *) TYPE_ZALLOC (result_type, sizeof (struct field));
 
   if (!TYPE_STUB (domain_type))
     {
@@ -1433,7 +1435,7 @@ struct type *
 lookup_unsigned_typename (const struct language_defn *language,
                          struct gdbarch *gdbarch, const char *name)
 {
-  char *uns = alloca (strlen (name) + 10);
+  char *uns = (char *) alloca (strlen (name) + 10);
 
   strcpy (uns, "unsigned ");
   strcpy (uns + 9, name);
@@ -1445,7 +1447,7 @@ lookup_signed_typename (const struct language_defn *language,
                        struct gdbarch *gdbarch, const char *name)
 {
   struct type *t;
-  char *uns = alloca (strlen (name) + 8);
+  char *uns = (char *) alloca (strlen (name) + 8);
 
   strcpy (uns, "signed ");
   strcpy (uns + 7, name);
@@ -1969,8 +1971,9 @@ resolve_dynamic_union (struct type *type,
 
   resolved_type = copy_type (type);
   TYPE_FIELDS (resolved_type)
-    = TYPE_ALLOC (resolved_type,
-                 TYPE_NFIELDS (resolved_type) * sizeof (struct field));
+    = (struct field *) TYPE_ALLOC (resolved_type,
+                                  TYPE_NFIELDS (resolved_type)
+                                  * sizeof (struct field));
   memcpy (TYPE_FIELDS (resolved_type),
          TYPE_FIELDS (type),
          TYPE_NFIELDS (resolved_type) * sizeof (struct field));
@@ -2009,8 +2012,9 @@ resolve_dynamic_struct (struct type *type,
 
   resolved_type = copy_type (type);
   TYPE_FIELDS (resolved_type)
-    = TYPE_ALLOC (resolved_type,
-                 TYPE_NFIELDS (resolved_type) * sizeof (struct field));
+    = (struct field *) TYPE_ALLOC (resolved_type,
+                                  TYPE_NFIELDS (resolved_type)
+                                  * sizeof (struct field));
   memcpy (TYPE_FIELDS (resolved_type),
          TYPE_FIELDS (type),
          TYPE_NFIELDS (resolved_type) * sizeof (struct field));
@@ -2187,8 +2191,7 @@ add_dyn_prop (enum dynamic_prop_node_kind prop_kind, struct dynamic_prop prop,
 
   gdb_assert (TYPE_OBJFILE_OWNED (type));
 
-  temp = obstack_alloc (&objfile->objfile_obstack,
-                       sizeof (struct dynamic_prop_list));
+  temp = XOBNEW (&objfile->objfile_obstack, struct dynamic_prop_list);
   temp->prop_kind = prop_kind;
   temp->prop = prop;
   temp->next = TYPE_DYN_PROP_LIST (type);
@@ -4344,8 +4347,9 @@ copy_dynamic_prop_list (struct obstack *objfile_obstack,
     {
       struct dynamic_prop_list *node_copy;
 
-      node_copy = obstack_copy (objfile_obstack, *node_ptr,
-                               sizeof (struct dynamic_prop_list));
+      node_copy = ((struct dynamic_prop_list *)
+                  obstack_copy (objfile_obstack, *node_ptr,
+                                sizeof (struct dynamic_prop_list)));
       node_copy->prop = (*node_ptr)->prop;
       *node_ptr = node_copy;
 
@@ -4658,7 +4662,8 @@ arch_flags_type (struct gdbarch *gdbarch, char *name, int length)
   type = arch_type (gdbarch, TYPE_CODE_FLAGS, length, name);
   TYPE_UNSIGNED (type) = 1;
   TYPE_NFIELDS (type) = nfields;
-  TYPE_FIELDS (type) = TYPE_ZALLOC (type, nfields * sizeof (struct field));
+  TYPE_FIELDS (type)
+    = (struct field *) TYPE_ZALLOC (type, nfields * sizeof (struct field));
 
   return type;
 }
@@ -4711,8 +4716,8 @@ append_composite_type_field_raw (struct type *t, char *name,
   struct field *f;
 
   TYPE_NFIELDS (t) = TYPE_NFIELDS (t) + 1;
-  TYPE_FIELDS (t) = xrealloc (TYPE_FIELDS (t),
-                             sizeof (struct field) * TYPE_NFIELDS (t));
+  TYPE_FIELDS (t) = XRESIZEVEC (struct field, TYPE_FIELDS (t),
+                               TYPE_NFIELDS (t));
   f = &(TYPE_FIELDS (t)[TYPE_NFIELDS (t) - 1]);
   memset (f, 0, sizeof f[0]);
   FIELD_TYPE (f[0]) = field;
index f270855988f4b4054e10176dc955d365fa142b87..29eec9990930f7508c9c5589e673cfd643bcbc7e 100644 (file)
@@ -1210,9 +1210,9 @@ extern void allocate_gnat_aux_type (struct type *);
 
 #define INIT_FUNC_SPECIFIC(type)                                              \
   (TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_FUNC,                           \
-   TYPE_MAIN_TYPE (type)->type_specific.func_stuff                            \
-     = TYPE_ZALLOC (type,                                                     \
-                   sizeof (*TYPE_MAIN_TYPE (type)->type_specific.func_stuff)))
+   TYPE_MAIN_TYPE (type)->type_specific.func_stuff = (struct func_type *)      \
+     TYPE_ZALLOC (type,                                                               \
+                 sizeof (*TYPE_MAIN_TYPE (type)->type_specific.func_stuff)))
 
 #define TYPE_INSTANCE_FLAGS(thistype) (thistype)->instance_flags
 #define TYPE_MAIN_TYPE(thistype) (thistype)->main_type
index 3b6cc774c6f5ea69049e1402c8de9b384d8fbbb5..b4931121fa2bb6bb3adb7803dae0b6b75d4cb9f2 100644 (file)
@@ -345,7 +345,7 @@ gnuv3_rtti_type (struct value *value,
     {
       char *copy;
 
-      copy = alloca (atsign - class_name + 1);
+      copy = (char *) alloca (atsign - class_name + 1);
       memcpy (copy, class_name, atsign - class_name);
       copy[atsign - class_name] = '\0';
       class_name = copy;
index 4e017fe3dce52b6929e491431f7603993825f28d..c2ae28d6071e09beb63c339df10b082705a97a11 100644 (file)
@@ -535,7 +535,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);
                        }
 
@@ -545,10 +545,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 ($3.length + 1);
+                         p = (char *) malloc ($3.length + 1);
                          memcpy (p, $3.ptr, $3.length + 1);
 
                          $$.tokens[$$.len - 1].type = $3.type;
index b72c85758c6ab0b08b2663c4dfa7535836b1f00c..509704c8c1a3cecf4ac128d2ec63505316d29363 100644 (file)
@@ -379,7 +379,7 @@ go_demangle (const char *mangled_name, int options)
     }
   obstack_grow_str0 (&tempbuf, "");
 
-  result = xstrdup (obstack_finish (&tempbuf));
+  result = xstrdup ((const char *) obstack_finish (&tempbuf));
   obstack_free (&tempbuf, NULL);
   xfree (name_buf);
   return result;
index 2eb6dc68b1a3ac99a1865aea26780a3ca2f73b9a..109c1b035d0b448b297b287bb7d334c26d73352a 100644 (file)
@@ -241,7 +241,7 @@ compute_scheme_string (struct command_line *l)
   for (iter = l; iter; iter = iter->next)
     size += strlen (iter->line) + 1;
 
-  script = xmalloc (size + 1);
+  script = (char *) xmalloc (size + 1);
   here = 0;
   for (iter = l; iter; iter = iter->next)
     {
index e7826489b47b99adf8a39adc62b73c0bd8f76f92..900d7b0442a893b92eb10b8bc92ad4304a138450 100644 (file)
@@ -506,7 +506,7 @@ gdbscm_parse_command_name (const char *name,
                   || name[i - 1] == '_');
        --i)
     ;
-  result = xmalloc (lastchar - i + 2);
+  result = (char *) xmalloc (lastchar - i + 2);
   memcpy (result, &name[i], lastchar - i + 1);
   result[lastchar - i + 1] = '\0';
 
@@ -519,7 +519,7 @@ gdbscm_parse_command_name (const char *name,
       return result;
     }
 
-  prefix_text = xmalloc (i + 2);
+  prefix_text = (char *) xmalloc (i + 2);
   memcpy (prefix_text, name, i + 1);
   prefix_text[i + 1] = '\0';
 
@@ -601,7 +601,8 @@ char *
 gdbscm_canonicalize_command_name (const char *name, int want_trailing_space)
 {
   int i, out, seen_word;
-  char *result = scm_gc_malloc_pointerless (strlen (name) + 2, FUNC_NAME);
+  char *result
+    = (char *) scm_gc_malloc_pointerless (strlen (name) + 2, FUNC_NAME);
 
   i = out = seen_word = 0;
   while (name[i])
index e406ae146801228e117169d670e74e91028f3c84..280e6d4e8276090db8725794836e68ccdd75d844 100644 (file)
@@ -326,7 +326,8 @@ ioscm_init_stdio_buffers (SCM port, long mode_bits)
 
   if (!writing && size > 0)
     {
-      pt->read_buf = scm_gc_malloc_pointerless (size, "port buffer");
+      pt->read_buf
+       = (unsigned char *) scm_gc_malloc_pointerless (size, "port buffer");
       pt->read_pos = pt->read_end = pt->read_buf;
       pt->read_buf_size = size;
     }
@@ -338,7 +339,8 @@ ioscm_init_stdio_buffers (SCM port, long mode_bits)
 
   if (writing && size > 0)
     {
-      pt->write_buf = scm_gc_malloc_pointerless (size, "port buffer");
+      pt->write_buf
+       = (unsigned char *) scm_gc_malloc_pointerless (size, "port buffer");
       pt->write_pos = pt->write_buf;
       pt->write_buf_size = size;
     }
@@ -1011,8 +1013,8 @@ ioscm_init_memory_port (SCM port, CORE_ADDR start, CORE_ADDR end)
   pt->write_buf_size = iomem->write_buf_size;
   if (buffered)
     {
-      pt->read_buf = xmalloc (pt->read_buf_size);
-      pt->write_buf = xmalloc (pt->write_buf_size);
+      pt->read_buf = (unsigned char *) xmalloc (pt->read_buf_size);
+      pt->write_buf = (unsigned char *) xmalloc (pt->write_buf_size);
     }
   else
     {
@@ -1076,7 +1078,7 @@ ioscm_reinit_memory_port (SCM port, size_t read_buf_size,
       iomem->read_buf_size = read_buf_size;
       pt->read_buf_size = read_buf_size;
       xfree (pt->read_buf);
-      pt->read_buf = xmalloc (pt->read_buf_size);
+      pt->read_buf = (unsigned char *) xmalloc (pt->read_buf_size);
       pt->read_pos = pt->read_end = pt->read_buf;
     }
 
@@ -1085,7 +1087,7 @@ ioscm_reinit_memory_port (SCM port, size_t read_buf_size,
       iomem->write_buf_size = write_buf_size;
       pt->write_buf_size = write_buf_size;
       xfree (pt->write_buf);
-      pt->write_buf = xmalloc (pt->write_buf_size);
+      pt->write_buf = (unsigned char *) xmalloc (pt->write_buf_size);
       pt->write_pos = pt->write_buf;
       pt->write_end = pt->write_buf + pt->write_buf_size;
     }
index b0873f336c6282de7923526a02efa5c8292ba93a..da45a05e7e044e227defc8fe644d441d0a69ab87 100644 (file)
@@ -587,7 +587,8 @@ char *
 gdbscm_gc_xstrdup (const char *str)
 {
   size_t len = strlen (str);
-  char *result = scm_gc_malloc_pointerless (len + 1, "gdbscm_gc_xstrdup");
+  char *result
+    = (char *) scm_gc_malloc_pointerless (len + 1, "gdbscm_gc_xstrdup");
 
   strcpy (result, str);
   return result;
@@ -607,8 +608,9 @@ gdbscm_gc_dup_argv (char **argv)
 
   /* Allocating "pointerless" works because the pointers are all
      self-contained within the object.  */
-  result = scm_gc_malloc_pointerless (((len + 1) * sizeof (char *))
-                                     + string_space, "parameter enum list");
+  result = (char **) scm_gc_malloc_pointerless (((len + 1) * sizeof (char *))
+                                               + string_space,
+                                               "parameter enum list");
   p = (char *) &result[len + 1];
 
   for (i = 0; i < len; ++i)
index 48879024394d157594df592787b225bffa751c3a..a8cfc52204be69f1d53c699e9a8e55a68e7c9668 100644 (file)
@@ -671,7 +671,7 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 
       /* Pad the argument appropriately.  */
       int padded_len = align_up (len, wordsize);
-      gdb_byte *padded = xmalloc (padded_len);
+      gdb_byte *padded = (gdb_byte *) xmalloc (padded_len);
       back_to = make_cleanup (xfree, padded);
 
       memset (padded, 0, padded_len);
index 01a7c8098c8515d60174ae47ff0dd3e6f458acb2..cf894eef8b51e8bbe619d704af8169ef677f8fd1 100644 (file)
@@ -261,7 +261,7 @@ internalize_unwinds (struct objfile *objfile, struct unwind_table_entry *table,
       struct gdbarch *gdbarch = get_objfile_arch (objfile);
       unsigned long tmp;
       unsigned i;
-      char *buf = alloca (size);
+      char *buf = (char *) alloca (size);
       CORE_ADDR low_text_segment_address;
 
       /* For ELF targets, then unwinds are supposed to
@@ -434,7 +434,7 @@ read_unwind_info (struct objfile *objfile)
   if (stub_unwind_size > 0)
     {
       unsigned int i;
-      char *buf = alloca (stub_unwind_size);
+      char *buf = (char *) alloca (stub_unwind_size);
 
       /* Read in the stub unwind entries.  */
       bfd_get_section_contents (objfile->obfd, stub_unwind_sec, buf,
index 79ff478fa9532bba8419398b88d7f478fd90e1ee..cb702587827dc8ac44f1431041c9c2255b1aac5e 100644 (file)
@@ -110,7 +110,7 @@ core_process_module_section (bfd *abfd, asection *sect, void *obj)
   if (!startswith (sect->name, ".module"))
     return;
 
-  buf = xmalloc (bfd_get_section_size (sect) + 1);
+  buf = (gdb_byte *) xmalloc (bfd_get_section_size (sect) + 1);
   if (!buf)
     {
       printf_unfiltered ("memory allocation failed for %s\n", sect->name);
@@ -163,7 +163,7 @@ windows_core_xfer_shared_libraries (struct gdbarch *gdbarch,
                         &data);
   obstack_grow_str0 (&obstack, "</library-list>\n");
 
-  buf = obstack_finish (&obstack);
+  buf = (const char *) obstack_finish (&obstack);
   len_avail = strlen (buf);
   if (offset >= len_avail)
     return 0;
index 9d52d4ad5e175b3dd67fabf2638ae0a43d546023..d4df18e1d6970e1e640d07a3f15c4f695874849d 100644 (file)
@@ -777,7 +777,7 @@ i386_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);
 
@@ -4051,7 +4051,7 @@ i386_stap_parse_special_token_triplet (struct gdbarch *gdbarch,
        return 0;
 
       len = s - start - 1;
-      regname = alloca (len + 1);
+      regname = (char *) alloca (len + 1);
 
       strncpy (regname, start, len);
       regname[len] = '\0';
@@ -4161,7 +4161,7 @@ i386_stap_parse_special_token_three_arg_disp (struct gdbarch *gdbarch,
        return 0;
 
       len_base = s - start;
-      base = alloca (len_base + 1);
+      base = (char *) alloca (len_base + 1);
       strncpy (base, start, len_base);
       base[len_base] = '\0';
 
@@ -4176,7 +4176,7 @@ i386_stap_parse_special_token_three_arg_disp (struct gdbarch *gdbarch,
        ++s;
 
       len_index = s - start;
-      index = alloca (len_index + 1);
+      index = (char *) alloca (len_index + 1);
       strncpy (index, start, len_index);
       index[len_index] = '\0';
 
index eae445c845f6bfb85842db59696d692b3b9c0fc8..f344a97e10115d12d66158d51a096ad45d8e8e1a 100644 (file)
@@ -92,7 +92,7 @@ i386obsd_sigtramp_p (struct frame_info *this_frame)
     return 0;
 
   /* Allocate buffer.  */
-  buf = alloca (buflen);
+  buf = (gdb_byte *) alloca (buflen);
 
   /* Loop over all offsets.  */
   for (offset = i386obsd_sigreturn_offset; *offset != -1; offset++)
index ada570d96f6e41d5ca93c0acf521c548039b1906..3566331c67514b01dcd6c48879caf318fa8190ab 100644 (file)
@@ -352,7 +352,7 @@ inf_child_fileio_readlink (struct target_ops *self,
       return NULL;
     }
 
-  ret = xmalloc (len + 1);
+  ret = (char *) xmalloc (len + 1);
   memcpy (ret, buf, len);
   ret[len] = '\0';
   return ret;
index 569a6dd54cf7936bfd6a4dce990d0df0a0d78306..c98de4ae4374a68a0b897506f2a57d9891f46dac 100644 (file)
@@ -728,7 +728,7 @@ inf_ptrace_fetch_register (struct regcache *regcache, int regnum)
 
   size = register_size (gdbarch, regnum);
   gdb_assert ((size % sizeof (PTRACE_TYPE_RET)) == 0);
-  buf = alloca (size);
+  buf = (long int *) alloca (size);
 
   /* Read the register contents from the inferior a chunk at a time.  */
   for (i = 0; i < size / sizeof (PTRACE_TYPE_RET); i++)
@@ -786,7 +786,7 @@ inf_ptrace_store_register (const struct regcache *regcache, int regnum)
 
   size = register_size (gdbarch, regnum);
   gdb_assert ((size % sizeof (PTRACE_TYPE_RET)) == 0);
-  buf = alloca (size);
+  buf = (long int *) alloca (size);
 
   /* Write the register contents into the inferior a chunk at a time.  */
   regcache_raw_collect (regcache, regnum, buf);
index 701ea37eb5d50c31bb64095e6489d9c1a32810e3..ec8862119bedf4da29503fd838e697be79784049 100644 (file)
@@ -1178,7 +1178,7 @@ follow_exec (ptid_t ptid, char *execd_pathname)
     {
       char *name = exec_file_find (execd_pathname, NULL);
 
-      execd_pathname = alloca (strlen (name) + 1);
+      execd_pathname = (char *) alloca (strlen (name) + 1);
       strcpy (execd_pathname, name);
       xfree (name);
     }
@@ -1789,7 +1789,7 @@ displaced_step_prepare_throw (ptid_t ptid)
   len = gdbarch_max_insn_length (gdbarch);
 
   /* Save the original contents of the copy area.  */
-  displaced->step_saved_copy = xmalloc (len);
+  displaced->step_saved_copy = (gdb_byte *) xmalloc (len);
   ignore_cleanups = make_cleanup (free_current_contents,
                                  &displaced->step_saved_copy);
   status = target_read_memory (copy, displaced->step_saved_copy, len);
@@ -7916,7 +7916,7 @@ struct stop_context
 static struct stop_context *
 save_stop_context (void)
 {
-  struct stop_context *sc = xmalloc (sizeof (struct stop_context));
+  struct stop_context *sc = XNEW (struct stop_context);
 
   sc->stop_id = get_stop_id ();
   sc->ptid = inferior_ptid;
@@ -8658,7 +8658,7 @@ save_infcall_suspend_state (void)
       size_t len = TYPE_LENGTH (type);
       struct cleanup *back_to;
 
-      siginfo_data = xmalloc (len);
+      siginfo_data = (gdb_byte *) xmalloc (len);
       back_to = make_cleanup (xfree, siginfo_data);
 
       if (target_read (&current_target, TARGET_OBJECT_SIGNAL_INFO, NULL,
index 10da21daae4520828dfcad567654832c876ed445..6302052321ef559c655c8597ab1b551760eefb1d 100644 (file)
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -364,7 +364,7 @@ jit_read_descriptor (struct gdbarch *gdbarch,
   ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
   ptr_size = TYPE_LENGTH (ptr_type);
   desc_size = 8 + 2 * ptr_size;  /* Two 32-bit ints and two pointers.  */
-  desc_buf = alloca (desc_size);
+  desc_buf = (gdb_byte *) alloca (desc_size);
 
   /* Read the descriptor.  */
   err = target_read_memory (MSYMBOL_VALUE_ADDRESS (ps_data->objfile,
@@ -412,7 +412,7 @@ jit_read_code_entry (struct gdbarch *gdbarch,
   off = (off + (align_bytes - 1)) & ~(align_bytes - 1);
 
   entry_size = off + 8;  /* Three pointers and one 64-bit int.  */
-  entry_buf = alloca (entry_size);
+  entry_buf = (gdb_byte *) alloca (entry_size);
 
   /* Read the entry.  */
   err = target_read_memory (code_addr, entry_buf, entry_size);
@@ -603,12 +603,14 @@ jit_symtab_line_mapping_add_impl (struct gdb_symbol_callbacks *cb,
                                   struct gdb_line_mapping *map)
 {
   int i;
+  int alloc_len;
 
   if (nlines < 1)
     return;
 
-  stab->linetable = xmalloc (sizeof (struct linetable)
-                             + (nlines - 1) * sizeof (struct linetable_entry));
+  alloc_len = sizeof (struct linetable)
+             + (nlines - 1) * sizeof (struct linetable_entry);
+  stab->linetable = (struct linetable *) xmalloc (alloc_len);
   stab->linetable->nitems = nlines;
   for (i = 0; i < nlines; i++)
     {
@@ -658,14 +660,15 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
                     * sizeof (struct linetable_entry)
                     + sizeof (struct linetable));
       SYMTAB_LINETABLE (COMPUNIT_FILETABS (cust))
-       = obstack_alloc (&objfile->objfile_obstack, size);
+       = (struct linetable *) obstack_alloc (&objfile->objfile_obstack, size);
       memcpy (SYMTAB_LINETABLE (COMPUNIT_FILETABS (cust)), stab->linetable,
              size);
     }
 
   blockvector_size = (sizeof (struct blockvector)
                       + (actual_nblocks - 1) * sizeof (struct block *));
-  bv = obstack_alloc (&objfile->objfile_obstack, blockvector_size);
+  bv = (struct blockvector *) obstack_alloc (&objfile->objfile_obstack,
+                                            blockvector_size);
   COMPUNIT_BLOCKVECTOR (cust) = bv;
 
   /* (begin, end) will contain the PC range this entire blockvector
@@ -702,9 +705,10 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
       SYMBOL_TYPE (block_name) = lookup_function_type (block_type);
       SYMBOL_BLOCK_VALUE (block_name) = new_block;
 
-      block_name->ginfo.name = obstack_copy0 (&objfile->objfile_obstack,
-                                             gdb_block_iter->name,
-                                             strlen (gdb_block_iter->name));
+      block_name->ginfo.name
+       = (const char *) obstack_copy0 (&objfile->objfile_obstack,
+                                       gdb_block_iter->name,
+                                       strlen (gdb_block_iter->name));
 
       BLOCK_FUNCTION (new_block) = block_name;
 
@@ -1134,7 +1138,8 @@ jit_unwind_reg_get_impl (struct gdb_unwind_callbacks *cb, int regnum)
 
   gdb_reg = gdbarch_dwarf2_reg_to_regnum (frame_arch, regnum);
   size = register_size (frame_arch, gdb_reg);
-  value = xmalloc (sizeof (struct gdb_reg_value) + size - 1);
+  value = ((struct gdb_reg_value *)
+          xmalloc (sizeof (struct gdb_reg_value) + size - 1));
   value->defined = deprecated_frame_register_read (priv->this_frame, gdb_reg,
                                                   value->value);
   value->size = size;
index 60b7d2e4e0aa830290e95ad8e4d16b958c150050..8edd94e0e0ca71a46fb1900340bced78bf320899 100644 (file)
@@ -355,7 +355,7 @@ QualifiedName:
                    {
                      char *buf;
 
-                     buf = malloc ($$.length + 1);
+                     buf = (char *) malloc ($$.length + 1);
                      make_cleanup (free, buf);
                      sprintf (buf, "%.*s.%.*s",
                               $1.length, $1.ptr, $3.length, $3.ptr);
index 73df0445eecf54204fbf16f2e7a37b6ae8510186..43e2c6b5a5e3874c87a312c9fba60916d5cfc302 100644 (file)
@@ -224,7 +224,7 @@ get_java_utf8_name (struct obstack *obstack, struct value *name)
   temp = value_struct_elt (&temp, NULL, "length", NULL, "structure");
   name_length = (int) value_as_long (temp);
   data_addr = value_address (temp) + TYPE_LENGTH (value_type (temp));
-  chrs = obstack_alloc (obstack, name_length + 1);
+  chrs = (char *) obstack_alloc (obstack, name_length + 1);
   chrs[name_length] = '\0';
   read_memory (data_addr, (gdb_byte *) chrs, name_length);
   return chrs;
@@ -314,7 +314,7 @@ type_from_class (struct gdbarch *gdbarch, struct value *clas)
       int namelen = java_demangled_signature_length (signature);
 
       if (namelen > strlen (name))
-       name = obstack_alloc (&objfile->objfile_obstack, namelen + 1);
+       name = (char *) obstack_alloc (&objfile->objfile_obstack, namelen + 1);
       java_demangled_signature_copy (name, signature);
       name[namelen] = '\0';
       temp = clas;
@@ -806,7 +806,7 @@ char *
 java_demangle_type_signature (const char *signature)
 {
   int length = java_demangled_signature_length (signature);
-  char *result = xmalloc (length + 1);
+  char *result = (char *) xmalloc (length + 1);
 
   java_demangled_signature_copy (result, signature);
   result[length] = '\0';
@@ -1059,7 +1059,7 @@ java_class_name_from_physname (const char *physname)
   end = java_find_last_component (demangled_name);
   if (end != NULL)
     {
-      ret = xmalloc (end - demangled_name + 1);
+      ret = (char *) xmalloc (end - demangled_name + 1);
       memcpy (ret, demangled_name, end - demangled_name);
       ret[end - demangled_name] = '\0';
     }
index 3ea81c3b171abaed046891fd049976ee30e71921..441f313f5705f35c85c8d564b6469730b0ec7851 100644 (file)
@@ -233,7 +233,7 @@ java_type_print_base (struct type *type, struct ui_file *stream, int show,
                  p = strrchr (real_physname, ')');
                  gdb_assert (p != NULL);
                  ++p;   /* Keep the trailing ')'.  */
-                 physname = alloca (p - real_physname + 1);
+                 physname = (char *) alloca (p - real_physname + 1);
                  memcpy (physname, real_physname, p - real_physname);
                  physname[p - real_physname] = '\0';
 
index 9fc8f50ed8ff1e279997df402106bfc7bab418e3..a8547a5819cbc3850829b1dad543ad3ccb3e3707 100644 (file)
@@ -99,7 +99,8 @@ java_value_print (struct value *val, struct ui_file *stream,
            {
              gdb_byte *buf;
 
-             buf = alloca (gdbarch_ptr_bit (gdbarch) / HOST_CHAR_BIT);
+             buf = ((gdb_byte *)
+                    alloca (gdbarch_ptr_bit (gdbarch) / HOST_CHAR_BIT));
              fputs_filtered (", ", stream);
              wrap_here (n_spaces (2));
 
index 121e8ad0e8cce2b6b36d658559d559d8046f0552..b6fe77ed86ba61342f7e14f7e610e5b67c534ad3 100644 (file)
@@ -568,8 +568,9 @@ add_language (const struct language_defn *lang)
 
   /* Build the language names array, to be used as enumeration in the
      set language" enum command.  */
-  language_names = xrealloc (language_names,
-                            (languages_size + 1) * sizeof (const char *));
+  language_names = XRESIZEVEC (const char *, language_names,
+                              languages_size + 1);
+
   for (i = 0; i < languages_size; ++i)
     language_names[i] = languages[i]->la_name;
   language_names[i] = NULL;
index 7a595ed575dcd2941a297a04c7da5ef20e698399..a61b08a371f5fd151a98367e64e220c666091674 100644 (file)
@@ -810,7 +810,7 @@ add_sal_to_sals_basic (struct symtabs_and_lines *sals,
                       struct symtab_and_line *sal)
 {
   ++sals->nelts;
-  sals->sals = xrealloc (sals->sals, sals->nelts * sizeof (sals->sals[0]));
+  sals->sals = XRESIZEVEC (struct symtab_and_line, sals->sals, sals->nelts);
   sals->sals[sals->nelts - 1] = *sal;
 }
 
@@ -833,9 +833,8 @@ add_sal_to_sals (struct linespec_state *self,
     {
       struct linespec_canonical_name *canonical;
 
-      self->canonical_names = xrealloc (self->canonical_names,
-                                       (sals->nelts
-                                        * sizeof (*self->canonical_names)));
+      self->canonical_names = XRESIZEVEC (struct linespec_canonical_name,
+                                         self->canonical_names, sals->nelts);
       canonical = &self->canonical_names[sals->nelts - 1];
       if (!literal_canonical && sal->symtab)
        {
@@ -2758,7 +2757,7 @@ decode_objc (struct linespec_state *self, linespec_p ls, const char *arg)
     {
       char *saved_arg;
 
-      saved_arg = alloca (new_argptr - arg + 1);
+      saved_arg = (char *) alloca (new_argptr - arg + 1);
       memcpy (saved_arg, arg, new_argptr - arg);
       saved_arg[new_argptr - arg] = '\0';
 
@@ -3290,14 +3289,14 @@ find_linespec_symbols (struct linespec_state *state,
 
       /* LOOKUP_NAME points to the class name.
         LAST points to the method name.  */
-      klass = xmalloc ((last - lookup_name + 1) * sizeof (char));
+      klass = XNEWVEC (char, last - lookup_name + 1);
       make_cleanup (xfree, klass);
       strncpy (klass, lookup_name, last - lookup_name);
       klass[last - lookup_name] = '\0';
 
       /* Skip past the scope operator.  */
       last += strlen (scope_op);
-      method = xmalloc ((strlen (last) + 1) * sizeof (char));
+      method = XNEWVEC (char, strlen (last) + 1);
       make_cleanup (xfree, method);
       strcpy (method, last);
 
index dbaa36eb4a7ad6467ebf24f7a64594425301cf1a..fdea2474e7292ada5343df64d17678a9588b94f3 100644 (file)
@@ -297,8 +297,7 @@ fork_save_infrun_state (struct fork_info *fp, int clobber_regs)
                fp->maxfd = tmp;
            }
          /* Allocate array of file positions.  */
-         fp->filepos = xrealloc (fp->filepos,
-                                 (fp->maxfd + 1) * sizeof (*fp->filepos));
+         fp->filepos = XRESIZEVEC (off_t, fp->filepos, fp->maxfd + 1);
 
          /* Initialize to -1 (invalid).  */
          for (tmp = 0; tmp <= fp->maxfd; tmp++)
index 6b01a51a1fdfd14009fda7dc1fad9940091d8571..c6dbc01d949ecfef0bfcfa4381c30a1a670c1d57 100644 (file)
@@ -1540,7 +1540,7 @@ linux_nat_detach (struct target_ops *ops, const char *args, int from_tty)
 
       /* Put the signal number in ARGS so that inf_ptrace_detach will
         pass it along with PTRACE_DETACH.  */
-      tem = alloca (8);
+      tem = (char *) alloca (8);
       xsnprintf (tem, 8, "%d", (int) WSTOPSIG (status));
       args = tem;
       if (debug_linux_nat)
@@ -4940,7 +4940,7 @@ linux_nat_fileio_readlink (struct target_ops *self,
       return NULL;
     }
 
-  ret = xmalloc (len + 1);
+  ret = (char *) xmalloc (len + 1);
   memcpy (ret, buf, len);
   ret[len] = '\0';
   return ret;
index 559d5f19079d87a14dd25b6ea3c7063b5f0acb3c..58733655169eed5d45997fbec446f8d4ab66b7d0 100644 (file)
@@ -98,7 +98,7 @@ record_linux_sockaddr (struct regcache *regcache,
   if (!addr)
     return 0;
 
-  a = alloca (tdep->size_int);
+  a = (gdb_byte *) alloca (tdep->size_int);
 
   if (record_full_arch_list_add_mem ((CORE_ADDR) len, tdep->size_int))
     return -1;
@@ -140,7 +140,7 @@ record_linux_msghdr (struct regcache *regcache,
   if (record_full_arch_list_add_mem ((CORE_ADDR) addr, tdep->size_msghdr))
     return -1;
 
-  a = alloca (tdep->size_msghdr);
+  a = (gdb_byte *) alloca (tdep->size_msghdr);
   if (target_read_memory ((CORE_ADDR) addr, a, tdep->size_msghdr))
     {
       if (record_debug)
@@ -172,7 +172,7 @@ record_linux_msghdr (struct regcache *regcache,
       ULONGEST i;
       ULONGEST len = extract_unsigned_integer (a, tdep->size_size_t,
                                                byte_order);
-      gdb_byte *iov = alloca (tdep->size_iovec);
+      gdb_byte *iov = (gdb_byte *) alloca (tdep->size_iovec);
 
       for (i = 0; i < len; i++)
         {
@@ -805,7 +805,7 @@ Do you want to stop the program?"),
       if (tmpulongest)
         {
           ULONGEST optvalp;
-          gdb_byte *optlenp = alloca (tdep->size_int);
+          gdb_byte *optlenp = (gdb_byte *) alloca (tdep->size_int);
 
           if (target_read_memory ((CORE_ADDR) tmpulongest, optlenp,
                                   tdep->size_int))
@@ -847,7 +847,7 @@ Do you want to stop the program?"),
                                         &tmpulongest);
             if (tmpulongest)
               {
-                gdb_byte *a = alloca (tdep->size_ulong * 2);
+                gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
                 ULONGEST len;
 
                 tmpulongest += tdep->size_ulong;
@@ -875,7 +875,7 @@ Do you want to stop the program?"),
 
         case RECORD_SYS_SOCKETPAIR:
           {
-            gdb_byte *a = alloca (tdep->size_ulong);
+            gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong);
 
             regcache_raw_read_unsigned (regcache, tdep->arg2,
                                         &tmpulongest);
@@ -909,7 +909,7 @@ Do you want to stop the program?"),
                                       &tmpulongest);
           if (tmpulongest)
             {
-              gdb_byte *a = alloca (tdep->size_ulong * 2);
+              gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
               ULONGEST len;
 
               tmpulongest += tdep->size_ulong * 4;
@@ -936,7 +936,7 @@ Do you want to stop the program?"),
                                       &tmpulongest);
           if (tmpulongest)
             {
-              gdb_byte *a = alloca (tdep->size_ulong * 2);
+              gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
 
               tmpulongest += tdep->size_ulong;
               if (target_read_memory ((CORE_ADDR) tmpulongest, a,
@@ -968,8 +968,8 @@ Do you want to stop the program?"),
           break;
         case RECORD_SYS_GETSOCKOPT:
           {
-            gdb_byte *a = alloca (tdep->size_ulong * 2);
-            gdb_byte *av = alloca (tdep->size_int);
+            gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
+            gdb_byte *av = (gdb_byte *) alloca (tdep->size_int);
 
             regcache_raw_read_unsigned (regcache, tdep->arg2,
                                         &tmpulongest);
@@ -1030,7 +1030,7 @@ Do you want to stop the program?"),
           break;
         case RECORD_SYS_RECVMSG:
           {
-            gdb_byte *a = alloca (tdep->size_ulong);
+            gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong);
 
             regcache_raw_read_unsigned (regcache, tdep->arg2,
                                         &tmpulongest);
@@ -1386,7 +1386,7 @@ Do you want to stop the program?"),
         regcache_raw_read_unsigned (regcache, tdep->arg2, &vec);
         if (vec)
           {
-            gdb_byte *iov = alloca (tdep->size_iovec);
+            gdb_byte *iov = (gdb_byte *) alloca (tdep->size_iovec);
 
             regcache_raw_read_unsigned (regcache, tdep->arg3, &vlen);
             for (tmpulongest = 0; tmpulongest < vlen; tmpulongest++)
@@ -1889,7 +1889,7 @@ Do you want to stop the program?"),
           gdb_byte *iocbp;
 
           regcache_raw_read_unsigned (regcache, tdep->arg2, &nr);
-          iocbp = alloca (nr * tdep->size_pointer);
+          iocbp = (gdb_byte *) alloca (nr * tdep->size_pointer);
           if (target_read_memory ((CORE_ADDR) tmpulongest, iocbp,
                                   nr * tdep->size_pointer))
             {
index ff3ada78c6b98e550e1c10c96e4d9be0867fa265..86d9eef0af89e4b1e3656b700f6d62dffd445cb5 100644 (file)
@@ -997,7 +997,7 @@ linux_core_info_proc_mappings (struct gdbarch *gdbarch, const char *args)
   if (note_size < 2 * addr_size)
     error (_("malformed core note - too short for header"));
 
-  contents = xmalloc (note_size);
+  contents = (unsigned char *) xmalloc (note_size);
   cleanup = make_cleanup (xfree, contents);
   if (!bfd_get_section_contents (core_bfd, section, contents, 0, note_size))
     error (_("could not get core note contents"));
@@ -1562,7 +1562,7 @@ linux_collect_regset_section_cb (const char *sect_name, int size,
 
   gdb_assert (regset && regset->collect_regset);
 
-  buf = xmalloc (size);
+  buf = (char *) xmalloc (size);
   regset->collect_regset (regset, data->regcache, -1, buf, size);
 
   /* PRSTATUS still needs to be treated specially.  */
@@ -1630,7 +1630,7 @@ linux_get_siginfo_data (struct gdbarch *gdbarch, LONGEST *size)
   
   siginfo_type = gdbarch_get_siginfo_type (gdbarch);
 
-  buf = xmalloc (TYPE_LENGTH (siginfo_type));
+  buf = (gdb_byte *) xmalloc (TYPE_LENGTH (siginfo_type));
   cleanups = make_cleanup (xfree, buf);
 
   bytes_read = target_read (&current_target, TARGET_OBJECT_SIGNAL_INFO, NULL,
index b5719eb9e8c6e8d036c3af50a4cbd60f0ee917c8..91bd0dccfee3ccf483c4c8020334732165adca37 100644 (file)
@@ -873,6 +873,7 @@ try_thread_db_load_from_pdir_1 (struct objfile *obj, const char *subdir)
   char *path, *cp;
   int result;
   const char *obj_name = objfile_name (obj);
+  int alloc_len;
 
   if (obj_name[0] != '/')
     {
@@ -881,8 +882,10 @@ try_thread_db_load_from_pdir_1 (struct objfile *obj, const char *subdir)
       return 0;
     }
 
-  path = xmalloc (strlen (obj_name) + (subdir ? strlen (subdir) + 1 : 0)
-                 + 1 + strlen (LIBTHREAD_DB_SO) + 1);
+  alloc_len = (strlen (obj_name)
+              + (subdir ? strlen (subdir) + 1 : 0)
+              + 1 + strlen (LIBTHREAD_DB_SO) + 1);
+  path = (char *) xmalloc (alloc_len);
   cleanup = make_cleanup (xfree, path);
 
   strcpy (path, obj_name);
@@ -959,7 +962,7 @@ try_thread_db_load_from_dir (const char *dir, size_t dir_len)
   if (!auto_load_thread_db)
     return 0;
 
-  path = xmalloc (dir_len + 1 + strlen (LIBTHREAD_DB_SO) + 1);
+  path = (char *) xmalloc (dir_len + 1 + strlen (LIBTHREAD_DB_SO) + 1);
   cleanup = make_cleanup (xfree, path);
 
   memcpy (path, dir, dir_len);
@@ -1004,7 +1007,7 @@ thread_db_load_search (void)
 
          if (this_dir[pdir_len] == '/')
            {
-             subdir = xmalloc (strlen (this_dir));
+             subdir = (char *) xmalloc (strlen (this_dir));
              make_cleanup (xfree, subdir);
              strcpy (subdir, this_dir + pdir_len + 1);
            }
@@ -2059,7 +2062,7 @@ info_auto_load_libthread_db (char *args, int from_tty)
   ui_out_table_header (uiout, pids_len, ui_left, "PIDs", "Pids");
   ui_out_table_body (uiout);
 
-  pids = xmalloc (max_pids_len + 1);
+  pids = (char *) xmalloc (max_pids_len + 1);
   make_cleanup (xfree, pids);
 
   /* Note I is incremented inside the cycle, not at its end.  */
index 3be74057a51d2ccca56fdc2dcdac1ceb0b43774c..3b7a5852f35dd24f3df4b4ed89a7021229ebd259 100644 (file)
@@ -2467,7 +2467,7 @@ m32c_m16c_address_to_pointer (struct gdbarch *gdbarch,
                paddress (gdbarch, addr));
 
       func_name = MSYMBOL_LINKAGE_NAME (func_msym.minsym);
-      tramp_name = xmalloc (strlen (func_name) + 5);
+      tramp_name = (char *) xmalloc (strlen (func_name) + 5);
       strcpy (tramp_name, func_name);
       strcat (tramp_name, ".plt");
 
@@ -2554,7 +2554,7 @@ m32c_m16c_pointer_to_address (struct gdbarch *gdbarch,
                  Since the trampoline contains a jump instruction, we
                  could also just extract the jump's target address.  I
                  don't see much advantage one way or the other.  */
-              char *func_name = xmalloc (len - 4 + 1);
+              char *func_name = (char *) xmalloc (len - 4 + 1);
               memcpy (func_name, ptr_msym_name, len - 4);
               func_name[len - 4] = '\0';
               func_msym
index 69ed9dce24532b9fc80ad5ca0d7dec9d79a4689b..df7cd0cfd800df118dd2ddf1d8a4000c4095494c 100644 (file)
@@ -337,7 +337,7 @@ m68hc11_pseudo_register_write (struct gdbarch *gdbarch,
   if (regno == M68HC12_HARD_PC_REGNUM)
     {
       const int regsize = 4;
-      gdb_byte *tmp = alloca (regsize);
+      gdb_byte *tmp = (gdb_byte *) alloca (regsize);
       CORE_ADDR pc;
 
       memcpy (tmp, buf, regsize);
@@ -362,7 +362,7 @@ m68hc11_pseudo_register_write (struct gdbarch *gdbarch,
   if (soft_regs[regno].name)
     {
       const int regsize = 2;
-      gdb_byte *tmp = alloca (regsize);
+      gdb_byte *tmp = (gdb_byte *) alloca (regsize);
       memcpy (tmp, buf, regsize);
       target_write_memory (soft_regs[regno].addr, tmp, regsize);
     }
index f833741e529319b93358447de2b76b7d8f87b2db..285a83159758c2f016db68937500b976376a23cb 100644 (file)
@@ -1028,7 +1028,7 @@ m68k_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
       return 0;
     }
 
-  buf = alloca (gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT);
+  buf = (gdb_byte *) alloca (gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT);
   sp = get_frame_register_unsigned (frame, gdbarch_sp_regnum (gdbarch));
 
   if (target_read_memory (sp + SP_ARG0,        /* Offset of first arg on stack.  */
index 675155e97b62fad69bb9058c4c10d518da78fd13..b7510fdbc7d7118b140b2a4f1c436b8e8ae9423f 100644 (file)
@@ -783,7 +783,7 @@ macho_check_dsym (struct objfile *objfile, char **filenamep)
   size_t dsym_len = strlen (DSYM_SUFFIX);
   const char *base_name = lbasename (objfile_name (objfile));
   size_t base_len = strlen (base_name);
-  char *dsym_filename = alloca (name_len + dsym_len + base_len + 1);
+  char *dsym_filename = (char *) alloca (name_len + dsym_len + base_len + 1);
   bfd *dsym_bfd;
   bfd_mach_o_load_command *main_uuid;
   bfd_mach_o_load_command *dsym_uuid;
index e6c9c86c30a5a519248197c2d4c066c0d6dc94e4..bbd81e7a0367efcdda9b3026bb226a1cd09395b7 100644 (file)
@@ -146,7 +146,7 @@ resize_buffer (struct macro_buffer *b, int n)
     while (b->size <= n)
       b->size *= 2;
 
-  b->text = xrealloc (b->text, b->size);
+  b->text = (char *) xrealloc (b->text, b->size);
 }
 
 
@@ -825,7 +825,7 @@ gather_arguments (const char *name, struct macro_buffer *src,
       if (args_len >= args_size)
         {
           args_size *= 2;
-          args = xrealloc (args, sizeof (*args) * args_size);
+          args = XRESIZEVEC (struct macro_buffer, args, args_size);
         }
 
       /* Initialize the next argument.  */
@@ -858,7 +858,8 @@ gather_arguments (const char *name, struct macro_buffer *src,
                      if (args_len >= args_size)
                        {
                          args_size++;
-                         args = xrealloc (args, sizeof (*args) * args_size);
+                         args = XRESIZEVEC (struct macro_buffer, args,
+                                            args_size);
                        }
                      arg = &args[args_len++];
                      set_token (arg, src->text, src->text);
@@ -1330,7 +1331,7 @@ maybe_expand (struct macro_buffer *dest,
     {
       /* Make a null-terminated copy of it, since that's what our
          lookup function expects.  */
-      char *id = xmalloc (src_first->len + 1);
+      char *id = (char *) xmalloc (src_first->len + 1);
       struct cleanup *back_to = make_cleanup (xfree, id);
 
       memcpy (id, src_first->text, src_first->len);
index 30c020b511d1fd708df411682a8afc3e42324d52..9245c7c1f96a03676e43075d8250364b96c6e2df 100644 (file)
@@ -352,7 +352,7 @@ new_macro_key (struct macro_table *t,
                struct macro_source_file *file,
                int line)
 {
-  struct macro_key *k = macro_alloc (sizeof (*k), t);
+  struct macro_key *k = (struct macro_key *) macro_alloc (sizeof (*k), t);
 
   memset (k, 0, sizeof (*k));
   k->table = t;
@@ -385,7 +385,8 @@ new_source_file (struct macro_table *t,
                  const char *filename)
 {
   /* Get space for the source file structure itself.  */
-  struct macro_source_file *f = macro_alloc (sizeof (*f), t);
+  struct macro_source_file *f
+    = (struct macro_source_file *) macro_alloc (sizeof (*f), t);
 
   memset (f, 0, sizeof (*f));
   f->table = t;
@@ -553,7 +554,8 @@ new_macro_definition (struct macro_table *t,
                       int argc, const char **argv,
                       const char *replacement)
 {
-  struct macro_definition *d = macro_alloc (sizeof (*d), t);
+  struct macro_definition *d
+    = (struct macro_definition *) macro_alloc (sizeof (*d), t);
 
   memset (d, 0, sizeof (*d));
   d->table = t;
@@ -568,7 +570,7 @@ new_macro_definition (struct macro_table *t,
       int cached_argv_size = argc * sizeof (*cached_argv);
 
       /* Bcache all the arguments.  */
-      cached_argv = alloca (cached_argv_size);
+      cached_argv = (const char **) alloca (cached_argv_size);
       for (i = 0; i < argc; i++)
         cached_argv[i] = macro_bcache_str (t, argv[i]);
 
index f8338f418bf8a2bc88bff1f435c7276231fe1b1a..7a81592c0c17e2cf87b26f677dc3535be58c8ce8 100644 (file)
@@ -1050,8 +1050,8 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
                enum_sym = allocate_symbol (mdebugread_objfile);
                SYMBOL_SET_LINKAGE_NAME
                  (enum_sym,
-                  obstack_copy0 (&mdebugread_objfile->objfile_obstack,
-                                 f->name, strlen (f->name)));
+                  (char *) obstack_copy0 (&mdebugread_objfile->objfile_obstack,
+                                          f->name, strlen (f->name)));
                SYMBOL_ACLASS_INDEX (enum_sym) = LOC_CONST;
                SYMBOL_TYPE (enum_sym) = t;
                SYMBOL_DOMAIN (enum_sym) = VAR_DOMAIN;
@@ -1696,8 +1696,9 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
          else if (TYPE_TAG_NAME (tp) == NULL
                   || strcmp (TYPE_TAG_NAME (tp), name) != 0)
            TYPE_TAG_NAME (tp)
-             = obstack_copy0 (&mdebugread_objfile->objfile_obstack,
-                              name, strlen (name));
+             = ((const char *)
+                obstack_copy0 (&mdebugread_objfile->objfile_obstack,
+                               name, strlen (name)));
        }
     }
 
@@ -1733,8 +1734,9 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
          if (TYPE_NAME (tp) == NULL
              || strcmp (TYPE_NAME (tp), name) != 0)
            TYPE_NAME (tp)
-             = obstack_copy0 (&mdebugread_objfile->objfile_obstack,
-                              name, strlen (name));
+             = ((const char *)
+                obstack_copy0 (&mdebugread_objfile->objfile_obstack,
+                               name, strlen (name)));
        }
     }
   if (t->bt == btTypedef)
@@ -2826,10 +2828,11 @@ parse_partial_symbols (struct objfile *objfile)
                    /* Concatinate stabstring2 with stabstring1.  */
                    if (stabstring
                     && stabstring != debug_info->ss + fh->issBase + sh.iss)
-                     stabstring = xrealloc (stabstring, len + len2 + 1);
+                     stabstring
+                       = (char *) xrealloc (stabstring, len + len2 + 1);
                    else
                      {
-                       stabstring = xmalloc (len + len2 + 1);
+                       stabstring = (char *) xmalloc (len + len2 + 1);
                        strcpy (stabstring, stabstring1);
                      }
                    strcpy (stabstring + len, stabstring2);
@@ -3249,7 +3252,7 @@ parse_partial_symbols (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';
@@ -3273,7 +3276,7 @@ parse_partial_symbols (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';
@@ -4278,10 +4281,10 @@ psymtab_to_symtab_1 (struct objfile *objfile,
       if (size > 1)
        --size;
       SYMTAB_LINETABLE (COMPUNIT_FILETABS (cust))
-       = obstack_copy (&mdebugread_objfile->objfile_obstack,
-                       lines,
-                       (sizeof (struct linetable)
-                        + size * sizeof (lines->item)));
+       = ((struct linetable *)
+          obstack_copy (&mdebugread_objfile->objfile_obstack,
+                        lines, (sizeof (struct linetable)
+                                + size * sizeof (lines->item))));
       xfree (lines);
 
       /* .. and our share of externals.
index 0fb53cf9ccb1ba5c2d10ab41bcaebd16d0ede48b..3fbc33b7ad35a3b4f4d8b5f356e845f13f8b1212 100644 (file)
@@ -53,7 +53,7 @@ default_memory_insert_breakpoint (struct gdbarch *gdbarch,
 
   /* Save the memory contents in the shadow_contents buffer and then
      write the breakpoint instruction.  */
-  readbuf = alloca (bplen);
+  readbuf = (gdb_byte *) alloca (bplen);
   val = target_read_memory (addr, readbuf, bplen);
   if (val == 0)
     {
index 74929edca9a81ee4c6ed8ac13045dc862f5c6123..4b6b19d15958864b1a0b318cfe63f82ca348bfeb 100644 (file)
@@ -156,7 +156,7 @@ mi_argv_to_format (char **argv, int argc)
     }
   obstack_1grow (&obstack, '\0');
 
-  ret = xstrdup (obstack_finish (&obstack));
+  ret = xstrdup ((const char *) obstack_finish (&obstack));
   obstack_free (&obstack, NULL);
 
   return ret;
index 907ed69af754ab91177ffcc355701a77fe0cbb98..8712a7fc74a7fdf3295e03151cfb063f68792122 100644 (file)
@@ -1493,7 +1493,7 @@ mi_cmd_data_read_memory (char *command, char **argv, int argc)
 
   /* Create a buffer and read it in.  */
   total_bytes = word_size * nr_rows * nr_cols;
-  mbuf = xcalloc (total_bytes, 1);
+  mbuf = XCNEWVEC (gdb_byte, total_bytes);
   make_cleanup (xfree, mbuf);
 
   /* Dispatch memory reads to the topmost target, not the flattened
@@ -1645,14 +1645,15 @@ mi_cmd_data_read_memory_bytes (char *command, char **argv, int argc)
       struct cleanup *t = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
       char *data, *p;
       int i;
+      int alloc_len;
 
       ui_out_field_core_addr (uiout, "begin", gdbarch, read_result->begin);
       ui_out_field_core_addr (uiout, "offset", gdbarch, read_result->begin
                              - addr);
       ui_out_field_core_addr (uiout, "end", gdbarch, read_result->end);
 
-      data = xmalloc (
-         (read_result->end - read_result->begin) * 2 * unit_size + 1);
+      alloc_len = (read_result->end - read_result->begin) * 2 * unit_size + 1;
+      data = (char *) xmalloc (alloc_len);
 
       for (i = 0, p = data;
           i < ((read_result->end - read_result->begin) * unit_size);
@@ -1790,7 +1791,7 @@ mi_cmd_data_write_memory_bytes (char *command, char **argv, int argc)
   else
     count_units = len_units;
 
-  databuf = xmalloc (len_bytes * sizeof (gdb_byte));
+  databuf = XNEWVEC (gdb_byte, len_bytes);
   back_to = make_cleanup (xfree, databuf);
 
   for (i = 0; i < len_bytes; ++i)
@@ -1805,7 +1806,7 @@ mi_cmd_data_write_memory_bytes (char *command, char **argv, int argc)
     {
       /* Pattern is made of less units than count:
          repeat pattern to fill memory.  */
-      data = xmalloc (count_units * unit_size);
+      data = (gdb_byte *) xmalloc (count_units * unit_size);
       make_cleanup (xfree, data);
 
       /* Number of times the pattern is entirely repeated.  */
@@ -2902,7 +2903,7 @@ mi_cmd_trace_frame_collected (char *command, char **argv, int argc)
 
        if (tsv != NULL)
          {
-           tsvname = xrealloc (tsvname, strlen (tsv->name) + 2);
+           tsvname = (char *) xrealloc (tsvname, strlen (tsv->name) + 2);
            tsvname[0] = '$';
            strcpy (tsvname + 1, tsv->name);
            ui_out_field_string (uiout, "name", tsvname);
@@ -2946,7 +2947,7 @@ mi_cmd_trace_frame_collected (char *command, char **argv, int argc)
        ui_out_field_core_addr (uiout, "address", gdbarch, r->start);
        ui_out_field_int (uiout, "length", r->length);
 
-       data = xmalloc (r->length);
+       data = (gdb_byte *) xmalloc (r->length);
        make_cleanup (xfree, data);
 
        if (memory_contents)
@@ -2956,7 +2957,7 @@ mi_cmd_trace_frame_collected (char *command, char **argv, int argc)
                int m;
                char *data_str, *p;
 
-               data_str = xmalloc (r->length * 2 + 1);
+               data_str = (char *) xmalloc (r->length * 2 + 1);
                make_cleanup (xfree, data_str);
 
                for (m = 0, p = data_str; m < r->length; ++m, p += 2)
index 1e11c599d341e075ec21cc1e924860cfaffc8840..92efe267f2bcb91afda78f752c503310dbd30292 100644 (file)
@@ -165,7 +165,7 @@ mi_parse_argv (const char *args, struct mi_parse *parse)
                return;
              }
            /* Create the buffer and copy characters in.  */
-           arg = xmalloc ((len + 1) * sizeof (char));
+           arg = XNEWVEC (char, len + 1);
            chp = start;
            len = 0;
            while (*chp != '\0' && *chp != '"')
@@ -195,14 +195,14 @@ mi_parse_argv (const char *args, struct mi_parse *parse)
                chp++;
              }
            len = chp - start;
-           arg = xmalloc ((len + 1) * sizeof (char));
+           arg = XNEWVEC (char, len + 1);
            strncpy (arg, start, len);
            arg[len] = '\0';
            break;
          }
        }
       /* Append arg to argv.  */
-      argv = xrealloc (argv, (argc + 2) * sizeof (char *));
+      argv = XRESIZEVEC (char *, argv, argc + 2);
       argv[argc++] = arg;
       argv[argc] = NULL;
     }
@@ -254,7 +254,7 @@ mi_parse (const char *cmd, char **token)
   /* Find/skip any token and then extract it.  */
   for (chp = cmd; *chp >= '0' && *chp <= '9'; chp++)
     ;
-  *token = xmalloc (chp - cmd + 1);
+  *token = (char *) xmalloc (chp - cmd + 1);
   memcpy (*token, cmd, (chp - cmd));
   (*token)[chp - cmd] = '\0';
 
@@ -276,7 +276,7 @@ mi_parse (const char *cmd, char **token)
 
     for (; *chp && !isspace (*chp); chp++)
       ;
-    parse->command = xmalloc (chp - tmp + 1);
+    parse->command = (char *) xmalloc (chp - tmp + 1);
     memcpy (parse->command, tmp, chp - tmp);
     parse->command[chp - tmp] = '\0';
   }
index 17c12f9210a0e0ca57328066bbef715523d76507..8610a150807ccb13ba337b36189250a670d235fc 100644 (file)
@@ -101,7 +101,7 @@ lzma_open (struct bfd *nbfd, void *open_closure)
     }
 
   offset -= options.backward_size;
-  indexdata = xmalloc (options.backward_size);
+  indexdata = (gdb_byte *) xmalloc (options.backward_size);
   index = NULL;
   pos = 0;
   if (bfd_seek (section->owner, offset, SEEK_SET) != 0
@@ -155,7 +155,7 @@ lzma_pread (struct bfd *nbfd, void *stream, void *buf, file_ptr nbytes,
          if (lzma_index_iter_locate (&iter, offset))
            break;
 
-         compressed = xmalloc (iter.block.total_size);
+         compressed = (gdb_byte *) xmalloc (iter.block.total_size);
          block_offset = section->filepos + iter.block.compressed_file_offset;
          if (bfd_seek (section->owner, block_offset, SEEK_SET) != 0
              || bfd_bread (compressed, iter.block.total_size, section->owner)
@@ -165,7 +165,7 @@ lzma_pread (struct bfd *nbfd, void *stream, void *buf, file_ptr nbytes,
              break;
            }
 
-         uncompressed = xmalloc (iter.block.uncompressed_size);
+         uncompressed = (gdb_byte *) xmalloc (iter.block.uncompressed_size);
 
          memset (&block, 0, sizeof (block));
          block.filters = filters;
index 89ccea88d4d0122df259d52d60ff73bce4d6300e..c0f84ee51c249391f246e4e1dccebfd27e098690 100644 (file)
@@ -6205,7 +6205,7 @@ mips_read_fp_register_single (struct frame_info *frame, int regno,
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
   int raw_size = register_size (gdbarch, regno);
-  gdb_byte *raw_buffer = alloca (raw_size);
+  gdb_byte *raw_buffer = (gdb_byte *) alloca (raw_size);
 
   if (!deprecated_frame_register_read (frame, regno, raw_buffer))
     error (_("can't read register %d (%s)"),
@@ -6281,8 +6281,9 @@ mips_print_fp_register (struct ui_file *file, struct frame_info *frame,
   double doub, flt1;   /* Doubles extracted from raw hex data.  */
   int inv1, inv2;
 
-  raw_buffer = alloca (2 * register_size (gdbarch,
-                                         mips_regnum (gdbarch)->fp0));
+  raw_buffer
+    = ((gdb_byte *)
+       alloca (2 * register_size (gdbarch, mips_regnum (gdbarch)->fp0)));
 
   fprintf_filtered (file, "%s:", gdbarch_register_name (gdbarch, regnum));
   fprintf_filtered (file, "%*s",
index d15c88c602a1bf43517d3e2cbd9bd9b4239a99c8..7cb83c0f82c7296a0048462e05f8083817bb15d3 100644 (file)
@@ -263,7 +263,7 @@ mipsnbsd_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
   CORE_ADDR jb_addr;
   gdb_byte *buf;
 
-  buf = alloca (NBSD_MIPS_JB_ELEMENT_SIZE (gdbarch));
+  buf = (gdb_byte *) alloca (NBSD_MIPS_JB_ELEMENT_SIZE (gdbarch));
 
   jb_addr = get_frame_register_unsigned (frame, MIPS_A0_REGNUM);
 
index 37f5b7abdb84eb3552f727983199408c58e90cb6..0710dea388c6423b9c4eb017c64f2fc2b5115081 100644 (file)
@@ -215,13 +215,13 @@ read_alphacoff_dynamic_symtab (struct section_offsets *section_offsets,
   str_secsize = bfd_get_section_size (si.str_sect);
   dyninfo_secsize = bfd_get_section_size (si.dyninfo_sect);
   got_secsize = bfd_get_section_size (si.got_sect);
-  sym_secptr = xmalloc (sym_secsize);
+  sym_secptr = (char *) xmalloc (sym_secsize);
   cleanups = make_cleanup (xfree, sym_secptr);
-  str_secptr = xmalloc (str_secsize);
+  str_secptr = (char *) xmalloc (str_secsize);
   make_cleanup (xfree, str_secptr);
-  dyninfo_secptr = xmalloc (dyninfo_secsize);
+  dyninfo_secptr = (char *) xmalloc (dyninfo_secsize);
   make_cleanup (xfree, dyninfo_secptr);
-  got_secptr = xmalloc (got_secsize);
+  got_secptr = (char *) xmalloc (got_secsize);
   make_cleanup (xfree, got_secptr);
 
   if (!bfd_get_section_contents (abfd, si.sym_sect, sym_secptr,
index ddc95229bb094e8ddd5ee1441048cc3ae64fbac9..21d081da7778f7a0dbbfaedb928fea778fb2707e 100644 (file)
@@ -200,7 +200,7 @@ mt_register_name (struct gdbarch *gdbarch, int regnum)
        array_names[regnum] = stub;
        return stub;
       }
-    name = xmalloc (30);
+    name = (char *) xmalloc (30);
     sprintf (name, "copro_%d_%d_%s", dim_1, dim_2, stub);
     array_names[regnum] = name;
     return name;
@@ -680,7 +680,7 @@ mt_registers_info (struct gdbarch *gdbarch,
 
          regsize = register_size (gdbarch, regnum);
 
-         buff = alloca (regsize);
+         buff = (unsigned char *) alloca (regsize);
          bytes = XALLOCAVEC (unsigned int, regsize);
 
          deprecated_frame_register_read (frame, regnum, buff);
@@ -707,7 +707,7 @@ mt_registers_info (struct gdbarch *gdbarch,
          gdb_byte *buf;
          struct value_print_options opts;
 
-         buf = alloca (register_size (gdbarch, MT_COPRO_REGNUM));
+         buf = (gdb_byte *) alloca (register_size (gdbarch, MT_COPRO_REGNUM));
          deprecated_frame_register_read (frame, MT_COPRO_REGNUM, buf);
          /* And print.  */
          regnum = MT_COPRO_PSEUDOREG_REGNUM;
@@ -849,7 +849,7 @@ mt_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
       /* Right-justify the value in an aligned-length buffer.  */
       typelen = TYPE_LENGTH (value_type (args[j]));
       slacklen = (wordsize - (typelen % wordsize)) % wordsize;
-      val = xmalloc (typelen + slacklen);
+      val = (gdb_byte *) xmalloc (typelen + slacklen);
       back_to = make_cleanup (xfree, val);
       memcpy (val, contents, typelen);
       memset (val + typelen, 0, slacklen);
index fdbe51b580be985dd4900fb8bbadeb800fa2a0bd..91cf5a2ad204879ff949cf6f562d6645af77b2dd 100644 (file)
@@ -45,6 +45,7 @@ add_using_directive (struct using_direct **using_directives,
 {
   struct using_direct *current;
   struct using_direct *newobj;
+  int alloc_len;
 
   /* Has it already been added?  */
 
@@ -81,15 +82,18 @@ add_using_directive (struct using_direct **using_directives,
       return;
     }
 
-  newobj = obstack_alloc (obstack, (sizeof (*newobj)
-                                + (VEC_length (const_char_ptr, excludes)
-                                   * sizeof (*newobj->excludes))));
+  alloc_len = (sizeof(*newobj)
+              + (VEC_length (const_char_ptr, excludes)
+                 * sizeof(*newobj->excludes)));
+  newobj = (struct using_direct *) obstack_alloc (obstack, alloc_len);
   memset (newobj, 0, sizeof (*newobj));
 
   if (copy_names)
     {
-      newobj->import_src = obstack_copy0 (obstack, src, strlen (src));
-      newobj->import_dest = obstack_copy0 (obstack, dest, strlen (dest));
+      newobj->import_src
+       = (const char *) obstack_copy0 (obstack, src, strlen (src));
+      newobj->import_dest
+       = (const char *) obstack_copy0 (obstack, dest, strlen (dest));
     }
   else
     {
@@ -98,13 +102,15 @@ add_using_directive (struct using_direct **using_directives,
     }
 
   if (alias != NULL && copy_names)
-    newobj->alias = obstack_copy0 (obstack, alias, strlen (alias));
+    newobj->alias
+      = (const char *) obstack_copy0 (obstack, alias, strlen (alias));
   else
     newobj->alias = alias;
 
   if (declaration != NULL && copy_names)
-    newobj->declaration = obstack_copy0 (obstack,
-                                     declaration, strlen (declaration));
+    newobj->declaration
+      = (const char *) obstack_copy0 (obstack, declaration,
+                                     strlen (declaration));
   else
     newobj->declaration = declaration;
 
index 08478d88c732936e29943c70a1d046194663f2e0..3173146cd3eab091359fbdc7b4984bc74dcf4b70 100644 (file)
@@ -132,7 +132,7 @@ perf_event_read (const struct perf_event_buffer *pev, __u64 data_head,
   start = begin + data_tail % buffer_size;
   stop = begin + data_head % buffer_size;
 
-  buffer = xmalloc (size);
+  buffer = (gdb_byte *) xmalloc (size);
 
   if (start < stop)
     memcpy (buffer, start, stop - start);
@@ -729,7 +729,8 @@ linux_enable_bts (ptid_t ptid, const struct btrace_config_bts *conf)
        continue;
 
       /* The number of pages we request needs to be a power of two.  */
-      header = mmap (NULL, length, PROT_READ, MAP_SHARED, bts->file, 0);
+      header = ((struct perf_event_mmap_page *)
+               mmap (NULL, length, PROT_READ, MAP_SHARED, bts->file, 0));
       if (header != MAP_FAILED)
        break;
     }
index 03e4a86cfb14d07bd2b9960c599f40a17f7353d8..56a8fe6783725804f5f14f53932fedb04bb1737c 100644 (file)
@@ -78,7 +78,7 @@ linux_common_core_of_thread (ptid_t ptid)
   for (;;)
     {
       int n;
-      content = xrealloc (content, content_read + 1024);
+      content = (char *) xrealloc (content, content_read + 1024);
       n = fread (content + content_read, 1, 1024, f);
       content_read += n;
       if (n < 1024)
index 4222df5ab57fb1704f7ba88d80b628a3d61fa31b..97331a4041ed1402fedb1bbd70226d754d309358 100644 (file)
@@ -101,7 +101,8 @@ linux_ptrace_test_ret_to_nx (void)
   long l;
   int status, kill_status;
 
-  return_address = mmap (NULL, 2, PROT_READ | PROT_WRITE,
+  return_address
+    = (gdb_byte *) mmap (NULL, 2, PROT_READ | PROT_WRITE,
                         MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
   if (return_address == MAP_FAILED)
     {
index ba3c845c3c8c14119d31fb9c43e0bc7431205fbf..81ee7fbb77bc33255117421bda78eaacd061195b 100644 (file)
@@ -118,11 +118,11 @@ nto_find_and_open_solib (char *solib, unsigned o_flags, char **temp_pathname)
 
   arch_len = (strlen (nto_root) + strlen (arch) + strlen (endian) + 2
              + strlen (solib));
-  arch_path = alloca (arch_len);
+  arch_path = (char *) alloca (arch_len);
   xsnprintf (arch_path, arch_len, "%s/%s%s", nto_root, arch, endian);
 
   len = strlen (PATH_FMT) + strlen (arch_path) * 5 + 1;
-  buf = alloca (len);
+  buf = (char *) alloca (len);
   xsnprintf (buf, len, PATH_FMT, arch_path, arch_path, arch_path, arch_path,
             arch_path);
 
@@ -194,7 +194,7 @@ nto_parse_redirection (char *pargv[], const char **pin, const char **pout,
   out = "";
   err = "";
 
-  argv = xcalloc (n + 1, sizeof argv[0]);
+  argv = XCNEWVEC (char *, n + 1);
   argc = n;
   for (i = 0, n = 0; n < argc; n++)
     {
index 44dfed73021b0206aa8b420eea73c2a216bf291e..227ecc0e2c8e09525abdca75551cef004a02e69a 100644 (file)
@@ -226,7 +226,7 @@ objc_demangle (const char *mangled, int options)
      (mangled[1] == 'i' || mangled[1] == 'c') &&
       mangled[2] == '_')
     {
-      cp = demangled = xmalloc(strlen(mangled) + 2);
+      cp = demangled = (char *) xmalloc (strlen (mangled) + 2);
 
       if (mangled[1] == 'i')
        *cp++ = '-';            /* for instance method */
@@ -1006,7 +1006,7 @@ find_methods (char type, const char *theclass, const char *category,
          while ((strlen (symname) + 1) >= tmplen)
            {
              tmplen = (tmplen == 0) ? 1024 : tmplen * 2;
-             tmp = xrealloc (tmp, tmplen);
+             tmp = (char *) xrealloc (tmp, tmplen);
            }
          strcpy (tmp, symname);
 
index f6be91ef3194d8429c415e2d8f72fd8d3e8b90d6..fc692d19f03391c3a3501f182abadda54e1f1051 100644 (file)
@@ -136,7 +136,9 @@ get_objfile_bfd_data (struct objfile *objfile, struct bfd *abfd)
         enough that this seems reasonable.  */
       if (abfd != NULL && !gdb_bfd_requires_relocations (abfd))
        {
-         storage = bfd_zalloc (abfd, sizeof (struct objfile_per_bfd_storage));
+         storage
+           = ((struct objfile_per_bfd_storage *)
+              bfd_zalloc (abfd, sizeof (struct objfile_per_bfd_storage)));
          set_bfd_data (abfd, objfiles_bfd_data, storage);
        }
       else
@@ -195,7 +197,8 @@ set_objfile_main_name (struct objfile *objfile,
   if (objfile->per_bfd->name_of_main == NULL
       || strcmp (objfile->per_bfd->name_of_main, name) != 0)
     objfile->per_bfd->name_of_main
-      = obstack_copy0 (&objfile->per_bfd->storage_obstack, name, strlen (name));
+      = (const char *) obstack_copy0 (&objfile->per_bfd->storage_obstack, name,
+                                     strlen (name));
   objfile->per_bfd->language_of_main = lang;
 }
 
@@ -392,9 +395,10 @@ allocate_objfile (bfd *abfd, const char *name, int flags)
     expanded_name = xstrdup (name);
   else
     expanded_name = gdb_abspath (name);
-  objfile->original_name = obstack_copy0 (&objfile->objfile_obstack,
-                                         expanded_name,
-                                         strlen (expanded_name));
+  objfile->original_name
+    = (char *) obstack_copy0 (&objfile->objfile_obstack,
+                             expanded_name,
+                             strlen (expanded_name));
   xfree (expanded_name);
 
   /* Update the per-objfile information that comes from the bfd, ensuring
@@ -951,7 +955,8 @@ objfile_relocate (struct objfile *objfile,
       gdb_assert (debug_objfile->num_sections
                  == gdb_bfd_count_sections (debug_objfile->obfd));
       new_debug_offsets = 
-       xmalloc (SIZEOF_N_SECTION_OFFSETS (debug_objfile->num_sections));
+       ((struct section_offsets *)
+        xmalloc (SIZEOF_N_SECTION_OFFSETS (debug_objfile->num_sections)));
       make_cleanup (xfree, new_debug_offsets);
       relative_addr_info_to_section_offsets (new_debug_offsets,
                                             debug_objfile->num_sections,
@@ -1399,7 +1404,7 @@ update_section_map (struct program_space *pspace,
 
   if (map_size < alloc_size)
     /* Some sections were eliminated.  Trim excess space.  */
-    map = xrealloc (map, map_size * sizeof (*map));
+    map = XRESIZEVEC (struct obj_section *, map, map_size);
   else
     gdb_assert (alloc_size == map_size);
 
index 6a269a853c1fd7d9096a2ca008b7c98c2e4076b7..eb5a750c86d534895109636a5e2714e7d4c034e7 100644 (file)
@@ -458,7 +458,7 @@ generic_elf_osabi_sniff_abi_tag_sections (bfd *abfd, asection *sect, void *obj)
      compressed section.  But, since note sections are not compressed,
      deferring the reading until we recognize the section avoids any
      error.  */
-  note = alloca (sectsize);
+  note = (char *) alloca (sectsize);
 
   /* .note.ABI-tag notes, used by GNU/Linux and FreeBSD.  */
   if (strcmp (name, ".note.ABI-tag") == 0)
index c255a57d0b6a175405a45278bac1a8b09a5c29cb..b4f08346aca5e09a3d25658f65475d4abce646f3 100644 (file)
@@ -364,7 +364,7 @@ exp :       exp '['
                              struct stoken stringsval;
                              char *buf;
 
-                             buf = alloca (strlen (arrayname) + 1);
+                             buf = (char *) alloca (strlen (arrayname) + 1);
                              stringsval.ptr = buf;
                              stringsval.length = strlen (arrayname);
                              strcpy (buf, arrayname);
@@ -1530,7 +1530,7 @@ yylex (void)
         so in expression to enter hexadecimal values
         we still need to use C syntax with 0xff  */
       write_dollar_variable (pstate, yylval.sval);
-      tmp = alloca (namelen + 1);
+      tmp = (char *) alloca (namelen + 1);
       memcpy (tmp, tokstart, namelen);
       tmp[namelen] = '\0';
       intvar = lookup_only_internalvar (tmp + 1);
@@ -1676,7 +1676,9 @@ yylex (void)
                      struct symbol *cur_sym;
                      /* As big as the whole rest of the expression, which is
                         at least big enough.  */
-                     char *ncopy = alloca (strlen (tmp)+strlen (namestart)+3);
+                     char *ncopy
+                       = (char *) alloca (strlen (tmp) + strlen (namestart)
+                                          + 3);
                      char *tmp1;
 
                      tmp1 = ncopy;
index 0ceddd1faa3f6c146a0c25651f4e8ce189a65048..4e1c812c41c7c169a82885c74b9230d7056d4188 100644 (file)
@@ -768,7 +768,7 @@ pascal_object_print_value (struct type *type, const gdb_byte *valaddr,
              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);
 
              base_valaddr = buf;
index acd48a5de50584bc20184ccbbc39fef932c0891b..fcd51f943643c09d5802711bba7668d673f568a8 100644 (file)
@@ -189,8 +189,9 @@ initialize_expout (struct parser_state *ps, size_t initial_size,
 {
   ps->expout_size = initial_size;
   ps->expout_ptr = 0;
-  ps->expout = xmalloc (sizeof (struct expression)
-                       + EXP_ELEM_TO_BYTES (ps->expout_size));
+  ps->expout
+    = (struct expression *) xmalloc (sizeof (struct expression)
+                                    + EXP_ELEM_TO_BYTES (ps->expout_size));
   ps->expout->language_defn = lang;
   ps->expout->gdbarch = gdbarch;
 }
@@ -585,7 +586,7 @@ mark_completion_tag (enum type_code tag, const char *ptr, int length)
              || tag == TYPE_CODE_STRUCT
              || tag == TYPE_CODE_ENUM);
   expout_tag_completion_type = tag;
-  expout_completion_name = xmalloc (length + 1);
+  expout_completion_name = (char *) xmalloc (length + 1);
   memcpy (expout_completion_name, ptr, length);
   expout_completion_name[length] = '\0';
 }
@@ -795,7 +796,7 @@ copy_name (struct stoken token)
   if (namecopy_size < token.length + 1)
     {
       namecopy_size = token.length + 1;
-      namecopy = xrealloc (namecopy, token.length + 1);
+      namecopy = (char *) xrealloc (namecopy, token.length + 1);
     }
       
   memcpy (namecopy, token.ptr, token.length);
@@ -1373,7 +1374,7 @@ parse_float (const char *p, int len, DOUBLEST *d, const char **suffix)
   char *copy;
   int n, num;
 
-  copy = xmalloc (len + 1);
+  copy = (char *) xmalloc (len + 1);
   memcpy (copy, p, len);
   copy[len] = 0;
 
@@ -1439,8 +1440,8 @@ type_stack_reserve (struct type_stack *stack, int howmuch)
       stack->size *= 2;
       if (stack->size < howmuch)
        stack->size = howmuch;
-      stack->elements = xrealloc (stack->elements,
-                                 stack->size * sizeof (union type_stack_elt));
+      stack->elements = XRESIZEVEC (union type_stack_elt, stack->elements,
+                                   stack->size);
     }
 }
 
index 56d9994476b3d0aa49fbdbb3ec42a9e7c35755c0..610e44fff70b02a134dcde935c0843073daae41c 100644 (file)
@@ -1079,7 +1079,7 @@ ppc_stap_parse_special_token (struct gdbarch *gdbarch,
        }
 
       len = s - p->arg;
-      regname = alloca (len + 2);
+      regname = (char *) alloca (len + 2);
       regname[0] = 'r';
 
       strncpy (regname + 1, p->arg, len);
@@ -1277,7 +1277,7 @@ ppu2spu_prev_register (struct frame_info *this_frame,
   struct gdbarch *gdbarch = get_regcache_arch (cache->regcache);
   gdb_byte *buf;
 
-  buf = alloca (register_size (gdbarch, regnum));
+  buf = (gdb_byte *) alloca (register_size (gdbarch, regnum));
 
   if (regnum < gdbarch_num_regs (gdbarch))
     regcache_raw_read (cache->regcache, regnum, buf);
index 7a1b8a5c46eb9e28abd328e9a0a701aa12bbc907..e27d12559d929b2584b04115bb3709f7a23112e3 100644 (file)
@@ -123,7 +123,7 @@ supply_register_at_address (struct regcache *regcache, int regnum,
   int buf_size = register_size (gdbarch, regnum);
   gdb_byte *buf;
 
-  buf = alloca (buf_size);
+  buf = (gdb_byte *) alloca (buf_size);
   read_memory (register_addr, buf, buf_size);
   regcache_raw_supply (regcache, regnum, buf);
 }
index 823f27b322c64a80d92b162ce5bb782821269df2..5dddf4e892d5c717c26efea0e6f8b12d6fd52444 100644 (file)
@@ -2064,7 +2064,7 @@ printf_wide_c_string (struct ui_file *stream, const char *format,
   struct type *wctype = lookup_typename (current_language, gdbarch,
                                         "wchar_t", NULL, 0);
   int wcwidth = TYPE_LENGTH (wctype);
-  gdb_byte *buf = alloca (wcwidth);
+  gdb_byte *buf = (gdb_byte *) alloca (wcwidth);
   struct obstack output;
   struct cleanup *inner_cleanup;
 
@@ -2203,7 +2203,7 @@ printf_pointer (struct ui_file *stream, const char *format,
   long val = value_as_long (value);
 #endif
 
-  fmt = alloca (strlen (format) + 5);
+  fmt = (char *) alloca (strlen (format) + 5);
 
   /* Copy up to the leading %.  */
   p = format;
index a3cfefe87c8e55896489477bd4ba0a29217cef93..5e95178f1e69ee5fea59b99fd98842de72414d7a 100644 (file)
@@ -146,9 +146,8 @@ parse_probes (const struct event_location *location,
              continue;
 
            ++result.nelts;
-           result.sals = xrealloc (result.sals,
-                                   result.nelts
-                                   * sizeof (struct symtab_and_line));
+           result.sals = XRESIZEVEC (struct symtab_and_line, result.sals,
+                                     result.nelts);
            sal = &result.sals[result.nelts - 1];
 
            init_sal (sal);
index b11fc3283de11a4223c8e9ff1893160d468bf659..303aecbceed519e7e40596a89fa21461eb255322 100644 (file)
@@ -452,7 +452,7 @@ gdbpy_parse_command_name (const char *name,
                   || name[i - 1] == '_');
        --i)
     ;
-  result = xmalloc (lastchar - i + 2);
+  result = (char *) xmalloc (lastchar - i + 2);
   memcpy (result, &name[i], lastchar - i + 1);
   result[lastchar - i + 1] = '\0';
 
@@ -465,7 +465,7 @@ gdbpy_parse_command_name (const char *name,
       return result;
     }
 
-  prefix_text = xmalloc (i + 2);
+  prefix_text = (char *) xmalloc (i + 2);
   memcpy (prefix_text, name, i + 1);
   prefix_text[i + 1] = '\0';
 
@@ -574,7 +574,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
          int i, out;
        
          /* Make a normalized form of the command name.  */
-         pfx_name = xmalloc (strlen (name) + 2);
+         pfx_name = (char *) xmalloc (strlen (name) + 2);
        
          i = 0;
          out = 0;
index 0cf4dfd219accf5b20651fefd3be495743a75c72..df14e28dbb22bbada5bb8ca6b2cbf49bf014c9a6 100644 (file)
@@ -63,7 +63,7 @@ gdbpy_readline_wrapper (FILE *sys_stdin, FILE *sys_stdout,
   /* Detect EOF (Ctrl-D).  */
   if (p == NULL)
     {
-      q = PyMem_Malloc (1);
+      q = (char *) PyMem_Malloc (1);
       if (q != NULL)
        q[0] = '\0';
       return q;
@@ -72,7 +72,7 @@ gdbpy_readline_wrapper (FILE *sys_stdin, FILE *sys_stdout,
   n = strlen (p);
 
   /* Copy the line to Python and return.  */
-  q = PyMem_Malloc (n + 2);
+  q = (char *) PyMem_Malloc (n + 2);
   if (q != NULL)
     {
       strncpy (q, p, n);
index 7c428a4e6c804478b1261adb16e4798e2475a80b..f0ae036da3529db153b6e1783ccd2568ea39be76 100644 (file)
@@ -370,8 +370,9 @@ set_sal (sal_object *sal_obj, struct symtab_and_line sal)
       Py_INCREF (Py_None);
     }
 
-  sal_obj->sal = xmemdup (&sal, sizeof (struct symtab_and_line),
-                         sizeof (struct symtab_and_line));
+  sal_obj->sal = ((struct symtab_and_line *)
+                 xmemdup (&sal, sizeof (struct symtab_and_line),
+                          sizeof (struct symtab_and_line)));
   sal_obj->symtab = symtab_obj;
   sal_obj->prev = NULL;
 
index 18f8f4d3546b44757b0de98fa15fb1c914708683..523cb76ab7d3bbccf5dcfe00f1f5e8868ae4d75d 100644 (file)
@@ -572,8 +572,10 @@ pyuw_sniffer (const struct frame_unwind *self, struct frame_info *this_frame,
     saved_reg *reg;
     int i;
 
-    cached_frame = xmalloc (sizeof (*cached_frame) +
-                            reg_count * sizeof (cached_frame->reg[0]));
+    cached_frame
+      = ((cached_frame_info *)
+        xmalloc (sizeof (*cached_frame)
+                 + reg_count * sizeof (cached_frame->reg[0])));
     cached_frame->gdbarch = gdbarch;
     cached_frame->frame_id = unwind_info->frame_id;
     cached_frame->reg_count = reg_count;
index 3a33c752ef91f3323ead457cba195b8afe977172..2031c0c824b0eef95a15a9c8a5897fef0b2d5094 100644 (file)
@@ -341,7 +341,7 @@ python_interactive_command (char *arg, int from_tty)
   if (arg && *arg)
     {
       int len = strlen (arg);
-      char *script = xmalloc (len + 2);
+      char *script = (char *) xmalloc (len + 2);
 
       strcpy (script, arg);
       script[len] = '\n';
@@ -428,7 +428,7 @@ compute_python_string (struct command_line *l)
   for (iter = l; iter; iter = iter->next)
     size += strlen (iter->line) + 1;
 
-  script = xmalloc (size + 1);
+  script = (char *) xmalloc (size + 1);
   here = 0;
   for (iter = l; iter; iter = iter->next)
     {
index fe36c96588246e6467608e2da546c1ea9a5c1b10..4adf9e33ba0e3a5895ac086c7525d374863ea9eb 100644 (file)
@@ -167,7 +167,7 @@ get_running_thread_id (void)
   object_addr = BMSYMBOL_VALUE_ADDRESS (object_msym);
   object_size = TYPE_LENGTH (builtin_type_void_data_ptr);
   buf_size = object_size;
-  buf = alloca (buf_size);
+  buf = (gdb_byte *) alloca (buf_size);
   read_memory (object_addr, buf, buf_size);
   return extract_typed_address (buf, builtin_type_void_data_ptr);
 }
index cb05437784e08ce39cc3623d3f3f96a57d6268a9..e2a36cf76a63577ff1f9f6e2472f6a8631e15a5f 100644 (file)
@@ -725,7 +725,7 @@ record_full_exec_insn (struct regcache *regcache,
        /* Nothing to do if the entry is flagged not_accessible.  */
         if (!entry->u.mem.mem_entry_not_accessible)
           {
-            gdb_byte *mem = alloca (entry->u.mem.len);
+            gdb_byte *mem = (gdb_byte *) alloca (entry->u.mem.len);
 
             if (record_debug > 1)
               fprintf_unfiltered (gdb_stdlog,
@@ -800,7 +800,7 @@ record_full_core_open_1 (const char *name, int from_tty)
 
   /* Get record_full_core_regbuf.  */
   target_fetch_registers (regcache, -1);
-  record_full_core_regbuf = xmalloc (MAX_REGISTER_SIZE * regnum);
+  record_full_core_regbuf = (gdb_byte *) xmalloc (MAX_REGISTER_SIZE * regnum);
   for (i = 0; i < regnum; i ++)
     regcache_raw_collect (regcache, i,
                          record_full_core_regbuf + MAX_REGISTER_SIZE * i);
index f1e03d3af27496aeae48eba4f4204af9b51f5cc8..c78c1423026b0804aec3446621209c0fac71b974 100644 (file)
@@ -675,7 +675,7 @@ regcache_raw_read_signed (struct regcache *regcache, int regnum, LONGEST *val)
 
   gdb_assert (regcache != NULL);
   gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
-  buf = alloca (regcache->descr->sizeof_register[regnum]);
+  buf = (gdb_byte *) alloca (regcache->descr->sizeof_register[regnum]);
   status = regcache_raw_read (regcache, regnum, buf);
   if (status == REG_VALID)
     *val = extract_signed_integer
@@ -695,7 +695,7 @@ regcache_raw_read_unsigned (struct regcache *regcache, int regnum,
 
   gdb_assert (regcache != NULL);
   gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
-  buf = alloca (regcache->descr->sizeof_register[regnum]);
+  buf = (gdb_byte *) alloca (regcache->descr->sizeof_register[regnum]);
   status = regcache_raw_read (regcache, regnum, buf);
   if (status == REG_VALID)
     *val = extract_unsigned_integer
@@ -822,7 +822,7 @@ regcache_cooked_read_signed (struct regcache *regcache, int regnum,
 
   gdb_assert (regcache != NULL);
   gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_cooked_registers);
-  buf = alloca (regcache->descr->sizeof_register[regnum]);
+  buf = (gdb_byte *) alloca (regcache->descr->sizeof_register[regnum]);
   status = regcache_cooked_read (regcache, regnum, buf);
   if (status == REG_VALID)
     *val = extract_signed_integer
@@ -842,7 +842,7 @@ regcache_cooked_read_unsigned (struct regcache *regcache, int regnum,
 
   gdb_assert (regcache != NULL);
   gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_cooked_registers);
-  buf = alloca (regcache->descr->sizeof_register[regnum]);
+  buf = (gdb_byte *) alloca (regcache->descr->sizeof_register[regnum]);
   status = regcache_cooked_read (regcache, regnum, buf);
   if (status == REG_VALID)
     *val = extract_unsigned_integer
index a6bb34dede10a4d6037a8a18a6d9b7f7de7d7e69..d84b3fffae60ea8036de7a0c02cad14e379c67eb 100644 (file)
@@ -450,7 +450,7 @@ remote_fileio_func_open (char *buf)
   mode = remote_fileio_mode_to_host (num, 1);
 
   /* Request pathname.  */
-  pathname = alloca (length);
+  pathname = (char *) alloca (length);
   if (target_read_memory (ptrval, (gdb_byte *) pathname, length) != 0)
     {
       remote_fileio_ioerror ();
@@ -794,7 +794,7 @@ remote_fileio_func_rename (char *buf)
     }
   
   /* Request oldpath using 'm' packet */
-  oldpath = alloca (old_len);
+  oldpath = (char *) alloca (old_len);
   if (target_read_memory (old_ptr, (gdb_byte *) oldpath, old_len) != 0)
     {
       remote_fileio_ioerror ();
@@ -802,7 +802,7 @@ remote_fileio_func_rename (char *buf)
     }
   
   /* Request newpath using 'm' packet */
-  newpath = alloca (new_len);
+  newpath = (char *) alloca (new_len);
   if (target_read_memory (new_ptr, (gdb_byte *) newpath, new_len) != 0)
     {
       remote_fileio_ioerror ();
@@ -880,7 +880,7 @@ remote_fileio_func_unlink (char *buf)
       return;
     }
   /* Request pathname using 'm' packet */
-  pathname = alloca (length);
+  pathname = (char *) alloca (length);
   if (target_read_memory (ptrval, (gdb_byte *) pathname, length) != 0)
     {
       remote_fileio_ioerror ();
@@ -930,7 +930,7 @@ remote_fileio_func_stat (char *buf)
   statptr = (CORE_ADDR) lnum;
   
   /* Request pathname using 'm' packet */
-  pathname = alloca (namelength);
+  pathname = (char *) alloca (namelength);
   if (target_read_memory (nameptr, (gdb_byte *) pathname, namelength) != 0)
     {
       remote_fileio_ioerror ();
@@ -1131,7 +1131,7 @@ remote_fileio_func_system (char *buf)
   if (length)
     {
       /* Request commandline using 'm' packet */
-      cmdline = alloca (length);
+      cmdline = (char *) alloca (length);
       if (target_read_memory (ptrval, (gdb_byte *) cmdline, length) != 0)
        {
          remote_fileio_ioerror ();
index 0846d84a58cb1cc98046818bbfe583092df0d2d7..e519b223fc10de8e3e4a9d3f9a8be24e5067ab21 100644 (file)
@@ -2160,7 +2160,7 @@ mips_xfer_memory (gdb_byte *readbuf, const gdb_byte *writebuf,
   /* Round ending address up; get number of longwords that makes.  */
   count = (((memaddr + len) - addr) + 3) / 4;
   /* Allocate buffer of that many longwords.  */
-  buffer = alloca (count * 4);
+  buffer = (gdb_byte *) alloca (count * 4);
 
   if (writebuf != NULL)
     {
@@ -2814,7 +2814,7 @@ mips_load_srec (const char *args)
   struct cleanup *cleanup;
   static int hashmark = 1;
 
-  buffer = alloca (srec_frame * 2 + 256);
+  buffer = (bfd_byte *) alloca (srec_frame * 2 + 256);
 
   abfd = gdb_bfd_open (args, NULL, -1);
   if (!abfd)
@@ -3322,7 +3322,8 @@ pmon_end_download (int final, int bintotal)
        mips_send_command ("initEther\r", -1);
 
       /* Send the load command.  */
-      cmd = xmalloc (strlen (load_cmd_prefix) + strlen (tftp_name) + 2);
+      cmd = (char *) xmalloc (strlen (load_cmd_prefix)
+                             + strlen (tftp_name) + 2);
       strcpy (cmd, load_cmd_prefix);
       strcat (cmd, tftp_name);
       strcat (cmd, "\r");
index b9dc4afb048cb976c47829844544888d32341748..11be6bba6aafcc47c5388df443465dd538d1b819 100644 (file)
@@ -470,7 +470,7 @@ new_remote_state (void)
   /* The default buffer size is unimportant; it will be expanded
      whenever a larger buffer is needed. */
   result->buf_size = 400;
-  result->buf = xmalloc (result->buf_size);
+  result->buf = (char *) xmalloc (result->buf_size);
   result->remote_traceframe_number = -1;
   result->last_sent_signal = GDB_SIGNAL_0;
   result->fs_pid = -1;
@@ -728,8 +728,7 @@ map_regcache_remote_table (struct gdbarch *gdbarch, struct packet_reg *regs)
      with a remote protocol number, in order of ascending protocol
      number.  */
 
-  remote_regs = alloca (gdbarch_num_regs (gdbarch)
-                       * sizeof (struct packet_reg *));
+  remote_regs = XALLOCAVEC (struct packet_reg *, gdbarch_num_regs (gdbarch));
   for (num_remote_regs = 0, regnum = 0;
        regnum < gdbarch_num_regs (gdbarch);
        regnum++)
@@ -765,7 +764,7 @@ remote_register_number_and_offset (struct gdbarch *gdbarch, int regnum,
 
   gdb_assert (regnum < gdbarch_num_regs (gdbarch));
 
-  regs = xcalloc (gdbarch_num_regs (gdbarch), sizeof (struct packet_reg));
+  regs = XCNEWVEC (struct packet_reg, gdbarch_num_regs (gdbarch));
   old_chain = make_cleanup (xfree, regs);
 
   sizeof_g_packet = map_regcache_remote_table (gdbarch, regs);
@@ -822,7 +821,7 @@ init_remote_state (struct gdbarch *gdbarch)
   if (rs->buf_size < rsa->remote_packet_size)
     {
       rs->buf_size = 2 * rsa->remote_packet_size;
-      rs->buf = xrealloc (rs->buf, rs->buf_size);
+      rs->buf = (char *) xrealloc (rs->buf, rs->buf_size);
     }
 
   return rsa;
@@ -1039,7 +1038,7 @@ get_memory_packet_size (struct memory_packet_config *config)
   if (rs->buf_size < what_they_get + 1)
     {
       rs->buf_size = 2 * what_they_get;
-      rs->buf = xrealloc (rs->buf, 2 * what_they_get);
+      rs->buf = (char *) xrealloc (rs->buf, 2 * what_they_get);
     }
 
   return what_they_get;
@@ -1938,7 +1937,7 @@ remote_pass_signals (struct target_ops *self,
          if (pass_signals[i])
            count++;
        }
-      pass_packet = xmalloc (count * 3 + strlen ("QPassSignals:") + 1);
+      pass_packet = (char *) xmalloc (count * 3 + strlen ("QPassSignals:") + 1);
       strcpy (pass_packet, "QPassSignals:");
       p = pass_packet + strlen (pass_packet);
       for (i = 0; i < numsigs; i++)
@@ -1989,7 +1988,7 @@ remote_program_signals (struct target_ops *self,
          if (signals[i])
            count++;
        }
-      packet = xmalloc (count * 3 + strlen ("QProgramSignals:") + 1);
+      packet = (char *) xmalloc (count * 3 + strlen ("QProgramSignals:") + 1);
       strcpy (packet, "QProgramSignals:");
       p = packet + strlen (packet);
       for (i = 0; i < numsigs; i++)
@@ -3882,7 +3881,7 @@ remote_start_remote (int from_tty, struct target_ops *target, int extended_p)
       else
        {
          /* Save the reply for later.  */
-         wait_status = alloca (strlen (rs->buf) + 1);
+         wait_status = (char *) alloca (strlen (rs->buf) + 1);
          strcpy (wait_status, rs->buf);
        }
 
@@ -4126,7 +4125,7 @@ remote_check_symbols (void)
 
   /* Allocate a message buffer.  We can't reuse the input buffer in RS,
      because we need both at the same time.  */
-  msg = xmalloc (get_remote_packet_size ());
+  msg = (char *) xmalloc (get_remote_packet_size ());
   old_chain = make_cleanup (xfree, msg);
 
   /* Invite target to request symbol lookups.  */
@@ -4580,7 +4579,7 @@ remote_query_supported (void)
   if (rs->buf_size < rs->explicit_packet_size)
     {
       rs->buf_size = rs->explicit_packet_size;
-      rs->buf = xrealloc (rs->buf, rs->buf_size);
+      rs->buf = (char *) xrealloc (rs->buf, rs->buf_size);
     }
 
   /* Handle the defaults for unmentioned features.  */
@@ -4969,7 +4968,7 @@ extended_remote_attach (struct target_ops *target, const char *args,
       if (!non_stop)
        {
          /* Save the reply for later.  */
-         wait_status = alloca (strlen (rs->buf) + 1);
+         wait_status = (char *) alloca (strlen (rs->buf) + 1);
          strcpy (wait_status, rs->buf);
        }
       else if (strcmp (rs->buf, "OK") != 0)
@@ -6877,7 +6876,7 @@ process_g_packet (struct regcache *regcache)
        }
     }
 
-  regs = alloca (rsa->sizeof_g_packet);
+  regs = (char *) alloca (rsa->sizeof_g_packet);
 
   /* Unimplemented registers read as all bits zero.  */
   memset (regs, 0, rsa->sizeof_g_packet);
@@ -7085,7 +7084,7 @@ store_registers_using_G (const struct regcache *regcache)
   {
     int i;
 
-    regs = alloca (rsa->sizeof_g_packet);
+    regs = (gdb_byte *) alloca (rsa->sizeof_g_packet);
     memset (regs, 0, rsa->sizeof_g_packet);
     for (i = 0; i < gdbarch_num_regs (get_regcache_arch (regcache)); i++)
       {
@@ -7939,7 +7938,7 @@ putpkt_binary (const char *buf, int cnt)
   struct remote_state *rs = get_remote_state ();
   int i;
   unsigned char csum = 0;
-  char *buf2 = xmalloc (cnt + 6);
+  char *buf2 = (char *) xmalloc (cnt + 6);
   struct cleanup *old_chain = make_cleanup (xfree, buf2);
 
   int ch;
@@ -8280,7 +8279,7 @@ read_frame (char **buf_p,
                  {
                    /* Make some more room in the buffer.  */
                    *sizeof_buf += repeat;
-                   *buf_p = xrealloc (*buf_p, *sizeof_buf);
+                   *buf_p = (char *) xrealloc (*buf_p, *sizeof_buf);
                    buf = *buf_p;
                  }
 
@@ -8298,7 +8297,7 @@ read_frame (char **buf_p,
            {
              /* Make some more room in the buffer.  */
              *sizeof_buf *= 2;
-             *buf_p = xrealloc (*buf_p, *sizeof_buf);
+             *buf_p = (char *) xrealloc (*buf_p, *sizeof_buf);
              buf = *buf_p;
            }
 
@@ -9463,7 +9462,7 @@ compare_sections_command (char *args, int from_tty)
       matched = 1;             /* Do this section.  */
       lma = s->lma;
 
-      sectdata = xmalloc (size);
+      sectdata = (gdb_byte *) xmalloc (size);
       old_chain = make_cleanup (xfree, sectdata);
       bfd_get_section_contents (exec_bfd, s, sectdata, 0, size);
 
@@ -10849,7 +10848,7 @@ remote_hostio_pread (struct target_ops *self,
   cache->fd = fd;
   cache->offset = offset;
   cache->bufsize = get_remote_packet_size ();
-  cache->buf = xrealloc (cache->buf, cache->bufsize);
+  cache->buf = (gdb_byte *) xrealloc (cache->buf, cache->bufsize);
 
   ret = remote_hostio_pread_vFile (self, cache->fd, cache->buf, cache->bufsize,
                                   cache->offset, remote_errno);
@@ -10935,7 +10934,7 @@ remote_hostio_readlink (struct target_ops *self,
   if (len < 0)
     return NULL;
 
-  ret = xmalloc (len + 1);
+  ret = (char *) xmalloc (len + 1);
 
   read_len = remote_unescape_input ((gdb_byte *) attachment, attachment_len,
                                    (gdb_byte *) ret, len);
@@ -11158,7 +11157,7 @@ remote_file_put (const char *local_file, const char *remote_file, int from_tty)
   /* Send up to this many bytes at once.  They won't all fit in the
      remote packet limit, so we'll transfer slightly fewer.  */
   io_size = get_remote_packet_size ();
-  buffer = xmalloc (io_size);
+  buffer = (gdb_byte *) xmalloc (io_size);
   make_cleanup (xfree, buffer);
 
   close_cleanup = make_cleanup (remote_hostio_close_cleanup, &fd);
@@ -11248,7 +11247,7 @@ remote_file_get (const char *remote_file, const char *local_file, int from_tty)
   /* Send up to this many bytes at once.  They won't all fit in the
      remote packet limit, so we'll transfer slightly fewer.  */
   io_size = get_remote_packet_size ();
-  buffer = xmalloc (io_size);
+  buffer = (gdb_byte *) xmalloc (io_size);
   make_cleanup (xfree, buffer);
 
   close_cleanup = make_cleanup (remote_hostio_close_cleanup, &fd);
@@ -12656,7 +12655,7 @@ remote_pid_to_exec_file (struct target_ops *self, int pid)
     {
       const int annex_size = 9;
 
-      annex = alloca (annex_size);
+      annex = (char *) alloca (annex_size);
       xsnprintf (annex, annex_size, "%x", pid);
     }
 
@@ -13575,6 +13574,6 @@ stepping is supported by the target.  The default is on."),
   any_thread_ptid = ptid_build (42000, 0, 1);
 
   target_buf_size = 2048;
-  target_buf = xmalloc (target_buf_size);
+  target_buf = (char *) xmalloc (target_buf_size);
 }
 
index ca262e9af684881ad3421f5188806fb0d3358a4e..2e57b84b88aea4bf00c8613ebcd74262a271a35c 100644 (file)
@@ -983,7 +983,7 @@ rs6000_aix_ld_info_to_xml (struct gdbarch *gdbarch, const gdb_byte *ldi_buf,
 
   obstack_grow_str0 (&obstack, "</library-list-aix>\n");
 
-  buf = obstack_finish (&obstack);
+  buf = (const char *) obstack_finish (&obstack);
   len_avail = strlen (buf);
   if (offset >= len_avail)
     len= 0;
@@ -1018,7 +1018,7 @@ rs6000_aix_core_xfer_shared_libraries_aix (struct gdbarch *gdbarch,
           bfd_errmsg (bfd_get_error ()));
   ldinfo_size = bfd_get_section_size (ldinfo_sec);
 
-  ldinfo_buf = xmalloc (ldinfo_size);
+  ldinfo_buf = (gdb_byte *) xmalloc (ldinfo_size);
   cleanup = make_cleanup (xfree, ldinfo_buf);
 
   if (! bfd_get_section_contents (core_bfd, ldinfo_sec,
index 785f4519a5f7d362b501cb977551c51a5b0f333a..14f121ab081796e8f99d9c6428f6f3584a2feebf 100644 (file)
@@ -992,7 +992,7 @@ ppc_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);
   struct cleanup *old_chain = make_cleanup (xfree, buf);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   int insn;
@@ -3613,7 +3613,7 @@ bfd_uses_spe_extensions (bfd *abfd)
     return 0;
 
   size = bfd_get_section_size (sect);
-  contents = xmalloc (size);
+  contents = (gdb_byte *) xmalloc (size);
   if (!bfd_get_section_contents (abfd, sect, contents, 0, size))
     {
       xfree (contents);
index 1e20c92b5482dbc30163b84fca0b9457bc2d11e4..8d277ac3f525b35af081bc0cc6f0a5f843daf17d 100644 (file)
@@ -1600,7 +1600,7 @@ s390_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);
   struct cleanup *old_chain = make_cleanup (xfree, buf);
 
   read_memory (from, buf, len);
index ef9336ead0a47fa3febf91e443f98576a9933bbb..09df712d0905fc3a1a22a0581d2dc24337834a2a 100644 (file)
@@ -825,7 +825,7 @@ score7_malloc_and_get_memblock (CORE_ADDR addr, CORE_ADDR size)
   else if (size == 0)
     return NULL;
 
-  memblock = xmalloc (size);
+  memblock = (gdb_byte *) xmalloc (size);
   memset (memblock, 0, size);
   ret = target_read_memory (addr & ~0x3, memblock, size);
   if (ret)
index 7261e73372bac6812a2484fb274256aaff940524..102b41abb2896771d28b2a09e2b03ded612f6eb1 100644 (file)
@@ -251,7 +251,7 @@ decode_loadmap (gdb_byte *buf)
      external loadsegs.  I.e, allocate the internal loadsegs.  */
   int_ldmbuf_size = (sizeof (struct int_elf32_dsbt_loadmap)
                     + (nsegs - 1) * sizeof (struct int_elf32_dsbt_loadseg));
-  int_ldmbuf = xmalloc (int_ldmbuf_size);
+  int_ldmbuf = (struct int_elf32_dsbt_loadmap *) xmalloc (int_ldmbuf_size);
 
   /* Place extracted information in internal structs.  */
   int_ldmbuf->version = version;
@@ -355,7 +355,7 @@ fetch_loadmap (CORE_ADDR ldmaddr)
   /* Allocate space for the complete (external) loadmap.  */
   ext_ldmbuf_size = sizeof (struct ext_elf32_dsbt_loadmap)
     + (nsegs - 1) * sizeof (struct ext_elf32_dsbt_loadseg);
-  ext_ldmbuf = xmalloc (ext_ldmbuf_size);
+  ext_ldmbuf = (struct ext_elf32_dsbt_loadmap *) xmalloc (ext_ldmbuf_size);
 
   /* Copy over the portion of the loadmap that's already been read.  */
   memcpy (ext_ldmbuf, &ext_ldmbuf_partial, sizeof ext_ldmbuf_partial);
@@ -374,7 +374,7 @@ fetch_loadmap (CORE_ADDR ldmaddr)
      external loadsegs.  I.e, allocate the internal loadsegs.  */
   int_ldmbuf_size = sizeof (struct int_elf32_dsbt_loadmap)
     + (nsegs - 1) * sizeof (struct int_elf32_dsbt_loadseg);
-  int_ldmbuf = xmalloc (int_ldmbuf_size);
+  int_ldmbuf = (struct int_elf32_dsbt_loadmap *) xmalloc (int_ldmbuf_size);
 
   /* Place extracted information in internal structs.  */
   int_ldmbuf->version = version;
@@ -452,7 +452,7 @@ scan_dyntag (int dyntag, bfd *abfd, CORE_ADDR *ptr)
   /* Read in .dynamic from the BFD.  We will get the actual value
      from memory later.  */
   sect_size = bfd_section_size (abfd, sect);
-  buf = bufstart = alloca (sect_size);
+  buf = bufstart = (gdb_byte *) alloca (sect_size);
   if (!bfd_get_section_contents (abfd, sect,
                                 buf, 0, sect_size))
     return 0;
@@ -825,7 +825,7 @@ enable_break (void)
       /* Read the contents of the .interp section into a local buffer;
         the contents specify the dynamic linker this program uses.  */
       interp_sect_size = bfd_section_size (exec_bfd, interp_sect);
-      buf = alloca (interp_sect_size);
+      buf = (char *) alloca (interp_sect_size);
       bfd_get_section_contents (exec_bfd, interp_sect,
                                buf, 0, interp_sect_size);
 
@@ -944,8 +944,8 @@ dsbt_relocate_main_executable (void)
   info->main_executable_lm_info = XCNEW (struct lm_info);
   info->main_executable_lm_info->map = ldm;
 
-  new_offsets = xcalloc (symfile_objfile->num_sections,
-                        sizeof (struct section_offsets));
+  new_offsets = XCNEWVEC (struct section_offsets,
+                         symfile_objfile->num_sections);
   old_chain = make_cleanup (xfree, new_offsets);
   changed = 0;
 
index 179974f24d94ad8033c22530dcbd81b6ecc628bc..922ee36a88a26919224b2bb1e56f49d251f36f28 100644 (file)
@@ -132,7 +132,7 @@ fetch_loadmap (CORE_ADDR ldmaddr)
   /* Allocate space for the complete (external) loadmap.  */
   ext_ldmbuf_size = sizeof (struct ext_elf32_fdpic_loadmap)
                + (nsegs - 1) * sizeof (struct ext_elf32_fdpic_loadseg);
-  ext_ldmbuf = xmalloc (ext_ldmbuf_size);
+  ext_ldmbuf = (struct ext_elf32_fdpic_loadmap *) xmalloc (ext_ldmbuf_size);
 
   /* Copy over the portion of the loadmap that's already been read.  */
   memcpy (ext_ldmbuf, &ext_ldmbuf_partial, sizeof ext_ldmbuf_partial);
@@ -151,7 +151,7 @@ fetch_loadmap (CORE_ADDR ldmaddr)
      external loadsegs.  I.e, allocate the internal loadsegs.  */
   int_ldmbuf_size = sizeof (struct int_elf32_fdpic_loadmap)
                + (nsegs - 1) * sizeof (struct int_elf32_fdpic_loadseg);
-  int_ldmbuf = xmalloc (int_ldmbuf_size);
+  int_ldmbuf = (struct int_elf32_fdpic_loadmap *) xmalloc (int_ldmbuf_size);
 
   /* Place extracted information in internal structs.  */
   int_ldmbuf->version = version;
@@ -543,7 +543,7 @@ enable_break2 (void)
       /* Read the contents of the .interp section into a local buffer;
          the contents specify the dynamic linker this program uses.  */
       interp_sect_size = bfd_section_size (exec_bfd, interp_sect);
-      buf = alloca (interp_sect_size);
+      buf = (char *) alloca (interp_sect_size);
       bfd_get_section_contents (exec_bfd, interp_sect,
                                buf, 0, interp_sect_size);
 
@@ -802,8 +802,8 @@ frv_relocate_main_executable (void)
   main_executable_lm_info = XCNEW (struct lm_info);
   main_executable_lm_info->map = ldm;
 
-  new_offsets = xcalloc (symfile_objfile->num_sections,
-                        sizeof (struct section_offsets));
+  new_offsets = XCNEWVEC (struct section_offsets,
+                         symfile_objfile->num_sections);
   old_chain = make_cleanup (xfree, new_offsets);
   changed = 0;
 
index a629ec9818c78f36c71863a160ced3f8661deb7f..12ff49e20c4d1a0e0e435d85586ca9283cf1e344 100644 (file)
@@ -56,8 +56,8 @@ spu_relocate_main_executable (int spufs_fd)
   if (symfile_objfile == NULL)
     return;
 
-  new_offsets = alloca (symfile_objfile->num_sections
-                       * sizeof (struct section_offsets));
+  new_offsets = XALLOCAVEC (struct section_offsets,
+                           symfile_objfile->num_sections);
 
   for (i = 0; i < symfile_objfile->num_sections; i++)
     new_offsets->offsets[i] = SPUADDR (spufs_fd, 0);
@@ -373,7 +373,8 @@ spu_bfd_open (char *pathname)
 
       if (sect_size > 20)
        {
-         char *buf = alloca (sect_size - 20 + strlen (original_name) + 1);
+         char *buf
+           = (char *) alloca (sect_size - 20 + strlen (original_name) + 1);
 
          bfd_get_section_contents (abfd, spu_name, buf, 20, sect_size - 20);
          buf[sect_size - 20] = '\0';
index 5d3d41e006b80a8808909ce30561d9569319ddb6..04d797bff8bae25c0458b7f96f24c1df5bcff107 100644 (file)
@@ -197,7 +197,7 @@ lm_info_read (CORE_ADDR lm_addr)
   struct lm_info *lm_info;
   struct cleanup *back_to;
 
-  lm = xmalloc (lmo->link_map_size);
+  lm = (gdb_byte *) xmalloc (lmo->link_map_size);
   back_to = make_cleanup (xfree, lm);
 
   if (target_read_memory (lm_addr, lm, lmo->link_map_size) != 0)
@@ -567,7 +567,7 @@ read_program_header (int type, int *p_sect_size, int *p_arch_size,
     }
 
   /* Read in requested program header.  */
-  buf = xmalloc (sect_size);
+  buf = (gdb_byte *) xmalloc (sect_size);
   if (target_read_memory (sect_addr, buf, sect_size))
     {
       xfree (buf);
@@ -602,7 +602,7 @@ find_program_interpreter (void)
       {
        int sect_size = bfd_section_size (exec_bfd, interp_sect);
 
-       buf = xmalloc (sect_size);
+       buf = (gdb_byte *) xmalloc (sect_size);
        bfd_get_section_contents (exec_bfd, interp_sect, buf, 0, sect_size);
       }
    }
@@ -666,7 +666,7 @@ scan_dyntag (const int desired_dyntag, bfd *abfd, CORE_ADDR *ptr,
   /* Read in .dynamic from the BFD.  We will get the actual value
      from memory later.  */
   sect_size = bfd_section_size (abfd, sect);
-  buf = bufstart = alloca (sect_size);
+  buf = bufstart = (gdb_byte *) alloca (sect_size);
   if (!bfd_get_section_contents (abfd, sect,
                                 buf, 0, sect_size))
     return 0;
@@ -811,7 +811,7 @@ elf_locate_base (void)
       gdb_byte *pbuf;
       int pbuf_size = TYPE_LENGTH (ptr_type);
 
-      pbuf = alloca (pbuf_size);
+      pbuf = (gdb_byte *) alloca (pbuf_size);
       /* DT_MIPS_RLD_MAP contains a pointer to the address
         of the dynamic link structure.  */
       if (target_read_memory (dyn_ptr, pbuf, pbuf_size))
@@ -829,7 +829,7 @@ elf_locate_base (void)
       gdb_byte *pbuf;
       int pbuf_size = TYPE_LENGTH (ptr_type);
 
-      pbuf = alloca (pbuf_size);
+      pbuf = (gdb_byte *) alloca (pbuf_size);
       /* DT_MIPS_RLD_MAP_REL contains an offset from the address of the
         DT slot to the address of the dynamic link structure.  */
       if (target_read_memory (dyn_ptr + dyn_ptr_addr, pbuf, pbuf_size))
@@ -1018,7 +1018,7 @@ open_symbol_file_object (void *from_ttyp)
   struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
   struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
   int l_name_size = TYPE_LENGTH (ptr_type);
-  gdb_byte *l_name_buf = xmalloc (l_name_size);
+  gdb_byte *l_name_buf = (gdb_byte *) xmalloc (l_name_size);
   struct cleanup *cleanups = make_cleanup (xfree, l_name_buf);
   struct svr4_info *info = get_svr4_info ();
 
@@ -2569,7 +2569,7 @@ read_program_headers_from_bfd (bfd *abfd, int *phdrs_size)
   if (*phdrs_size == 0)
     return NULL;
 
-  buf = xmalloc (*phdrs_size);
+  buf = (gdb_byte *) xmalloc (*phdrs_size);
   if (bfd_seek (abfd, ehdr->e_phoff, SEEK_SET) != 0
       || bfd_bread (buf, *phdrs_size, abfd) != *phdrs_size)
     {
@@ -3033,8 +3033,8 @@ svr4_relocate_main_executable (void)
       struct section_offsets *new_offsets;
       int i;
 
-      new_offsets = alloca (symfile_objfile->num_sections
-                           * sizeof (*new_offsets));
+      new_offsets = XALLOCAVEC (struct section_offsets,
+                               symfile_objfile->num_sections);
 
       for (i = 0; i < symfile_objfile->num_sections; i++)
        new_offsets->offsets[i] = displacement;
index f14363a4d9812517f8aedb7dbd3e34315eb77817..a41560e17c1eb6881e989f13709e219a631a2745 100644 (file)
@@ -345,7 +345,9 @@ solib_target_relocate_section_addresses (struct so_list *so,
     {
       int num_sections = gdb_bfd_count_sections (so->abfd);
 
-      so->lm_info->offsets = xzalloc (SIZEOF_N_SECTION_OFFSETS (num_sections));
+      so->lm_info->offsets
+       = ((struct section_offsets *)
+          xzalloc (SIZEOF_N_SECTION_OFFSETS (num_sections)));
 
       if (so->lm_info->section_bases)
        {
index c46116d4fbcdb162c187fdfa07b3fbc2ef2cf9ee..d6ab93d3c4087e1ffe66efb001086289d4353938 100644 (file)
@@ -192,7 +192,7 @@ solib_find_1 (char *in_pathname, int *fd, int is_solib)
       char *p;
 
       /* Avoid clobbering our input.  */
-      p = alloca (strlen (in_pathname) + 1);
+      p = (char *) alloca (strlen (in_pathname) + 1);
       strcpy (p, in_pathname);
       in_pathname = p;
 
@@ -396,7 +396,7 @@ exec_file_find (char *in_pathname, int *fd)
        {
          char *new_pathname;
 
-         new_pathname = alloca (strlen (in_pathname) + 5);
+         new_pathname = (char *) alloca (strlen (in_pathname) + 5);
          strcpy (new_pathname, in_pathname);
          strcat (new_pathname, ".exe");
 
@@ -434,8 +434,9 @@ solib_find (char *in_pathname, int *fd)
        {
          char *new_pathname;
 
-         new_pathname = alloca (p - in_pathname + 1
-                                + strlen (solib_symbols_extension) + 1);
+         new_pathname
+           = (char *) alloca (p - in_pathname + 1
+                              + strlen (solib_symbols_extension) + 1);
          memcpy (new_pathname, in_pathname, p - in_pathname + 1);
          strcpy (new_pathname + (p - in_pathname) + 1,
                  solib_symbols_extension);
index fab974c2119a76916ffc2d12616f0abfa61532c7..3e5e15c1112915d228ce443a608460f113ee7505 100644 (file)
@@ -775,7 +775,7 @@ openp (const char *path, int opts, const char *string,
 
       if (is_regular_file (string))
        {
-         filename = alloca (strlen (string) + 1);
+         filename = (char *) alloca (strlen (string) + 1);
          strcpy (filename, string);
          fd = gdb_open_cloexec (filename, mode, 0);
          if (fd >= 0)
@@ -806,7 +806,7 @@ openp (const char *path, int opts, const char *string,
     string += 2;
 
   alloclen = strlen (path) + strlen (string) + 2;
-  filename = alloca (alloclen);
+  filename = (char *) alloca (alloclen);
   fd = -1;
 
   dir_vec = dirnames_to_char_ptr_vec (path);
@@ -827,7 +827,7 @@ openp (const char *path, int opts, const char *string,
          if (newlen > alloclen)
            {
              alloclen = newlen;
-             filename = alloca (alloclen);
+             filename = (char *) alloca (alloclen);
            }
          strcpy (filename, current_directory);
        }
@@ -845,7 +845,7 @@ openp (const char *path, int opts, const char *string,
          if (newlen > alloclen)
            {
              alloclen = newlen;
-             filename = alloca (alloclen);
+             filename = (char *) alloca (alloclen);
            }
          strcpy (filename, tilde_expanded);
          xfree (tilde_expanded);
@@ -1366,7 +1366,7 @@ print_source_lines_base (struct symtab *s, int line, int stopline,
        {
          const char *filename = symtab_to_filename_for_display (s);
          int len = strlen (filename) + 100;
-         char *name = alloca (len);
+         char *name = (char *) alloca (len);
 
          xsnprintf (name, len, "%d\t%s", line, filename);
          print_sys_errmsg (name, errno);
@@ -1393,7 +1393,7 @@ print_source_lines_base (struct symtab *s, int line, int stopline,
              /* ui_out_field_string may free S_FULLNAME by calling
                 open_source_file for it again.  See e.g.,
                 tui_field_string->tui_show_source.  */
-             local_fullname = alloca (strlen (s_fullname) + 1);
+             local_fullname = (char *) alloca (strlen (s_fullname) + 1);
              strcpy (local_fullname, s_fullname);
 
              ui_out_field_string (uiout, "fullname", local_fullname);
@@ -1644,7 +1644,7 @@ forward_search_command (char *regex, int from_tty)
       int cursize, newsize;
 
       cursize = 256;
-      buf = xmalloc (cursize);
+      buf = (char *) xmalloc (cursize);
       p = buf;
 
       c = fgetc (stream);
@@ -1656,7 +1656,7 @@ forward_search_command (char *regex, int from_tty)
          if (p - buf == cursize)
            {
              newsize = cursize + cursize / 2;
-             buf = xrealloc (buf, newsize);
+             buf = (char *) xrealloc (buf, newsize);
              p = buf + cursize;
              cursize = newsize;
            }
index 80c5e84f0ad4abe8b5924dc193817fb45dd8f888..02f9f7c708383ac8ec539db59d15378fe926775d 100644 (file)
@@ -66,7 +66,7 @@ supply_register_at_address (struct regcache *regcache, int regnum,
   int buf_size = register_size (gdbarch, regnum);
   gdb_byte *buf;
 
-  buf = alloca (buf_size);
+  buf = (gdb_byte *) alloca (buf_size);
   read_memory (register_addr, buf, buf_size);
   regcache_raw_supply (regcache, regnum, buf);
 }
index 4c3f77754ece5940171488e314a98600c8f44205..6e754a40140d331d6abdf60bafe1da5426a9276a 100644 (file)
@@ -1228,7 +1228,7 @@ spu2ppu_prev_register (struct frame_info *this_frame,
   struct gdbarch *gdbarch = get_regcache_arch (cache->regcache);
   gdb_byte *buf;
 
-  buf = alloca (register_size (gdbarch, regnum));
+  buf = (gdb_byte *) alloca (register_size (gdbarch, regnum));
   regcache_cooked_read (cache->regcache, regnum, buf);
   return frame_unwind_got_bytes (this_frame, regnum, buf);
 }
@@ -1827,7 +1827,7 @@ spu_get_overlay_table (struct objfile *objfile)
   ovly_buf_table_base = BMSYMBOL_VALUE_ADDRESS (ovly_buf_table_msym);
   ovly_buf_table_size = MSYMBOL_SIZE (ovly_buf_table_msym.minsym);
 
-  ovly_table = xmalloc (ovly_table_size);
+  ovly_table = (gdb_byte *) xmalloc (ovly_table_size);
   read_memory (ovly_table_base, ovly_table, ovly_table_size);
 
   tbl = OBSTACK_CALLOC (&objfile->objfile_obstack,
index 900344287bf55993f71bc6b005bfb377bb205d7b..650d424f76dfe0ecd6a1325bd070183a4a769027 100644 (file)
@@ -398,8 +398,8 @@ patch_block_stabs (struct pending *symbols, struct pending_stabs *stabs,
              SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
              SYMBOL_ACLASS_INDEX (sym) = LOC_OPTIMIZED_OUT;
              SYMBOL_SET_LINKAGE_NAME
-               (sym, obstack_copy0 (&objfile->objfile_obstack,
-                                    name, pp - name));
+               (sym, (char *) obstack_copy0 (&objfile->objfile_obstack,
+                                             name, pp - name));
              pp += 2;
              if (*(pp - 1) == 'F' || *(pp - 1) == 'f')
                {
@@ -716,7 +716,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
     normal:
       if (SYMBOL_LANGUAGE (sym) == language_cplus)
        {
-         char *name = alloca (p - string + 1);
+         char *name = (char *) alloca (p - string + 1);
 
          memcpy (name, string, p - string);
          name[p - string] = '\0';
@@ -784,9 +784,9 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
               probably has the necessary code.  */
 
            dbl_type = objfile_type (objfile)->builtin_double;
-           dbl_valu =
-             obstack_alloc (&objfile->objfile_obstack,
-                            TYPE_LENGTH (dbl_type));
+           dbl_valu
+             = (gdb_byte *) obstack_alloc (&objfile->objfile_obstack,
+                                           TYPE_LENGTH (dbl_type));
            store_typed_floating (dbl_valu, dbl_type, d);
 
            SYMBOL_TYPE (sym) = dbl_type;
@@ -868,7 +868,8 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
            SYMBOL_TYPE (sym) = create_array_type (NULL,
                                  objfile_type (objfile)->builtin_char,
                                  range_type);
-           string_value = obstack_alloc (&objfile->objfile_obstack, ind + 1);
+           string_value
+             = (gdb_byte *) obstack_alloc (&objfile->objfile_obstack, ind + 1);
            memcpy (string_value, string_local, ind + 1);
            p++;
 
@@ -1622,15 +1623,16 @@ again:
          type_name = NULL;
          if (current_subfile->language == language_cplus)
            {
-             char *new_name, *name = alloca (p - *pp + 1);
+             char *new_name, *name = (char *) alloca (p - *pp + 1);
 
              memcpy (name, *pp, p - *pp);
              name[p - *pp] = '\0';
              new_name = cp_canonicalize_string (name);
              if (new_name != NULL)
                {
-                 type_name = obstack_copy0 (&objfile->objfile_obstack,
-                                            new_name, strlen (new_name));
+                 type_name
+                   = (char *) obstack_copy0 (&objfile->objfile_obstack,
+                                             new_name, strlen (new_name));
                  xfree (new_name);
                }
            }
@@ -2711,8 +2713,9 @@ read_member_functions (struct field_info *fip, char **pp, struct type *type,
                                             dem_opname, 0);
              if (ret)
                new_fnlist->fn_fieldlist.name
-                 = obstack_copy0 (&objfile->objfile_obstack,
-                                  dem_opname, strlen (dem_opname));
+                 = ((const char *)
+                    obstack_copy0 (&objfile->objfile_obstack, dem_opname,
+                                   strlen (dem_opname)));
              xfree (main_fn_name);
            }
 
@@ -2853,8 +2856,8 @@ read_one_struct_field (struct field_info *fip, char **pp, char *p,
 {
   struct gdbarch *gdbarch = get_objfile_arch (objfile);
 
-  fip->list->field.name =
-    obstack_copy0 (&objfile->objfile_obstack, *pp, p - *pp);
+  fip->list->field.name
+    = (const char *) obstack_copy0 (&objfile->objfile_obstack, *pp, p - *pp);
   *pp = p + 1;
 
   /* This means we have a visibility for a field coming.  */
@@ -3676,7 +3679,7 @@ read_enum_type (char **pp, struct type *type,
       p = *pp;
       while (*p != ':')
        p++;
-      name = obstack_copy0 (&objfile->objfile_obstack, *pp, p - *pp);
+      name = (char *) obstack_copy0 (&objfile->objfile_obstack, *pp, p - *pp);
       *pp = p + 1;
       n = read_huge_number (pp, ',', &nbits, 0);
       if (nbits != 0)
@@ -4329,8 +4332,8 @@ common_block_start (char *name, struct objfile *objfile)
     }
   common_block = local_symbols;
   common_block_i = local_symbols ? local_symbols->nsyms : 0;
-  common_block_name = obstack_copy0 (&objfile->objfile_obstack,
-                                    name, strlen (name));
+  common_block_name = (char *) obstack_copy0 (&objfile->objfile_obstack, name,
+                                             strlen (name));
 }
 
 /* Process a N_ECOMM symbol.  */
index 7d37dd179fad4ba3f57616d49099c69da2f0ec86..2b7cc92c73c830960f137aac455021fa9ab67713 100644 (file)
@@ -348,7 +348,7 @@ read_frame_arg (struct symbol *sym, struct frame_info *frame,
        }
       CATCH (except, RETURN_MASK_ERROR)
        {
-         val_error = alloca (strlen (except.message) + 1);
+         val_error = (char *) alloca (strlen (except.message) + 1);
          strcpy (val_error, except.message);
        }
       END_CATCH
@@ -475,7 +475,7 @@ read_frame_arg (struct symbol *sym, struct frame_info *frame,
            }
          CATCH (except, RETURN_MASK_ERROR)
            {
-             val_error = alloca (strlen (except.message) + 1);
+             val_error = (char *) alloca (strlen (except.message) + 1);
              strcpy (val_error, except.message);
            }
          END_CATCH
@@ -1915,7 +1915,7 @@ backtrace_command (char *arg, int from_tty)
        {
          if (arglen > 0)
            {
-             arg = xmalloc (arglen + 1);
+             arg = (char *) xmalloc (arglen + 1);
              make_cleanup (xfree, arg);
              arg[0] = 0;
              for (i = 0; i < argc; i++)
index 8f8cea67fd339a6e8d7431833d52788c0af5f168..691877fd64f9ff5a9b3d32bcb2c63b30bf83f640 100644 (file)
@@ -653,7 +653,7 @@ stap_parse_register_operand (struct stap_parse_info *p)
 
   len = p->arg - start;
 
-  regname = alloca (len + gdb_reg_prefix_len + gdb_reg_suffix_len + 1);
+  regname = (char *) alloca (len + gdb_reg_prefix_len + gdb_reg_suffix_len + 1);
   regname[0] = '\0';
 
   /* We only add the GDB's register prefix/suffix if we are dealing with
index cbb6d25037efda6e8f57a8eecf2105f1ad144f17..229f9b430b90ce0827eab231d61dd09bdfb0b39e 100644 (file)
@@ -1015,7 +1015,8 @@ syms_from_objfile_1 (struct objfile *objfile,
 
       objfile->num_sections = num_sections;
       objfile->section_offsets
-        = obstack_alloc (&objfile->objfile_obstack, size);
+       = (struct section_offsets *) obstack_alloc (&objfile->objfile_obstack,
+                                                   size);
       memset (objfile->section_offsets, 0, size);
       return;
     }
@@ -1470,12 +1471,13 @@ find_separate_debug_file (const char *dir,
   if (canon_dir != NULL && strlen (canon_dir) > i)
     i = strlen (canon_dir);
 
-  debugfile = xmalloc (strlen (debug_file_directory) + 1
-                      + i
-                      + strlen (DEBUG_SUBDIRECTORY)
-                      + strlen ("/")
-                      + strlen (debuglink)
-                      + 1);
+  debugfile
+    = (char *) xmalloc (strlen (debug_file_directory) + 1
+                       + i
+                       + strlen (DEBUG_SUBDIRECTORY)
+                       + strlen ("/")
+                       + strlen (debuglink)
+                       + 1);
 
   /* First try in the same directory as the original file.  */
   strcpy (debugfile, dir);
@@ -1860,7 +1862,7 @@ load_command (char *arg, int from_tty)
       if (count)
        {
          /* We need to quote this string so buildargv can pull it apart.  */
-         char *temp = xmalloc (strlen (arg) + count + 1 );
+         char *temp = (char *) xmalloc (strlen (arg) + count + 1 );
          char *ptemp = temp;
          char *prev;
 
@@ -1971,7 +1973,7 @@ load_progress (ULONGEST bytes, void *untyped_arg)
         might add a verify_memory() method to the target vector and
         then use that.  remote.c could implement that method using
         the ``qCRC'' packet.  */
-      gdb_byte *check = xmalloc (bytes);
+      gdb_byte *check = (gdb_byte *) xmalloc (bytes);
       struct cleanup *verify_cleanups = make_cleanup (xfree, check);
 
       if (target_read_memory (args->lma, check, bytes) != 0)
@@ -2026,7 +2028,7 @@ load_section_callback (bfd *abfd, asection *asec, void *data)
   new_request->begin = bfd_section_lma (abfd, asec) + args->load_offset;
   new_request->end = new_request->begin + size; /* FIXME Should size
                                                   be in instead?  */
-  new_request->data = xmalloc (size);
+  new_request->data = (gdb_byte *) xmalloc (size);
   new_request->baton = section_data;
 
   buffer = new_request->data;
@@ -2629,9 +2631,9 @@ reread_symbols (void)
             do it *after* the obstack has been initialized.  */
          set_objfile_per_bfd (objfile);
 
-         objfile->original_name = obstack_copy0 (&objfile->objfile_obstack,
-                                                 original_name,
-                                                 strlen (original_name));
+         objfile->original_name
+           = (char *) obstack_copy0 (&objfile->objfile_obstack, original_name,
+                                     strlen (original_name));
 
          /* Reset the sym_fns pointer.  The ELF reader can change it
             based on whether .gdb_index is present, and we need it to
@@ -2732,9 +2734,9 @@ add_filename_language (char *ext, enum language lang)
   if (fl_table_next >= fl_table_size)
     {
       fl_table_size += 10;
-      filename_language_table =
-       xrealloc (filename_language_table,
-                 fl_table_size * sizeof (*filename_language_table));
+      filename_language_table = XRESIZEVEC (filename_language,
+                                           filename_language_table,
+                                           fl_table_size);
     }
 
   filename_language_table[fl_table_next].ext = xstrdup (ext);
@@ -2961,8 +2963,9 @@ allocate_compunit_symtab (struct objfile *objfile, const char *name)
      Just save the basename to avoid path issues (too long for display,
      relative vs absolute, etc.).  */
   saved_name = lbasename (name);
-  cu->name = obstack_copy0 (&objfile->objfile_obstack, saved_name,
-                           strlen (saved_name));
+  cu->name
+    = (const char *) obstack_copy0 (&objfile->objfile_obstack, saved_name,
+                                   strlen (saved_name));
 
   COMPUNIT_DEBUGFORMAT (cu) = "unknown";
 
@@ -3562,7 +3565,7 @@ read_target_long_array (CORE_ADDR memaddr, unsigned int *myaddr,
                        int len, int size, enum bfd_endian byte_order)
 {
   /* FIXME (alloca): Not safe if array is very large.  */
-  gdb_byte *buf = alloca (len * size);
+  gdb_byte *buf = (gdb_byte *) alloca (len * size);
   int i;
 
   read_memory (memaddr, buf, len * size);
@@ -3608,7 +3611,7 @@ simple_read_overlay_table (void)
   cache_novlys = read_memory_integer (BMSYMBOL_VALUE_ADDRESS (novlys_msym),
                                      4, byte_order);
   cache_ovly_table
-    = (void *) xmalloc (cache_novlys * sizeof (*cache_ovly_table));
+    = (unsigned int (*)[4]) xmalloc (cache_novlys * sizeof (*cache_ovly_table));
   cache_ovly_table_base = BMSYMBOL_VALUE_ADDRESS (ovly_table_msym);
   read_target_long_array (cache_ovly_table_base,
                           (unsigned int *) cache_ovly_table,
index 90204cd195362697de4c020b037d857ecefd3fce..91976214b06215c4bc7e99d9d170eea2ef2ee4e2 100644 (file)
@@ -874,7 +874,8 @@ symbol_set_names (struct general_symbol_info *gsymbol,
        gsymbol->name = linkage_name;
       else
        {
-         char *name = obstack_alloc (&per_bfd->storage_obstack, len + 1);
+         char *name = (char *) obstack_alloc (&per_bfd->storage_obstack,
+                                              len + 1);
 
          memcpy (name, linkage_name, len);
          name[len] = '\0';
@@ -896,7 +897,7 @@ symbol_set_names (struct general_symbol_info *gsymbol,
       char *alloc_name;
 
       lookup_len = len + JAVA_PREFIX_LEN;
-      alloc_name = alloca (lookup_len + 1);
+      alloc_name = (char *) alloca (lookup_len + 1);
       memcpy (alloc_name, JAVA_PREFIX, JAVA_PREFIX_LEN);
       memcpy (alloc_name + JAVA_PREFIX_LEN, linkage_name, len);
       alloc_name[lookup_len] = '\0';
@@ -909,7 +910,7 @@ symbol_set_names (struct general_symbol_info *gsymbol,
       char *alloc_name;
 
       lookup_len = len;
-      alloc_name = alloca (lookup_len + 1);
+      alloc_name = (char *) alloca (lookup_len + 1);
       memcpy (alloc_name, linkage_name, len);
       alloc_name[lookup_len] = '\0';
 
@@ -950,10 +951,11 @@ symbol_set_names (struct general_symbol_info *gsymbol,
         us better bcache hit rates for partial symbols.  */
       if (!copy_name && lookup_name == linkage_name)
        {
-         *slot = obstack_alloc (&per_bfd->storage_obstack,
-                                offsetof (struct demangled_name_entry,
-                                          demangled)
-                                + demangled_len + 1);
+         *slot
+           = ((struct demangled_name_entry *)
+              obstack_alloc (&per_bfd->storage_obstack,
+                             offsetof (struct demangled_name_entry, demangled)
+                             + demangled_len + 1));
          (*slot)->mangled = lookup_name;
        }
       else
@@ -963,10 +965,11 @@ symbol_set_names (struct general_symbol_info *gsymbol,
          /* If we must copy the mangled name, put it directly after
             the demangled name so we can have a single
             allocation.  */
-         *slot = obstack_alloc (&per_bfd->storage_obstack,
-                                offsetof (struct demangled_name_entry,
-                                          demangled)
-                                + lookup_len + demangled_len + 2);
+         *slot
+           = ((struct demangled_name_entry *)
+              obstack_alloc (&per_bfd->storage_obstack,
+                             offsetof (struct demangled_name_entry, demangled)
+                             + lookup_len + demangled_len + 2));
          mangled_ptr = &((*slot)->demangled[demangled_len + 1]);
          strcpy (mangled_ptr, lookup_name);
          (*slot)->mangled = mangled_ptr;
@@ -1291,8 +1294,10 @@ resize_symbol_cache (struct symbol_cache *cache, unsigned int new_size)
     {
       size_t total_size = symbol_cache_byte_size (new_size);
 
-      cache->global_symbols = xcalloc (1, total_size);
-      cache->static_symbols = xcalloc (1, total_size);
+      cache->global_symbols
+       = (struct block_symbol_cache *) xcalloc (1, total_size);
+      cache->static_symbols
+       = (struct block_symbol_cache *) xcalloc (1, total_size);
       cache->global_symbols->size = new_size;
       cache->static_symbols->size = new_size;
     }
@@ -4911,7 +4916,7 @@ rbreak_command (char *regexp, int from_tty)
          char *local_name;
 
          colon_index = colon - regexp;
-         local_name = alloca (colon_index + 1);
+         local_name = (char *) alloca (colon_index + 1);
          memcpy (local_name, regexp, colon_index);
          local_name[colon_index--] = 0;
          while (isspace (local_name[colon_index]))
@@ -4942,7 +4947,7 @@ rbreak_command (char *regexp, int from_tty)
 
          if (newlen > len)
            {
-             string = xrealloc (string, newlen);
+             string = (char *) xrealloc (string, newlen);
              len = newlen;
            }
          strcpy (string, fullname);
@@ -4961,7 +4966,7 @@ rbreak_command (char *regexp, int from_tty)
 
          if (newlen > len)
            {
-             string = xrealloc (string, newlen);
+             string = (char *) xrealloc (string, newlen);
              len = newlen;
            }
          strcpy (string, "'");
@@ -5076,19 +5081,19 @@ completion_list_add_name (const char *symname,
 
     if (word == sym_text)
       {
-       newobj = xmalloc (strlen (symname) + 5);
+       newobj = (char *) xmalloc (strlen (symname) + 5);
        strcpy (newobj, symname);
       }
     else if (word > sym_text)
       {
        /* Return some portion of symname.  */
-       newobj = xmalloc (strlen (symname) + 5);
+       newobj = (char *) xmalloc (strlen (symname) + 5);
        strcpy (newobj, symname + (word - sym_text));
       }
     else
       {
        /* Return some of SYM_TEXT plus symname.  */
-       newobj = xmalloc (strlen (symname) + (sym_text - word) + 5);
+       newobj = (char *) xmalloc (strlen (symname) + (sym_text - word) + 5);
        strncpy (newobj, word, sym_text - word);
        newobj[sym_text - word] = '\0';
        strcat (newobj, symname);
@@ -5144,7 +5149,7 @@ completion_list_objc_symbol (struct minimal_symbol *msymbol,
        tmplen = 1024;
       else
        tmplen *= 2;
-      tmp = xrealloc (tmp, tmplen);
+      tmp = (char *) xrealloc (tmp, tmplen);
     }
   selector = strchr (method, ' ');
   if (selector != NULL)
@@ -5742,19 +5747,19 @@ add_filename_to_list (const char *fname, const char *text, const char *word,
   if (word == text)
     {
       /* Return exactly fname.  */
-      newobj = xmalloc (fnlen + 5);
+      newobj = (char *) xmalloc (fnlen + 5);
       strcpy (newobj, fname);
     }
   else if (word > text)
     {
       /* Return some portion of fname.  */
-      newobj = xmalloc (fnlen + 5);
+      newobj = (char *) xmalloc (fnlen + 5);
       strcpy (newobj, fname + (word - text));
     }
   else
     {
       /* Return some of TEXT plus fname.  */
-      newobj = xmalloc (fnlen + (text - word) + 5);
+      newobj = (char *) xmalloc (fnlen + (text - word) + 5);
       strncpy (newobj, word, text - word);
       newobj[text - word] = '\0';
       strcat (newobj, fname);
index 0eec6be18bb2619338724c489f7dbb91159b1d8a..9ef811bb5c172d2ea5b72f82e91182bade68ab15 100644 (file)
@@ -1629,7 +1629,7 @@ maint_print_c_tdesc_cmd (char *args, int from_tty)
     error (_("The current target description did not come from an XML file."));
 
   filename = lbasename (target_description_filename);
-  function = alloca (strlen (filename) + 1);
+  function = (char *) alloca (strlen (filename) + 1);
   for (inp = filename, outp = function; *inp != '\0'; inp++)
     if (*inp == '.')
       break;
index 177deb6ef3681e926645f78db4b04c435c969cec..93772aa08ad3d32a03926c516b1760f00ebb2c17 100644 (file)
@@ -366,7 +366,7 @@ target_write_memory_blocks (VEC(memory_write_request_s) *requests,
          for (i = 0; VEC_iterate (memory_write_request_s, garbled, i, r); ++i)
            {
              gdb_assert (r->data == NULL);
-             r->data = xmalloc (r->end - r->begin);
+             r->data = (gdb_byte *) xmalloc (r->end - r->begin);
              err = target_read_memory (r->begin, r->data, r->end - r->begin);
              if (err != 0)
                goto out;
index 8df862ba3f8f2862081b30a5175bad8b0a929e97..14cec5697b0550c6db48513647e67511c836d8dc 100644 (file)
@@ -926,7 +926,7 @@ target_read_string (CORE_ADDR memaddr, char **string, int len, int *errnop)
 
   /* Small for testing.  */
   buffer_allocated = 4;
-  buffer = xmalloc (buffer_allocated);
+  buffer = (char *) xmalloc (buffer_allocated);
   bufptr = buffer;
 
   while (len > 0)
@@ -953,7 +953,7 @@ target_read_string (CORE_ADDR memaddr, char **string, int len, int *errnop)
 
          bytes = bufptr - buffer;
          buffer_allocated *= 2;
-         buffer = xrealloc (buffer, buffer_allocated);
+         buffer = (char *) xrealloc (buffer, buffer_allocated);
          bufptr = buffer + bytes;
        }
 
@@ -1655,7 +1655,7 @@ read_whatever_is_readable (struct target_ops *ops,
                           int unit_size,
                           VEC(memory_read_result_s) **result)
 {
-  gdb_byte *buf = xmalloc (end - begin);
+  gdb_byte *buf = (gdb_byte *) xmalloc (end - begin);
   ULONGEST current_begin = begin;
   ULONGEST current_end = end;
   int forward;
@@ -1755,7 +1755,7 @@ read_whatever_is_readable (struct target_ops *ops,
       /* The [current_end, end) range has been read.  */
       LONGEST region_len = end - current_end;
 
-      r.data = xmalloc (region_len * unit_size);
+      r.data = (gdb_byte *) xmalloc (region_len * unit_size);
       memcpy (r.data, buf + (current_end - begin) * unit_size,
              region_len * unit_size);
       r.begin = current_end;
@@ -1923,7 +1923,7 @@ target_read_alloc_1 (struct target_ops *ops, enum target_object object,
   /* Start by reading up to 4K at a time.  The target will throttle
      this number down if necessary.  */
   buf_alloc = 4096;
-  buf = xmalloc (buf_alloc);
+  buf = (gdb_byte *) xmalloc (buf_alloc);
   buf_pos = 0;
   while (1)
     {
@@ -1956,7 +1956,7 @@ target_read_alloc_1 (struct target_ops *ops, enum target_object object,
       if (buf_alloc < buf_pos * 2)
        {
          buf_alloc *= 2;
-         buf = xrealloc (buf, buf_alloc);
+         buf = (gdb_byte *) xrealloc (buf, buf_alloc);
        }
 
       QUIT;
@@ -2363,7 +2363,7 @@ simple_search_memory (struct target_ops *ops,
   if (search_space_len < search_buf_size)
     search_buf_size = search_space_len;
 
-  search_buf = malloc (search_buf_size);
+  search_buf = (gdb_byte *) malloc (search_buf_size);
   if (search_buf == NULL)
     error (_("Unable to allocate memory to perform the search."));
   old_cleanups = make_cleanup (free_current_contents, &search_buf);
@@ -3049,7 +3049,7 @@ target_fileio_read_alloc_1 (struct inferior *inf, const char *filename,
   /* Start by reading up to 4K at a time.  The target will throttle
      this number down if necessary.  */
   buf_alloc = 4096;
-  buf = xmalloc (buf_alloc);
+  buf = (gdb_byte *) xmalloc (buf_alloc);
   buf_pos = 0;
   while (1)
     {
@@ -3080,7 +3080,7 @@ target_fileio_read_alloc_1 (struct inferior *inf, const char *filename,
       if (buf_alloc < buf_pos * 2)
        {
          buf_alloc *= 2;
-         buf = xrealloc (buf, buf_alloc);
+         buf = (gdb_byte *) xrealloc (buf, buf_alloc);
        }
 
       QUIT;
index d1364011228e2640aa700d34a4623676d00e1e22..65f072922755cac287f93caadafa386de5fa2231 100644 (file)
@@ -333,7 +333,7 @@ tilegx_push_dummy_call (struct gdbarch *gdbarch,
 
       typelen = TYPE_LENGTH (value_enclosing_type (args[j]));
       slacklen = align_up (typelen, 8) - typelen;
-      val = xmalloc (typelen + slacklen);
+      val = (gdb_byte *) xmalloc (typelen + slacklen);
       back_to = make_cleanup (xfree, val);
       memcpy (val, contents, typelen);
       memset (val + typelen, 0, slacklen);
index 6388ba25881c39570172c819d435dafcf1908185..23ad6035f8ba2e656751b5b9119e5621b4d8f916 100644 (file)
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1065,8 +1065,9 @@ command_line_input (const char *prompt_arg, int repeat, char *annotation_suffix)
     {
       char *local_prompt;
 
-      local_prompt = alloca ((prompt == NULL ? 0 : strlen (prompt))
-                            + strlen (annotation_suffix) + 40);
+      local_prompt
+       = (char *) alloca ((prompt == NULL ? 0 : strlen (prompt))
+                          + strlen (annotation_suffix) + 40);
       if (prompt == NULL)
        local_prompt[0] = '\0';
       else
@@ -1235,7 +1236,8 @@ command_line_input (const char *prompt_arg, int repeat, char *annotation_suffix)
     {
       if (linelength > saved_command_line_size)
        {
-         saved_command_line = xrealloc (saved_command_line, linelength);
+         saved_command_line
+           = (char *) xrealloc (saved_command_line, linelength);
          saved_command_line_size = linelength;
        }
       strcpy (saved_command_line, linebuffer);
index 8cc36b82695e82f56a5f3e26421482fdb4b66d83..68ff5b14b79ac0cf7ed81fd71ff9a75df3264a91 100644 (file)
@@ -805,7 +805,7 @@ tfile_fetch_registers (struct target_ops *ops,
 
   if (traceframe_find_block_type ('R', 0) >= 0)
     {
-      gdb_byte *regs = alloca (trace_regblock_size);
+      gdb_byte *regs = (gdb_byte *) alloca (trace_regblock_size);
 
       tfile_read (regs, trace_regblock_size);
 
index a31a589a45488cf8d666b5d91fbdb3ac0dd1bacc..21bf25f53c728c931c3b3916428c7fbc33e4b742 100644 (file)
@@ -429,7 +429,7 @@ tracefile_fetch_registers (struct regcache *regcache, int regno)
              return;
            }
 
-         regs = alloca (register_size (gdbarch, pc_regno));
+         regs = (gdb_byte *) alloca (register_size (gdbarch, pc_regno));
          store_unsigned_integer (regs, register_size (gdbarch, pc_regno),
                                  gdbarch_byte_order (gdbarch),
                                  tp->base.loc->address);
index 1e079e9fc13670ac098db73f4cdd6d253435c046..2ed24e9baffb438850add4c697e943a59a63c9a9 100644 (file)
@@ -948,8 +948,8 @@ add_memrange (struct collection_list *memranges,
   if (memranges->next_memrange >= memranges->listsize)
     {
       memranges->listsize *= 2;
-      memranges->list = xrealloc (memranges->list,
-                                 memranges->listsize);
+      memranges->list = (struct memrange *) xrealloc (memranges->list,
+                                                     memranges->listsize);
     }
 
   if (type != memrange_absolute)    /* Better collect the base register!  */
@@ -1244,12 +1244,10 @@ init_collection_list (struct collection_list *clist)
   memset (clist, 0, sizeof *clist);
 
   clist->listsize = 128;
-  clist->list = xcalloc (clist->listsize,
-                        sizeof (struct memrange));
+  clist->list = XCNEWVEC (struct memrange, clist->listsize);
 
   clist->aexpr_listsize = 128;
-  clist->aexpr_list = xcalloc (clist->aexpr_listsize,
-                              sizeof (struct agent_expr *));
+  clist->aexpr_list = XCNEWVEC (struct agent_expr *, clist->aexpr_listsize);
 }
 
 /* Reduce a collection list to string form (for gdb protocol).  */
@@ -1708,9 +1706,9 @@ add_aexpr (struct collection_list *collect, struct agent_expr *aexpr)
 {
   if (collect->next_aexpr_elt >= collect->aexpr_listsize)
     {
-      collect->aexpr_list =
-       xrealloc (collect->aexpr_list,
-                 2 * collect->aexpr_listsize * sizeof (struct agent_expr *));
+      collect->aexpr_list = XRESIZEVEC (struct agent_expr *,
+                                       collect->aexpr_list,
+                                       2 * collect->aexpr_listsize);
       collect->aexpr_listsize *= 2;
     }
   collect->aexpr_list[collect->next_aexpr_elt] = aexpr;
@@ -2947,7 +2945,7 @@ trace_dump_actions (struct command_line *action,
                        {
                          size_t len = next_comma - action_exp;
 
-                         cmd = xrealloc (cmd, len + 1);
+                         cmd = (char *) xrealloc (cmd, len + 1);
                          memcpy (cmd, action_exp, len);
                          cmd[len] = 0;
                        }
@@ -2955,7 +2953,7 @@ trace_dump_actions (struct command_line *action,
                        {
                          size_t len = strlen (action_exp);
 
-                         cmd = xrealloc (cmd, len + 1);
+                         cmd = (char *) xrealloc (cmd, len + 1);
                          memcpy (cmd, action_exp, len + 1);
                        }
 
@@ -3627,7 +3625,7 @@ Status line: '%s'\n"), p, line);
            }
          else if (p2 != p1)
            {
-             ts->stop_desc = xmalloc (strlen (line));
+             ts->stop_desc = (char *) xmalloc (strlen (line));
              end = hex2bin (p1, (gdb_byte *) ts->stop_desc, (p2 - p1) / 2);
              ts->stop_desc[end] = '\0';
            }
@@ -3647,7 +3645,7 @@ Status line: '%s'\n"), p, line);
          p2 = strchr (++p1, ':');
          if (p2 != p1)
            {
-             ts->stop_desc = xmalloc ((p2 - p1) / 2 + 1);
+             ts->stop_desc = (char *) xmalloc ((p2 - p1) / 2 + 1);
              end = hex2bin (p1, (gdb_byte *) ts->stop_desc, (p2 - p1) / 2);
              ts->stop_desc[end] = '\0';
            }
@@ -3701,7 +3699,7 @@ Status line: '%s'\n"), p, line);
       else if (strncmp (p, "username", p1 - p) == 0)
        {
          ++p1;
-         ts->user_name = xmalloc (strlen (p) / 2);
+         ts->user_name = (char *) xmalloc (strlen (p) / 2);
          end = hex2bin (p1, (gdb_byte *) ts->user_name, (p3 - p1)  / 2);
          ts->user_name[end] = '\0';
          p = p3;
@@ -3709,7 +3707,7 @@ Status line: '%s'\n"), p, line);
       else if (strncmp (p, "notes", p1 - p) == 0)
        {
          ++p1;
-         ts->notes = xmalloc (strlen (p) / 2);
+         ts->notes = (char *) xmalloc (strlen (p) / 2);
          end = hex2bin (p1, (gdb_byte *) ts->notes, (p3 - p1) / 2);
          ts->notes[end] = '\0';
          p = p3;
@@ -3836,7 +3834,7 @@ parse_tracepoint_definition (char *line, struct uploaded_tp **utpp)
       p = unpack_varlen_hex (p, &xlen);
       p++;  /* skip a colon */
 
-      buf = alloca (strlen (line));
+      buf = (char *) alloca (strlen (line));
 
       end = hex2bin (p, (gdb_byte *) buf, strlen (p) / 2);
       buf[end] = '\0';
@@ -3873,7 +3871,7 @@ parse_tsv_definition (char *line, struct uploaded_tsv **utsvp)
   int end;
   struct uploaded_tsv *utsv = NULL;
 
-  buf = alloca (strlen (line));
+  buf = (char *) alloca (strlen (line));
 
   p = line;
   p = unpack_varlen_hex (p, &num);
@@ -3929,14 +3927,14 @@ parse_static_tracepoint_marker_definition (char *line, char **pp,
   if (endp == NULL)
     error (_("bad marker definition: %s"), line);
 
-  marker->str_id = xmalloc (endp - p + 1);
+  marker->str_id = (char *) xmalloc (endp - p + 1);
   end = hex2bin (p, (gdb_byte *) marker->str_id, (endp - p + 1) / 2);
   marker->str_id[end] = '\0';
 
   p += 2 * end;
   p++;  /* skip a colon */
 
-  marker->extra = xmalloc (strlen (p) + 1);
+  marker->extra = (char *) xmalloc (strlen (p) + 1);
   end = hex2bin (p, (gdb_byte *) marker->extra, strlen (p) / 2);
   marker->extra[end] = '\0';
 
index 4b4b92c43428d7f8772da69fb0094b53682b7cd3..1aa0a61631b0e302b6e994621a41ab93d51b780d 100644 (file)
@@ -107,7 +107,7 @@ tui_sfileopen (int n)
   tmpstream->ts_filestream = NULL;
   if (n > 0)
     {
-      tmpstream->ts_strbuf = xmalloc ((n + 1) * sizeof (char));
+      tmpstream->ts_strbuf = XNEWVEC (char, n + 1);
       tmpstream->ts_strbuf[0] = '\0';
     }
   else
@@ -221,12 +221,13 @@ tui_file_adjust_strbuf (int n, struct ui_file *file)
       if (n > (stream->ts_buflen - non_null_chars - 1))
        {
          stream->ts_buflen = n + non_null_chars + 1;
-         stream->ts_strbuf = xrealloc (stream->ts_strbuf, stream->ts_buflen);
+         stream->ts_strbuf
+           = XRESIZEVEC (char, stream->ts_strbuf, stream->ts_buflen);
        }
     }
   else
     /* No buffer yet, so allocate one of the desired size.  */
-    stream->ts_strbuf = xmalloc ((n + 1) * sizeof (char));
+    stream->ts_strbuf = XNEWVEC (char, n + 1);
 }
 
 static void
index c7a092f15eb6364fb2b9d5103224514cfce7f569..6f81f0980ff73788fafd5f502b2fcd9dc46d55f0 100644 (file)
@@ -671,7 +671,7 @@ tui_expand_tabs (const char *string, int col)
     }
 
   /* Allocate the copy.  */
-  ret = q = xmalloc (strlen (string) + n_adjust + 1);
+  ret = q = (char *) xmalloc (strlen (string) + n_adjust + 1);
 
   /* 2. Copy the original string while replacing TABs with spaces.  */
   for (ncol = col, s = string; s; )
index 018a1df8e5488b23a9031480db3c9f5a4f2f1b47..9f407813473e224804920632ab47890d5ac60d78 100644 (file)
@@ -62,7 +62,7 @@ tui_set_source_content (struct symtab *s,
              if (!noerror)
                {
                  const char *filename = symtab_to_filename_for_display (s);
-                 char *name = alloca (strlen (filename) + 100);
+                 char *name = (char *) alloca (strlen (filename) + 100);
 
                  sprintf (name, "%s:%d", filename, line_no);
                  print_sys_errmsg (name, errno);
index 9e44225f4242f807e521dd40bf42a3649f714de8..8dc57f20b8b29a5078f4f900c24f8f9977f80035 100644 (file)
@@ -297,8 +297,9 @@ find_global_typedef (const struct type_print_options *flags,
 
   if (applied != NULL)
     {
-      new_tf->name = obstack_copy0 (&flags->global_typedefs->storage, applied,
-                                   strlen (applied));
+      new_tf->name
+       = (const char *) obstack_copy0 (&flags->global_typedefs->storage,
+                                       applied, strlen (applied));
       xfree (applied);
     }
 
index 3aa2a7cac8b6bf3114ba1824111dc948d3e6d7d3..c59c14c2544d2074e27627b44e4328c6ae712d3f 100644 (file)
@@ -333,9 +333,9 @@ do_ui_file_xstrdup (void *context, const char *buffer, long length)
   struct accumulated_ui_file *acc = context;
 
   if (acc->buffer == NULL)
-    acc->buffer = xmalloc (length + 1);
+    acc->buffer = (char *) xmalloc (length + 1);
   else
-    acc->buffer = xrealloc (acc->buffer, acc->length + length + 1);
+    acc->buffer = (char *) xrealloc (acc->buffer, acc->length + length + 1);
   memcpy (acc->buffer + acc->length, buffer, length);
   acc->length += length;
   acc->buffer[acc->length] = '\0';
@@ -371,7 +371,7 @@ ui_file_obsavestring (struct ui_file *file, struct obstack *obstack,
   ui_file_put (file, do_ui_file_obsavestring, obstack);
   *length = obstack_object_size (obstack);
   obstack_1grow (obstack, '\0');
-  return obstack_finish (obstack);
+  return (char *) obstack_finish (obstack);
 }
 \f
 /* A pure memory based ``struct ui_file'' that can be used an output
@@ -468,7 +468,7 @@ mem_file_write (struct ui_file *file,
     {
       stream->length_buffer = length_buffer;
       stream->sizeof_buffer = length_buffer;
-      stream->buffer = xmalloc (stream->sizeof_buffer);
+      stream->buffer = (char *) xmalloc (stream->sizeof_buffer);
       memcpy (stream->buffer, buffer, length_buffer);
     }
   else
@@ -478,7 +478,8 @@ mem_file_write (struct ui_file *file,
       if (new_length >= stream->sizeof_buffer)
        {
          stream->sizeof_buffer = new_length;
-         stream->buffer = xrealloc (stream->buffer, stream->sizeof_buffer);
+         stream->buffer
+           = (char *) xrealloc (stream->buffer, stream->sizeof_buffer);
        }
       memcpy (stream->buffer + stream->length_buffer, buffer, length_buffer);
       stream->length_buffer = new_length;
index 3ce88b957ba4fe4cb0b7e16092a4aa4e98fcf765..3bb82f051b278a74b4e65e1ace810c78d26ae110 100644 (file)
@@ -1112,7 +1112,7 @@ gdb_print_host_address (const void *addr, struct ui_file *stream)
 char *
 make_hex_string (const gdb_byte *data, size_t length)
 {
-  char *result = xmalloc (length * 2 + 1);
+  char *result = (char *) xmalloc (length * 2 + 1);
   char *p;
   size_t i;
 
@@ -1148,7 +1148,7 @@ char *
 get_regcomp_error (int code, regex_t *rx)
 {
   size_t length = regerror (code, rx, NULL, 0);
-  char *result = xmalloc (length);
+  char *result = (char *) xmalloc (length);
 
   regerror (code, rx, result, length);
   return result;
@@ -1996,7 +1996,7 @@ puts_filtered_tabular (char *string, int width, int right)
   if (right)
     spaces += width - stringlen;
 
-  spacebuf = alloca (spaces + 1);
+  spacebuf = (char *) alloca (spaces + 1);
   spacebuf[spaces] = '\0';
   while (spaces--)
     spacebuf[spaces] = ' ';
@@ -2902,7 +2902,7 @@ gdb_realpath_keepfile (const char *filename)
   if (base_name == filename)
     return xstrdup (filename);
 
-  dir_name = alloca ((size_t) (base_name - filename + 2));
+  dir_name = (char *) alloca ((size_t) (base_name - filename + 2));
   /* Allocate enough space to store the dir_name + plus one extra
      character sometimes needed under Windows (see below), and
      then the closing \000 character.  */
@@ -3013,7 +3013,7 @@ ldirname (const char *filename)
   if (base == filename)
     return NULL;
 
-  dirname = xmalloc (base - filename + 2);
+  dirname = (char *) xmalloc (base - filename + 2);
   memcpy (dirname, filename, base - filename);
 
   /* On DOS based file systems, convert "d:foo" to "d:.", so that we
@@ -3079,7 +3079,7 @@ gdb_bfd_errmsg (bfd_error_type error_tag, char **matching)
             + strlen (AMBIGUOUS_MESS2);
   for (p = matching; *p; p++)
     ret_len += strlen (*p) + 1;
-  ret = xmalloc (ret_len + 1);
+  ret = (char *) xmalloc (ret_len + 1);
   retp = ret;
   make_cleanup (xfree, ret);
 
@@ -3241,7 +3241,8 @@ substitute_path_component (char **stringp, const char *from, const char *to)
        {
          char *string_new;
 
-         string_new = xrealloc (string, (strlen (string) + to_len + 1));
+         string_new
+           = (char *) xrealloc (string, (strlen (string) + to_len + 1));
 
          /* Relocate the current S pointer.  */
          s = s - string + string_new;
index 173ef4e7bd12871281a9d149a82af1c31b5845ab..1e372efc88bace91e84ee1005503773a8453851c 100644 (file)
@@ -2047,7 +2047,7 @@ search_struct_method (const char *name, struct value **arg1p,
              struct cleanup *back_to;
              CORE_ADDR address;
 
-             tmp = xmalloc (TYPE_LENGTH (baseclass));
+             tmp = (gdb_byte *) xmalloc (TYPE_LENGTH (baseclass));
              back_to = make_cleanup (xfree, tmp);
              address = value_address (*arg1p);
 
@@ -2900,7 +2900,7 @@ find_oload_champ_namespace_loop (struct value **args, int nargs,
 
   old_cleanups = make_cleanup (xfree, *oload_syms);
   make_cleanup (xfree, *oload_champ_bv);
-  new_namespace = alloca (namespace_len + 1);
+  new_namespace = (char *) alloca (namespace_len + 1);
   strncpy (new_namespace, qualified_name, namespace_len);
   new_namespace[namespace_len] = '\0';
   new_oload_syms = make_symbol_overload_list (func_name,
index 713998cc7a068b75cd0d1d72fdee40cd4d3d5731..c053a817815ee6180165dbdb83260126adc763a3 100644 (file)
@@ -1603,7 +1603,7 @@ print_decimal_chars (struct ui_file *stream, const gdb_byte *valaddr,
      as the base 16 number, which is 2 digits per byte.  */
 
   decimal_len = len * 2 * 2;
-  digits = xmalloc (decimal_len);
+  digits = (unsigned char *) xmalloc (decimal_len);
 
   for (i = 0; i < decimal_len; i++)
     {
@@ -2119,7 +2119,7 @@ read_string (CORE_ADDR addr, int len, int width, unsigned int fetchlimit,
   else
     {                          /* Length of string is really 0!  */
       /* We always allocate *buffer.  */
-      *buffer = bufptr = xmalloc (1);
+      *buffer = bufptr = (gdb_byte *) xmalloc (1);
       errcode = 0;
     }
 
@@ -2272,7 +2272,7 @@ generic_emit_char (int c, struct type *type, struct ui_file *stream,
   struct wchar_iterator *iter;
   int need_escape = 0;
 
-  buf = alloca (TYPE_LENGTH (type));
+  buf = (gdb_byte *) alloca (TYPE_LENGTH (type));
   pack_long (buf, type, c);
 
   iter = make_wchar_iterator (buf, TYPE_LENGTH (type),
index 2a95c869483d6d814103dbecf6e40ac582ad0b33..74a06d9638522fe8c8cb33db026c94d58f5338dd 100644 (file)
@@ -529,7 +529,7 @@ varobj_delete (struct varobj *var, char ***dellist, int only_children)
   /* We may have been asked to return a list of what has been deleted.  */
   if (dellist != NULL)
     {
-      *dellist = xmalloc ((delcount + 1) * sizeof (char *));
+      *dellist = XNEWVEC (char *, delcount + 1);
 
       cp = *dellist;
       mycount = delcount;
@@ -2610,7 +2610,7 @@ varobj_value_get_print_value (struct value *value,
                            }
 
                          len = strlen (s);
-                         thevalue = xmemdup (s, len + 1, len + 1);
+                         thevalue = (char *) xmemdup (s, len + 1, len + 1);
                          type = builtin_type (gdbarch)->builtin_char;
                          xfree (s);
 
index 9a1e4e23dd949045f9a266d09f4de92a80cfa105..4e2701f79fa7cbec4d1aa476b5b61a5f0c849310 100644 (file)
@@ -69,7 +69,7 @@ vaxobsd_sigtramp_sniffer (const struct frame_unwind *self,
   if (name)
     return 0;
 
-  buf = alloca(sizeof vaxobsd_sigreturn);
+  buf = (gdb_byte *) alloca (sizeof vaxobsd_sigreturn);
   if (!safe_frame_unwind_memory (this_frame, sigreturn_addr,
                                 buf, sizeof vaxobsd_sigreturn))
     return 0;
index dc4e2e43c1c071153f6abe00cc8bfe89de3a54d5..58e8fcacd3f163808e343e4912eef4d1fc9493b2 100644 (file)
@@ -321,7 +321,7 @@ display_one_tib (ptid_t ptid)
       max = tib_size / size;
     }
   
-  tib = alloca (tib_size);
+  tib = (gdb_byte *) alloca (tib_size);
 
   if (target_get_tib_address (ptid, &thread_local_base) == 0)
     {
index 0d497514cd9a670aed9c6953148e295722e03ad7..2c158b8b65f5795476968ac95a67f616c28825cf 100644 (file)
@@ -1079,7 +1079,8 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
              {
                char *p;
 
-               p = obstack_alloc (&objfile->objfile_obstack, E_SYMNMLEN + 1);
+               p = (char *) obstack_alloc (&objfile->objfile_obstack,
+                                           E_SYMNMLEN + 1);
                strncpy (p, cs->c_name, E_SYMNMLEN);
                p[E_SYMNMLEN] = '\0';
                cs->c_name = p;
@@ -1561,7 +1562,8 @@ process_xcoff_symbol (struct coff_symbol *cs, struct objfile *objfile)
          will be patched with the type from its stab entry later on in
          patch_block_stabs (), unless the file was compiled without -g.  */
 
-      SYMBOL_SET_LINKAGE_NAME (sym, SYMNAME_ALLOC (name, symname_alloced));
+      SYMBOL_SET_LINKAGE_NAME (sym, ((const char *)
+                                    SYMNAME_ALLOC (name, symname_alloced)));
       SYMBOL_TYPE (sym) = objfile_type (objfile)->nodebug_text_symbol;
 
       SYMBOL_ACLASS_INDEX (sym) = LOC_BLOCK;
@@ -2133,7 +2135,8 @@ swap_sym (struct internal_syment *symbol, union internal_auxent *aux,
             into the minimal symbols.  */
          char *p;
 
-         p = obstack_alloc (&objfile->objfile_obstack, E_SYMNMLEN + 1);
+         p = (char *) obstack_alloc (&objfile->objfile_obstack,
+                                     E_SYMNMLEN + 1);
          strncpy (p, symbol->n_name, E_SYMNMLEN);
          p[E_SYMNMLEN] = '\0';
          *name = p;
@@ -2789,7 +2792,7 @@ scan_xcoff_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';
@@ -2812,7 +2815,7 @@ scan_xcoff_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';
@@ -2963,7 +2966,9 @@ xcoff_initial_scan (struct objfile *objfile, int symfile_flags)
            length = bfd_section_size (abfd, secp);
            if (length)
              {
-               debugsec = obstack_alloc (&objfile->objfile_obstack, length);
+               debugsec
+                 = (bfd_byte *) obstack_alloc (&objfile->objfile_obstack,
+                                               length);
 
                if (!bfd_get_full_section_contents (abfd, secp, &debugsec))
                  {
@@ -2983,7 +2988,7 @@ xcoff_initial_scan (struct objfile *objfile, int symfile_flags)
     error (_("Error reading symbols from %s: %s"),
           name, bfd_errmsg (bfd_get_error ()));
   size = coff_data (abfd)->local_symesz * num_symbols;
-  info->symtbl = obstack_alloc (&objfile->objfile_obstack, size);
+  info->symtbl = (char *) obstack_alloc (&objfile->objfile_obstack, size);
   info->symtbl_num_syms = num_symbols;
 
   val = bfd_bread (info->symtbl, size, abfd);
index 054d56b8653c01f39c9b218af37ab94c16b400d4..211f7457bb24bf2177521df336f569315627f56e 100644 (file)
@@ -365,7 +365,7 @@ gdb_xml_end_element (void *data, const XML_Char *name)
 
          length = obstack_object_size (scope->body);
          obstack_1grow (scope->body, '\0');
-         body = obstack_finish (scope->body);
+         body = (char *) obstack_finish (scope->body);
 
          /* Strip leading and trailing whitespace.  */
          while (length > 0 && ISSPACE (body[length-1]))
@@ -905,7 +905,7 @@ xml_process_xincludes (const char *name, const char *text,
   if (gdb_xml_parse (parser, text) == 0)
     {
       obstack_1grow (&data->obstack, '\0');
-      result = xstrdup (obstack_finish (&data->obstack));
+      result = xstrdup ((const char *) obstack_finish (&data->obstack));
 
       if (depth == 0)
        gdb_xml_debug (parser, _("XInclude processing succeeded."));
@@ -1041,7 +1041,7 @@ xml_fetch_content_from_file (const char *filename, void *baton)
   /* Read in the whole file, one chunk at a time.  */
   len = 4096;
   offset = 0;
-  text = xmalloc (len);
+  text = (char *) xmalloc (len);
   make_cleanup (free_current_contents, &text);
   while (1)
     {
@@ -1063,7 +1063,7 @@ xml_fetch_content_from_file (const char *filename, void *baton)
        break;
 
       len = len * 2;
-      text = xrealloc (text, len);
+      text = (char *) xrealloc (text, len);
     }
 
   fclose (file);
index ea85a2c419970110f9888917b9808206204dc4d3..255d8164bed899a79dbd58de5f29cb7952a87d53 100644 (file)
@@ -376,7 +376,7 @@ xml_list_of_syscalls (struct gdbarch *gdbarch)
     return NULL;
 
   nsyscalls = VEC_length (syscall_desc_p, syscalls_info->syscalls);
-  names = xmalloc ((nsyscalls + 1) * sizeof (char *));
+  names = XNEWVEC (const char *, nsyscalls + 1);
 
   for (i = 0;
        VEC_iterate (syscall_desc_p, syscalls_info->syscalls, i, sysdesc);
index 05b3039231e8fd1779833b94a9e310e6532f187b..92e3b3792b56d8b75a1f05618c2349e7d7a2f23a 100644 (file)
@@ -282,7 +282,7 @@ xstormy16_push_dummy_call (struct gdbarch *gdbarch,
 
       typelen = TYPE_LENGTH (value_enclosing_type (args[j]));
       slacklen = typelen & 1;
-      val = xmalloc (typelen + slacklen);
+      val = (gdb_byte *) xmalloc (typelen + slacklen);
       back_to = make_cleanup (xfree, val);
       memcpy (val, bytes, typelen);
       memset (val + typelen, 0, slacklen);