[m-rev.] for review: Add --error-files-in-subdir option.

Zoltan Somogyi zoltan.somogyi at runbox.com
Fri Jul 26 17:57:51 AEST 2024



On Fri, 26 Jul 2024 15:29:43 +1000, Peter Wang <novalazy at gmail.com> wrote:
> Add --error-files-in-subdir option.
> 
> Add an option, --error-files-in-subdir, which tells mmc --make
> to create .err files under the Mercury subdirectory.

See below.

> compiler/options.m:
>     Add the option.
> 
> compiler/file_names.m:
>     Replace the existing ext_cur_user_err constructor
>     with a constructor, ext_cur_ngs_gs_err_err, in a new category.
> 
>     Implement the rules for .err files:
> 
>     - When neither of --use-subdirs is enabled, .err files are placed in
>       the current directory (as before).

--use-subdirs or --use-grade-subdirs

>     - When --use-subdirs is enabled, .err files are placed in the
>       non-grade-specific Mercury/errs subdirectory.
> 
>     - When --use-grade-subdirs is enabled, .err files are placed in a
>       grade-specific err subdirectory.

> diff --git a/compiler/file_names.m b/compiler/file_names.m
> index d28b93b9c..c0ed677c2 100644
> --- a/compiler/file_names.m
> +++ b/compiler/file_names.m
> @@ -198,6 +198,11 @@
>              % directory, or into a non-grade-specific subdirectory, or into
>              % a grade-specific subdirectory, with search being irrelevant.
>  
> +    ;       ext_cur_ngs_gs_err(ext_cur_ngs_gs_err)
> +            % .err files can be placed into the current directory, or into a
> +            % non-grade-specific subdirectory, or into a grade-specific
> +            % subdirectory, depending on options.

That comment also applies to the existing ext_cur_ngs_gs category.
You need to document the difference, which is that the options you
are talking about extend *beyond* --use-subdirs/--use-grade-subdirs,
and include --error-files-in-subdir.

> diff --git a/compiler/options.m b/compiler/options.m
> index 526319d6c..8e13f11ff 100644
> --- a/compiler/options.m
> +++ b/compiler/options.m
>  long_table("std-int-file-not-written-msgs",
>                      std_int_file_not_written_msgs).
>  long_table("search-directory",     search_directories).
> @@ -7015,6 +7018,10 @@ options_help_build_system(Stream, !IO) :-
>          "\tthe current directory.",
>          "\t`--use-grade-subdirs' does not work with Mmake (it does",
>          "\twork with `mmc --make').",
> +        "--error-files-in-subdir",
> +        "\tGenerate .err files under the `Mercury' subdirectory",
> +        "\trather than in the current directory.",
> +        "\t(This option is only supported by `mmc --make'.)",

I don't think this explanation works, because even if this option is enabled,
.err files *still* get put into the current directory, unless --use-subdirs/--use-grade-subdirs
is specified. This also means that the option name itself is slighly misleading,
though I can't think of a good non-misleading name, except possibly
--allow-error-files-in-subdir. The documentation could be something like:

Without this option, mmc --make always puts .err files into the current directory.
With this option, mmc --make can put .err files into the Mercury subdirectory
if the --use-subdirs and/or --use-grade subdirs options are enabled.
(Mmake puts .err files into the current directory regardless of the setting
of this option.)

> + at sp 1
> + at item --error-files-in-subdir
> + at findex --error-files-in-subdir
> + at cindex File names
> + at cindex Directories
> + at cindex Subdirectories
> + at cindex @file{Mercury} subdirectory
> +Generate @file{.err} files (containing compiler error messages)
> +under the @file{Mercury} subdirectory
> +rather than in the current directory,
> +when using @samp{mmc --make}.

Same here.

The diff is otherwise fine.

Zoltan.





More information about the reviews mailing list