From 6bf58a59a1f3803e57e3f0378aa9344686707b75 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Mon, 28 May 2012 11:32:03 +0000 Subject: aclocal: declare function prototypes, do not use '&' in function calls * aclocal.in: Declare prototypes for almost all functions early, before any actual function definition (but omit the prototype for the dynamically generated '&search' function). Add prototypes to any function definition. Remove '&' from function invocations (i.e., simply use "func(ARGS..)" instead of "&func(ARGS...)"). --- aclocal.in.orig Mon Jul 9 16:39:57 2012 +++ aclocal.in Sat Mar 30 20:55:26 2013 @@ -152,8 +152,34 @@ my $erase_me; ################################################################ +# Prototypes for all subroutines. + +sub unlink_tmp (;$); +sub xmkdir_p ($); +sub check_acinclude (); +sub reset_maps (); +sub install_file ($$); +sub list_compare (\@\@); +sub scan_m4_dirs ($@); +sub scan_m4_files (); +sub add_macro ($); +sub scan_configure_dep ($); +sub add_file ($); +sub scan_file ($$$); +sub strip_redundant_includes (%); +sub trace_used_macros (); +sub scan_configure (); +sub write_aclocal ($@); +sub usage ($); +sub version (); +sub handle_acdir_option ($$); +sub parse_arguments (); +sub parse_ACLOCAL_PATH (); + +################################################################ + # Erase temporary file ERASE_ME. Handle signals. -sub unlink_tmp +sub unlink_tmp (;$) { my ($sig) = @_; @@ -351,7 +377,7 @@ sub scan_m4_dirs ($@) next if $file eq 'aclocal.m4'; my $fullfile = File::Spec->canonpath ("$m4dir/$file"); - &scan_file ($type, $fullfile, 'aclocal'); + scan_file ($type, $fullfile, 'aclocal'); } closedir (DIR); } @@ -362,12 +388,12 @@ sub scan_m4_files () { # First, scan configure.ac. It may contain macro definitions, # or may include other files that define macros. - &scan_file (FT_USER, $configure_ac, 'aclocal'); + scan_file (FT_USER, $configure_ac, 'aclocal'); # Then, scan acinclude.m4 if it exists. if (-f 'acinclude.m4') { - &scan_file (FT_USER, 'acinclude.m4', 'aclocal'); + scan_file (FT_USER, 'acinclude.m4', 'aclocal'); } # Finally, scan all files in our search paths. @@ -381,7 +407,7 @@ sub scan_m4_files () my $search = "sub search {\nmy \$found = 0;\n"; foreach my $key (reverse sort keys %map) { - $search .= ('if (/\b\Q' . $key . '\E(?!\w)/) { & add_macro ("' . $key + $search .= ('if (/\b\Q' . $key . '\E(?!\w)/) { add_macro ("' . $key . '"); $found = 1; }' . "\n"); } $search .= "return \$found;\n};\n"; @@ -404,7 +430,7 @@ sub add_macro ($) verb "saw macro $macro"; $macro_seen{$macro} = 1; - &add_file ($map{$macro}); + add_file ($map{$macro}); } # scan_configure_dep ($file) @@ -466,7 +492,7 @@ sub scan_configure_dep ($) } add_macro ($_) foreach (@rlist); - &scan_configure_dep ($_) foreach @ilist; + scan_configure_dep ($_) foreach @ilist; } # add_file ($FILE) @@ -933,7 +959,7 @@ General help using GNU software: