diff --git a/ChangeLog b/ChangeLog index 6eb56913..46d049ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2002-09-18 Paul D. Smith + + * doc/make.texi (Bugs): Update with some info on Savannah, etc. + + * read.c (eval): Expansion of arguments to export/unexport was + ignoring all arguments after the first one. Change the algorithm + to expand the whole line once, then parse the results. + 2002-09-17 Paul D. Smith Fix Bug #940 (plus another bug I found while looking at this): diff --git a/doc/make.texi b/doc/make.texi index 0593f19f..2efcca07 100644 --- a/doc/make.texi +++ b/doc/make.texi @@ -442,24 +442,36 @@ documentation! Before reporting a bug or trying to fix it yourself, try to isolate it to the smallest possible makefile that reproduces the problem. Then -send us the makefile and the exact results @code{make} gave you. When -generating this small makefile, be sure to not use any non-free or -unusual tools in your commands: you can almost always emulate what +send us the makefile and the exact results @code{make} gave you, +including any error or warning messages. Please don't paraphrase +these messages: it's best to cut and paste them into your report. +When generating this small makefile, be sure to not use any non-free +or unusual tools in your commands: you can almost always emulate what such a tool would do with simple shell commands. Finally, be sure to explain what you expected to occur; this will help us decide whether the problem was really in the documentation. -Once you've got a precise problem, please send electronic mail to: +Once you have a precise problem you can report it in one of two ways. +Either send electronic mail to: @example bug-make@@gnu.org @end example @noindent -Please include the version number of @code{make} you are using. You can -get this information with the command @samp{make --version}. -Be sure also to include the type of machine and operating system you are -using. +or use our Web-based project management tool, at: + +@example + http://savannah.gnu.org/projects/make/ +@end example + +@noindent +In addition to the information above, please be careful to include the +version number of @code{make} you are using. You can get this +information with the command @samp{make --version}. Be sure also to +include the type of machine and operating system you are using. One +way to obtain this information is by looking at the final lines of +output from the command @samp{make --help}. @node Introduction, Makefiles, Overview, Top @comment node-name, next, previous, up diff --git a/read.c b/read.c index 34885244..c135acca 100644 --- a/read.c +++ b/read.c @@ -683,25 +683,23 @@ eval (ebuf, set_default) else { unsigned int len; + char *ap; + + /* Expand the line so we can use indirect and constructed + variable names in an export command. */ + p2 = ap = allocated_variable_expand (p2); + for (p = find_next_token (&p2, &len); p != 0; p = find_next_token (&p2, &len)) { - char *var; - int l; - - /* Expand the thing we're looking up, so we can use - indirect and constructed variable names. */ - p[len] = '\0'; - var = allocated_variable_expand (p); - l = strlen (var); - - v = lookup_variable (var, l); + v = lookup_variable (p, len); if (v == 0) - v = define_variable_loc (var, l, "", o_file, 0, + v = define_variable_loc (p, len, "", o_file, 0, fstart); v->export = v_export; - free (var); } + + free (ap); } } goto rule_complete; @@ -715,26 +713,23 @@ eval (ebuf, set_default) { unsigned int len; struct variable *v; + char *ap; + + /* Expand the line so we can use indirect and constructed + variable names in an unexport command. */ + p2 = ap = allocated_variable_expand (p2); + for (p = find_next_token (&p2, &len); p != 0; p = find_next_token (&p2, &len)) { - char *var; - int l; - - /* Expand the thing we're looking up, so we can use - indirect and constructed variable names. */ - p[len] = '\0'; - var = allocated_variable_expand (p); - l = strlen (var); - - v = lookup_variable (var, l); + v = lookup_variable (p, len); if (v == 0) - v = define_variable_loc (var, l, "", o_file, 0, fstart); + v = define_variable_loc (p, len, "", o_file, 0, fstart); v->export = v_noexport; - - free (var); } + + free (ap); } goto rule_complete; } diff --git a/tests/ChangeLog b/tests/ChangeLog index a2edc504..9b5c7921 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,8 @@ +2002-09-18 Paul D. Smith + + * scripts/features/export: Test export/unexport of multiple + variables in a single command. + 2002-09-17 Paul D. Smith * scripts/features/targetvars: Tests for Bug #940: test diff --git a/tests/scripts/features/export b/tests/scripts/features/export index 3d630a4a..1690ee80 100644 --- a/tests/scripts/features/export +++ b/tests/scripts/features/export @@ -25,7 +25,6 @@ BOTZ = botz export BITZ BOTZ unexport BOTZ - ifdef EXPORT_ALL export endif @@ -173,5 +172,79 @@ $answer = "foo=f-ok bar=b-ok\nfoo= bar=\n"; &compare_output($answer,&get_logfile(1)); +# TEST 7: Test exporting multiple variables on the same line + +$makefile4 = &get_tmpfile; + +open(MAKEFILE, "> $makefile4"); + +print MAKEFILE <<'EOF'; + +A = a +B = b +C = c +D = d +E = e +F = f +G = g +H = h +I = i +J = j + +SOME = A B C + +export F G H I J + +export D E $(SOME) + +all: ; @echo A=$$A B=$$B C=$$C D=$$D E=$$E F=$$F G=$$G H=$$H I=$$I J=$$J +EOF + +close(MAKEFILE); + +&run_make_with_options($makefile4,"",&get_logfile,0); +$answer = "A=a B=b C=c D=d E=e F=f G=g H=h I=i J=j\n"; +&compare_output($answer,&get_logfile(1)); + + +# TEST 8: Test unexporting multiple variables on the same line + +$makefile5 = &get_tmpfile; + +open(MAKEFILE, "> $makefile5"); + +print MAKEFILE <<'EOF'; + +A = a +B = b +C = c +D = d +E = e +F = f +G = g +H = h +I = i +J = j + +SOME = A B C + +unexport F G H I J + +unexport D E $(SOME) + +all: ; @echo A=$$A B=$$B C=$$C D=$$D E=$$E F=$$F G=$$G H=$$H I=$$I J=$$J +EOF + +close(MAKEFILE); + +@ENV{qw(A B C D E F G H I J)} = qw(1 2 3 4 5 6 7 8 9 10); + +&run_make_with_options($makefile5,"",&get_logfile,0); +$answer = "A= B= C= D= E= F= G= H= I= J=\n"; +&compare_output($answer,&get_logfile(1)); + +delete @ENV{qw(A B C D E F G H I J)}; + + # This tells the test driver that the perl test script executed properly. 1;