-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
implement --warningAsError:on
and enforce it for compiler sources; fix some bugs with warningAsError:foo:on|off
#14068
Conversation
f4fc026
to
018132d
Compare
But "turn all warnings into errors" is a misfeature that I won't accept. |
virtually every language I've used have that feature, and for good reasons.
even non statically compiled languages have that feature for library code:
It's not a misfeature, warnings are so easy to ignore (who's looking at warnings in CI?).
if nim compiler introduces a new warning This feature is meant for CI (whether in nim's CI or other nimble packages's CI), and helps phasing out deprecated features faster, while avoiding introducing regressions. A PR that makes a change that causes a new warning-as-error (eg unused module import) can and should fix it in the same PR, or if that's technically difficult, selectively disable that warning-as-error. For example, |
I don't mind turning warnings into errors, I mind blindlessly turning all warnings into errors. This switch will end up in somebody's build, we add a new warning, yay, we break somebody's build. That's exactly what we didn't want to do. |
The fix is trivial, it's What you're suggesting is not very practical, users would have to blacklist all existing warnings in their CI if they want to keep their code warning free in CI. That list would not only become stale, but they'll be unaware that some new warning is introduced, ie, miss an opportunity to fix a security issue etc. However, I think the following suggestion should remove any remaining concern:
so compiler sources and code nimble projects that WANT to break-and-fix because of new compiler warnings can use |
I can see how the versioned, uh, version could work, but I cannot see how the |
|
This pull request has been automatically marked as stale because it has not had recent activity. If you think it is still a valid PR, please rebase it on the latest devel; otherwise it will be closed. Thank you for your contributions. |
before PR:
warningAsError
had some bugs, for examplenim c -r --warningAsError:Deprecated:on hello.nim
would crash without any error or warning shownafter PR
--warningAsError:foo:on
means enable warning and turn it into error--warningAsError:foo:off
means do not error for that warning but don't disable the warning--warningAsError:on|off
is now implemented, with semantics:--warningAsError:on
turns all warnings into errors but doesn't enable (nor disable) any warning--warningAsError:off
turns all warnings into non-errors but doesn't enable (nor disable) any warning--warningAsError:on
for compiler sources; more sources could follow later. Errors can be selectively disabled:the flags combine in the way you'd expect, so that
--warningAsError:on --warningAsError:foo:off
can be used to turn all enabled warnings into errors except forfoo
.note
I'm also incrementing
NimPatch
so user code can simply branch viawhen (NimMajor, NimMinor, NimPatch) >= version:
../compiler/config.nims
can't use that because of bootstrapping, but will be able to oncequerySetting
reports the(NimMajor, NimMinor, NimPatch)
it was compiled against