Commit Graph

25081 Commits

Author SHA1 Message Date
Julien Fischer
cd48b281df Add a missing word.
compiler/notes/compiler_design.html:
    As above.
2026-02-25 15:27:00 +11:00
Julien Fischer
c99565e517 Minor fix for compiler design doc.
compiler/notes/compiler_design.html:
    s/compile_target_code.m/link_target_code.m/ where the latter
    was meant.
2026-02-25 15:24:02 +11:00
Julien Fischer
de8f79cac3 Better document error behaviour in random.system_rng.
library/random.system_rng.m:
     Better document the error behaviour of some predicates in this module.

     Adjust the header comment to group the description of what happens
     on Cygwin with the rest of the Windows description.

     Adjust a comment.
2026-02-24 21:08:25 +11:00
Zoltan Somogyi
1d736d1447 Delete may_gather_warning_pragma_for_pred_old. 2026-02-24 12:11:54 +11:00
Zoltan Somogyi
0a7b5c1a6b Give a type a more meaningful name. 2026-02-24 02:47:42 +11:00
Zoltan Somogyi
2afa32259a Carve four new modules out of unused_args.m.
compiler/unused_args_analysis.m:
    New module containing the parts of the old unused_args.m
    that deal with the intermodule analysis framework.

compiler/unused_args_base_ops.m:
    New module containing the parts of the old unused_args.m
    that define and operate on the main data structure we use
    to find out which variables are unused.

compiler/unused_args_optimize.m:
    New module containing the parts of the old unused_args.m
    that "optimize out" unused arguments.

compiler/unused_args_warn_pragma.m:
    New module containing the parts of the old unused_args.m
    that generate warnings about unused arguments, and that generate
    unused_args pragmas for .opt files. The module contains both
    because they share the same test for whether we want to ignore
    any unused arguments in a predicate.

compiler/unused_args.m:
    Delete the moved code.

compiler/transform_hlds.m:
compiler/notes/compiler_design.html:
    Include and document the new modules.

compiler/mercury_compile_middle_passes.m:
compiler/mmc_analysis.m:
    Conform to the changes above.
2026-02-24 02:32:37 +11:00
Zoltan Somogyi
b28858717f Fix wording of an informational message. 2026-02-24 01:51:26 +11:00
Zoltan Somogyi
19d8f1e0de Delete a redundant assign and a redundant test. 2026-02-23 20:49:01 +11:00
Julien Fischer
499559fceb Do not use bitwise and on booleans in Java.
library/time.m:
     As above.
2026-02-22 03:03:32 +11:00
Julien Fischer
a089b6626f Fix a bug in the C# system RNG.
library/random.system_rng.m:
    Fix an inverted Boolean in the implentation of generate_uint8/4.
2026-02-21 00:07:01 +11:00
Julien Fischer
d3c943500a More library fixes.
library/*.m:
    As above.
2026-02-20 23:57:09 +11:00
Julien Fischer
63ab40f515 More library documentation fixes.
library/*.m:

libary/map.m:
   Fix a variable name that was obviously the reuslt of a
   copy-and-paste error.
2026-02-20 21:05:08 +11:00
Zoltan Somogyi
c6f77ce5c5 Fix typos. 2026-02-20 19:54:49 +11:00
Julien Fischer
7c2cf9e946 Rationalise foreign_proc attributes in stdlib.
library/*.m:
    Remove tabled_for_io attributes from C# and Java foreign_procs.
    I/O tabling is not supported by those backends.

    Remove will_not_modify_trail attributes from C# and Java foreign_procs,
    and from predicates that do I/O. They have no effect in the former and
    cannot affect anything with the latter.

    Fix a spot a where will_not_modify_trail was given, but
    will_not_call_mercury was meant.
2026-02-20 19:19:26 +11:00
Julien Fischer
8a534df57c Library documentation fixes.
library/term_subst.m:
    Document when term_list_to_var_list/2 fails.

    Minor formatting fix.

library/term_to_xml.m:
    Fix a documentation error.
2026-02-20 16:20:42 +11:00
Julien Fischer
e3cc72cb0b Fix bug in term_io.format_term_nl/5.
library/term_io.m:
     foramt_term_nl/5 should call format_term_nl_with_op_table/6, *not*
     format_term_with_op_table/6, otherwise the terminating ".\n" will
     not be written.

tests/hard_coded/Mmakefile:
tests/hard_coded/format_term_nl.{exp,m}:
     Add a regression test.
2026-02-20 16:03:18 +11:00
Julien Fischer
a77da7b5ff More standard library fixes.
library/set_tree234.m:
    Delete a duplicate type_spec pragma.

library/set_bbbtree.m:
library/set_ctree234.m:
library/set_ordlist.m:
library/set_tree234.m:
library/stack.m:
library/store.m:
    Documentation and formatting fixes.
2026-02-20 14:42:38 +11:00
Julien Fischer
7f771cb245 Fix rbtree.count and rbtree.ucount.
These were inadvertently broken by updates to programming style in
commit 185443d79.

library/rbree.m:
    In the implementation of ucount, increment the count for the
    current node.

tests/hard_coded/Mmakefile:
tests/hard_coded/rbtree_count.{m,exp}:
    Add a regression test.
2026-02-20 13:40:40 +11:00
Zoltan Somogyi
0966d89479 Expand a comment. 2026-02-20 00:41:49 +11:00
Zoltan Somogyi
58ddc0dc4d Fix typo. 2026-02-19 18:13:31 +11:00
Zoltan Somogyi
4d6bc0cd5b Rename and document unused_args.m's main data structure.
compiler/unused_args.m:
    Rename the "usage_info" type to "required_by". Document the meaning
    of its contents.

    Rename the low-level predicates that operate on this data structure
    accordingly. Make them fit consistently into the same pattern:
    X_{is,are}_required_by_Y.

    In the argument lists of these predicates, pass values of arg_var_in_proc
    as a unit, instead of passing them as two separate components, one of which
    was easily confusable with another argument that has the opposite role.

    To make this possible *and* non-misleading, reorder arguments as needed.
    In one case, replace a call to list.foldl with an explicit loop
    to make the reordering possible.

    Give the high-level predicates that operate on this data structure
    more descriptive names as well. Document the logic behind the fixpoint
    iteration.
2026-02-19 18:05:31 +11:00
Zoltan Somogyi
2301658c7e Give predicates more descriptive names.
compiler/unused_args.m:
    Replace "fixup_x" naming scheme with "delete_unused_args_in_x".

    Fix some misleading comments.

    Add some comments on not-chosen alternative approaches.

    Move a utility predicate to the end of the module,
    and give it a simpler interface.
2026-02-19 18:05:31 +11:00
Julien Fischer
778e75f696 Fix problems in the library.
library/array.m:
library/builtin.m:
library/construct.m:
    Fix copy-and-paste errors.

library/arrayd2d.m:
    Use the mode array2d_di instead of array_di in a spot.

    Delete an extra space from an exception message.

library/bimap.m:
    Fix formatting.

library/bit_buffer.m:
    Fix inverted argument types.

library/dir.m:
    Say that make_single_directory/4 returns an error rather
    than saying that it fails.

library/io.m:
    Fix errors in obsolete pragmas.

library/assoc_list.m:
library/bag.m:
library/cord.m:
library/deconstruct.m:
library/enum.m:
library/fat_sparse_bitset.m:
library/getopt*.m:
library/int*.m:
library/io*.m:
library/type_desc.m:
    Fix documentation errors.

tests/hard_coded/array2d_from_array.exp:
    Conform to the changed exception message in array2d.m.
2026-02-19 15:24:59 +11:00
Zoltan Somogyi
c857c616a6 Replace a bool. 2026-02-19 08:47:19 +11:00
Zoltan Somogyi
c2dcc0e0c9 Give some variables more descriptive names. 2026-02-19 08:32:42 +11:00
Julien Fischer
06fe5931d3 Documentation and obsolete pragma fixes.
library/char.m:
    Fix description of character ranges recognised by hex_digit_to_int/2.

library/pretty_printer.m:
    Fix a copy-and-paste error.

library/string.m:
    Fix errors in predicate descriptions.

    Fix obsolete pragmas that specified the replacement predicate to
    be the target of the pragma.
2026-02-18 23:31:27 +11:00
Julien Fischer
68a3e2a297 Documentation fixes for the map module.
library/set.m:
    As above; in particular fix inverted section headings.
2026-02-18 21:18:30 +11:00
Julien Fischer
97ad29f37b Fix documentation of set.map2_fold/6.
library/set.m:
    As above.
2026-02-18 21:05:36 +11:00
Julien Fischer
f7f0efc555 Yet more user guide fixes.
doc/mercury_user_guide.texi:
    As above.
2026-02-18 20:58:27 +11:00
Julien Fischer
5249f31265 Yet more user guide fixes.
docs/mercury_user_texi:
    As above.
2026-02-18 20:46:27 +11:00
Zoltan Somogyi
246bc5129e Reorder switch arms. 2026-02-18 20:42:17 +11:00
Julien Fischer
e7abff9cfa More user guide fixes.
docs/mercury_user_texi:
    As above.
2026-02-18 20:25:33 +11:00
Julien Fischer
4507b0cf16 Fix an option name in the user's guide.
docs/mercury_user_texi:
    s/--asm--labels/--asm-labels/
2026-02-18 20:21:20 +11:00
Julien Fischer
4fd875441b Fix issues in users guide.
docs/mercury_user_texi:
     As above.
2026-02-18 19:59:17 +11:00
Julien Fischer
f4b40d9ca4 Adjust documentation for random.normal_floats/7.
library/random.m:
    Use variable naming that is consistent with the ground generator version of
    normal floats and doesn't clash with the state.
2026-02-18 15:31:30 +11:00
Julien Fischer
d4bb2dcdf4 Minor documentation fix.
library/math.m:
    Fix description of solve_quadratic/3.
2026-02-18 15:08:23 +11:00
Julien Fischer
0c72ee7370 Fixes for io module documentation.
library/io.m:
    Fix some copy-and-paste errors.

    Fix grammar and punctuation.
2026-02-18 15:00:47 +11:00
Julien Fischer
61e7f23d19 Fixes for list module documentation.
library/list.m:
    As above, mainly copy-and-paste errors.
2026-02-18 14:34:41 +11:00
Julien Fischer
d273f35d57 Fixes for reference manual.
doc/mercury_reference_manual.texi:
    Fix spelling, grammar and punctuation.

    Fix some incorrect examples.

    Fix inconsistent markup.
2026-02-18 14:23:15 +11:00
Julien Fischer
b7233ff507 Minor fixes for profiler documentation.
profiler/mercury_profile.m:
    Fix some comments.

profiler/options.m:
    Add a missing period.
2026-02-18 13:51:47 +11:00
Zoltan Somogyi
7b549bc6ae Fix typos. 2026-02-18 13:09:25 +11:00
Zoltan Somogyi
54b6bfc354 Put the contents of equiv_type.m in top-down order. 2026-02-18 09:38:16 +11:00
Zoltan Somogyi
51282bd2a4 Document forcing preds for type_spec pragmas.
compiler/higher_order.specialize_in_module.m:
    Document the meaning of a field.

compiler/add_pragma_type_spec.m:
compiler/hlds_module.m:
    Change the code filling and using that field to avoid misleading
    variable and predicate names. Add some extra documentation
    where that can help.
2026-02-17 22:24:31 +11:00
Zoltan Somogyi
019ea41ec4 Break up add_pragma.m into four new modules.
compiler/add_pragma_decl.m:
compiler/add_pragma_gen.m:
compiler/add_pragma_impl.m:
    These three new modules add declarative pragmas, implementation pragmas,
    and compiler-generated pragmas to the HLDS respectively.

compiler/add_pragma_util.m:
    This new module contains the parts of the old add_pragma.m
    that are needed by more than one of the three modules above.

compiler/add_pragma.m:
    Delete this module.

compiler/notes/compiler_design.html:
    Update the relevant documentation.

compiler/add_pragma_tabling.m:
    Use standard length section dividers.

compiler/make_hlds.m:
    Include the new modules.

compiler/make_hlds_passes.m:
    Import the new modules.
2026-02-17 16:45:43 +11:00
Zoltan Somogyi
ab0d1a31a2 Carve add_pragma_type_spec_constr.m ...
... out of add_pragma_type_spec.m.

compiler/add_pragma_type_spec.m:
compiler/add_pragma_type_spec_constr.m:
    As above.

compiler/add_pragma.m:
    Import the new module.

compiler/make_hlds.m:
    Include the new module.

compiler/notes/compiler_design.html:
    Document the new module.
2026-02-17 15:11:03 +11:00
Zoltan Somogyi
29deb20fde Fix the --show-pred-movability option.
I seem to have been broken it on Aug 18 with the move to associate
a option with every severity_informational spec. The code added then
treated all these options as bool options, but one is not.

compiler/error_util.m:
    Allow a severity_informational spec to depend on an accumulating
    option, which --show-pred-movability is.

    As far as I can see, it is the only non-bool option used
    in such messages, but since we don't have a database of
    options named in severity_informational specs, I can't be sure.

compiler/hlds_call_tree.m:
    Avoid printing a sentence when its subject is moot.

tests/valid/show_movability.m:
    New test case to test the --show-pred-movability option.

tests/valid/Mercury.options:
    Specify the option for the new test case.
2026-02-17 14:11:41 +11:00
Zoltan Somogyi
aa3f3445d8 Add test case for the last bug fix. 2026-02-17 10:15:57 +11:00
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