[m-rev.] for review: {err,warn,info}_spec
Zoltan Somogyi
zoltan.somogyi at runbox.com
Fri Jul 17 21:38:41 AEST 2026
On Fri, 17 Jul 2026 15:19:00 +1000, Julien Fischer <jfischer at opturion.com> wrote:
> > - Context, PredOrFunc, SymName, UserArity),
> > + % XXX DIAG_SPEC
> > + % This Spec used to have this severity:
> > + % Severity =
> > + % severity_informational(inform_ignored_pragma_errors),
> > + % Should it stay that way?
> > + Spec = report_ambiguous_pred_or_func(PragmaName, Context,
> > + PredOrFunc, SymName, UserArity),
> > Specs = [Spec]
>
>
> Strictly speaking, unrecognised pragmas should be ignored. Practically,
> since
> there is only one Mercury implementation, it's probably better to treat them
> as errors.
I updated the comment to say this.
> > +% XXX DIAG_SPECS
> > +% The numbers in these names mirror the number of arguments of the okN
> > +% function symbol, but they do not match the type constructor's arity,
> > +% due to the warn_specs being implicit. Which is more important?
>
> I would say the latter.
I switched them over.
> > MaybeError = no,
> > read_options_files_named_in_options_file_option(ProgressStream,
> > ArgsOptionTable, EnvOptFileVariables0,
> > - OptFileNonUndefSpecs, OptFileUndefSpecs, !IO),
> > + OptFileErrSpecs, OptFileUndefWarnSpecs0, !IO),
> > getopt.lookup_bool_option(ArgsOptionTable,
> > warn_undefined_options_variables, WarnUndef),
> > (
> > WarnUndef = no,
> > - OptFileSpecs = OptFileNonUndefSpecs
> > + OptFileUndefWarnSpecs = []
> > ;
> > WarnUndef = yes,
> > - OptFileSpecs = OptFileNonUndefSpecs ++ OptFileUndefSpecs
> > + OptFileUndefWarnSpecs = OptFileUndefWarnSpecs0
> > ),
> > io.environment.get_environment_var_map(EnvVarMap, !IO),
> > + % XXX DIAG_SPEC we used to include OptFileUndefWarnSpecs in this
>
> Not sure about that one; are they written out somewhere else?
This predicate returns OptFileUndefWarnSpecs in the event of failure.
but not in the event of the error. However, that is not what the DIAG_SPEC
is about. It is about the fact the code following that line, which is not
in your email, which is a switch on OptFileSpecs being nil or cons, used to
include OptFileUndefWarnSpecs in the value of OptFileSpecs being switched on.
So this diff fixes an old "problem" where (with the right options), warnings
were being counted as errors.
I followed all your other suggestions. Thanks for the review.
Zoltan.
More information about the reviews
mailing list