automake
[Top][All Lists]
Advanced

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

87-stricter-vars.patch


From: Akim Demaille
Subject: 87-stricter-vars.patch
Date: Wed, 28 Feb 2001 11:01:30 +0100

Index: ChangeLog
from  Akim Demaille  <address@hidden>
        * automake.in (%am_vars, @var_list, %def_type): Globals.
        (&initialize_per_input): Initialize them.
        (&read_main_am_file): Don't local them.
        (&get_object_extension): $objext is private.
        (&handle_single_transform_list): $lang is.
        (&handle_ltlibraries): $libname_rx is.
        (&scan_autoconf_config_files): How about actually paying attention
        to your arguments, instead of working on $_? (this is no Perl
        variable, it's a Perl variable followed by a question mark).
        (&file_contents): $contents and $separator are private.
        (&am_install_var): Declare @condvals, not $condvals.
        (%make_dirs): My.
        
        
Index: automake.in
--- automake.in Tue, 27 Feb 2001 23:08:54 +0100 akim (am/f/39_automake.i 1.94 
755)
+++ automake.in Tue, 27 Feb 2001 23:23:53 +0100 akim (am/f/39_automake.i 1.94 
755)
@@ -586,6 +586,13 @@
 # True if we need `LINK' defined.  This is a hack.
 my $need_link;
 
+# The keys here are variables we want to dump at the end of this
+# function.  The values are corresponding comments.  Need dynamic
+# scopes.
+my %am_vars;
+my @var_list;
+my %def_type;
+
 
 # &initialize_per_input ()
 # ------------------------
@@ -789,6 +796,13 @@ sub initialize_per_input ()
 
     # True if we need `LINK' defined.  This is a hack.
     $need_link = 0;
+
+    # The keys here are variables we want to dump at the end of this
+    # function.  The values are corresponding comments.  Need dynamic
+    # scopes.
+    %am_vars = ();
+    @var_list = ();
+    %def_type = ();
 }
 
 
@@ -1345,7 +1359,7 @@ sub get_object_extension
            # Generate rules to build ansi2knr.  If it is in some
            # other directory, then generate dependencies but have the
            # rule just run elsewhere.
-           $objext = $seen_objext ? ".\$(OBJEXT)" : ".o";
+           my $objext = $seen_objext ? ".\$(OBJEXT)" : ".o";
            $output_rules .= ($options{'ansi2knr'} . ': '
                              . $options{'ansi2knr'} . $objext . "\n");
            if ($options{'ansi2knr'} eq 'ansi2knr')
@@ -1639,7 +1653,7 @@ sub handle_single_transform_list
         my $renamed = 0;
 
         $extension = &derive_suffix ($extension);
-        $lang = $extension_map{$extension};
+        my $lang = $extension_map{$extension};
         if ($lang)
         {
             &saw_extension ($extension);
@@ -2436,7 +2450,7 @@ sub handle_ltlibraries
        }
 
        # Check that the library fits the standard naming convention.
-       $libname_rx = "^lib.*\.la";
+       my $libname_rx = "^lib.*\.la";
        if ((&variable_defined ($xlib . '_LDFLAGS')
             && grep (/-module/, &variable_value_as_list ($xlib . '_LDFLAGS',
                                                          'all')))
@@ -4373,8 +4387,9 @@ sub handle_minor_options
 # (or AC_OUTPUT).
 sub scan_autoconf_config_files
 {
+    my ($config_files) = @_;
     # Look at potential Makefile.am's.
-    foreach (split)
+    foreach (split ' ', $config_files)
     {
         # Must skip empty string for Perl 4.
         next if $_ eq "\\" || $_ eq '';
@@ -6635,13 +6650,6 @@ sub read_main_am_file
 {
     my ($amfile) = @_;
 
-    # The keys here are variables we want to dump at the end of this
-    # function.  The values are corresponding comments.
-    # Need dynamic scopes.
-    local %am_vars = ();
-    local @var_list = ();
-    local %def_type = ();
-
     # This supports the strange variable tricks we are about to play.
     &prog_error ("variable defined before read_main_am_file")
         if scalar keys %contents > 0;
@@ -6784,9 +6792,8 @@ sub file_contents
     $_ = $fc_file->getline;
     $/ = $saved_dollar_slash;
     eval $command;
-    $contents = $_;
-
     $fc_file->close;
+    my $contents = $_;
 
 
     # Process each Make `paragraph'.
@@ -6810,6 +6817,7 @@ sub file_contents
     my $result_vars = '';
     my $result_rules = '';
     my $comment = '';
+    my $separator = '';
     foreach (split (/(?<!\\)\n(?![\t#])/, $contents))
     {
         # Strip leading new lines.  This can happen for comments:
@@ -7170,7 +7178,7 @@ sub am_install_var
                }
                else
                {
-                   my $condvals = '';
+                   my @condvals;
                    foreach my $cond (@conds)
                    {
                        my @one_binlist = ();
@@ -7196,7 +7204,7 @@ sub am_install_var
 
                    while (@condvals)
                    {
-                       $cond = shift (@condvals);
+                       my $cond = shift (@condvals);
                        my @val = split (' ', shift (@condvals));
                        &define_pretty_variable ($one_name, $cond, @val);
                    }
@@ -7279,7 +7287,7 @@ sub am_install_var
 
 # Each key in this hash is the name of a directory holding a
 # Makefile.in.  These variables are local to `is_make_dir'.
-%make_dirs = ();
+my %make_dirs = ();
 my $make_dirs_set = 0;
 
 sub is_make_dir



reply via email to

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