]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
Consistently use ‘our’ instead of ‘use vars’.
authorZack Weinberg <zackw@panix.com>
Fri, 11 Sep 2020 22:03:19 +0000 (18:03 -0400)
committerZack Weinberg <zackw@panix.com>
Sat, 12 Sep 2020 13:33:42 +0000 (09:33 -0400)
At file scope of a file containing at most one ‘package’ declaration,
‘use vars’ is exactly equivalent to ‘our’, and the latter is preferred
starting with Perl 5.6.0, which happens to be the oldest version we
support.

(This change has nothing to do with the previous two, but I want to make the
same change in Autoconf and that means doing it here for all the files synced
from Automake.)

(I don’t know why, but this change exposed a latent bug in FileUtils.pm where
the last pod block in the file didn’t have a ‘=cut’ delimiter, so the code
after it was considered documentation, causing ‘require FileUtils’ to fail.)

* lib/Automake/ChannelDefs.pm
* lib/Automake/Channels.pm
* lib/Automake/Condition.pm
* lib/Automake/Configure_ac.pm
* lib/Automake/DisjConditions.pm
* lib/Automake/FileUtils.pm
* lib/Automake/General.pm
* lib/Automake/Getopt.pm
* lib/Automake/Options.pm
* lib/Automake/Rule.pm
* lib/Automake/RuleDef.pm
* lib/Automake/VarDef.pm
* lib/Automake/Variable.pm
* lib/Automake/Wrap.pm
* lib/Automake/XFile.pm:
  Replace all uses of ‘use vars’ with ‘our’.

* lib/Automake/FileUtils.pm:
  Add missing ‘=cut’ to a pod block near the end of the file.

15 files changed:
lib/Automake/ChannelDefs.pm
lib/Automake/Channels.pm
lib/Automake/Condition.pm
lib/Automake/Configure_ac.pm
lib/Automake/DisjConditions.pm
lib/Automake/FileUtils.pm
lib/Automake/General.pm
lib/Automake/Getopt.pm
lib/Automake/Options.pm
lib/Automake/Rule.pm
lib/Automake/RuleDef.pm
lib/Automake/VarDef.pm
lib/Automake/Variable.pm
lib/Automake/Wrap.pm
lib/Automake/XFile.pm

index 1693c05d5205af3482726e3676880098c2ca9c02..b98191b4c928ba8c1bd503c9dda341289b9cfc2f 100644 (file)
@@ -61,10 +61,9 @@ BEGIN
     }
 }
 
-use vars qw (@EXPORT @ISA);
-@ISA = qw (Exporter);
-@EXPORT = qw (&prog_error &error &fatal &verb
-             &switch_warning &parse_WARNINGS &parse_warnings);
+our @ISA = qw (Exporter);
+our @EXPORT = qw (&prog_error &error &fatal &verb
+                 &switch_warning &parse_WARNINGS &parse_warnings);
 
 =head2 CHANNELS
 
index 7cc7ffdf6e504a112b225a19408c7b32aaf27a07..02f03f8ff3857abb37f6f8ec6038a630f9546474 100644 (file)
@@ -74,19 +74,19 @@ use Carp;
 use Exporter;
 use File::Basename;
 
-use vars qw (@EXPORT @ISA %channels $me);
-@ISA = qw (Exporter);
-@EXPORT = qw ($exit_code $warnings_are_errors
-             &reset_local_duplicates &reset_global_duplicates
-             &register_channel &msg &exists_channel &channel_type
-             &setup_channel &setup_channel_type
-             &dup_channel_setup &drop_channel_setup
-             &buffer_messages &flush_messages
-             &setup_channel_queue &pop_channel_queue
-             US_GLOBAL US_LOCAL
-             UP_NONE UP_TEXT UP_LOC_TEXT);
-
-$me = basename $0;
+our @ISA = qw (Exporter);
+our @EXPORT = qw ($exit_code $warnings_are_errors
+                 &reset_local_duplicates &reset_global_duplicates
+                 &register_channel &msg &exists_channel &channel_type
+                 &setup_channel &setup_channel_type
+                 &dup_channel_setup &drop_channel_setup
+                 &buffer_messages &flush_messages
+                 &setup_channel_queue &pop_channel_queue
+                 US_GLOBAL US_LOCAL
+                 UP_NONE UP_TEXT UP_LOC_TEXT);
+
+our %channels;
+our $me = basename $0;
 
 =head2 Global Variables
 
@@ -99,8 +99,7 @@ the C<exit_code> options of C<fatal> and C<error> channels.
 
 =cut
 
-use vars qw ($exit_code);
-$exit_code = 0;
+our $exit_code = 0;
 
 =item C<$warnings_are_errors>
 
@@ -109,8 +108,7 @@ errors (i.e. if they should update C<$exit_code>).
 
 =cut
 
-use vars qw ($warnings_are_errors);
-$warnings_are_errors = 0;
+our $warnings_are_errors = 0;
 
 =back
 
@@ -260,11 +258,8 @@ be ignored.
 
 =cut
 
-use vars qw (%_default_options %_global_duplicate_messages
-            %_local_duplicate_messages);
-
 # Default options for a channel.
-%_default_options =
+our %_default_options =
   (
    type => 'warning',
    exit_code => 1,
@@ -284,8 +279,8 @@ use vars qw (%_default_options %_global_duplicate_messages
 # Filled with output messages as keys, to detect duplicates.
 # The value associated with each key is the number of occurrences
 # filtered out.
-%_local_duplicate_messages = ();
-%_global_duplicate_messages = ();
+our %_local_duplicate_messages = ();
+our %_global_duplicate_messages = ();
 
 sub _reset_duplicates (\%)
 {
@@ -404,8 +399,7 @@ sub _format_sub_message ($$)
 }
 
 # Store partial messages here. (See the 'partial' option.)
-use vars qw ($partial);
-$partial = '';
+our $partial = '';
 
 # _format_message ($LOCATION, $MESSAGE, %OPTIONS)
 # -----------------------------------------------
@@ -620,11 +614,9 @@ both print
 =cut
 
 
-use vars qw (@backlog %buffering);
-
 # See buffer_messages() and flush_messages() below.
-%buffering = ();       # The map of channel types to buffer.
-@backlog = ();         # The buffer of messages.
+our %buffering = ();   # The map of channel types to buffer.
+our @backlog = ();             # The buffer of messages.
 
 sub msg ($$;$%)
 {
@@ -716,9 +708,8 @@ entry, while C<drop_channel_setup ()> just deletes it.
 
 =cut
 
-use vars qw (@_saved_channels @_saved_werrors);
-@_saved_channels = ();
-@_saved_werrors = ();
+our @_saved_channels = ();
+our @_saved_werrors = ();
 
 sub dup_channel_setup ()
 {
index 072602afec9a34aac43d17b1ff8385c592d7026e..437a5c7a6acf84d1fbf6106490d0f551e5f2035b 100644 (file)
@@ -22,9 +22,8 @@ use warnings FATAL => 'all';
 use Carp;
 use Exporter;
 
-use vars qw (@EXPORT_OK @ISA);
-@ISA = qw (Exporter);
-@EXPORT_OK = qw (TRUE FALSE reduce_and reduce_or);
+our @ISA = qw (Exporter);
+our @EXPORT_OK = qw (TRUE FALSE reduce_and reduce_or);
 
 =head1 NAME
 
@@ -169,7 +168,7 @@ both create the C<"FALSE"> condition).
 # Keys in this hash are conditional strings. Values are the
 # associated object conditions.  This is used by 'new' to reuse
 # Condition objects with identical conditionals.
-use vars '%_condition_singletons';
+our %_condition_singletons;
 # Do NOT reset this hash here.  It's already empty by default,
 # and any setting would otherwise occur AFTER the 'TRUE' and 'FALSE'
 # constants definitions.
index 0d9b465e68b1e9a2f5dc047c197e3f6968f296bf..bc501b18e4f35bb58112258a78c446f43096b4ba 100644 (file)
@@ -29,9 +29,8 @@ use Exporter;
 use Automake::ChannelDefs;
 use Automake::Channels;
 
-use vars qw (@EXPORT @ISA);
-@ISA = qw (Exporter);
-@EXPORT = qw (&find_configure_ac &require_configure_ac);
+our @ISA = qw (Exporter);
+our @EXPORT = qw (&find_configure_ac &require_configure_ac);
 
 =head1 NAME
 
index af9d1a95583e59d0b9800d7be6479ab33ac04ab3..164e48810d7cf570062c1296e640e1901d7d4746 100644 (file)
@@ -141,7 +141,7 @@ ignored.
 # Keys in this hash are DisjConditions strings. Values are the
 # associated object DisjConditions.  This is used by 'new' to reuse
 # DisjConditions objects with identical conditions.
-use vars '%_disjcondition_singletons';
+our %_disjcondition_singletons;
 
 sub new ($;@)
 {
index 65f9216dfa2893518f73dfa0259296e405e0d2c4..028516584d690f57125e809448dcda1e649519c8 100644 (file)
@@ -45,14 +45,13 @@ use IO::File;
 use Automake::Channels;
 use Automake::ChannelDefs;
 
-use vars qw (@EXPORT @ISA);
-@ISA = qw (Exporter);
-@EXPORT = qw (&contents
-             &find_file &mtime
-             &update_file
-             &xsystem &xsystem_hint &xqx
-             &dir_has_case_matching_file &reset_dir_cache
-             &set_dir_cache_file);
+our @ISA = qw (Exporter);
+our @EXPORT = qw (&contents
+                 &find_file &mtime
+                 &update_file
+                 &xsystem &xsystem_hint &xqx
+                 &dir_has_case_matching_file &reset_dir_cache
+                 &set_dir_cache_file);
 
 =over 4
 
@@ -332,7 +331,7 @@ same file).
 
 =cut
 
-use vars '%_directory_cache';
+our %_directory_cache;
 sub dir_has_case_matching_file ($$)
 {
   # Note that print File::Spec->case_tolerant returns 0 even on MacOS
@@ -383,4 +382,6 @@ sub set_dir_cache_file ($$)
 
 =back
 
+=cut
+
 1; # for require
index ea7032cd1c2783ce5997644597edac4b329d98d7..59efd21b904341a45bea8e703003013217b63488 100644 (file)
@@ -22,16 +22,13 @@ use warnings FATAL => 'all';
 use Exporter;
 use File::Basename;
 
-use vars qw (@EXPORT @ISA);
-
-@ISA = qw (Exporter);
-@EXPORT = qw (&uniq &none $me);
+our @ISA = qw (Exporter);
+our @EXPORT = qw (&uniq &none $me);
 
 # Variable we share with the main package.  Be sure to have a single
 # copy of them: using 'my' together with multiple inclusion of this
 # package would introduce several copies.
-use vars qw ($me);
-$me = basename ($0);
+our $me = basename ($0);
 
 # END
 # ---
index 5d7d57bae49844aff736108d32461196fc9bd63e..d5910ab26dccd426b8a64d8815b6bb76382d6fd0 100644 (file)
@@ -40,9 +40,8 @@ use Getopt::Long ();
 
 use Automake::ChannelDefs qw (fatal);
 
-use vars qw (@EXPORT @ISA);
-@ISA = qw (Exporter);
-@EXPORT = qw (getopt);
+our @ISA = qw (Exporter);
+our @EXPORT = qw (getopt);
 
 =item C<parse_options (%option)>
 
index 5e20a34100dfb8f22b41157c4b17884fc6f824a9..b846fee87f3e6c4aecdf2cdd9624dc2674fc8d42 100644 (file)
@@ -26,14 +26,13 @@ use Automake::ChannelDefs;
 use Automake::Channels;
 use Automake::Version;
 
-use vars qw (@EXPORT @ISA);
-@ISA = qw (Exporter);
-@EXPORT = qw (option global_option
-              set_option set_global_option
-              unset_option unset_global_option
-              process_option_list process_global_option_list
-              set_strictness $strictness $strictness_name
-              &FOREIGN &GNU &GNITS);
+our @ISA = qw (Exporter);
+our @EXPORT = qw (option global_option
+                 set_option set_global_option
+                 unset_option unset_global_option
+                 process_option_list process_global_option_list
+                 set_strictness $strictness $strictness_name
+                 &FOREIGN &GNU &GNITS);
 
 =head1 NAME
 
@@ -74,14 +73,14 @@ F<Makefile.am>s.
 =cut
 
 # Values are the Automake::Location of the definition.
-use vars '%_options';        # From AUTOMAKE_OPTIONS
-use vars '%_global_options'; # From AM_INIT_AUTOMAKE or the command line.
+our %_options;        # From AUTOMAKE_OPTIONS
+our %_global_options; # From AM_INIT_AUTOMAKE or the command line.
 
 # Whether process_option_list has already been called for the current
 # Makefile.am.
-use vars '$_options_processed';
+our $_options_processed;
 # Whether process_global_option_list has already been called.
-use vars '$_global_options_processed';
+our $_global_options_processed;
 
 =head2 Constants
 
@@ -121,10 +120,10 @@ The current strictness name.  One of C<'foreign'>, C<'gnu'>, or C<'gnits'>.
 =cut
 
 # Strictness levels.
-use vars qw ($strictness $strictness_name);
+our ($strictness, $strictness_name);
 
 # Strictness level as set on command line.
-use vars qw ($_default_strictness $_default_strictness_name);
+our ($_default_strictness, $_default_strictness_name);
 
 
 =head2 Functions
index 0227a85d1608053951b89ce3fa0e5eb706f972ea..5336422eea2746a4478b3da1946cd185f0a12dbc 100644 (file)
@@ -30,14 +30,13 @@ use Automake::Options;
 use Automake::Condition qw (TRUE FALSE);
 use Automake::DisjConditions;
 
-use vars qw (@EXPORT @EXPORT_OK @ISA);
-@ISA = qw (Automake::Item Exporter);
-@EXPORT = qw (reset register_suffix_rule next_in_suffix_chain
-             suffixes rules $KNOWN_EXTENSIONS_PATTERN
-             depend %dependencies %actions register_action
-             accept_extensions
-             reject_rule msg_rule msg_cond_rule err_rule err_cond_rule
-             rule rrule ruledef rruledef);
+our @ISA = qw (Automake::Item Exporter);
+our @EXPORT = qw (reset register_suffix_rule next_in_suffix_chain
+                 suffixes rules $KNOWN_EXTENSIONS_PATTERN
+                 depend %dependencies %actions register_action
+                 accept_extensions
+                 reject_rule msg_rule msg_cond_rule err_rule err_cond_rule
+                 rule rrule ruledef rruledef);
 
 =head1 NAME
 
@@ -123,7 +122,7 @@ Makefile: keeping related stuff altogether.
 
 =cut
 
-use vars '%dependencies';
+our %dependencies;
 
 =item <%actions>
 
@@ -132,7 +131,7 @@ only when keys exists in C<%dependencies>.
 
 =cut
 
-use vars '%actions';
+our %actions;
 
 =item C<$KNOWN_EXTENSIONS_PATTERN>
 
@@ -145,8 +144,7 @@ New extensions should be registered with C<accept_extensions>.
 
 =cut
 
-use vars qw ($KNOWN_EXTENSIONS_PATTERN);
-$KNOWN_EXTENSIONS_PATTERN = "";
+our $KNOWN_EXTENSIONS_PATTERN = "";
 
 =back
 
index 091a78c50440c38b5c4d5a521ca94135f2b1546d..73929da214c33c0d3760f93a5cf98469e2149101 100644 (file)
@@ -25,9 +25,8 @@ use Exporter;
 use Automake::ChannelDefs;
 use Automake::ItemDef;
 
-use vars qw (@EXPORT @ISA);
-@ISA = qw (Automake::ItemDef Exporter);
-@EXPORT = qw (&RULE_AUTOMAKE &RULE_USER);
+our @ISA = qw (Automake::ItemDef Exporter);
+our @EXPORT = qw (&RULE_AUTOMAKE &RULE_USER);
 
 =head1 NAME
 
index adeb6e299a0f8d86f3e436a1d6032bd10fda946a..3bde2e1a8c99347b4a66c57305b7ff209ccf1695 100644 (file)
@@ -25,10 +25,9 @@ use Exporter;
 use Automake::ChannelDefs;
 use Automake::ItemDef;
 
-use vars qw (@ISA @EXPORT);
-@ISA = qw (Automake::ItemDef Exporter);
-@EXPORT = qw (&VAR_AUTOMAKE &VAR_CONFIGURE &VAR_MAKEFILE
-             &VAR_ASIS &VAR_PRETTY &VAR_SILENT &VAR_SORTED);
+our @ISA = qw (Automake::ItemDef Exporter);
+our @EXPORT = qw (&VAR_AUTOMAKE &VAR_CONFIGURE &VAR_MAKEFILE
+                 &VAR_ASIS &VAR_PRETTY &VAR_SILENT &VAR_SORTED);
 
 =head1 NAME
 
index 4ec0dd4b0e545a4bb92e08d2bb5e7b90e38fffd8..32db936980aabb13445ff1086d209e8ad4f0e2b2 100644 (file)
@@ -32,19 +32,18 @@ use Automake::DisjConditions;
 use Automake::General 'uniq';
 use Automake::Wrap 'makefile_wrap';
 
-use vars qw (@EXPORT @EXPORT_OK @ISA);
-@ISA = qw (Automake::Item Exporter);
-@EXPORT = qw (err_var msg_var msg_cond_var reject_var
-             var rvar vardef rvardef
-             variables
-             scan_variable_expansions check_variable_expansions
-             variable_delete
-             variables_dump
-             set_seen
-             require_variables
-             variable_value
-             output_variables
-             transform_variable_recursively);
+our @ISA = qw (Automake::Item Exporter);
+our @EXPORT = qw (err_var msg_var msg_cond_var reject_var
+                 var rvar vardef rvardef
+                 variables
+                 scan_variable_expansions check_variable_expansions
+                 variable_delete
+                 variables_dump
+                 set_seen
+                 require_variables
+                 variable_value
+                 output_variables
+                 transform_variable_recursively);
 
 =head1 NAME
 
@@ -301,7 +300,7 @@ is the value being appended to  C<$varname>.
 
 =cut
 
-use vars '%_hooks';
+our %_hooks;
 sub hook ($$)
 {
   my ($var, $fun) = @_;
@@ -316,7 +315,7 @@ the L<Automake::Variable> instances that ends with C<_$suffix>.
 
 =cut
 
-use vars '%_variable_dict', '%_primary_dict';
+our (%_variable_dict, %_primary_dict);
 sub variables (;$)
 {
   my ($suffix) = @_;
index c821b8b993a2216f60f7281198f4c6e02bdc1c3f..639996da1eca319474669738369088d40158dfb4 100644 (file)
@@ -21,9 +21,8 @@ use warnings FATAL => 'all';
 
 use Exporter;
 
-use vars qw (@EXPORT_OK @ISA);
-@ISA = qw (Exporter);
-@EXPORT_OK = qw (wrap makefile_wrap);
+our @ISA = qw (Exporter);
+our @EXPORT_OK = qw (wrap makefile_wrap);
 
 =head1 NAME
 
index 5284faa5d09f8f7d083792d01942d7eaeb10603f..d0cf32cd401915da7aa73418e795a3d677e36f7f 100644 (file)
@@ -81,10 +81,9 @@ use Automake::ChannelDefs;
 use Automake::Channels qw (msg);
 use Automake::FileUtils;
 
-use vars qw ($AUTOLOAD @EXPORT @EXPORT_OK @ISA $VERSION);
-@ISA = qw(Exporter IO::File);
-@EXPORT = @IO::File::EXPORT;
-$VERSION = "1.2";
+our @ISA = qw(Exporter IO::File);
+our @EXPORT = @IO::File::EXPORT;
+our $VERSION = "1.2";
 
 eval {
   # Make all Fcntl O_XXX and LOCK_XXX constants available for importing