From 582f770b4553764cf1b6f506ca7a5388b575086e Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Wed, 31 Dec 2014 11:38:33 +0100 Subject: [PATCH] diagnostic.c (build_message_string): Use xvasprintf. * diagnostic.c (build_message_string): Use xvasprintf. * final.c (output_operand_lossage): Use xvasprintf and xasprintf. * lto-wrapper.c (merge_and_complain): Use xasprintf. * targhooks.c (pch_option_mismatch): Ditto. * tree-ssa-structalias.c (create_function_info_for): Ditto. (create_variable_info_for_1): Ditto. From-SVN: r219122 --- gcc/ChangeLog | 20 ++++++++++++++------ gcc/diagnostic.c | 2 +- gcc/final.c | 4 ++-- gcc/lto-wrapper.c | 2 +- gcc/targhooks.c | 8 ++------ gcc/tree-ssa-structalias.c | 18 ++++++++++-------- 6 files changed, 30 insertions(+), 24 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 60986f99a11..88555d11736 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2014-12-31 Uros Bizjak + + * diagnostic.c (build_message_string): Use xvasprintf. + * final.c (output_operand_lossage): Use xvasprintf and xasprintf. + * lto-wrapper.c (merge_and_complain): Use xasprintf. + * targhooks.c (pch_option_mismatch): Ditto. + * tree-ssa-structalias.c (create_function_info_for): Ditto. + (create_variable_info_for_1): Ditto. + 2014-12-30 Anthony Green * config/moxie/moxie.md (zero_extendqisi2, zero_extendhisi2): @@ -147,8 +156,8 @@ 2014-12-22 Martin Liska - * cgraphunit.c (symbol_table::process_new_functions): New inline_summaries - is used. + * cgraphunit.c (symbol_table::process_new_functions): New + inline_summaries is used. * ipa-cp.c (ipcp_cloning_candidate_p): Likewise. (devirtualization_time_bonus): Likewise. (estimate_local_effects): Likewise. @@ -223,8 +232,8 @@ is used. * ipa-polymorphic-call.c: Include of symbol-summary.h is added. * ipa-profile.c: Include of symbol-summary.h is added. - * ipa-prop.c (ipa_propagate_indirect_call_infos): New ipa_node_params_sum - data structure is used. + * ipa-prop.c (ipa_propagate_indirect_call_infos): New + ipa_node_params_sum data structure is used. (ipa_node_params::~ipa_node_params): New function. (ipa_free_all_node_params): Destruction is simplified. (ipa_node_removal_hook): Removed. @@ -777,8 +786,7 @@ (parser::parse_pattern): Properly allocate capture_ids before using them. Set capture_ids to zero when its lifetime is supposed to finish. - (parser::parse_simplify): Allocate capture_ids only if - required. + (parser::parse_simplify): Allocate capture_ids only if required. 2014-12-16 Michael Haubenwallner diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index 7cbdb797aed..066cebb8017 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -70,7 +70,7 @@ build_message_string (const char *msg, ...) va_list ap; va_start (ap, msg); - vasprintf (&str, msg, ap); + str = xvasprintf (msg, ap); va_end (ap); return str; diff --git a/gcc/final.c b/gcc/final.c index 4c894c3014b..2f86ab128ae 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -3420,8 +3420,8 @@ output_operand_lossage (const char *cmsgid, ...) va_start (ap, cmsgid); pfx_str = this_is_asm_operands ? _("invalid 'asm': ") : "output_operand: "; - asprintf (&fmt_string, "%s%s", pfx_str, _(cmsgid)); - vasprintf (&new_message, fmt_string, ap); + fmt_string = xasprintf ("%s%s", pfx_str, _(cmsgid)); + new_message = xvasprintf (fmt_string, ap); if (this_is_asm_operands) error_for_asm (this_is_asm_operands, "%s", new_message); diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c index f75c0dc4378..f7118760d94 100644 --- a/gcc/lto-wrapper.c +++ b/gcc/lto-wrapper.c @@ -371,7 +371,7 @@ merge_and_complain (struct cl_decoded_option **decoded_options, } (*decoded_options)[j].opt_index = OPT_O; char *tem; - asprintf (&tem, "-O%d", level); + tem = xasprintf ("-O%d", level); (*decoded_options)[j].arg = &tem[2]; (*decoded_options)[j].canonical_option[0] = tem; (*decoded_options)[j].value = 1; diff --git a/gcc/targhooks.c b/gcc/targhooks.c index 5e723b4d59b..eedcc80ce7a 100644 --- a/gcc/targhooks.c +++ b/gcc/targhooks.c @@ -1639,12 +1639,8 @@ default_get_pch_validity (size_t *sz) static const char * pch_option_mismatch (const char *option) { - char *r; - - asprintf (&r, _("created and used with differing settings of '%s'"), option); - if (r == NULL) - return _("out of memory"); - return r; + return xasprintf (_("created and used with differing settings of '%s'"), + option); } /* Default version of pch_valid_p. */ diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 69cf60b0895..1f29bee5936 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -5457,7 +5457,7 @@ create_function_info_for (tree decl, const char *name) const char *newname; char *tempname; - asprintf (&tempname, "%s.clobber", name); + tempname = xasprintf ("%s.clobber", name); newname = ggc_strdup (tempname); free (tempname); @@ -5471,7 +5471,7 @@ create_function_info_for (tree decl, const char *name) prev_vi->next = clobbervi->id; prev_vi = clobbervi; - asprintf (&tempname, "%s.use", name); + tempname = xasprintf ("%s.use", name); newname = ggc_strdup (tempname); free (tempname); @@ -5493,7 +5493,7 @@ create_function_info_for (tree decl, const char *name) const char *newname; char *tempname; - asprintf (&tempname, "%s.chain", name); + tempname = xasprintf ("%s.chain", name); newname = ggc_strdup (tempname); free (tempname); @@ -5521,7 +5521,7 @@ create_function_info_for (tree decl, const char *name) if (DECL_RESULT (decl)) resultdecl = DECL_RESULT (decl); - asprintf (&tempname, "%s.result", name); + tempname = xasprintf ("%s.result", name); newname = ggc_strdup (tempname); free (tempname); @@ -5551,7 +5551,7 @@ create_function_info_for (tree decl, const char *name) if (arg) argdecl = arg; - asprintf (&tempname, "%s.arg%d", name, i); + tempname = xasprintf ("%s.arg%d", name, i); newname = ggc_strdup (tempname); free (tempname); @@ -5580,7 +5580,7 @@ create_function_info_for (tree decl, const char *name) char *tempname; tree decl; - asprintf (&tempname, "%s.varargs", name); + tempname = xasprintf ("%s.varargs", name); newname = ggc_strdup (tempname); free (tempname); @@ -5717,8 +5717,10 @@ create_variable_info_for_1 (tree decl, const char *name) if (dump_file) { - asprintf (&tempname, "%s." HOST_WIDE_INT_PRINT_DEC - "+" HOST_WIDE_INT_PRINT_DEC, name, fo->offset, fo->size); + tempname + = xasprintf ("%s." HOST_WIDE_INT_PRINT_DEC + "+" HOST_WIDE_INT_PRINT_DEC, name, + fo->offset, fo->size); newname = ggc_strdup (tempname); free (tempname); } -- 2.30.2