[SV 63098] Enhance detection of missing peer also-make targets

The previous attempt to detect missing peer targets for implicit
rules had some holes.  Move the detection to notice_finished_file().

* src/remake.c (check_also_make): If we don't have the current mtime
for the file, obtain it.
(update_goal_chain): Don't call check_also_make() here.
(check_dep): Ditto.
(notice_finished_file): If we finished running an implicit rule that
has also_make targets, invoke check_also_make().
This commit is contained in:
Paul Smith
2022-10-22 19:09:44 -04:00
parent f987d181c4
commit bb0c05a7f0
2 changed files with 58 additions and 31 deletions

View File

@@ -478,6 +478,20 @@ run_make_test(q!
'gta', "touch gta\n#MAKEFILE#:2: warning: pattern recipe did not update peer target 'gtb'.\n");
unlink(qw(gta));
# We don't warn if we didn't update the file
utouch(-10, qw(gta));
run_make_test(q!
%a %b : xyzzy ; $(OP)
xyzzy: ;
ifdef RUN
OP = @echo no
endif
!,
'-rR gta', "#MAKE#: 'gta' is up to date.\n");
run_make_test(undef, '-rR gta RUN=1', "no\n");
unlink(qw(gta));
run_make_test(q!
all:;
include gta
@@ -486,6 +500,14 @@ include gta
'', "touch gta\n#MAKEFILE#:4: warning: pattern recipe did not update peer target 'gtb'.\n#MAKE#: 'all' is up to date.");
unlink(qw(gta));
run_make_test(q!
%.c %.h : %.y; touch $*.c
%.o: %.c; touch $@
foo.y: ; touch $@
!,
'foo.o', "touch foo.y\ntouch foo.c\n#MAKEFILE#:2: warning: pattern recipe did not update peer target 'foo.h'.\ntouch foo.o\nrm foo.c");
unlink(qw(foo.y foo.c foo.o));
if (0) {
# SV 12078: Missing grouped pattern peer causes remake regardless of which
# target caused the rule to run.