summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2006-02-19 07:46:08 +0000
committerMike Frysinger <vapier@gentoo.org>2006-02-19 07:46:08 +0000
commita673a799c22768e2180fc539a10e64ff80831d77 (patch)
tree50c70857c48079e5da19545efc726975ace86948 /sys-devel/make/files
parentFixes a crash issue on PPC64. (Fixes bug #58092) (diff)
downloadgentoo-2-a673a799c22768e2180fc539a10e64ff80831d77.tar.gz
gentoo-2-a673a799c22768e2180fc539a10e64ff80831d77.tar.bz2
gentoo-2-a673a799c22768e2180fc539a10e64ff80831d77.zip
Add patch from upstream for conditional eval statements #123317 by Maurice van der Pot.
(Portage version: 2.1_pre4-r1)
Diffstat (limited to 'sys-devel/make/files')
-rw-r--r--sys-devel/make/files/digest-make-3.80-r41
-rw-r--r--sys-devel/make/files/make-3.80-conditional-eval.patch157
2 files changed, 158 insertions, 0 deletions
diff --git a/sys-devel/make/files/digest-make-3.80-r4 b/sys-devel/make/files/digest-make-3.80-r4
new file mode 100644
index 000000000000..bdd63b418ee6
--- /dev/null
+++ b/sys-devel/make/files/digest-make-3.80-r4
@@ -0,0 +1 @@
+MD5 0bbd1df101bc0294d440471e50feca71 make-3.80.tar.bz2 920645
diff --git a/sys-devel/make/files/make-3.80-conditional-eval.patch b/sys-devel/make/files/make-3.80-conditional-eval.patch
new file mode 100644
index 000000000000..f4c1581f316f
--- /dev/null
+++ b/sys-devel/make/files/make-3.80-conditional-eval.patch
@@ -0,0 +1,157 @@
+Fix from upstream
+
+https://savannah.gnu.org/bugs/index.php?func=detailitem&item_id=1516
+http://bugs.gentoo.org/123317
+
+Index: read.c
+===================================================================
+RCS file: /cvsroot/make/make/read.c,v
+retrieving revision 1.124
+retrieving revision 1.125
+diff -u -p -r1.124 -r1.125
+--- read.c 14 Oct 2002 21:54:04 -0000 1.124
++++ read.c 25 Oct 2002 22:01:47 -0000 1.125
+@@ -272,6 +272,34 @@ read_all_makefiles (char **makefiles)
+ return read_makefiles;
+ }
+
++/* Install a new conditional and return the previous one. */
++
++static struct conditionals *
++install_conditionals (struct conditionals *new)
++{
++ struct conditionals *save = conditionals;
++
++ bzero ((char *) new, sizeof (*new));
++ conditionals = new;
++
++ return save;
++}
++
++/* Free the current conditionals and reinstate a saved one. */
++
++static void
++restore_conditionals (struct conditionals *saved)
++{
++ /* Free any space allocated by conditional_line. */
++ if (conditionals->ignoring)
++ free (conditionals->ignoring);
++ if (conditionals->seen_else)
++ free (conditionals->seen_else);
++
++ /* Restore state. */
++ conditionals = saved;
++}
++
+ static int
+ eval_makefile (char *filename, int flags)
+ {
+@@ -388,6 +416,8 @@ int
+ eval_buffer (char *buffer)
+ {
+ struct ebuffer ebuf;
++ struct conditionals *saved;
++ struct conditionals new;
+ const struct floc *curfile;
+ int r;
+
+@@ -402,8 +432,12 @@ eval_buffer (char *buffer)
+ curfile = reading_file;
+ reading_file = &ebuf.floc;
+
++ saved = install_conditionals (&new);
++
+ r = eval (&ebuf, 1);
+
++ restore_conditionals (saved);
++
+ reading_file = curfile;
+
+ return r;
+@@ -412,13 +446,8 @@ eval_buffer (char *buffer)
+
+ /* Read file FILENAME as a makefile and add its contents to the data base.
+
+- SET_DEFAULT is true if we are allowed to set the default goal.
++ SET_DEFAULT is true if we are allowed to set the default goal. */
+
+- FILENAME is added to the `read_makefiles' chain.
+-
+- Returns 0 if a file was not found or not read.
+- Returns 1 if FILENAME was found and read.
+- Returns 2 if FILENAME was read, and we kept a reference (don't free it). */
+
+ static int
+ eval (struct ebuffer *ebuf, int set_default)
+@@ -782,9 +811,7 @@ eval (struct ebuffer *ebuf, int set_defa
+
+ /* Save the state of conditionals and start
+ the included makefile with a clean slate. */
+- save = conditionals;
+- bzero ((char *) &new_conditionals, sizeof new_conditionals);
+- conditionals = &new_conditionals;
++ save = install_conditionals (&new_conditionals);
+
+ /* Record the rules that are waiting so they will determine
+ the default goal before those in the included makefile. */
+@@ -810,14 +837,8 @@ eval (struct ebuffer *ebuf, int set_defa
+ }
+ }
+
+- /* Free any space allocated by conditional_line. */
+- if (conditionals->ignoring)
+- free (conditionals->ignoring);
+- if (conditionals->seen_else)
+- free (conditionals->seen_else);
+-
+- /* Restore state. */
+- conditionals = save;
++ /* Restore conditional state. */
++ restore_conditionals (save);
+
+ goto rule_complete;
+ }
+Index: tests/scripts/functions/eval
+===================================================================
+RCS file: /cvsroot/make/make/tests/scripts/functions/eval,v
+retrieving revision 1.1
+retrieving revision 1.2
+diff -u -p -r1.1 -r1.2
+--- tests/scripts/functions/eval 8 Jul 2002 02:26:48 -0000 1.1
++++ tests/scripts/functions/eval 25 Oct 2002 22:01:47 -0000 1.2
+@@ -57,4 +57,35 @@ $answer = "A = A B = B\n";
+
+ &compare_output($answer,&get_logfile(1));
+
++# Test to make sure eval'ing inside conditionals works properly
++
++$makefile3 = &get_tmpfile;
++
++open(MAKEFILE,"> $makefile3");
++
++print MAKEFILE <<'EOF';
++FOO = foo
++
++all:: ; @echo it
++
++define Y
++ all:: ; @echo worked
++endef
++
++ifdef BAR
++$(eval $(Y))
++endif
++
++EOF
++
++close(MAKEFILE);
++
++&run_make_with_options($makefile3, "", &get_logfile);
++$answer = "it\n";
++&compare_output($answer,&get_logfile(1));
++
++&run_make_with_options($makefile3, "BAR=1", &get_logfile);
++$answer = "it\nworked\n";
++&compare_output($answer,&get_logfile(1));
++
+ 1;