mirror of
https://git.savannah.gnu.org/git/make.git
synced 2025-01-13 01:07:36 +00:00
[SV 64815] Recipe lines cannot contain conditional statements
* NEWS: Mention this change. * src/read.c (eval): Check for ignoring for any line even if not in a rule context. * tests/scripts/features/conditionals: Write new tests.
This commit is contained in:
parent
c85b71a396
commit
07fcee35f0
3 changed files with 69 additions and 4 deletions
4
NEWS
4
NEWS
|
@ -53,6 +53,10 @@ https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=111&se
|
|||
invoked recursively, warnings can be controlled only for the current
|
||||
instance of make using the .WARNINGS variable.
|
||||
|
||||
* Conditional statements starting with the recipe prefix were sometimes
|
||||
interpreted in previous versions. As per the documentation, lines starting
|
||||
with the recipe prefix are now never considered conditional statements.
|
||||
|
||||
* Tests in the regression test suite now are run in their own directory to
|
||||
avoid cross-contamination and allow cleanup if the tests are interrupted.
|
||||
More information is printed about failing tests.
|
||||
|
|
|
@ -666,16 +666,16 @@ eval (struct ebuffer *ebuf, int set_default)
|
|||
/* Ignore the commands in a rule with no targets. */
|
||||
continue;
|
||||
|
||||
if (ignoring)
|
||||
/* Yep, this is a shell command, and we don't care. */
|
||||
continue;
|
||||
|
||||
/* If there is no preceding rule line, don't treat this line
|
||||
as a command, even though it begins with a recipe prefix.
|
||||
SunOS 4 make appears to behave this way. */
|
||||
|
||||
if (filenames != 0)
|
||||
{
|
||||
if (ignoring)
|
||||
/* Yep, this is a shell command, and we don't care. */
|
||||
continue;
|
||||
|
||||
if (commands_idx == 0)
|
||||
cmds_started = ebuf->floc.lineno;
|
||||
|
||||
|
|
|
@ -153,6 +153,67 @@ endif
|
|||
',
|
||||
'', "one\n");
|
||||
|
||||
# SV 64085: Ensure recipe prefixed conditionals are never considered
|
||||
run_make_test(q!
|
||||
blah=1
|
||||
ifdef blah
|
||||
else
|
||||
else
|
||||
endif
|
||||
all:;
|
||||
!,
|
||||
'', "#MAKE#: 'all' is up to date.");
|
||||
|
||||
run_make_test(q!
|
||||
blah=1
|
||||
ifdef blah
|
||||
else
|
||||
endif
|
||||
endif
|
||||
all:;
|
||||
!,
|
||||
'', "#MAKE#: 'all' is up to date.");
|
||||
|
||||
run_make_test(q!
|
||||
blah=1
|
||||
ifdef blah
|
||||
else
|
||||
ifdef blah
|
||||
endif
|
||||
all:;
|
||||
!,
|
||||
'', "#MAKE#: 'all' is up to date.");
|
||||
|
||||
run_make_test(q!
|
||||
blah=1
|
||||
all:;
|
||||
foo:
|
||||
ifdef blah
|
||||
ifdef blah
|
||||
endif
|
||||
!,
|
||||
'', "#MAKE#: 'all' is up to date.");
|
||||
|
||||
run_make_test(q!
|
||||
blah=1
|
||||
all:;
|
||||
foo:
|
||||
ifdef blah
|
||||
endif
|
||||
endif
|
||||
!,
|
||||
'', "#MAKE#: 'all' is up to date.");
|
||||
|
||||
run_make_test(q!
|
||||
blah=1
|
||||
all:;
|
||||
foo:
|
||||
ifdef blah
|
||||
else
|
||||
else
|
||||
endif
|
||||
!,
|
||||
'', "#MAKE#: 'all' is up to date.");
|
||||
|
||||
# This tells the test driver that the perl test script executed properly.
|
||||
1;
|
||||
|
|
Loading…
Reference in a new issue