options: try to report as much errors as possible
authorStefano Lattarini <stefano.lattarini@gmail.com>
Fri, 10 May 2013 22:28:15 +0000 (00:28 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Fri, 10 May 2013 22:42:51 +0000 (00:42 +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 <stefano.lattarini@gmail.com>
lib/Automake/Options.pm

index f745d3a..db5661c 100644 (file)
@@ -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 (@)