On 5/19/24 18:25, Paul D. Smith wrote:
Follow-up Comment #6, bug #60736 (group make):

I think that using a warn option is better than forcing this to always warn.
But I still think that the warning makes global usage useless, and since
there's no way to control warnings on a per-target basis (today) it means the
warning is hard to use.

It seems to me that we have two different behaviors: for global .EXTRA_PREREQS
I just can't imagine anyone ever wanting to enable this warning.  Can someone
show an example of a situation where it would be useful for global
.EXTRA_PREREQS?

But for target-specific .EXTRA_PREREQS I can see how it could be useful.

So maybe what we want to do instead of (or in addition to) creating the
warning is to say that the entire behavior of omitting extra prereqs as a
prerequisite to itself only applies to global .EXTRA_PREREQS; that is in the
manual instead of:

Note @code{make} is smart enough not to add a prerequisite listed in
@code{.EXTRA_PREREQS} as a prerequisite to itself.

we make it explicit (and in the code) that this only applies to global
.EXTRA_PREREQS; something like:

Note @code{make} is smart enough not to add a prerequisite listed in a
global setting of @code{.EXTRA_PREREQS} as a prerequisite to itself.

Then we can keep all the default behaviors, including warning about circular
dependencies using the already existing warning option for this that you
proposed in the other bug, because by definition those warnings won't apply to
global .EXTRA_PREREQS due to the special case above, but they will still apply
to target-specific .EXTRA_PREREQS.

Thoughts?

As long as comment #6 is only referring to the special case of "target never added as a prerequisite to itself via global .EXTRA_PREREQS," then there is no need for the warning, because by definition there is no circular dependency caused by global .EXTRA_PREREQS. So in essence, the situation becomes "make is not going to warn about something it didn't do..." The slight clarification in the manual is thus sufficient.

But it should still warn about other circular dependencies caused by users setting global .EXTRA_PREREQS, which is current behaviour already:

.EXTRA_PREREQS = a

a: b
b: c
c: d
d:
        @echo making $@

$ make
make: Circular d <- a dependency dropped.
making d
make: Circular c <- a dependency dropped.
make: Circular b <- a dependency dropped.

So the corner-case of no warning for a <- a is fine, but this is where the choice of :warning or :error for the rest is still useful, though the circularity is caused by global .EXTRA_PREREQS. It is not clear from the last sentence of comment #6 what the proposal is in terms what happens in such case.

There is one other small improvement I'd like to request in terms of reporting the circular dependencies, and this is almost off topic, but maybe it can be squeezed in to this bug, or I can open a new request, whatever is better:

In the make snippet above the output shows

make: Circular d <- a dependency dropped.

but what would be immensely more useful are the missing intermediate targets, i.e.:

make: Circular d <- c <- b <-a dependency dropped.

Tracking down circular dependencies at the moment is usually accompanied by digging through tons of output from the -d flag, which is time-consuming when all I'd really need is the [longer] cycle path itself.


Reply via email to