I got the J language working on OpenBSD
briancallahan.net
briancallahan.net
Googling “openbsd werror” doesn’t show anything, why is this?
Enabling Werror sounds like exactly the sort of thing that'd be encouraged by default, and only disabled on ports that couldn't be patched to fix it. Or at least, enabled on ports that can have it enabled.
(that said, I know that the vast majority of software won't compile with Werror, so, ?)
Since they do want the OS to be practical and usable, though, your argument also holds true, and seems to take precedence here. Just kind of surprised they'd make a policy of explicitly patching out upstream's Werror, since it implies it's "supposed" to work with no errors.
Some compilers will warn about:
while (true) { ... }
having a constant condition. The fix is to write: for (;;) { ... }
to nobody's benefit.I've used languages that warn if you use snake_case instead of camelCase, because it violates their preferred naming convention. Or if you accidentally use a tab somewhere, it'll warn about a mix of tabs and spaces.
None of these matter for correctness, yet you're advocating to break the build for correctness.
Idiomatic constructions benefit whoever would read the code (along with choosing and following to a style guide).
Warnings do not mean the program is incorrect, and lack of warnings do not mean the program is correct. It is just heuristics, and changes between major versions and different implementations, even while the program execution behavior is exactly the same. OpenBSD cares about portability. A well implemented program should work correctly with a good range of different reasonable compilers, and -Werror really throws a wrench in that.
Imagine you want to update the compiler to a new major version that has some corner-case correctness improvement or some security mitigation feature - but it also has a new warning. Can't do that! Unless you change the source of a bunch of libraries and applications which you didn't write. Mistakes have been made fixing warnings, like the infamous Debian openssl fix that removed most of the entropy from generated ssh keys.
If you care about correctness, you pay attention to and fix warnings where appropriate, without forcing yourself by making all your builds on different compiler versions/implementations just fail.
There was a time that CPython wanted to add a deprecation warning, but some popular libraries ran tests with the equivalent of -Werror during a regular build/install (trying to be super-correct best-practices etc), so adding a warning would break compatibility with most of the ecosystem, so CPython couldn't just add the warning using the long-established system. Instead they had to come up with a new system for warnings shown in some circumstances and not others, to effectively trick these super-best-practices projects into still working.
The problem are the "surprise me!" warning options (-Wall, -Wextra) of GCC which bring in diagnostics which differ from version to version. So then with -Werror, the language has become a moving target: what is considered a bad construct that stops the translation is changing.
The problem with not using -Wall and -Werror and just specifying the exact diagnostics you want, together with -Werror, is that you don't benefit from the discovery of defects brought about by new diagnostic options.
The fix for that is to have an ongoing thread of activity in your project dedicated to exploring new compiler options (supported by a special build configuration).
Bug free software that compiles warning free has to be updated because of the stylistic preferences of some RedHat person practically with every new gcc release.
For KPI harvesting developers of course "fixing" non-issues is financially attractive.
It's easy to imagine having a compiler upgrade then add new warnings, that cause unchanged code in a project with -Werror to no longer build, thus breaking it.
Of course it can be argued that such "exposure" flushes out bad code with a vengeance, but it can also be considered to be annoying.
I think one was about superfluous parentheses, and the other about not parenthesising an expression because it assumed the programmer would be too stupid to know the precedence of operators.
I understand the noble goal of being warning-clean, but I wish there was a way to implement it in such a way that it could also be globally disabled. Then I could get a top level build, but the local resolution of the issues would still be on the owners of the code.
But all of this requires adding complexity and branching to the system. It can be done and is worth doing, you just have to choose your battles.
Not in OpenBSD it isn't.
There's also a wealth of documentation and books on J: J for C Programmers: https://www.jsoftware.com/help/jforc/contents.htm
Learning J: https://www.jsoftware.com/help/learning/contents.htm
And the New Vocabulary "Nuvoc" on the wiki: https://code.jsoftware.com/wiki/NuVoc
Edit: spelling.
[0]Notation as a tool of thought, https://doi.org/10.1145/1283920.1283935
If they really want something open source and good, J, open source ks, or BQN will be better. But if you're suggesting an APL dialect, Dyalog is much better than GNU despite being proprietary.
BEST, llc has built it with Tup (see https://github.com/iocane/unbox), so changing the build system is at least possible.
Edit: there's also a long-open PR to move to CMake at https://github.com/jsoftware/jsource/pull/20.