Do not use "private" in stdlib/Makefile#8608
Conversation
This directive has been introduced in GNU make 3.82 while Mac OS still ships GNU make 3.81.
|
Thinking more about this PR, I realize that I don't understand the implications of inheriting these flags. For example, Do I understand correctly that any Makefile-side flag set for I am now under the impression that #8601 is not the right way to go: it makes the system harder to understand and more fragile. With my current understanding (I would be happy to be reassured about the impact of inheritance), I would propose to revert #8601 rather than merge this followup PR. |
|
Many thanks for your prompt response, @gasche!
I think you are monstly correct and I also started to ask myself the
very same questions you mention.
I went ahead because things were working but now I think I understand
why they are working and agree they are fragile. Taking
`stdlib__seq.cmi` as an example, there are several reasons for make to
decide to compile it. One reason is the rule you mention, another reason
is that this file is that this file is also a prerequisite for
`stdlib__seq.cmo` which is itself a prerequisite for the whole library.
My understanding is that the compilation is triggered by the second
reason and that's why the flags are not passed, but if the compilation
would be triggered by the rule you mention, e.g. because one would
manually run `make stdlib__array.cmo` then the flag would be inherited.
So I agree that it seems simpler and wiser to jsut revert #8601 and am
very sorry for the wasted time it created.
Can we perhaps think about a way to add module-specific flags to the
source files themselves?
|
|
For warnings you can use In the past I proposed to allow toplevel directives at the beginning (only) of each source file, so that #labels false;;
#alias-deps false;;could be used to specify compilation options. This proposal has not had the enthusiastic following that I expected. (I think it's important to have something that is only syntactically valid at the head of a source file, rather than anywhere in the file like extensions and attributes, to enforce the semantics that this header is interpreted by the compiler before the whole file, which is the only semantics that makes sense for global flags that affect the semantics of all the code in the module (for example |
|
Sure, i'll take care of it.
|
|
Gabriel Scherer (2019/04/11 02:31 -0700):
For warnings you can use `[@@@ocaml.warning "..."]` attributes to specify warnings at the top of a source file.
In the past I proposed to allow toplevel directives at the beginning (only) of each source file, so that
```ocaml
#labels false;;
#alias-deps false;;
```
could be used to specify compilation options. This proposal has not had the enthusiastic following that I expected.
(I think it's important to have something that is only syntactically
valid at the head of a source file, rather than anywhere in the file
like extensions and attributes, to enforce the semantics that this
header is interpreted by the compiler *before the whole file*, which
is the only semantics that makes sense for global flags that affect
the semantics of all the code in the module (for example
`-safe-string`, `-for-pack foo`, `-no-alias-deps`), in opposition to
settings that can be meaningfully changed from one sentence to the
other (actually not many flags are properly supported in this mode).
I fully agree. At the time, did you do a PR for that?
If not, shall we try to write a proposal that could be part of a
roadmap?
|
This directive has been introduced in GNU make 3.82 while Mac OS still
ships GNU make 3.81.
This is a follow-up to #8601 and fixes Inria's CI so it would be good to
merge promptly to avoid false positives on other PRs.