[m-dev.] warnings/purity_warningsn and mmc -w

Zoltan Somogyi zoltan.somogyi at runbox.com
Sat Aug 16 02:13:43 AEST 2025


I was just checking the operation of -w (--inhibit-warnings)
while working on the user guide, and I saw that this test case
generates the same set of warnings with and without -w.
The reason for this is that these warnings are generated by code
that does not depend on the values of the options that -w disables.

There are two ways we can fix this, if indeed we want to fix it.
I do want to fix it, because the current situation violates the
law of least astonishment.

Way 1: simply search for all occurrences of severity_warning
in the compiler, and ensure that every piece of code that constructs
such an error_spec tests the value of a oc_warn_* category option.

Way 2: make --inhibit-warnings a plain option, and have write_error_spec.m
filter out every error_spec whose severity ends up being severity_warning
if it is set.

Way 2 is in a way more robust, because it does not require constant
vigilance against the addition of new warnings that do not depend
on a warning option. However, since write_error_spec cannot tell
whether a warning is a style warning or not, Way 1 cannot implement
--inhibit-STYLE-warnings.

I am leaning towards Way 1 for --inhibit-warnings and (by necessity)
Way 2 for --inhibit-style-warnings. We could even keep Way 2 as a backup
for -w. What do you think?

Zoltan.


More information about the developers mailing list