Skip to content

Disable warning 66 (unused-open-bang) locally rather than globally#11498

Merged
dra27 merged 3 commits intoocaml:trunkfrom
shindere:disable-warning-66-locally
Aug 24, 2022
Merged

Disable warning 66 (unused-open-bang) locally rather than globally#11498
dra27 merged 3 commits intoocaml:trunkfrom
shindere:disable-warning-66-locally

Conversation

@shindere
Copy link
Copy Markdown
Contributor

At the moment, our build system imposes that the dependencies computed
by ocamldep for the native backends must be exactly the same for
all backends, although the dependencies are actually different.

To circumvent this limitation, four backends (amd64, arm64, i386
and riscv) need to introduce a dependency that does not really exist:
these backends don't have instruction scheduling enabled, but still, their
scheduling.ml module must
open! Schedgen to cope with the requirements of our build system.

On top of that, when it is enabled, the warning 66 (unused-open-bang)
rightly reports that the above mentionned directives are not necessary.

In the current codebase, this warning is disabled at the level
of the build system, so for the whole compiler's codebase.

The purpose of this PR is to disable the warning locally rather than
globally, only at those places where it is known that, for the moment,
it is necessary to do so.

The PR is not an ultimate fix. The ultimate fix would consist in
having a build system which tolerates that each backend has its own
dependencies, which does not necessarily entail that the dependencies
can not be stored statically. But that's a bit too ambitious, which
would likely require more invasive changes and so this PR proposes
an intermediate solution, a middle way so to speak, which can be summed
up as follows: we are still hiding the dust under a carpet but this
PR makes the carpet smaller than it was before, with the hope that, one day,
it will become possible to remove both carpet and dust.

the other purpose of this PR is to reduce the difference between the
warnings WHICH NEED TO BE disabled to compile the compiler and
those which need to be disabled to compile ocamllex, to make
the merge of lex/Makefile into the root Makefile proposed in
#11420 easier.

Of course, in theory it could make sense to different different lists of
warnings to compile the compiler and ocamllex. But, in the particular
case addressed by this PR, it does not sound insane to turn a global
warning into a local one. The Pr also clarifies the situation in
the codebase itself, thanks to the comments and to an attribute,
which is of course also a form of documentation.

But make sure not to turn it into an error at this stage, so that
all the warnings get printed.
This commit disables warning 66 (unused-open-bang) only locally in
the four places where it was triggered, rather than disabling it for the
whole compiler.

See the source code for the explanation about why it is necessary to
use code that triggers this warning.
Now that the warning has been disabled exactly where it was currently
necessary to disable it, we can turn it into an error in the build system.
Copy link
Copy Markdown
Member

@dra27 dra27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely nicer this way, yes!

@dra27 dra27 merged commit f14c8ff into ocaml:trunk Aug 24, 2022
@shindere
Copy link
Copy Markdown
Contributor Author

shindere commented Aug 24, 2022 via email

@shindere
Copy link
Copy Markdown
Contributor Author

shindere commented Aug 24, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants