automake-patches
[Top][All Lists]
Advanced

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

[FYI] {maint} options: try to report as much errors as possible


From: Stefano Lattarini
Subject: [FYI] {maint} options: try to report as much errors as possible
Date: Sat, 11 May 2013 00:43:25 +0200

For example, if two invalid options are used in AUTOMAKE_OPTIONS, don't
report just the first one, but both of them.

* lib/Automake/Options.pm (_process_option_list): Do so by avoiding
early returns in here.

Signed-off-by: Stefano Lattarini <address@hidden>
---
 lib/Automake/Options.pm | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/lib/Automake/Options.pm b/lib/Automake/Options.pm
index f745d3a..db5661c 100644
--- a/lib/Automake/Options.pm
+++ b/lib/Automake/Options.pm
@@ -307,6 +307,7 @@ sub _process_option_list (\%@)
 {
   my ($options, @list) = @_;
   my @warnings = ();
+  my $ret = 1;
 
   foreach my $h (@list)
     {
@@ -323,20 +324,20 @@ sub _process_option_list (\%@)
           # Obsolete (and now removed) de-ANSI-fication support.
           error ($where,
                  "automatic de-ANSI-fication support has been removed");
-          return 0;
+          $ret = 0;
         }
       # TODO: Remove this special check in Automake 3.0.
       elsif ($_ eq 'cygnus')
         {
           error $where, "support for Cygnus-style trees has been removed";
-          return 0;
+          $ret = 0;
         }
       # TODO: Remove this special check in Automake 3.0.
       elsif ($_ eq 'dist-lzma')
         {
           error ($where, "support for lzma-compressed distribution " .
                          "archives has been removed");
-          return 0;
+          $ret = 0;
         }
       # TODO: Make this a fatal error in Automake 2.0.
       elsif ($_ eq 'dist-shar')
@@ -362,7 +363,7 @@ sub _process_option_list (\%@)
         {
           if (not _option_is_from_configure ($_, $where))
             {
-              return 0;
+              $ret = 0;
             }
           for my $opt ('tar-v7', 'tar-ustar', 'tar-pax')
             {
@@ -370,7 +371,7 @@ sub _process_option_list (\%@)
                 if $opt eq $_ or ! exists $options->{$opt};
               error ($where,
                      "options '$_' and '$opt' are mutually exclusive");
-              return 0;
+              $ret = 0;
             }
         }
       elsif (/^\d+\.\d+(?:\.\d+)?[a-z]?(?:-[A-Za-z0-9]+)?$/)
@@ -380,7 +381,7 @@ sub _process_option_list (\%@)
             {
               error ($where, "require Automake $_, but have $VERSION",
                      uniq_scope => US_GLOBAL);
-              return 0;
+              $ret = 0;
             }
         }
       elsif (/^(?:--warnings=|-W)(.*)$/)
@@ -391,9 +392,10 @@ sub _process_option_list (\%@)
       elsif (! _is_valid_easy_option $_)
         {
           error ($where, "option '$_' not recognized");
-          return 0;
+          $ret = 0;
         }
     }
+
   # We process warnings here, so that any explicitly-given warning setting
   # will take precedence over warning settings defined implicitly by the
   # strictness.
@@ -403,7 +405,8 @@ sub _process_option_list (\%@)
           "unknown warning category '$w->{'cat'}'"
         if switch_warning $w->{cat};
     }
-  return 1;
+
+  return $ret;
 }
 
 sub process_option_list (@)
-- 
1.8.3.rc0.19.g7e6a0cc




reply via email to

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