25234 Commits

Author SHA1 Message Date
Zoltan Somogyi
465e82ed6d Fix an abort. 2026-02-17 08:51:22 +11:00
Zoltan Somogyi
3a431411cd Pass goal components when those are wanted.
Move a predicate next to a related predicate.
2026-02-17 08:49:51 +11:00
Zoltan Somogyi
ac6abd4694 Delete obsolete history from two comments. 2026-02-17 08:48:54 +11:00
Zoltan Somogyi
6c45431924 Give a predicate a more descriptive name. 2026-02-17 08:48:28 +11:00
Zoltan Somogyi
88c7d52bb6 Simplify a call. 2026-02-17 08:47:59 +11:00
Julien Fischer
8ed7f24b20 Fix a bug in the interpreter sample.
Commit 92f60e5c7 inadvertently changed the conjunction operator recognised by
this program from "," to ", ". Fix that.

samples/interpreter.m:
tests/debugger/interpreter.m:
     As above.
2026-02-16 16:15:44 +11:00
Julien Fischer
1adccd0b65 Fix typos in integer module.
library/integer.m:
    As above.
2026-02-16 15:50:34 +11:00
Zoltan Somogyi
33fb4d7618 Fix a mismatch between old and new code.
compiler/unused_args.m:
    Make the new version of a test succeeds, where the old version
    *looked like* it failed, but did not.

compiler/lambda.m:
    Fix misleading module comment.
2026-02-16 15:23:12 +11:00
Julien Fischer
97a49d6dea Minor fixes for diff sample.
samples/diff/diff_out.m:
    s/effected/affected in a couple of spots.

samples/diff/globals.m
samples/diff/options.m:
    Fix typos.
2026-02-16 14:58:41 +11:00
Julien Fischer
39db3051b8 Fix errors in thread.future.
library/thread.future.m:
    Fix documnetation errors.
2026-02-16 14:30:14 +11:00
Julien Fischer
bbd760e67c Fix errors in thread.barrier.
library/thread.barrier.m:
    Fix errors documentation.

    Fix an incorrect error message.
2026-02-16 14:18:33 +11:00
Julien Fischer
66a346e41d Fix errors in version_store documentation.
library/version_store.m:
    As above.
2026-02-16 14:06:32 +11:00
Julien Fischer
8f61d08328 Fix errors in version_array2d documentation.
library/version_array2d.m:
    As above.
2026-02-16 13:56:50 +11:00
Julien Fischer
86969081cb Adjust version_array documentation.
library/version_array.m:
     As above.
2026-02-16 13:48:24 +11:00
Zoltan Somogyi
e513a340fb A minor style improvement. 2026-02-16 12:47:25 +11:00
Zoltan Somogyi
b024b5f533 Carve build_eqv_maps.m out of equiv_type.m.
compiler/build_eqv_maps.m:
compiler/equiv_type.m:
    As above.

compiler/parse_tree.m:
compiler/notes/compiler_design.html:
    Include and document the new module.

compiler/decide_type_repn.m:
compiler/equiv_type_hlds.m:
compiler/make_hlds_passes.m:
compiler/mercury_compile_make_hlds.m:
compiler/qual_info.m:
    Conform to the changes above.
2026-02-16 11:11:10 +11:00
Zoltan Somogyi
4254e2f648 Make some variable names more descriptive. 2026-02-16 10:00:56 +11:00
Zoltan Somogyi
5275a670b7 Fix too-long lines. 2026-02-16 08:32:17 +11:00
Zoltan Somogyi
17dfe80eb6 Give some predicates better names. 2026-02-16 07:40:41 +11:00
Zoltan Somogyi
8597feaae6 Improve two rarely-seen diagnostics.
compiler/parse_type_defn.m:
    As above.

tests/invalid/field_syntax_error.{m,err_exp}:
tests/invalid/types.{m,err_exp}:
    Add an instance of each bug the diagnostics are for,
    and test for the updated diagnostic text.
2026-02-15 23:45:25 +11:00
Zoltan Somogyi
f51eb26a44 Delete some obsolete XXXs. 2026-02-15 22:10:12 +11:00
Zoltan Somogyi
5f4a14a189 Clarify the diagnostics about missing section markers.
compiler/parse_module.m:
    When complaining about missing ":- interface"/":- implementation" markers,
    reword the diagnostic to clarify that these should come after
    the initial ":- module" declaration.

tests/invalid_make_int/missing_initial_section.int_err_exp:
tests/invalid_nodepend/bigtest.err_exp:
tests/invalid_nodepend/errors_1.err_exp:
tests/invalid_nodepend/errors_2.err_exp:
tests/invalid_nodepend/errors_3.err_exp:
tests/invalid_nodepend/funcs_as_preds.err_exp:
tests/invalid_nodepend/invalid_main.err_exp:
tests/invalid_nodepend/no_exports.err_exp:
tests/invalid_nodepend/occurs.err_exp:
tests/invalid_nodepend/prog_io_erroneous.err_exp:
tests/invalid_nodepend/types.err_exp:
tests/invalid_nodepend/vars_in_wrong_places.err_exp:
    Expect the updated wording.
2026-02-15 16:20:34 +11:00
Zoltan Somogyi
1cc34eb911 Simplify the "warn about unused args?" test.
compiler/unused_args.m:
    The old code that we use to decide whether we want to warn
    about unused args in a predicate was built up piecemeal
    over a long time, mostly before the creation pred_origins.
    It never had a cohesive design.

    Add a new version of the test that has a cohesive design,
    consisting of just a test of the pred_status, and a case analysis
    of the various possible values of the pred's origin.

    Add code to automatically compare the result of the old and new tests,
    and abort if they do not match. After a few days of tests on code
    other than the Mercury system that don't trigger any of the new exceptions,
    we can throw away the old code.
2026-02-15 14:43:58 +11:00
Zoltan Somogyi
36e8833145 Add a new option, --warn-unused-types.
When set, this option tells the compiler to generate warnings
about locally-defined types that are neither used in the module
nor exported to any other module.

compiler/options.m:
    Add the new option.

compiler/unused_types.m:
    New module to implement the new option.

compiler/mercury_compile_front_end.m:
    Invoke the new module, unless the presence of previous errors
    would make its warnings just a distraction.

compiler/check_hlds.m:
    Include the new module.

compiler/notes/compiler_design.html:
    Document the new module.

compiler/typecheck_error_wrong_type.m:
    Simplify some code.

browser/declarative_tree.m:
compiler/accumulator.m:
compiler/du_type_layout.m:
compiler/intermod.m:
compiler/mode_errors.m:
compiler/parse_inst_mode_defn.m:
compiler/polyhedron.m:
compiler/split_parse_tree_src.m:
compiler/tag_switch_util.m:
compiler/typecheck_error_unify.m:
compiler/unneeded_code.m:
deep_profiler/mdprof_test.m:
library/getopt.m:
library/getopt_io.m:
    Delete unused types reported by the new option.

library/rtti_implementation.m:
    Comment out unused type reported by the new option. This type was exported
    to both Java and C#, but this diff comments it out because neither language
    the Java or the C# runtime system seems to use the exported versions
    either. (Bootcheck in both java and csharp grades worked, with the
    same number of test case failures as before.) We do not delete it,
    because it may be useful in the future.

tests/warnings/help_text.err_exp:
    Expect the documentation of the new option.

tests/invalid_nodepend/Mmakefile:
    Specify --warn-unused-types for two test cases to test that the compiler
    does NOT generate warnings about unused types in the presence of previous
    errors.

tests/warnings/abstract_type_decl.err_exp:
tests/warnings/bug412.err_exp:
tests/warnings/warn_dead_procs.err_exp:
    Expect the new warnings for unused types.

tests/warnings/Mmakefile:
    Specify --warn-unused-types for the three test cases listed above.
2026-02-15 11:26:34 +11:00
Zoltan Somogyi
81c6c5e04a Decide what unused_args.m should do just once.
compiler/mercury_compile_middle_passes.m:
    Pass the main predicate of unused_args.m two flags that together
    specify what it should do, besides generating warnings. This makes
    the code easier to understand, since each ignored argument representing
    a set of unused_args pragmas is now preceded by a flag argument
    that says "do not generate those pragmas".

compiler/unused_args.m:
    Delete the code for deciding whether (a) we want to generate unused_args
    pragmas or (b) record unused_args information in the analysis registry.
    This is because the code doing that was duplicating the code fragments
    in mercury_compile_front_end.m and mercury_compile_augment.m that decided
    which predicate to call in mercury_compile_middle_passes.m:
    either middle_pass_for_opt_file, or output_analysis_file.

    This duplication not only violates the "Don't repeat yourself" principle",
    but also led to hard-to-understand code in unused_args.m.
2026-02-15 09:32:48 +11:00
Zoltan Somogyi
e1ff6d4077 Break up a large predicate.
Replace bools with two new bespoke types.

Replace an unnecessary fold operation.

Put some switch arms into the same order as the cases' cons_ids.
2026-02-14 22:32:44 +11:00
Zoltan Somogyi
5763792c36 Stop the unneeded export of a predicate. 2026-02-14 22:28:18 +11:00
Zoltan Somogyi
45cf0f5f92 Do not warn about foreign_procs from other modules. 2026-02-14 22:27:21 +11:00
Zoltan Somogyi
142b59f9d4 Fix typos. 2026-02-14 09:34:29 +11:00
Julien Fischer
5315e73e12 Address review comments.
library/calendar.m:
    As above.
2026-02-13 20:34:52 +11:00
Julien Fischer
592e67dad5 Document the duration/0 type more thoroughly.
This addresses an XXX added by Zoltan in commit eb623b17a,
which misunderstands what the intended semantics of the duration/0
type are.

library/calender.m:
    As above.
2026-02-13 19:31:04 +11:00
Julien Fischer
cb391eb967 Fix documentation and formatting.
library/mercury_term_lexer.m:
library/sparse_bitset.m:
library/uint64.m:
     As above.
2026-02-12 21:59:25 +11:00
Zoltan Somogyi
b7a4aa83dc Reorder the contents of unused_args.m.
compiler/unused_args.m:
    Put both the primitive operations on the module's main analysis
    data structure, and the code required for the analysis typeclass
    instances, into separate blocks near the end of the module,
    just before the debugging routines.

    Replace more uses of bools with the maybe_changed type.

    Do not allocate new hlds_goal structures that are identical to
    already existing hlds_goal structure.

    Carve two new small predicates out of an existing too-big one.

    Make some other simplifications, and improve some other type,
    predicate and variable names.

compiler/maybe_util.m:
    Add two utility functions for use by unused_args.m.
2026-02-12 19:47:27 +11:00
Zoltan Somogyi
0816664388 Give some predicates in mmc_analysis.m more meaningful names.
compiler/mmc_analysis.m:
    As above.

compiler/exception_analysis.m:
compiler/structure_reuse.analysis.m:
compiler/structure_sharing.analysis.m:
compiler/tabling_analysis.m:
compiler/trailing_analysis.m:
compiler/unused_args.m:
    Conform to the changes above.
2026-02-12 17:09:07 +11:00
Zoltan Somogyi
93bd7db4d1 Make unused_args.m more readable.
Give some types, predicates and variables more descriptive and more
consistent names.

Document some predicates rather better. Add XXXs indicating where
further documentation would help :-(

Redirect some references to map.set to map.det_{insert,update}.
2026-02-12 16:41:58 +11:00
Julien Fischer
a88b2a648e Fix method reference in stream documentation.
library/stream.m:
    The arity of bulk_get is 9, not 4.
2026-02-12 14:04:05 +11:00
Julien Fischer
b9f36b87f7 Update some documentation.
library/string.m:
    Fix the description of the range of integers that to_int/2
    and det_to_int/1 can produce. It can include min_int.
2026-02-12 13:55:35 +11:00
Julien Fischer
781265b060 Add a missing word.
library/string.m:
    As above.
2026-02-12 13:06:57 +11:00
Julien Fischer
6c1a717a1c Fix more calendar documentation.
library/calendar.m;
    Fix incorrect argument ordering in a comment.

    Avoid an ambiguity.
2026-02-10 17:13:19 +11:00
Julien Fischer
76c32768f1 Fix copy-and-paste error.
library/calendar.m;
    As above.
2026-02-10 16:12:55 +11:00
Julien Fischer
22139e728c Delete a very old FAQ entry.
doc/mercury_faq.texi:
    Delete an entry concerning GCC 2.6.3, which was released in
    1994.
2026-02-09 21:05:25 +11:00
Julien Fischer
84c46b83cd Fix some errors in the FAQ.
doc/mercury_faq.texi:
    As above.
2026-02-09 21:00:47 +11:00
Julien Fischer
53591838fe Fix some errors in the reference manual.
doc/mercury_reference_manual.texi:
    As above.
2026-02-09 15:39:35 +11:00
Julien Fischer
dbaa88605a Minor cleanups and fixes for standalone C sample.
samples/c_interface/standalone_c/Makefile:
    Fix grammar in a couple of spots.

    Use ':=' in place of '=' in some assignments.

samples/c_interface/standalone_c/c_main.c:
    Fix grammar in a couple of spots.

    Do not say that access to Mercury mutables from C is currently
    not thread safe; it will never be thread without the programmer
    putting in their own synchronization.
2026-02-07 16:16:48 +11:00
Julien Fischer
7dccb03be1 Delete an unused variable.
util/mkinit.c:
    Delete the variable "init_suffix", which has never been used.
    (It was added in commit 04e614485, where it was merged on to the then CVS
     trunk from the deep2 branch.)
2026-02-07 15:56:32 +11:00
Julien Fischer
579044d267 Update .gitignore files in deep_profiler and slice dirs.
deep_profiler/.gitignore:
slice/.gitignore:
    As aobve.
2026-02-06 17:28:44 +11:00
Julien Fischer
57469e6736 Fixes for reference manual.
doc/mercury_reference_manual.texi:
   Fix spelling and grammar.

   Expand "iff" to "if and only if".

   Use "choice point" consistently in the text instead of a mixture
   of that and "choicepoint".
2026-02-06 17:25:37 +11:00
Julien Fischer
fd6350931f More minor fixes for users guide.
docs/mercury_user_guide.texi:
    As above
2026-02-05 12:21:51 +11:00
Julien Fischer
8691e00b67 Minor fixes for users guide.
docs/mercury_user_guide.texi:
    As above
2026-02-05 11:42:54 +11:00
Julien Fischer
23e380761d Fix entry in the LIMITATIONS file.
LIMITATIONS.md:
    Add a missing word.
2026-02-05 11:25:20 +11:00