summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authormeyering <meyering@138bc75d-0d04-0410-961f-82ee72b054a4>2011-04-20 18:19:03 +0000
committermeyering <meyering@138bc75d-0d04-0410-961f-82ee72b054a4>2011-04-20 18:19:03 +0000
commitdd045aeeddc65c15840ac25e90f729e2805dfc17 (patch)
treee56a024bf4863c42aaa3f941f466a849bb9d3b82 /gcc
parentff3aed6233b16f02b26f82b3dac7d604aac42641 (diff)
downloadgcc-dd045aeeddc65c15840ac25e90f729e2805dfc17.tar.gz
remove useless if-before-free tests
Change "if (E) free (E);" to "free (E);" everywhere except in the libgo/, intl/, zlib/ and classpath/ directories. Also transform equivalent variants like "if (E != NULL) free (E);" and allow an extra cast on the argument to free. Otherwise, the tested and freed "E" expressions must be identical, modulo white space. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@172785 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog39
-rw-r--r--gcc/ada/ChangeLog4
-rw-r--r--gcc/ada/initialize.c3
-rw-r--r--gcc/c-family/ChangeLog7
-rw-r--r--gcc/c-family/c-format.c6
-rw-r--r--gcc/calls.c15
-rw-r--r--gcc/cfgcleanup.c3
-rw-r--r--gcc/collect2.c3
-rw-r--r--gcc/config/i386/i386.c3
-rw-r--r--gcc/config/mcore/mcore.c3
-rw-r--r--gcc/coverage.c3
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/tree.c3
-rw-r--r--gcc/cse.c6
-rw-r--r--gcc/cselib.c3
-rw-r--r--gcc/df-core.c15
-rw-r--r--gcc/fortran/ChangeLog7
-rw-r--r--gcc/fortran/expr.c3
-rw-r--r--gcc/fortran/gfortranspec.c5
-rw-r--r--gcc/fortran/interface.c3
-rw-r--r--gcc/fortran/trans-openmp.c3
-rw-r--r--gcc/function.c3
-rw-r--r--gcc/gcc.c15
-rw-r--r--gcc/gcov.c6
-rw-r--r--gcc/gensupport.c12
-rw-r--r--gcc/graphite-clast-to-gimple.c3
-rw-r--r--gcc/graphite-sese-to-poly.c3
-rw-r--r--gcc/haifa-sched.c3
-rw-r--r--gcc/ipa-prop.c3
-rw-r--r--gcc/ipa-pure-const.c3
-rw-r--r--gcc/ipa-reference.c3
-rw-r--r--gcc/ira-costs.c12
-rw-r--r--gcc/ira.c18
-rw-r--r--gcc/java/ChangeLog6
-rw-r--r--gcc/java/jcf-parse.c3
-rw-r--r--gcc/matrix-reorg.c9
-rw-r--r--gcc/prefix.c3
-rw-r--r--gcc/profile.c3
-rw-r--r--gcc/reload1.c6
-rw-r--r--gcc/sched-deps.c3
-rw-r--r--gcc/sel-sched-ir.c3
-rw-r--r--gcc/sese.c6
-rw-r--r--gcc/tree-data-ref.c6
-rw-r--r--gcc/tree-eh.c3
-rw-r--r--gcc/tree-ssa-coalesce.c3
-rw-r--r--gcc/tree-ssa-live.c6
-rw-r--r--gcc/tree-ssa-loop-ivopts.c6
-rw-r--r--gcc/tree-ssa-pre.c3
48 files changed, 141 insertions, 153 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6dade07dc5b..86a2b832cf1 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,42 @@
+2011-04-20 Jim Meyering <meyering@redhat.com>
+
+ Remove useless if-before-free tests.
+ * calls.c (expand_call, save_area): Likewise.
+ * cfgcleanup.c (try_forward_edges): Likewise.
+ * collect2.c (collect_execute): Likewise.
+ * config/i386/i386.c (ix86_valid_target_attribute_tree): Likewise.
+ * config/mcore/mcore.c (mcore_expand_prolog): Likewise.
+ * coverage.c (coverage_checksum_string): Likewise.
+ * cse.c (init_cse_reg_info, delete_trivially_dead_insns): Likewise.
+ * cselib.c (cselib_init): Likewise.
+ * df-core.c (rest_of_handle_df_finish, df_analyze): Likewise.
+ (df_set_clean_cfg): Likewise.
+ * function.c (free_after_compilation): Likewise.
+ * gcc.c (do_spec_1, main): Likewise.
+ * gcov.c (create_file_names): Likewise.
+ * gensupport.c (identify_predicable_attribute): Likewise.
+ * graphite-clast-to-gimple.c (save_clast_name_index): Likewise.
+ * graphite-sese-to-poly.c (free_data_refs_aux): Likewise.
+ * haifa-sched.c (haifa_finish_h_i_d): Likewise.
+ * ipa-prop.c (ipa_free_node_params_substructures): Likewise.
+ * ipa-pure-const.c (local_pure_const): Likewise.
+ * ipa-reference.c (propagate): Likewise.
+ * ira-costs.c (free_ira_costs): Likewise.
+ * ira.c (free_register_move_costs, build_insn_chain): Likewise.
+ * matrix-reorg.c (mat_free): Likewise.
+ * prefix.c (get_key_value): Likewise.
+ * profile.c (compute_value_histograms): Likewise.
+ * reload1.c (free_reg_equiv): Likewise.
+ * sched-deps.c (free_deps): Likewise.
+ * sel-sched-ir.c (fence_clear): Likewise.
+ * sese.c (set_rename, if_region_set_false_region): Likewise.
+ * tree-data-ref.c (free_rdg): Likewise.
+ * tree-eh.c (lower_try_finally): Likewise.
+ * tree-ssa-coalesce.c (delete_coalesce_list): Likewise.
+ * tree-ssa-live.c (delete_var_map): Likewise.
+ * tree-ssa-loop-ivopts.c (free_loop_data): Likewise.
+ * tree-ssa-pre.c (phi_trans_add): Likewise.
+
2011-04-20 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/48611
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index a73831629a1..c2758d1b0cc 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,7 @@
+2011-04-20 Jim Meyering <meyering@redhat.com>
+
+ * initialize.c (__gnat_initialize): Remove useless if-before-free.
+
2011-04-17 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/Make-lang.in (gnatbind): Replace $(ALL_CFLAGS) with
diff --git a/gcc/ada/initialize.c b/gcc/ada/initialize.c
index 32ea0e5c7f3..e2ad904e9b2 100644
--- a/gcc/ada/initialize.c
+++ b/gcc/ada/initialize.c
@@ -217,8 +217,7 @@ __gnat_initialize (void *eh ATTRIBUTE_UNUSED)
FindClose (hDir);
- if (dir != NULL)
- free (dir);
+ free (dir);
}
}
else
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index f8f0b4b6707..b0f27c510d4 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,8 @@
+2011-04-20 Jim Meyering <meyering@redhat.com>
+
+ * c-format.c (init_dollar_format_checking): Remove useless
+ if-before-free.
+
2011-04-15 Nicola Pero <nicola.pero@meta-innovation.com>
* c-objc.h (objc_get_interface_ivars): Removed.
@@ -1105,7 +1110,7 @@
* c-common.c: Include gt-c-family-c-common.h.
* c-pragma.c: Include gt-c-family-c-pragma.h.
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2010, 2011 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gcc/c-family/c-format.c b/gcc/c-family/c-format.c
index 801e4347da9..0c5115a9360 100644
--- a/gcc/c-family/c-format.c
+++ b/gcc/c-family/c-format.c
@@ -1107,10 +1107,8 @@ init_dollar_format_checking (int first_arg_num, tree params)
}
if (dollar_arguments_alloc < dollar_arguments_count)
{
- if (dollar_arguments_used)
- free (dollar_arguments_used);
- if (dollar_arguments_pointer_p)
- free (dollar_arguments_pointer_p);
+ free (dollar_arguments_used);
+ free (dollar_arguments_pointer_p);
dollar_arguments_alloc = dollar_arguments_count;
dollar_arguments_used = XNEWVEC (char, dollar_arguments_alloc);
dollar_arguments_pointer_p = XNEWVEC (char, dollar_arguments_alloc);
diff --git a/gcc/calls.c b/gcc/calls.c
index 2e7977720e1..bb95852bf84 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -2555,8 +2555,7 @@ expand_call (tree exp, rtx target, int ignore)
highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use,
needed);
#endif
- if (stack_usage_map_buf)
- free (stack_usage_map_buf);
+ free (stack_usage_map_buf);
stack_usage_map_buf = XNEWVEC (char, highest_outgoing_arg_in_use);
stack_usage_map = stack_usage_map_buf;
@@ -2661,8 +2660,7 @@ expand_call (tree exp, rtx target, int ignore)
= stack_arg_under_construction;
stack_arg_under_construction = 0;
/* Make a new map for the new argument list. */
- if (stack_usage_map_buf)
- free (stack_usage_map_buf);
+ free (stack_usage_map_buf);
stack_usage_map_buf = XCNEWVEC (char, highest_outgoing_arg_in_use);
stack_usage_map = stack_usage_map_buf;
highest_outgoing_arg_in_use = 0;
@@ -3152,8 +3150,7 @@ expand_call (tree exp, rtx target, int ignore)
/* Free up storage we no longer need. */
for (i = 0; i < num_actuals; ++i)
- if (args[i].aligned_regs)
- free (args[i].aligned_regs);
+ free (args[i].aligned_regs);
insns = get_insns ();
end_sequence ();
@@ -3208,8 +3205,7 @@ expand_call (tree exp, rtx target, int ignore)
currently_expanding_call--;
- if (stack_usage_map_buf)
- free (stack_usage_map_buf);
+ free (stack_usage_map_buf);
return target;
}
@@ -3966,8 +3962,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
stack_usage_map = initial_stack_usage_map;
}
- if (stack_usage_map_buf)
- free (stack_usage_map_buf);
+ free (stack_usage_map_buf);
return value;
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index 98c51ad2573..179cd00ad0c 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -646,8 +646,7 @@ try_forward_edges (int mode, basic_block b)
ei_next (&ei);
}
- if (threaded_edges)
- free (threaded_edges);
+ free (threaded_edges);
return changed;
}
diff --git a/gcc/collect2.c b/gcc/collect2.c
index 373483bcd38..0c554f05346 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -2087,8 +2087,7 @@ collect_execute (const char *prog, char **argv, const char *outname,
fatal (errmsg);
}
- if (response_arg)
- free (response_arg);
+ free (response_arg);
return pex;
}
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index b6d41f08dd0..80cb104b06e 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -4783,8 +4783,7 @@ ix86_valid_target_attribute_tree (tree args)
/* Free up memory allocated to hold the strings */
for (i = 0; i < IX86_FUNCTION_SPECIFIC_MAX; i++)
- if (option_strings[i])
- free (option_strings[i]);
+ free (option_strings[i]);
}
return t;
diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c
index 093ac2f2de0..741452ec05f 100644
--- a/gcc/config/mcore/mcore.c
+++ b/gcc/config/mcore/mcore.c
@@ -1980,8 +1980,7 @@ mcore_expand_prolog (void)
gcc_assert (GET_CODE (x) == SYMBOL_REF);
- if (mcore_current_function_name)
- free (mcore_current_function_name);
+ free (mcore_current_function_name);
mcore_current_function_name = xstrdup (XSTR (x, 0));
diff --git a/gcc/coverage.c b/gcc/coverage.c
index 79d20ab5cee..58b7c69e893 100644
--- a/gcc/coverage.c
+++ b/gcc/coverage.c
@@ -522,8 +522,7 @@ coverage_checksum_string (unsigned chksum, const char *string)
}
chksum = crc32_string (chksum, string);
- if (dup)
- free (dup);
+ free (dup);
return chksum;
}
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c7068ab97cc..e854651ecb6 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,7 @@
+2011-04-20 Jim Meyering <meyering@redhat.com>
+
+ * tree.c (cxx_printable_name_internal): Remove useless if-before-free.
+
2011-04-19 Jason Merrill <jason@redhat.com>
PR c++/46304
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 25f2c32f0f2..23daa6c45e0 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -1509,8 +1509,7 @@ cxx_printable_name_internal (tree decl, int v, bool translate)
gcc_assert (uid_ring[ring_counter] != DECL_UID (current_function_decl));
}
- if (print_ring[ring_counter])
- free (print_ring[ring_counter]);
+ free (print_ring[ring_counter]);
print_ring[ring_counter] = xstrdup (lang_decl_name (decl, v, translate));
uid_ring[ring_counter] = DECL_UID (decl);
diff --git a/gcc/cse.c b/gcc/cse.c
index f7b477c60b1..d83b38a60b8 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -796,8 +796,7 @@ init_cse_reg_info (unsigned int nregs)
}
/* Reallocate the table with NEW_SIZE entries. */
- if (cse_reg_info_table)
- free (cse_reg_info_table);
+ free (cse_reg_info_table);
cse_reg_info_table = XNEWVEC (struct cse_reg_info, new_size);
cse_reg_info_table_size = new_size;
cse_reg_info_table_first_uninitialized = 0;
@@ -6975,8 +6974,7 @@ delete_trivially_dead_insns (rtx insns, int nreg)
df_insn_rescan (insn);
}
}
- if (replacements)
- free (replacements);
+ free (replacements);
}
if (dump_file && ndead)
diff --git a/gcc/cselib.c b/gcc/cselib.c
index dff096752f5..56e6d178576 100644
--- a/gcc/cselib.c
+++ b/gcc/cselib.c
@@ -2462,8 +2462,7 @@ cselib_init (int record_what)
if (!reg_values || reg_values_size < cselib_nregs
|| (reg_values_size > 10 && reg_values_size > cselib_nregs * 4))
{
- if (reg_values)
- free (reg_values);
+ free (reg_values);
/* Some space for newly emit instructions so we don't end up
reallocating in between passes. */
reg_values_size = cselib_nregs + (63 + cselib_nregs) / 16;
diff --git a/gcc/df-core.c b/gcc/df-core.c
index 98c2088f51e..9f3ea429562 100644
--- a/gcc/df-core.c
+++ b/gcc/df-core.c
@@ -811,10 +811,8 @@ rest_of_handle_df_finish (void)
dflow->problem->free_fun ();
}
- if (df->postorder)
- free (df->postorder);
- if (df->postorder_inverted)
- free (df->postorder_inverted);
+ free (df->postorder);
+ free (df->postorder_inverted);
free (df->hard_regs_live_count);
free (df);
df = NULL;
@@ -1183,10 +1181,8 @@ df_analyze (void)
bool everything;
int i;
- if (df->postorder)
- free (df->postorder);
- if (df->postorder_inverted)
- free (df->postorder_inverted);
+ free (df->postorder);
+ free (df->postorder_inverted);
df->postorder = XNEWVEC (int, last_basic_block);
df->postorder_inverted = XNEWVEC (int, last_basic_block);
df->n_blocks = post_order_compute (df->postorder, true, true);
@@ -1725,8 +1721,7 @@ df_check_cfg_clean (void)
static void
df_set_clean_cfg (void)
{
- if (saved_cfg)
- free (saved_cfg);
+ free (saved_cfg);
saved_cfg = df_compute_cfg_image ();
}
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 7a857a47664..9e949b3fb0a 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,10 @@
+2011-04-20 Jim Meyering <meyering@redhat.com>
+
+ * expr.c (free_expr0): Remove useless if-before-free.
+ * gfortranspec.c (lang_specific_pre_link): Likewise.
+ * interface.c (gfc_extend_expr): Likewise.
+ * trans-openmp.c (gfc_trans_omp_array_reduction): Likewise.
+
2011-04-19 Tobias Burnus <burnus@net-b.de>
PR fortran/48588
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index 42b65c6a36b..dae2149b1de 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -433,8 +433,7 @@ free_expr0 (gfc_expr *e)
}
/* Free the representation. */
- if (e->representation.string)
- free (e->representation.string);
+ free (e->representation.string);
break;
diff --git a/gcc/fortran/gfortranspec.c b/gcc/fortran/gfortranspec.c
index 2d732fdd45b..4d939a05bf8 100644
--- a/gcc/fortran/gfortranspec.c
+++ b/gcc/fortran/gfortranspec.c
@@ -472,9 +472,8 @@ For more information about these matters, see the file named COPYING\n\n"));
int
lang_specific_pre_link (void)
{
- if (spec_file)
- free (spec_file);
- else if (library)
+ free (spec_file);
+ if (spec_file == NULL && library)
do_spec ("%:include(libgfortran.spec)");
return 0;
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index 872d4898ff6..5e7a1dce196 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -3141,8 +3141,7 @@ gfc_extend_expr (gfc_expr *e, bool *real_error)
}
/* Don't use gfc_free_actual_arglist(). */
- if (actual->next != NULL)
- free (actual->next);
+ free (actual->next);
free (actual);
return FAILURE;
diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c
index d709fdf4c4e..625daebe8b2 100644
--- a/gcc/fortran/trans-openmp.c
+++ b/gcc/fortran/trans-openmp.c
@@ -714,8 +714,7 @@ gfc_trans_omp_array_reduction (tree c, gfc_symbol *sym, locus where)
free (symtree1);
free (symtree2);
free (symtree3);
- if (symtree4)
- free (symtree4);
+ free (symtree4);
gfc_free_array_spec (outer_sym.as);
}
diff --git a/gcc/function.c b/gcc/function.c
index c14a3396745..d7d56ddfb5e 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -211,8 +211,7 @@ free_after_compilation (struct function *f)
prologue_insn_hash = NULL;
epilogue_insn_hash = NULL;
- if (crtl->emit.regno_pointer_align)
- free (crtl->emit.regno_pointer_align);
+ free (crtl->emit.regno_pointer_align);
memset (crtl, 0, sizeof (struct rtl_data));
f->eh = NULL;
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 7ad959aa8da..f9a2bb2105c 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -4806,8 +4806,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
t->filename_length = temp_filename_length;
}
- if (saved_suffix)
- free (saved_suffix);
+ free (saved_suffix);
obstack_grow (&obstack, t->filename, t->filename_length);
delete_this_arg = 1;
@@ -6724,12 +6723,10 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
{
if (compare_debug)
{
- if (debug_check_temp_file[0])
- free (debug_check_temp_file[0]);
+ free (debug_check_temp_file[0]);
debug_check_temp_file[0] = NULL;
- if (debug_check_temp_file[1])
- free (debug_check_temp_file[1]);
+ free (debug_check_temp_file[1]);
debug_check_temp_file[1] = NULL;
}
@@ -6773,12 +6770,10 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
if (compare_debug)
{
- if (debug_check_temp_file[0])
- free (debug_check_temp_file[0]);
+ free (debug_check_temp_file[0]);
debug_check_temp_file[0] = NULL;
- if (debug_check_temp_file[1])
- free (debug_check_temp_file[1]);
+ free (debug_check_temp_file[1]);
debug_check_temp_file[1] = NULL;
}
}
diff --git a/gcc/gcov.c b/gcc/gcov.c
index 56fff3a75fa..bb2791324a3 100644
--- a/gcc/gcov.c
+++ b/gcc/gcov.c
@@ -661,10 +661,8 @@ create_file_names (const char *file_name)
int base;
/* Free previous file names. */
- if (bbg_file_name)
- free (bbg_file_name);
- if (da_file_name)
- free (da_file_name);
+ free (bbg_file_name);
+ free (da_file_name);
da_file_name = bbg_file_name = NULL;
bbg_file_time = 0;
bbg_stamp = 0;
diff --git a/gcc/gensupport.c b/gcc/gensupport.c
index d2c2f715729..682d2ac6959 100644
--- a/gcc/gensupport.c
+++ b/gcc/gensupport.c
@@ -594,8 +594,7 @@ identify_predicable_attribute (void)
if (p_true == NULL || strchr (++p_true, ',') != NULL)
{
error_with_line (elem->lineno, "attribute `predicable' is not a boolean");
- if (p_false)
- free (p_false);
+ free (p_false);
return;
}
p_true[-1] = '\0';
@@ -611,15 +610,13 @@ identify_predicable_attribute (void)
case CONST:
error_with_line (elem->lineno, "attribute `predicable' cannot be const");
- if (p_false)
- free (p_false);
+ free (p_false);
return;
default:
error_with_line (elem->lineno,
"attribute `predicable' must have a constant default");
- if (p_false)
- free (p_false);
+ free (p_false);
return;
}
@@ -631,8 +628,7 @@ identify_predicable_attribute (void)
{
error_with_line (elem->lineno,
"unknown value `%s' for `predicable' attribute", value);
- if (p_false)
- free (p_false);
+ free (p_false);
}
}
diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c
index 41356dc814a..c8356d34a63 100644
--- a/gcc/graphite-clast-to-gimple.c
+++ b/gcc/graphite-clast-to-gimple.c
@@ -114,8 +114,7 @@ save_clast_name_index (htab_t index_table, const char *name, int index)
if (slot)
{
- if (*slot)
- free (*slot);
+ free (*slot);
*slot = new_clast_name_index (name, index);
}
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index 064ded3e2f0..7474be016c3 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -190,8 +190,7 @@ free_data_refs_aux (VEC (data_reference_p, heap) *datarefs)
{
base_alias_pair *bap = (base_alias_pair *)(dr->aux);
- if (bap->alias_set)
- free (bap->alias_set);
+ free (bap->alias_set);
free (bap);
dr->aux = NULL;
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index e2d389b9592..d67aee8f827 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -5582,8 +5582,7 @@ haifa_finish_h_i_d (void)
FOR_EACH_VEC_ELT (haifa_insn_data_def, h_i_d, i, data)
{
- if (data->reg_pressure != NULL)
- free (data->reg_pressure);
+ free (data->reg_pressure);
for (use = data->reg_use_list; use != NULL; use = next)
{
next = use->next_insn_use;
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index 3fdebc1f2c5..d7386545990 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -1936,8 +1936,7 @@ ipa_free_all_edge_args (void)
void
ipa_free_node_params_substructures (struct ipa_node_params *info)
{
- if (info->params)
- free (info->params);
+ free (info->params);
memset (info, 0, sizeof (*info));
}
diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
index eb5b0f6ab61..67022c4edbb 100644
--- a/gcc/ipa-pure-const.c
+++ b/gcc/ipa-pure-const.c
@@ -1662,8 +1662,7 @@ local_pure_const (void)
lang_hooks.decl_printable_name (current_function_decl,
2));
}
- if (l)
- free (l);
+ free (l);
if (changed)
return execute_fixup_cfg ();
else
diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c
index f874a2e80ef..40fa6bc1bcb 100644
--- a/gcc/ipa-reference.c
+++ b/gcc/ipa-reference.c
@@ -913,8 +913,7 @@ propagate (void)
node_g->statics_written);
}
}
- if (node_info)
- free (node_info);
+ free (node_info);
if (node->aux)
{
free (node->aux);
diff --git a/gcc/ira-costs.c b/gcc/ira-costs.c
index 3b113b67da9..de894a25223 100644
--- a/gcc/ira-costs.c
+++ b/gcc/ira-costs.c
@@ -1968,19 +1968,15 @@ free_ira_costs (void)
{
int i;
- if (init_cost != NULL)
- free (init_cost);
+ free (init_cost);
init_cost = NULL;
for (i = 0; i < MAX_RECOG_OPERANDS; i++)
{
- if (op_costs[i] != NULL)
- free (op_costs[i]);
- if (this_op_costs[i] != NULL)
- free (this_op_costs[i]);
+ free (op_costs[i]);
+ free (this_op_costs[i]);
op_costs[i] = this_op_costs[i] = NULL;
}
- if (temp_costs != NULL)
- free (temp_costs);
+ free (temp_costs);
temp_costs = NULL;
}
diff --git a/gcc/ira.c b/gcc/ira.c
index 054f4ca8eb2..49f3e764ed0 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -1556,16 +1556,11 @@ free_register_move_costs (void)
for (mode = 0; mode < MAX_MACHINE_MODE; mode++)
{
- if (ira_max_register_move_cost[mode] != NULL)
- free (ira_max_register_move_cost[mode]);
- if (ira_may_move_in_cost[mode] != NULL)
- free (ira_may_move_in_cost[mode]);
- if (ira_may_move_out_cost[mode] != NULL)
- free (ira_may_move_out_cost[mode]);
- if (ira_max_may_move_in_cost[mode] != NULL)
- free (ira_max_may_move_in_cost[mode]);
- if (ira_max_may_move_out_cost[mode] != NULL)
- free (ira_max_may_move_out_cost[mode]);
+ free (ira_max_register_move_cost[mode]);
+ free (ira_may_move_in_cost[mode]);
+ free (ira_may_move_out_cost[mode]);
+ free (ira_max_may_move_in_cost[mode]);
+ free (ira_max_may_move_out_cost[mode]);
ira_register_move_cost[mode] = NULL;
ira_max_register_move_cost[mode] = NULL;
ira_may_move_in_cost[mode] = NULL;
@@ -3461,8 +3456,7 @@ build_insn_chain (void)
}
for (i = 0; i < (unsigned int) max_regno; i++)
- if (live_subregs[i])
- free (live_subregs[i]);
+ free (live_subregs[i]);
reload_insn_chain = c;
*p = NULL;
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 5ddbc9d541e..dec7e0b79ed 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,7 @@
+2011-04-20 Jim Meyering <meyering@redhat.com>
+
+ * jcf-parse.c (java_parse_file): Remove useless if-before-free.
+
2011-04-18 Jim Meyering <meyering@redhat.com>
* jcf-parse.c: Fix typo in comment.
@@ -22471,7 +22475,7 @@ Tue Mar 9 11:52:08 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+2006, 2007, 2008, 2009, 2011 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c
index a56c1b75c51..37cea2870a8 100644
--- a/gcc/java/jcf-parse.c
+++ b/gcc/java/jcf-parse.c
@@ -1843,8 +1843,7 @@ java_parse_file (void)
list = next;
}
- if (file_list != NULL)
- free (file_list);
+ free (file_list);
if (filename_count == 0)
warning (0, "no input file specified");
diff --git a/gcc/matrix-reorg.c b/gcc/matrix-reorg.c
index 44daa27c1f7..6f75d3320c1 100644
--- a/gcc/matrix-reorg.c
+++ b/gcc/matrix-reorg.c
@@ -529,12 +529,9 @@ mat_free (void *e)
if (!mat)
return;
- if (mat->free_stmts)
- free (mat->free_stmts);
- if (mat->dim_hot_level)
- free (mat->dim_hot_level);
- if (mat->malloc_for_level)
- free (mat->malloc_for_level);
+ free (mat->free_stmts);
+ free (mat->dim_hot_level);
+ free (mat->malloc_for_level);
}
/* Find all potential matrices.
diff --git a/gcc/prefix.c b/gcc/prefix.c
index 67ebdd99ed6..90261ae6ffe 100644
--- a/gcc/prefix.c
+++ b/gcc/prefix.c
@@ -103,8 +103,7 @@ get_key_value (char *key)
if (prefix == 0)
prefix = std_prefix;
- if (temp)
- free (temp);
+ free (temp);
return prefix;
}
diff --git a/gcc/profile.c b/gcc/profile.c
index fd377486b85..e40bfecca90 100644
--- a/gcc/profile.c
+++ b/gcc/profile.c
@@ -828,8 +828,7 @@ compute_value_histograms (histogram_values values)
}
for (t = 0; t < GCOV_N_VALUE_COUNTERS; t++)
- if (histogram_counts[t])
- free (histogram_counts[t]);
+ free (histogram_counts[t]);
}
/* The entry basic block will be moved around so that it has index=1,
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 058b5e9e51b..7fb427078f3 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -4213,10 +4213,8 @@ free_reg_equiv (void)
int i;
- if (offsets_known_at)
- free (offsets_known_at);
- if (offsets_at)
- free (offsets_at);
+ free (offsets_known_at);
+ free (offsets_at);
offsets_at = 0;
offsets_known_at = 0;
diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
index 6abef8b9f4d..09bf65d9093 100644
--- a/gcc/sched-deps.c
+++ b/gcc/sched-deps.c
@@ -3547,8 +3547,7 @@ free_deps (struct deps_desc *deps)
/* As we initialize reg_last lazily, it is possible that we didn't allocate
it at all. */
- if (deps->reg_last)
- free (deps->reg_last);
+ free (deps->reg_last);
deps->reg_last = NULL;
deps = NULL;
diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index a6daa5886dc..a12617ce3ee 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -581,8 +581,7 @@ fence_clear (fence_t f)
gcc_assert ((s != NULL && dc != NULL && tc != NULL)
|| (s == NULL && dc == NULL && tc == NULL));
- if (s != NULL)
- free (s);
+ free (s);
if (dc != NULL)
delete_deps_context (dc);
diff --git a/gcc/sese.c b/gcc/sese.c
index bfb0276d3a8..3ce83b9f7c1 100644
--- a/gcc/sese.c
+++ b/gcc/sese.c
@@ -449,8 +449,7 @@ set_rename (htab_t rename_map, tree old_name, tree expr)
if (!slot)
return;
- if (*slot)
- free (*slot);
+ free (*slot);
*slot = new_rename_map_elt (old_name, expr);
}
@@ -676,8 +675,7 @@ if_region_set_false_region (ifsese if_region, sese region)
SESE_EXIT (region) = false_edge;
- if (if_region->false_region)
- free (if_region->false_region);
+ free (if_region->false_region);
if_region->false_region = region;
if (slot)
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index e01c67722f7..04606052225 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -5127,11 +5127,9 @@ free_rdg (struct graph *rdg)
struct graph_edge *e;
for (e = v->succ; e; e = e->succ_next)
- if (e->data)
- free (e->data);
+ free (e->data);
- if (v->data)
- free (v->data);
+ free (v->data);
}
htab_delete (rdg->indices);
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 76453b8f45a..60e2236823b 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -1619,8 +1619,7 @@ lower_try_finally (struct leh_state *state, gimple tp)
}
VEC_free (tree, heap, this_tf.dest_array);
- if (this_tf.goto_queue)
- free (this_tf.goto_queue);
+ free (this_tf.goto_queue);
if (this_tf.goto_queue_map)
pointer_map_destroy (this_tf.goto_queue_map);
diff --git a/gcc/tree-ssa-coalesce.c b/gcc/tree-ssa-coalesce.c
index e7490e6813c..2dfe37eca53 100644
--- a/gcc/tree-ssa-coalesce.c
+++ b/gcc/tree-ssa-coalesce.c
@@ -242,8 +242,7 @@ delete_coalesce_list (coalesce_list_p cl)
{
gcc_assert (cl->cost_one_list == NULL);
htab_delete (cl->list);
- if (cl->sorted)
- free (cl->sorted);
+ free (cl->sorted);
gcc_assert (cl->num_sorted == 0);
free (cl);
}
diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c
index c99d987b6b6..4216b225851 100644
--- a/gcc/tree-ssa-live.c
+++ b/gcc/tree-ssa-live.c
@@ -157,10 +157,8 @@ delete_var_map (var_map map)
{
var_map_base_fini (map);
partition_delete (map->var_partition);
- if (map->partition_to_view)
- free (map->partition_to_view);
- if (map->view_to_partition)
- free (map->view_to_partition);
+ free (map->partition_to_view);
+ free (map->view_to_partition);
free (map);
}
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index 0aa21e0c9f3..b00b8d44ac3 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -6254,8 +6254,7 @@ free_loop_data (struct ivopts_data *data)
struct version_info *info;
info = ver_info (data, i);
- if (info->iv)
- free (info->iv);
+ free (info->iv);
info->iv = NULL;
info->has_nonlin_use = false;
info->preserve_biv = false;
@@ -6282,8 +6281,7 @@ free_loop_data (struct ivopts_data *data)
{
struct iv_cand *cand = iv_cand (data, i);
- if (cand->iv)
- free (cand->iv);
+ free (cand->iv);
if (cand->depends_on)
BITMAP_FREE (cand->depends_on);
free (cand);
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index ee9ee6fe080..a833a041bbb 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -580,8 +580,7 @@ phi_trans_add (pre_expr e, pre_expr v, basic_block pred)
slot = htab_find_slot_with_hash (phi_translate_table, new_pair,
new_pair->hashcode, INSERT);
- if (*slot)
- free (*slot);
+ free (*slot);
*slot = (void *) new_pair;
}