* 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.
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.
/* 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;
',
'', "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;