-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support suppressing opportunistic compiler warnings #4598
Support suppressing opportunistic compiler warnings #4598
Conversation
lib/compiler/doc/src/compile.xml
Outdated
disabling all warnings).</p> | ||
<p>Another kind of warnings is <em>opportunistic | ||
warnings</em>. They are generated when the compiler | ||
<strong>happens</strong> to notice potential issues during |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this stress "potential" and not "happens"? Or is it not a given that in some cases e.g. unused returned values would be missed by the compiler?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to emphasize the other kind of problem with opportunistic warnings, namely that not all potential problems are reported. I think it is better to remove the emphasis on "happens".
3e71047
to
d179bea
Compare
7dae886
to
ef0bbb2
Compare
Classify the warnings from the v3_core, sys_core_fold, and v3_kernel into three different categories: * {nomatch,Term} - a pattern will not match for some reason. * {failed,Term} - an expression or term construction will fail for some reason. * {ignored,Term} - an expression or constructed term is ignored. The classification will make it easier to selectively disable certain categories of warnings.
It has never been possible to disable the opportunistic warnings generated by the code generation and optimization passes. It is high time to allow the user to disable those warnings, especially since using funs to suppress warnings may no longer work since commit 72675ba that introduced inlining of funs that were immediately used.
9cd6d0a
to
b217b21
Compare
To work around erlang-lager/lager#546. The flag was introduced in erlang/otp#4598, which is more recent than 24-rc.1.
To work around erlang-lager/lager#546. The flag was introduced in erlang/otp#4598, which is more recent than 24-rc.1.
To work around erlang-lager/lager#546. The flag was introduced in erlang/otp#4598, which is more recent than 24-rc.1.
Opportunistic warnings are the warnings that the compiler's optimization and code generating passes emit when they happen to notice potential issues.
One problem with the opportunistic warnings is that there can be inappropriate warnings for perfectly good code, especially if inlining or macros are involved. Therefore, it has been our TO DO list for a long time to implement a way to turn off those warnings.
#4545, which was recently merged, can cause more spurious warnings to appear (because a
fun
that is now inlined could suppress warnings intentionally or unintentionally). Therefore, it's high time to add options to suppress opportunistic warnings.