[Fortran,0/7] delete some unused decls, make static

Message ID 20211024223023.1410274-1-rep.dot.nop@gmail.com
Headers
Series delete some unused decls, make static |

Message

Bernhard Reutner-Fischer Oct. 24, 2021, 10:30 p.m. UTC
  Hi!

Quickly skimming through the frontend headers.
There are a couple of declarations for functions that do not have
definitions. And there are a couple of functions that can be static.

Notes i took while at it / TODOs:

- get rid of VTAB_GET_FIELD_GEN and unused extern decls
- The last block of gfc_trans_vla_one_sizepos() could simply use
  gfc_evaluate_now_function_scope(). Passing down unshared val of course.
- trans-expr.c has one use of gfc_evaluate_now_loc() but should simply use
  gfc_evaluate_now() there; Calling ...now_loc(input_location) is superfluous
- s/mane/name/;# in git grep -w mane gcc/fortran/
- delete gfc_match_small_int, use gfc_match_small_literal_int instead
- move gfc_match_null definition up before first user, make it static
  and delete decl from match.h
- gfc_cpp_add_include_path_after move up, make static, rm external decl
- gfc_walk_array_ref move up, make static, rm external decl
- delete unused gfc_copy_only_alloc_comp ?
- delete unused gfc_conv_descriptor_attribute ?
- gfc_build_nan str arg is "" always. Delete parameter and handling?
- delete unused gfc_simplify_get_team or wire it up in intrinsics,
  get_team handling (instead of the NULL..)

Anyone who does coarrays might want to fill in the missing get_team()
simplify and add an appropriate test. That's the only thing that i will
not do as i once was more into MPI and verbs so won't ever do coarrays ;)

Bootstraps fine, regression tests running over night.
Ok for trunk if it passes?

thanks,

Bernhard Reutner-Fischer (7):
  Fortran: make some trans* functions static
  Fortran: make some match* functions static
  Fortran: make some constructor* functions static
  Fortran: make some trans-array functions static
  Fortran: Delete unused decl in trans-stmt.h
  Fortran: Delete unused decl in trans-types.h
  Fortran: Delete unused decl in intrinsic.h

 gcc/fortran/constructor.c | 20 ++------------------
 gcc/fortran/constructor.h | 10 ----------
 gcc/fortran/decl.c        | 15 ++++++++-------
 gcc/fortran/expr.c        |  2 +-
 gcc/fortran/gfortran.h    |  1 -
 gcc/fortran/intrinsic.h   |  4 ----
 gcc/fortran/match.c       | 28 +---------------------------
 gcc/fortran/match.h       | 10 ----------
 gcc/fortran/scanner.c     |  4 ++--
 gcc/fortran/trans-array.c |  2 +-
 gcc/fortran/trans-array.h |  6 ------
 gcc/fortran/trans-expr.c  | 10 +++++-----
 gcc/fortran/trans-stmt.h  |  1 -
 gcc/fortran/trans-types.c | 25 +++----------------------
 gcc/fortran/trans-types.h |  4 ----
 gcc/fortran/trans.c       |  1 -
 gcc/fortran/trans.h       | 11 -----------
 17 files changed, 23 insertions(+), 131 deletions(-)
  

Comments

Bernhard Reutner-Fischer Oct. 24, 2021, 10:46 p.m. UTC | #1
On Mon, 25 Oct 2021 00:30:16 +0200
Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> wrote:

> Hi!
> 
> Quickly skimming through the frontend headers.

I'm also attaching the other view for the fortran FE after the header
cleanup:

python3 $topsrc/contrib/unused_functions.py gcc/fortran/ \
  grep -v "gt_"

for a guesstimate list of
 Symbol 'foo' declared extern but never referenced externally

Down to about 50 for f951 as we want to keep the debug ones of course.

For other language frontends see the head of the script;
Back then there was no D nor modula2, and a go sample is missing, too.
Should be rather straight forward if anyone is curious. You can just
abbreviate the list of objects that are used to link your frontend.
Archives are supposedly handled fine, at least last time i tried.

HTH,
gcc/fortran/match.o: Symbol 'type_param_spec_list' declared extern but never referenced externally
gcc/fortran/openmp.o: Symbol 'gfc_free_expr_list(gfc_expr_list*)' declared extern but never referenced externally
gcc/fortran/openmp.o: Symbol 'gfc_free_omp_declare_simd(gfc_omp_declare_simd*)' declared extern but never referenced externally
gcc/fortran/openmp.o: Symbol 'gfc_match_omp_context_selector(gfc_omp_set_selector*)' declared extern but never referenced externally
gcc/fortran/openmp.o: Symbol 'gfc_match_omp_context_selector_specification(gfc_omp_declare_variant*)' declared extern but never referenced externally
gcc/fortran/trans-expr.o: Symbol 'gfc_class_vtab_hash_get(tree_node*)' declared extern but never referenced externally
gcc/fortran/trans-expr.o: Symbol 'gfc_class_vtab_extends_get(tree_node*)' declared extern but never referenced externally
gcc/fortran/trans-expr.o: Symbol 'gfc_vptr_extends_get(tree_node*)' declared extern but never referenced externally
gcc/fortran/trans-expr.o: Symbol 'gfc_class_vtab_def_init_get(tree_node*)' declared extern but never referenced externally
gcc/fortran/trans-expr.o: Symbol 'gfc_vptr_def_init_get(tree_node*)' declared extern but never referenced externally
gcc/fortran/trans-expr.o: Symbol 'gfc_class_vtab_copy_get(tree_node*)' declared extern but never referenced externally
gcc/fortran/trans-expr.o: Symbol 'gfc_vptr_copy_get(tree_node*)' declared extern but never referenced externally
gcc/fortran/trans-expr.o: Symbol 'gfc_vptr_final_get(tree_node*)' declared extern but never referenced externally
gcc/fortran/trans-expr.o: Symbol 'gfc_class_vtab_deallocate_get(tree_node*)' declared extern but never referenced externally
gcc/fortran/trans-decl.o: Symbol 'module_decl_hasher::hash(tree_node*)' declared extern but never referenced externally
gcc/fortran/trans-decl.o: Symbol 'gfor_fndecl_set_args' declared extern but never referenced externally
gcc/fortran/trans-decl.o: Symbol 'gfor_fndecl_set_convert' declared extern but never referenced externally
gcc/fortran/trans-decl.o: Symbol 'gfor_fndecl_set_record_marker' declared extern but never referenced externally
gcc/fortran/trans-decl.o: Symbol 'gfor_fndecl_set_max_subrecord_length' declared extern but never referenced externally
gcc/fortran/simplify.o: Symbol 'gfc_simplify_get_team(gfc_expr*)' declared extern but never referenced externally
gcc/fortran/simplify.o: Symbol 'simplify_ieee_selected_real_kind(gfc_expr*)' declared extern but never referenced externally
gcc/fortran/simplify.o: Symbol 'simplify_ieee_support(gfc_expr*)' declared extern but never referenced externally
gcc/fortran/decl.o: Symbol 'gfc_match_null(gfc_expr**)' declared extern but never referenced externally
gcc/fortran/decl.o: Symbol 'gfc_insert_kind_parameter_exprs(gfc_expr*)' declared extern but never referenced externally
gcc/fortran/decl.o: Symbol 'check_bind_name_identifier(char**)' declared extern but never referenced externally
gcc/fortran/decl.o: Symbol 'gfc_mod_pointee_as(gfc_array_spec*)' declared extern but never referenced externally
gcc/fortran/module.o: Symbol 'mio_symbol_ref(gfc_symbol**)' declared extern but never referenced externally
gcc/fortran/module.o: Symbol 'mio_interface_rest(gfc_interface**)' declared extern but never referenced externally
gcc/fortran/trans-intrinsic.o: Symbol 'specific_intrinsic_symbol(gfc_expr*)' declared extern but never referenced externally
gcc/fortran/resolve.o: Symbol 'gfc_elemental(gfc_symbol*)' declared extern but never referenced externally
gcc/fortran/trans-openmp.o: Symbol 'gfc_trans_oacc_declare(gfc_code*)' declared extern but never referenced externally
gcc/fortran/primary.o: Symbol 'matching_actual_arglist' declared extern but never referenced externally
gcc/fortran/symbol.o: Symbol 'gfc_drop_last_undo_checkpoint()' declared extern but never referenced externally
gcc/fortran/symbol.o: Symbol 'gfc_restore_last_undo_checkpoint()' declared extern but never referenced externally
gcc/fortran/symbol.o: Symbol 'gfc_get_ultimate_derived_super_type(gfc_symbol*)' declared extern but never referenced externally
gcc/fortran/gfortranspec.o: Symbol 'lang_specific_pre_link()' declared extern but never referenced externally
gcc/fortran/gfortranspec.o: Symbol 'lang_specific_extra_outfiles' declared extern but never referenced externally
gcc/fortran/class.o: Symbol 'gfc_intrinsic_hash_value(gfc_typespec*)' declared extern but never referenced externally
gcc/fortran/trans-array.o: Symbol 'gfc_conv_descriptor_attribute(tree_node*)' declared extern but never referenced externally
gcc/fortran/cpp.o: Symbol 'gfc_cpp_option' declared extern but never referenced externally
gcc/fortran/error.o: Symbol 'notify_std_msg(int)' declared extern but never referenced externally
gcc/fortran/frontend-passes.o: Symbol 'n_vars' declared extern but never referenced externally
gcc/fortran/frontend-passes.o: Symbol 'stack_top' declared extern but never referenced externally
gcc/fortran/frontend-passes.o: Symbol 'evec' declared extern but never referenced externally
gcc/fortran/interface.o: Symbol 'maybe_dummy_array_arg(gfc_expr*)' declared extern but never referenced externally
gcc/fortran/dump-parse-tree.o: Symbol 'debug(symbol_attribute*)' declared extern but never referenced externally
gcc/fortran/dump-parse-tree.o: Symbol 'debug(gfc_formal_arglist*)' declared extern but never referenced externally
gcc/fortran/dump-parse-tree.o: Symbol 'debug(symbol_attribute)' declared extern but never referenced externally
gcc/fortran/dump-parse-tree.o: Symbol 'debug(gfc_expr*)' declared extern but never referenced externally
gcc/fortran/dump-parse-tree.o: Symbol 'debug(gfc_typespec*)' declared extern but never referenced externally
gcc/fortran/dump-parse-tree.o: Symbol 'debug(gfc_typespec)' declared extern but never referenced externally
gcc/fortran/dump-parse-tree.o: Symbol 'debug(gfc_ref*)' declared extern but never referenced externally
gcc/fortran/dump-parse-tree.o: Symbol 'gfc_debug_expr(gfc_expr*)' declared extern but never referenced externally
gcc/fortran/dump-parse-tree.o: Symbol 'gfc_debug_code(gfc_code*)' declared extern but never referenced externally
gcc/fortran/dump-parse-tree.o: Symbol 'debug(gfc_symbol*)' declared extern but never referenced externally
gcc/fortran/dump-parse-tree.o: Symbol 'debug(gfc_array_ref*)' declared extern but never referenced externally
  
Bernhard Reutner-Fischer Oct. 25, 2021, 9:25 a.m. UTC | #2
On Mon, 25 Oct 2021 00:30:16 +0200
Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> wrote:

> Hi!
> 
> Quickly skimming through the frontend headers.
> There are a couple of declarations for functions that do not have
> definitions. And there are a couple of functions that can be static.

> Bootstraps fine, regression tests running over night.
> Ok for trunk if it passes?

Tested with no regressions on x86_64-unknown-linux {-m32,-m64}.
Ok for trunk?