* Fix PR/1709.
authorPaul Smith <psmith@gnu.org>
Thu, 22 Jun 2000 00:45:34 +0000 (00:45 +0000)
committerPaul Smith <psmith@gnu.org>
Thu, 22 Jun 2000 00:45:34 +0000 (00:45 +0000)
ChangeLog
read.c
tests/ChangeLog
tests/scripts/features/targetvars

index db0a7c1ebc7fb7415654ae54940294b3c2272ff2..cd917b6fc1f754c9527a51dd2c45c3c54872c519 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2000-06-21  Paul D. Smith  <psmith@gnu.org>
+
+       * read.c (read_makefile): If we find a semicolon in the target
+       definition, remember where it was.  If the line turns out to be a
+       target-specific variable, add back the semicolon and everything
+       after it.  Fixes PR/1709.
+
 2000-06-19  Paul D. Smith  <psmith@gnu.org>
 
        * config.h-vms.template: #define uintmax_t for this system.
diff --git a/read.c b/read.c
index 7ef1081f6d52e495eab236175bf575fd6897caf8..465c5db182c30efe952fcef297394e695aa7c548 100644 (file)
--- a/read.c
+++ b/read.c
@@ -751,7 +751,7 @@ read_makefile (filename, flags)
 
           enum make_word_type wtype;
           enum variable_origin v_origin;
-          char *cmdleft, *lb_next;
+          char *cmdleft, *semip, *lb_next;
           unsigned int len, plen = 0;
           char *colonp;
 
@@ -772,6 +772,7 @@ read_makefile (filename, flags)
          else if (cmdleft != 0)
            /* Found one.  Cut the line short there before expanding it.  */
            *(cmdleft++) = '\0';
+          semip = cmdleft;
 
          collapse_continuations (lb.buffer);
 
@@ -932,6 +933,14 @@ read_makefile (filename, flags)
 
           if (wtype == w_varassign)
             {
+              /* If there was a semicolon found, add it back, plus anything
+                 after it.  */
+              if (semip)
+                {
+                  *(--semip) = ';';
+                  variable_buffer_output (p2 + strlen (p2),
+                                          semip, strlen (semip)+1);
+                }
               record_target_var (filenames, p, two_colon, v_origin, &fileinfo);
               filenames = 0;
               continue;
index 9c8e7fbdc05d2a22fffd551a47abf41b447db4dc..458b0e038f679989e098254040602659b9ec8154 100644 (file)
@@ -1,3 +1,8 @@
+2000-06-21  Paul D. Smith  <psmith@gnu.org>
+
+       * scripts/features/targetvars: Added a test for PR/1709: allowing
+       semicolons in target-specific variable values.
+
 2000-06-19  Paul D. Smith  <psmith@gnu.org>
 
        * scripts/functions/addsuffix: Test for an empty final argument.
index e4dc0b2aab957576f001e2631ca6ae9c591fd8af..52548f2dc75b0b8714ee452ddb64dcc1de2b4614 100644 (file)
@@ -146,9 +146,27 @@ close(MAKEFILE);
 $answer = "bar baz biz\nbar baz\n";
 &compare_output($answer, &get_logfile(1));
 
+# Test #10
+
 &run_make_with_options("$makefile3", "one", &get_logfile);
 $answer = "bar biz\n";
 &compare_output($answer, &get_logfile(1));
 
+# Test #11
+# PR/1709: Test semicolons in target-specific variable values
+
+$makefile4 = &get_tmpfile;
+
+open(MAKEFILE, "> $makefile4");
+print MAKEFILE <<'EOF';
+foo : FOO = ; ok
+foo : ; @echo '$(FOO)'
+EOF
+close(MAKEFILE);
+
+&run_make_with_options("$makefile4", "", &get_logfile);
+$answer = "; ok\n";
+&compare_output($answer, &get_logfile(1));
+
 
 1;