[m-rev.] for review: make warning/info messages conditional on an option

Peter Wang novalazy at gmail.com
Mon Aug 18 17:38:53 AEST 2025


On Sun, 17 Aug 2025 19:48:59 +0200 "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> This implements most of the proposal from a day or two ago.
> For review by anyone, but I would like Peter to write the help text
> for the new option warn_opt_desc_spec, since it applies to diagnostics
> in code that he touched last. The option may need renaming as well.
> 
> I would like feedback on the names of the new options.
> I would also like feedback on the two ZZZs in options.m,
> which I intend to act on after this diff is committed.
> A third ZZZ is a reminder to me to move a predicate
> whose movement before commit would make the diff
> harder to review.

> diff --git a/NEWS.md b/NEWS.md
> index 8e586f4e5..00b1d4def 100644
> --- a/NEWS.md
> +++ b/NEWS.md
> @@ -1619,6 +1619,30 @@ Changes to the Mercury compiler
>    removed in a future release. This option has not had any effect for a long
>    time.
>  
> +* We have added whole list of options that users can use to selectively

whole list of options that users can use to -> more options to

> +  turn off warnings messages that were previously not under such control.
> +  These options are the following.
> +
> +    --no-warn-cannot-table
> +    --no-warn-disj-fills-partial-inst
> +    --no-warn-duplicate-abstract-instances
> +    --no-warn-exported-insts-for-private-type
> +    --no-warn-missing-descendant-modules
> +    --no-warn-missing-state-var-init
> +    --no-warn-moved-trace-goal
> +    --no-warn-no-auto-parallelisation
> +    --no-warn-no-recursion
> +    --no-warn-nonexported-pragma
> +    --no-warn-opt-deps-spec

Delete --no-warn-opt-deps-spec, it is private.

> diff --git a/compiler/options.m b/compiler/options.m
> index 125e3d6fb..f985baac1 100644
> --- a/compiler/options.m
> +++ b/compiler/options.m
> @@ -439,7 +439,10 @@
>      ;       warn_interface_imports
>      ;       warn_interface_imports_in_parents
>      ;       warn_stdlib_shadowing
> +    ;       warn_duplicate_abstract_instances
>      ;       warn_too_private_instances
> +    ;       warn_subtype_ctor_order
> +    ;       warn_opt_deps_spec          % XXX placeholder name

warn_trans_opt_deps_spec

> @@ -496,12 +513,20 @@
>      ;       warn_unneeded_mode_specific_clause
>  
>      % Warnings about programming style, simple mistakes.
> +    % ZZZ warn_simple_code should be split into two halves:
> +    % one for style issues, and one for dodgy code.
> +    % And if none of its current uses are style issues,
> +    % then it should be moved to the dodgy code category.
>      ;       warn_simple_code

Makes sense.

> +    % ZZZ These should be renamed s/inform_/warn_/ and the severity
> +    % of their error_specs changed.
>      ;       inform_ite_instead_of_switch
>      ;       inform_incomplete_switch
>      ;       inform_incomplete_switch_threshold
>      ;       warn_duplicate_calls
>      ;       warn_redundant_coerce
> +    ;       warn_requested_by_code
> +    ;       warn_requested_by_option

Ok.

> @@ -2507,6 +2543,13 @@ optdb(oc_warn_dodgy_mod, warn_too_private_instances,   bool(no),
>          w("Generate a warning if an instance declaration"),
>          w("that can be relevant outside the current module"),
>          w("is not exported.")])).
> +optdb(oc_warn_dodgy_mod, warn_subtype_ctor_order,      bool(yes),
> +    help("warn-subtype-ctor-order", [
> +        w("Do not warn about a subtype definition that lists its"),
> +        w("data constructors in a different order than its supertype.")])).
> +optdb(oc_warn_dodgy_mod, warn_opt_deps_spec,           bool(yes),
> +    priv_help("warn-opt-deps-spec", [
> +        w("XXX Peter, please document this warning.")])).
>  

--warn-trans-opt-deps-spec
    Do not warn about missing or unknown module names
    in the --trans-opt-deps-spec file.

> +optdb(oc_warn_dodgy_goal, warn_unknown_warning_name, bool(yes),
> +    help("warn-unknown-warning-name", [
> +        w("When processing disable_warning scopes, do not report"),
> +        w("unknown warning names in the list of warnings to disable.")])).

Perhaps:

    Do not report unknown warning names listed at the start of a
    disable_warning(s) scope.

That looks fine, otherwise.

Peter


More information about the reviews mailing list