automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 05/10] Remove global/local distinction for automake options.


From: stefano . lattarini
Subject: [PATCH 05/10] Remove global/local distinction for automake options.
Date: Thu, 23 Dec 2010 12:27:41 +0100

From: Stefano Lattarini <address@hidden>

After the previous change (v1.11-546-g243a0a6), the distinction
between global-level (from command line and AM_INIT_AUTOMAKE)
and local-level (from AUTOMAKE_OPTIONS) automake options can be
safely removed without losing functionalities.

* lib/Automake/Options.pm (%_default_options): New private global
variable.
(%_global_options): Removed this private global variable.
(global_option): Removed this public subroutine.
(set_global_option): Likewise.
(unset_global_option): Likewise.
(process_global_option_list): Likewise.
(reset): Set the default options on the first run.  Do not copy
from `%_global_options' anymore.
(@EXPORT, =head1): Update.
* automake.in: Updated by using only `process_option_list' and
`set_option' and (instead of resp. `process_global_option_list'
and `set_global_option').
---
 ChangeLog               |   21 ++++++++++++++++
 automake.in             |    8 +++---
 lib/Automake/Options.pm |   62 ++++-------------------------------------------
 3 files changed, 30 insertions(+), 61 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4bf9faa..0788270 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,26 @@
 2010-12-20  Stefano Lattarini  <address@hidden>
 
+       Remove global/local distinction for automake options.
+       After the previous change (v1.11-546-g243a0a6), the distinction
+       between global-level (from command line and AM_INIT_AUTOMAKE)
+       and local-level (from AUTOMAKE_OPTIONS) automake options can be
+       safely removed without losing functionalities.
+       * lib/Automake/Options.pm (%_default_options): New private global
+       variable.
+       (%_global_options): Removed this private global variable.
+       (global_option): Removed this public subroutine.
+       (set_global_option): Likewise.
+       (unset_global_option): Likewise.
+       (process_global_option_list): Likewise.
+       (reset): Set the default options on the first run.  Do not copy
+       from `%_global_options' anymore.
+       (@EXPORT, =head1): Update.
+       * automake.in: Updated by using only `process_option_list' and
+       `set_option' and (instead of resp. `process_global_option_list'
+       and `set_global_option').
+
+2010-12-20  Stefano Lattarini  <address@hidden>
+
        Refactoring: new $automake_remake_options global variable.
        This change is useful only in view of soon-to-follow refactorings
        and simplifications, related to the fixing of Automake bug#7669
diff --git a/automake.in b/automake.in
index 9bef982..d320ebd 100644
--- a/automake.in
+++ b/automake.in
@@ -5472,7 +5472,7 @@ sub scan_autoconf_traces ($)
                    if $opt eq 'no-dependencies';
                }
              exit $exit_code
-               if process_global_option_list ($where, @opts);
+               if (process_option_list ($where,  @opts));
            }
        }
       elsif ($macro eq 'AM_MAINTAINER_MODE')
@@ -5485,7 +5485,7 @@ sub scan_autoconf_traces ($)
        }
       elsif ($macro eq 'AM_SILENT_RULES')
         {
-         set_global_option ('silent-rules', $where);
+         set_option ('silent-rules', $where);
        }
       elsif ($macro eq '_AM_COND_IF')
         {
@@ -8504,8 +8504,8 @@ sub parse_arguments ()
 
   set_strictness ($strictness);
   my $cli_where = new Automake::Location;
-  set_global_option ('cygnus', $cli_where) if $cygnus;
-  set_global_option ('no-dependencies', $cli_where) if $ignore_deps;
+  set_option ('cygnus', $cli_where) if $cygnus;
+  set_option ('no-dependencies', $cli_where) if $ignore_deps;
   for my $warning (@warnings)
   {
     &parse_warnings('-W', $warning);
diff --git a/lib/Automake/Options.pm b/lib/Automake/Options.pm
index a6d65a8..ccd940c 100644
--- a/lib/Automake/Options.pm
+++ b/lib/Automake/Options.pm
@@ -26,10 +26,7 @@ use Automake::Version;
 use vars qw (@ISA @EXPORT);
 
 @ISA = qw (Exporter);
address@hidden = qw (option global_option
-             set_option set_global_option
-             unset_option unset_global_option
-             process_option_list process_global_option_list
address@hidden = qw (option set_option unset_option process_option_list
              set_strictness $strictness $strictness_name
              &FOREIGN &GNU &GNITS);
 
@@ -43,15 +40,11 @@ Automake::Options - keep track of Automake options
 
   # Option lookup and setting.
   $opt = option 'name';
-  $opt = global_option 'name';
   set_option 'name', 'value';
-  set_global_option 'name', 'value';
   unset_option 'name';
-  unset_global_option 'name';
 
   # Batch option setting.
   process_option_list $location, @names;
-  process_global_option_list $location, @names;
 
   # Strictness lookup and setting.
   set_strictness 'foreign';
@@ -63,18 +56,12 @@ Automake::Options - keep track of Automake options
 =head1 DESCRIPTION
 
 This packages manages Automake's options and strictness settings.
-Options can be either local or global.  Local options are set using an
-C<AUTOMAKE_OPTIONS> variable in a F<Makefile.am> and apply only to
-this F<Makefile.am>.  Global options are set from the command line or
-passed as an argument to C<AM_INIT_AUTOMAKE>, they apply to all
-F<Makefile.am>s.
 
 =cut
 
 # Values are the Automake::Location of the definition, except
 # for 'ansi2knr' whose value is a pair [filename, Location].
-use vars '%_options';          # From AUTOMAKE_OPTIONS
-use vars '%_global_options';   # from AM_INIT_AUTOMAKE or the command line.
+use vars qw (%_options %_default_options);
 
 =head2 Constants
 
@@ -135,33 +122,27 @@ previous F<Makefile.am>.
 
 sub reset ()
 {
-  %_options = %_global_options;
   # The first time we are run,
   # remember the current setting as the default.
   if (defined $_default_strictness)
     {
       $strictness = $_default_strictness;
       $strictness_name = $_default_strictness_name;
+      %_options = %_default_options;
     }
   else
     {
       $_default_strictness = $strictness;
       $_default_strictness_name = $strictness_name;
+      %_default_options = %_options;
     }
 }
 
 =item C<$value = option ($name)>
 
-=item C<$value = global_option ($name)>
-
 Query the state of an option.  If the option is unset, this
 returns the empty list.  Otherwise it returns the option's value,
-as set by C<set_option> or C<set_global_option>.
-
-Note that C<global_option> should be used only when it is
-important to make sure an option hasn't been set locally.
-Otherwise C<option> should be the standard function to
-check for options (be they global or local).
+as set by C<set_option>.
 
 =cut
 
@@ -172,17 +153,8 @@ sub option ($)
   return $_options{$name};
 }
 
-sub global_option ($)
-{
-  my ($name) = @_;
-  return () unless defined $_global_options{$name};
-  return $_global_options{$name};
-}
-
 =item C<set_option ($name, $value)>
 
-=item C<set_global_option ($name, $value)>
-
 Set an option.  By convention, C<$value> is usually the location
 of the option definition.
 
@@ -194,17 +166,8 @@ sub set_option ($$)
   $_options{$name} = $value;
 }
 
-sub set_global_option ($$)
-{
-  my ($name, $value) = @_;
-  $_global_options{$name} = $value;
-}
-
-
 =item C<unset_option ($name)>
 
-=item C<unset_global_option ($name)>
-
 Unset an option.
 
 =cut
@@ -215,17 +178,8 @@ sub unset_option ($)
   delete $_options{$name};
 }
 
-sub unset_global_option ($)
-{
-  my ($name) = @_;
-  delete $_global_options{$name};
-}
-
-
 =item C<process_option_list ($where, @options)>
 
-=item C<process_global_option_list ($where, @options)>
-
 Process Automake's option lists.  C<@options> should be a list of
 words, as they occur in C<AUTOMAKE_OPTIONS> or C<AM_INIT_AUTOMAKE>.
 
@@ -335,12 +289,6 @@ sub process_option_list ($@)
   return _process_option_list (%_options, $where, @list);
 }
 
-sub process_global_option_list ($@)
-{
-  my ($where, @list) = @_;
-  return _process_option_list (%_global_options, $where, @list);
-}
-
 =item C<set_strictness ($name)>
 
 Set the current strictness level.
-- 
1.7.2.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]