summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2014-01-11 16:10:02 -0500
committerPaul Smith <psmith@gnu.org>2014-01-12 10:54:29 -0500
commit9c8b68a905871882905fad6ca72c499a98bc2513 (patch)
tree15fbacf2c7c6f3f9f2b58dda5beb210dbc69cb6d
parent432cb6575d469d4d7575d420f83990437b837f43 (diff)
downloadgunmake-9c8b68a905871882905fad6ca72c499a98bc2513.tar.gz
* main.c (die): Close output_context AND make_sync.
die() can be invoked inside a separate output_context, if the $(error ...) function is expanded as part of a recipe.
-rw-r--r--main.c9
-rw-r--r--tests/scripts/features/output-sync7
2 files changed, 14 insertions, 2 deletions
diff --git a/main.c b/main.c
index fa0498f..27d3a6e 100644
--- a/main.c
+++ b/main.c
@@ -3406,9 +3406,14 @@ die (int status)
if (output_context)
{
- assert (output_context == &make_sync);
+ /* die() might be called in a recipe output context due to an
+ $(error ...) function. */
+ output_close (output_context);
+
+ if (output_context != &make_sync)
+ output_close (&make_sync);
+
OUTPUT_UNSET ();
- output_close (&make_sync);
}
output_close (NULL);
diff --git a/tests/scripts/features/output-sync b/tests/scripts/features/output-sync
index 75d7e81..a7534cb 100644
--- a/tests/scripts/features/output-sync
+++ b/tests/scripts/features/output-sync
@@ -330,5 +330,12 @@ t1: ; -\@\$(MAKE) -f $m1
rmfiles($m1);
+# Test $(error ...) functions in recipes
+
+run_make_test(q!
+foo: $(OBJS) ; echo $(or $(filter %.o,$^),$(error fail))
+!,
+ '-O', "#MAKEFILE#:2: *** fail. Stop.\n", 512);
+
# This tells the test driver that the perl test script executed properly.
1;