Add a regression test for this.
Older libraries don't allow *alloc(0), so make sure we don't ever do that.
*.dep *.dvi *.toc *.aux *.log
*.cp *.cps *.fn *.fns *.vr *.vrs *.tp *.tps *.ky *.kys *.pg *.pgs
-README README.DOS README.W32
+README README.DOS README.W32 README.OS2
aclocal.m4 autom4te.cache
config.h.in config.h config.status config.cache configure
Makefile.in Makefile
+2004-01-07 Paul D. Smith <psmith@gnu.org>
+
+ * implicit.c (pattern_search): When matching an implicit rule,
+ remember which dependencies have the ignore_mtime flag set.
+ Original fix provided in Savannah patch #2349, by Benoit
+ Poulot-Cazajous <Benoit.Poulot-Cazajous@jaluna.com>.
+
2003-11-02 Paul D. Smith <psmith@gnu.org>
* function.c (func_if): Strip all the trailing whitespace from the
(get-config/config.guess get-config/config.sub): Get these files
from the Savannah config project instead of ftp.gnu.org.
+2003-08-22 Paul D. Smith <psmith@gnu.org>
+
+ * misc.c (xmalloc, xrealloc): Add one to 0 sizes, to cater to
+ systems which don't yet implement the C89 standard :-/.
+
2003-07-18 Paul D. Smith <psmith@gnu.org>
* dir.c (directory_contents_hash_1, directory_contents_hash_1)
/* This buffer records all the dependencies actually found for a rule. */
char **found_files = (char **) alloca (max_pattern_deps * sizeof (char *));
+ /* This list notes if the associated dep has an "ignore_mtime" flag set. */
+ unsigned char *found_files_im = (unsigned char *) alloca (max_pattern_deps * sizeof (unsigned char));
/* Number of dep names now in FOUND_FILES. */
unsigned int deps_found = 0;
if (lookup_file (p) != 0
|| ((!dep->changed || check_lastslash) && file_exists_p (p)))
{
+ found_files_im[deps_found] = dep->ignore_mtime;
found_files[deps_found++] = xstrdup (p);
continue;
}
DBS (DB_IMPLICIT,
(_("Found prerequisite `%s' as VPATH `%s'\n"), p, vp));
strcpy (vp, p);
+ found_files_im[deps_found] = dep->ignore_mtime;
found_files[deps_found++] = vp;
continue;
}
intermediate_file->name = p;
intermediate_files[deps_found] = intermediate_file;
intermediate_file = 0;
+ found_files_im[deps_found] = dep->ignore_mtime;
/* Allocate an extra copy to go in FOUND_FILES,
because every elt of FOUND_FILES is consumed
or freed later. */
- found_files[deps_found] = xstrdup (p);
- ++deps_found;
+ found_files[deps_found++] = xstrdup (p);
continue;
}
}
dep = (struct dep *) xmalloc (sizeof (struct dep));
- dep->ignore_mtime = 0;
+ dep->ignore_mtime = found_files_im[deps_found];
s = found_files[deps_found];
if (recursions == 0)
{
char *
xmalloc (unsigned int size)
{
- char *result = (char *) malloc (size);
+ /* Make sure we don't allocate 0, for pre-ANSI libraries. */
+ char *result = (char *) malloc (size ? size : 1);
if (result == 0)
fatal (NILF, _("virtual memory exhausted"));
return result;
char *result;
/* Some older implementations of realloc() don't conform to ANSI. */
+ if (! size)
+ size = 1;
result = ptr ? realloc (ptr, size) : malloc (size);
if (result == 0)
fatal (NILF, _("virtual memory exhausted"));
+2004-01-07 Paul D. Smith <psmith@gnu.org>
+
+ * scripts/features/order_only: Test order-only prerequisites in
+ pattern rules (patch #2349).
+
2003-11-02 Paul D. Smith <psmith@gnu.org>
* scripts/functions/if: Test if on conditionals with trailing
unlink(qw(foo baz));
+# Test order-only in pattern rules
+
+$makefile4 = &get_tmpfile;
+
+open(MAKEFILE,"> $makefile4");
+
+print MAKEFILE <<'EOF';
+%.w : %.x | baz
+ @echo '$$^ = $^'
+ @echo '$$| = $|'
+ touch $@
+
+all: foo.w
+
+.PHONY: baz
+foo.x baz:
+ touch $@
+EOF
+
+close(MAKEFILE);
+
+# TEST #7 -- make sure the parser was correct.
+
+&run_make_with_options($makefile4, "", &get_logfile);
+$answer = "touch foo.x\ntouch baz\n\$^ = foo.x\n\$| = baz\ntouch foo.w\n";
+&compare_output($answer,&get_logfile(1));
+
+# TEST #8 -- now we do it again: this time foo.w won't be built
+
+&run_make_with_options($makefile4, "", &get_logfile);
+$answer = "touch baz\n";
+&compare_output($answer,&get_logfile(1));
+
+unlink(qw(foo.w foo.x baz));
+
1;