autoconf-patches
[Top][All Lists]
Advanced

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

[PATCH] avoid new warning about undefined $ARGV[0]


From: Jim Meyering
Subject: [PATCH] avoid new warning about undefined $ARGV[0]
Date: Sun, 15 Jan 2012 17:22:03 +0100

Without this change, numerous tests would fail.
E.g., on a Fedora 16 system, running autoreconf would print this warning:

    Use of uninitialized value $ARGV[0] in pattern match (m//) at \
      /p/share/autoconf/Autom4te/General.pm line 273.


>From 75a5ef5c889bc7db3d560034338e99b2fc88f846 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 15 Jan 2012 17:16:52 +0100
Subject: [PATCH] avoid new warning about undefined $ARGV[0]

* lib/Autom4te/General.pm (getopt): Avoid warning induced by
yesterday's change: $ARGV[0] may not be defined, e.g., when
invoked via autoreconf.
---
 ChangeLog               |    7 +++++++
 lib/Autom4te/General.pm |    2 +-
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c5ccc04..2ab830e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-01-15  Jim Meyering  <address@hidden>
+
+       avoid new warning about undefined $ARGV[0]
+       * lib/Autom4te/General.pm (getopt): Avoid warning induced by
+       yesterday's change: $ARGV[0] may not be defined, e.g., when
+       invoked via autoreconf.
+
 2011-01-14  Stefano Lattarini  <address@hidden>

        getopt: fix diagnostic for missing mandatory option argument
diff --git a/lib/Autom4te/General.pm b/lib/Autom4te/General.pm
index 5b48005..2379ce3 100644
--- a/lib/Autom4te/General.pm
+++ b/lib/Autom4te/General.pm
@@ -270,7 +270,7 @@ sub getopt (%)
   # FIXME: Lot of code duplication with automake here.  It would probably
   # be best to generalize our getopt() func and rip it out in a new module
   # from which automake can sync.
-  if ($ARGV[0] =~ /^-./)
+  if (defined $ARGV[0] && $ARGV[0] =~ /^-./)
     {
       my %argopts;
       for my $k (keys %option)
--
1.7.9.rc1.2.gccfe4



reply via email to

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