automake-patches
[Top][All Lists]
Advanced

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

Location of multiline definitions


From: Akim Demaille
Subject: Location of multiline definitions
Date: 31 Oct 2002 12:43:01 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Honest Recruiter)

I'm installing this:

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * automake.in (&read_am_file): Use $last_where to register the
        _first_ line of a variable definition as location instead of the
        last one.
        (&conditional_ambiguous_p): Don't forget to ->string the
        Conditionals.
        (&rule_define): Likewise.
        * tests/location.test: Adjust to exercise this.

Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1380
diff -u -u -r1.1380 automake.in
--- automake.in 16 Oct 2002 18:53:44 -0000 1.1380
+++ automake.in 31 Oct 2002 11:41:31 -0000
@@ -6089,6 +6089,7 @@
 sub conditional_ambiguous_p ($$@)
 {
   my ($var, $cond, @conds) = @_;
+
   foreach my $vcond (@conds)
     {
       # Note that these rules doesn't consider the following
@@ -6106,17 +6107,18 @@
       my $message;
       if ($vcond eq $cond)
        {
-         return ("$var multiply defined in condition $cond", $vcond);
+         return ("$var multiply defined in condition ". $cond->string,
+                 $vcond);
        }
       elsif ($vcond->true_when ($cond))
        {
          return ("$var was already defined in condition $vcond, "
-                 . "which implies condition $cond", $vcond);
+                 . "which implies condition ". $cond->string, $vcond);
        }
       elsif ($cond->true_when ($vcond))
        {
          return ("$var was already defined in condition $vcond, "
-                  . "which is implied by condition $cond", $vcond);
+                  . "which is implied by condition " . $cond->string, $vcond);
        }
     }
   return ('', '');
@@ -7479,7 +7481,7 @@
       my $oldowner  = $target_owner{$target}{$cond};
 
       # Don't mention true conditions in diagnostics.
-      my $condmsg = $cond == TRUE ? " in condition `$cond'" : '';
+      my $condmsg = $cond == TRUE ? " in condition `" . $cond->string . "'" : 
'';
 
       if ($owner == TARGET_USER)
        {
@@ -7723,6 +7725,7 @@
     my $last_var_name = '';
     my $last_var_type = '';
     my $last_var_value = '';
+    my $last_where;
     # FIXME: shouldn't use $_ in this loop; it is too big.
     while ($_)
     {
@@ -7791,7 +7794,7 @@
                  $comment = $spacing = '';
                  macro_define ($last_var_name, VAR_MAKEFILE,
                                $last_var_type, $cond,
-                               $last_var_value, $where)
+                               $last_var_value, $last_where)
                    if $cond != FALSE;
                  push (@var_list, $last_var_name);
                }
@@ -7836,6 +7839,7 @@
            $last_var_name = $1;
            $last_var_type = $2;
            $last_var_value = $3;
+           $last_where = $where->clone;
            if ($3 ne '' && substr ($3, -1) eq "\\")
            {
                # We preserve the `\' because otherwise the long lines
@@ -7852,7 +7856,7 @@
 
                macro_define ($last_var_name, VAR_MAKEFILE,
                              $last_var_type, $cond,
-                             $last_var_value, $where)
+                             $last_var_value, $last_where)
                  if $cond != FALSE;
                push (@var_list, $last_var_name);
              }
Index: tests/location.test
===================================================================
RCS file: /cvs/automake/automake/tests/location.test,v
retrieving revision 1.1
diff -u -u -r1.1 location.test
--- tests/location.test 29 Sep 2002 12:49:07 -0000 1.1
+++ tests/location.test 31 Oct 2002 11:41:32 -0000
@@ -39,6 +39,13 @@
 if COND1
   bin_PROGRAMS += ctags
 endif
+VAR = 1 \
+      2 \
+      3
+
+VAR = 1 \
+      2 \
+      3
 END
 
 $ACLOCAL
@@ -49,3 +56,5 @@
 grep 'Makefile\.am:6:.*program.*ctags' stderr
 grep 'redefinition of.*libfoo\.a' stderr
 grep 'redefinition of.*ctags' stderr
+grep 'Makefile.am:12: VAR multiply defined in condition TRUE' stderr
+grep 'Makefile.am:8: ... .VAR. previously defined here' stderr




reply via email to

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