[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/4] maint: use more perl subroutines prototypes in the automake
From: |
Stefano Lattarini |
Subject: |
[PATCH 3/4] maint: use more perl subroutines prototypes in the automake script |
Date: |
Thu, 14 Feb 2013 13:43:22 +0100 |
* automake.in: Throughout this file. Note that these new prototypes
are not much useful, since many subroutine calls still use the old
'&foo' form; but we'll take care of that in later patches.
* lib/Automake/Language.pm (target_hook): Call the '_target_hook'
of the given language in a more modern form, avoiding '&'.
Signed-off-by: Stefano Lattarini <address@hidden>
---
automake.in | 90 ++++++++++++++++++++++++------------------------
lib/Automake/Language.pm | 2 +-
2 files changed, 46 insertions(+), 46 deletions(-)
diff --git a/automake.in b/automake.in
index 3e27843..8466ee4 100644
--- a/automake.in
+++ b/automake.in
@@ -1146,7 +1146,7 @@ sub handle_silent ()
# Handle AUTOMAKE_OPTIONS variable. Return 1 on error, 0 otherwise.
-sub handle_options
+sub handle_options ()
{
my $var = var ('AUTOMAKE_OPTIONS');
if ($var)
@@ -1219,7 +1219,7 @@ sub check_user_variables (@)
}
# Call finish function for each language that was used.
-sub handle_languages
+sub handle_languages ()
{
if (! option 'no-dependencies')
{
@@ -1526,7 +1526,7 @@ sub append_exeext (&$)
# mentioned. This is a separate function (as opposed to being inlined
# in handle_source_transform) because it isn't always appropriate to
# do this check.
-sub check_libobjs_sources
+sub check_libobjs_sources ($$)
{
my ($one_file, $unxformed) = @_;
@@ -2133,7 +2133,7 @@ sub handle_source_transform ($$$$%)
# transformed name of object being built, or empty string if no object
# name of _LDADD/_LIBADD-type variable to examine
# Returns 1 if LIBOBJS seen, 0 otherwise.
-sub handle_lib_objects
+sub handle_lib_objects ($$)
{
my ($xname, $varname) = @_;
@@ -2303,7 +2303,7 @@ sub handle_ALLOCA ($$$)
}
# Canonicalize the input parameter
-sub canonicalize
+sub canonicalize ($)
{
my ($string) = @_;
$string =~ tr/A-Za-z0-9_\@/_/c;
@@ -2313,7 +2313,7 @@ sub canonicalize
# Canonicalize a name, and check to make sure the non-canonical name
# is never used. Returns canonical name. Arguments are name and a
# list of suffixes to check for.
-sub check_canonical_spelling
+sub check_canonical_spelling ($@)
{
my ($name, @suffixes) = @_;
@@ -2389,7 +2389,7 @@ sub handle_compile ()
# handle_libtool ()
# -----------------
# Handle libtool rules.
-sub handle_libtool
+sub handle_libtool ()
{
return unless var ('LIBTOOL');
@@ -2418,7 +2418,7 @@ sub handle_libtool
# handle_programs ()
# ------------------
# Handle C programs.
-sub handle_programs
+sub handle_programs ()
{
my @proglist = &am_install_var ('progs', 'PROGRAMS',
'bin', 'sbin', 'libexec', 'pkglibexec',
@@ -2510,7 +2510,7 @@ sub handle_programs
# handle_libraries ()
# -------------------
# Handle libraries.
-sub handle_libraries
+sub handle_libraries ()
{
my @liblist = &am_install_var ('libs', 'LIBRARIES',
'lib', 'pkglib', 'noinst', 'check');
@@ -2623,7 +2623,7 @@ sub handle_libraries
# handle_ltlibraries ()
# ---------------------
# Handle shared libraries.
-sub handle_ltlibraries
+sub handle_ltlibraries ()
{
my @liblist = &am_install_var ('ltlib', 'LTLIBRARIES',
'noinst', 'lib', 'pkglib', 'check');
@@ -2893,7 +2893,7 @@ sub check_typos ()
# Handle scripts.
-sub handle_scripts
+sub handle_scripts ()
{
# NOTE we no longer automatically clean SCRIPTS, because it is
# useful to sometimes distribute scripts verbatim. This happens
@@ -3416,7 +3416,7 @@ sub handle_texinfo ()
# Handle any man pages.
-sub handle_man_pages
+sub handle_man_pages ()
{
reject_var 'MANS', "'MANS' is an anachronism; use 'man_MANS'";
@@ -3555,7 +3555,7 @@ sub handle_man_pages
}
# Handle DATA variables.
-sub handle_data
+sub handle_data ()
{
&am_install_var ('-noextra', '-candist', 'data', 'DATA',
'data', 'dataroot', 'doc', 'dvi', 'html', 'pdf',
@@ -3564,7 +3564,7 @@ sub handle_data
}
# Handle TAGS.
-sub handle_tags
+sub handle_tags ()
{
my @config;
foreach my $spec (@config_headers)
@@ -4291,7 +4291,7 @@ sub handle_configure ($$$@)
}
# Handle C headers.
-sub handle_headers
+sub handle_headers ()
{
my @r = &am_install_var ('-defaultdist', 'header', 'HEADERS', 'include',
'oldinclude', 'pkginclude',
@@ -4303,7 +4303,7 @@ sub handle_headers
}
}
-sub handle_gettext
+sub handle_gettext ()
{
return if ! $seen_gettext || $relative_dir ne '.';
@@ -4360,7 +4360,7 @@ sub handle_gettext
}
# Handle footer elements.
-sub handle_footer
+sub handle_footer ()
{
reject_rule ('.SUFFIXES',
"use variable 'SUFFIXES', not target '.SUFFIXES'");
@@ -4612,7 +4612,7 @@ sub target_cmp
# &handle_factored_dependencies ()
# --------------------------------
# Handle everything related to gathered targets.
-sub handle_factored_dependencies
+sub handle_factored_dependencies ()
{
# Reject bad hooks.
foreach my $utarg ('uninstall-data-local', 'uninstall-data-hook',
@@ -4699,13 +4699,13 @@ sub handle_factored_dependencies
# &handle_tests_dejagnu ()
# ------------------------
-sub handle_tests_dejagnu
+sub handle_tests_dejagnu ()
{
push (@check_tests, 'check-DEJAGNU');
$output_rules .= file_contents ('dejagnu', new Automake::Location);
}
-sub handle_per_suffix_test
+sub handle_per_suffix_test ($%)
{
my ($test_suffix, %transform) = @_;
my ($pfx, $generic, $am_exeext);
@@ -4769,7 +4769,7 @@ sub is_valid_test_extension ($)
}
# Handle TESTS variable and other checks.
-sub handle_tests
+sub handle_tests ()
{
if (option 'dejagnu')
{
@@ -4903,7 +4903,7 @@ sub handle_tests
}
# Handle Emacs Lisp.
-sub handle_emacs_lisp
+sub handle_emacs_lisp ()
{
my @elfiles = &am_install_var ('-candist', 'lisp', 'LISP',
'lisp', 'noinst');
@@ -4924,7 +4924,7 @@ sub handle_emacs_lisp
}
# Handle Python
-sub handle_python
+sub handle_python ()
{
my @pyfiles = &am_install_var ('-defaultdist', 'python', 'PYTHON',
'noinst');
@@ -4936,7 +4936,7 @@ sub handle_python
}
# Handle Java.
-sub handle_java
+sub handle_java ()
{
my @sourcelist = &am_install_var ('-candist',
'java', 'JAVA',
@@ -4981,7 +4981,7 @@ sub handle_java
# Handle some of the minor options.
-sub handle_minor_options
+sub handle_minor_options ()
{
if (option 'readme-alpha')
{
@@ -5479,7 +5479,7 @@ sub scan_autoconf_files ()
################################################################
# Do any extra checking for GNU standards.
-sub check_gnu_standards
+sub check_gnu_standards ()
{
if ($relative_dir eq '.')
{
@@ -5511,7 +5511,7 @@ sub check_gnu_standards
}
# Do any extra checking for GNITS standards.
-sub check_gnits_standards
+sub check_gnits_standards ()
{
if ($relative_dir eq '.')
{
@@ -5537,7 +5537,7 @@ sub check_gnits_standards
# This is just a convenience function that can be used to determine
# when a subdir object should be used.
-sub lang_sub_obj
+sub lang_sub_obj ()
{
return option 'subdir-objects' ? LANG_SUBDIR : LANG_PROCESS;
}
@@ -5686,7 +5686,7 @@ sub lang_vala_finish_target ($$)
# Add output rules to invoke valac and create stamp file as a witness
# to handle multiple outputs. This function is called after all source
# file processing is done.
-sub lang_vala_finish
+sub lang_vala_finish ()
{
my ($self) = @_;
@@ -5704,7 +5704,7 @@ sub lang_vala_finish
# The built .c files should be cleaned only on maintainer-clean
# as the .c files are distributed. This function is called for each
# .vala source file.
-sub lang_vala_target_hook
+sub lang_vala_target_hook ($$$$%)
{
my ($self, $aggregate, $output, $input, %transform) = @_;
@@ -5713,7 +5713,7 @@ sub lang_vala_target_hook
# This is a yacc helper which is called whenever we have decided to
# compile a yacc file.
-sub lang_yacc_target_hook
+sub lang_yacc_target_hook ($$$$%)
{
my ($self, $aggregate, $output, $input, %transform) = @_;
@@ -5789,7 +5789,7 @@ sub lang_yacc_target_hook
# This is a lex helper which is called whenever we have decided to
# compile a lex file.
-sub lang_lex_target_hook
+sub lang_lex_target_hook ($$$$%)
{
my ($self, $aggregate, $output, $input, %transform) = @_;
# The GNU rules say that yacc/lex output files should be removed
@@ -5800,7 +5800,7 @@ sub lang_lex_target_hook
}
# This is a helper for both lex and yacc.
-sub yacc_lex_finish_helper
+sub yacc_lex_finish_helper ()
{
return if defined $language_scratch{'lex-yacc-done'};
$language_scratch{'lex-yacc-done'} = 1;
@@ -5810,7 +5810,7 @@ sub yacc_lex_finish_helper
&define_variable ('YLWRAP', "$am_config_aux_dir/ylwrap", INTERNAL);
}
-sub lang_yacc_finish
+sub lang_yacc_finish ()
{
return if defined $language_scratch{'yacc-done'};
$language_scratch{'yacc-done'} = 1;
@@ -5821,7 +5821,7 @@ sub lang_yacc_finish
}
-sub lang_lex_finish
+sub lang_lex_finish ()
{
return if defined $language_scratch{'lex-done'};
$language_scratch{'lex-done'} = 1;
@@ -5834,7 +5834,7 @@ sub lang_lex_finish
# precedence. This is lame, but something has to have global
# knowledge in order to eliminate the conflict. Add more linkers as
# required.
-sub resolve_linker
+sub resolve_linker (%)
{
my (%linkers) = @_;
@@ -5846,7 +5846,7 @@ sub resolve_linker
}
# Called to indicate that an extension was used.
-sub saw_extension
+sub saw_extension ($)
{
my ($ext) = @_;
$extension_seen{$ext} = 1;
@@ -5928,7 +5928,7 @@ sub derive_suffix ($$)
################################################################
# Pretty-print something and append to output_rules.
-sub pretty_print_rule
+sub pretty_print_rule (@)
{
$output_rules .= &makefile_wrap (@_);
}
@@ -6538,7 +6538,7 @@ sub read_am_file ($$)
# ----------------------------
# A helper for read_main_am_file which initializes configure variables
# and variables from header-vars.am.
-sub define_standard_variables
+sub define_standard_variables ()
{
my $saved_output_vars = $output_vars;
my ($comments, undef, $rules) =
@@ -6585,7 +6585,7 @@ sub read_main_am_file ($$)
# &flatten ($STRING)
# ------------------
# Flatten the $STRING and return the result.
-sub flatten
+sub flatten ($)
{
$_ = shift;
@@ -7059,7 +7059,7 @@ sub am_primary_prefixes ($$@)
# up into multiple functions.
#
# Usage is: am_install_var (OPTION..., file, HOW, where...)
-sub am_install_var
+sub am_install_var (@)
{
my (@args) = @_;
@@ -7265,7 +7265,7 @@ sub am_install_var
my %make_dirs = ();
my $make_dirs_set = 0;
-sub is_make_dir
+sub is_make_dir ($)
{
my ($dir) = @_;
if (! $make_dirs_set)
@@ -7319,7 +7319,7 @@ sub locate_aux_dir ()
# &push_required_file ($DIR, $FILE, $FULLFILE)
# --------------------------------------------------
# Push the given file onto DIST_COMMON.
-sub push_required_file
+sub push_required_file ($$$)
{
my ($dir, $file, $fullfile) = @_;
@@ -7715,7 +7715,7 @@ sub require_build_directory_maybe ($)
################################################################
# Push a list of files onto dist_common.
-sub push_dist_common
+sub push_dist_common (@)
{
prog_error "push_dist_common run after handle_dist"
if $handle_dist_run;
@@ -8130,7 +8130,7 @@ sub handle_makefiles_serial ()
# get_number_of_threads ()
# ------------------------
# Logic for deciding how many worker threads to use.
-sub get_number_of_threads
+sub get_number_of_threads ()
{
my $nthreads = $ENV{'AUTOMAKE_JOBS'} || 0;
diff --git a/lib/Automake/Language.pm b/lib/Automake/Language.pm
index 6408e86..a678e1e 100644
--- a/lib/Automake/Language.pm
+++ b/lib/Automake/Language.pm
@@ -98,7 +98,7 @@ sub target_hook ($$$$%)
my ($self) = @_;
if (defined $self->_target_hook)
{
- &{$self->_target_hook} (@_);
+ $self->_target_hook->(@_);
}
}
--
1.8.1.1.662.gaa39828
- [PATCH 0/4] Use more perl function prototypes, and prefer func() over &func(), Stefano Lattarini, 2013/02/14
- [PATCH 1/4] refactor: rip module Automake::Language out of automake script, Stefano Lattarini, 2013/02/14
- [PATCH 2/4] build: auto-generate perl subroutines prototypes for automake and aclocal, Stefano Lattarini, 2013/02/14
- [PATCH 3/4] maint: use more perl subroutines prototypes in the automake script,
Stefano Lattarini <=
- [PATCH 4/4] style: call perl functions 'like_this()', not '&like_this()', Stefano Lattarini, 2013/02/14
- Re: [PATCH 0/4] Use more perl function prototypes, and prefer func() over &func(), Stefano Lattarini, 2013/02/16