Commit Graph

22765 Commits

Author SHA1 Message Date
Julien Fischer
7e10820891 Update programming style.
extras/lex/tests/test_regex.m:
    As above.

    Delete an unused function, that the stdlib now provides
    in any case.
2023-03-11 14:34:50 +11:00
Julien Fischer
5f6981c7de Delete ancient workaround for g++ 2.7.
samples/c_interface/cplusplus_calls_mercury/Mmakefile:
samples/c_interface/mercury_calls_cplusplus/Mmakefile:
samples/c_interface/simpler_cplusplus_calls_mercury/Mmakefile:
     As above.
2023-03-11 14:21:10 +11:00
Zoltan Somogyi
4cb235fa4f Fix calls to maybe_check_libraries_are_installed.
compiler/mercury_compile_main.m:
    Compiler invocations that generate an executable, and thus do linking,
    should check that the selected grade's libraries are in fact available.
    In non-"mmc --make" invocations, this is the job of mercury_compile_main.m.

    Once upon a time, we used to do this once per compiler argument.
    A diff later intended to change this so that the check was done
    only once, and not repeated for every compiler argument, but it
    did it wrong. It did add a single central check (the do-it-once part), but

    - it added this check only in the case where --filenames-from-stdin
      was not specified, and

    - it did not delete the do-it-for-every-argument code.

    For invocations with --filenames-from-stdin, the checks were still
    needed, though only once. For invocations without --filenames-from-stdin,
    the extra check was only repeated overhead. (The duplicate error messages
    would have been deleted when they were sorted.)

    Fix this by doing the check only once, whether --filenames-from-stdin
    is specified or not.

    Document why doing this is a reasonable thing to do. Add an XXX about
    a possible improvement.

    Resolve a conjecture in an old comment.
2023-03-10 21:36:46 +08:00
Julien Fischer
797dcc6d56 Fix wording in NEWS file.
NEWS.md:
    As above.
2023-03-11 00:19:40 +11:00
Zoltan Somogyi
6fe876e131 Do not ignore errors from library checks. 2023-03-10 13:08:38 +08:00
Chloé Kekoa
23cf3b5d38 Fix --no-warn-non-contiguous-decls documentation.
doc/user_guide.texi:
compiler/options.m:
    Name the option correctly in the documentation.
2023-03-03 07:21:16 +11:00
Mark Brown
ec24859b4c Update library documentation.
library/random.m:
    Add a guide for people implementing RNGs using this interface.

    Other minor improvements.
2023-02-26 21:52:41 +11:00
Julien Fischer
52fc3915e7 Update extras/references.
extra/references/c_reference.h:
     Replace refernces to the old c_header_code and c_code
     pragmas.
2023-02-25 12:59:54 +11:00
Julien Fischer
5de97e355a Replace references to the c_header_code pragma.
tests/hard_coded/needs_init.m:
tests/hard_coded/pragma_c_code.m:
    As above.
2023-02-25 12:55:08 +11:00
Julien Fischer
0cd62edc7c Clean-ups and fixes for the C interface examples.
samples/c_interface/*:
    Replace left over references to the old c_header_code pragma.

    Replace some uses of '__' as a module qualifier.

    Replace tabs with spaces.

    Add some missing words.
2023-02-25 12:53:26 +11:00
Zoltan Somogyi
47e867b5e0 Delete redundant module qualifiers. 2023-02-21 00:40:31 +11:00
Zoltan Somogyi
03ed92ad75 Fix indentation. 2023-02-21 00:40:12 +11:00
Julien Fischer
9da35ef306 Replace the use '--' as a module qualifier.
Use typed insts.

extras/solver_types/library/*.m:
    As above.
2023-02-14 18:25:59 +11:00
Julien Fischer
b58aab912c Use a typed inst in a spot.
extras/align_right/align_right.m:
    As above.
2023-02-14 18:24:08 +11:00
Julien Fischer
bbd7686d80 Update some links.
docs/reference_manual.texi:
docs/user_guide.texi:
    As above (and check that they are still current).

doc/mercury.html.in:
    Update a link to the old Mercury homepage.

    Update the markup style.
2023-02-14 17:25:08 +11:00
Julien Fischer
4b28829101 Use typed insts in extras/lex.
extras/lex/lex.automata.m:
extras/lex/lex.buf.m:
extras/lex/lex.lexeme.m:
extras/lex/lex.m:
    As above.
2023-02-14 17:04:26 +11:00
Julien Fischer
a2db163e56 Use a typed inst in spot.
extras/windows_installer_generator/sample/gen_merc_wxs.m:
    As above.
2023-02-14 16:49:09 +11:00
Julien Fischer
c4358adeeb Fix the windows installer generator sample
extras/windows_installer_generator/sample/gen_merc_wxs.m:
    Get this compiling again.

    Add a vim modeline; convert tabs to spaces.
2023-02-14 16:46:51 +11:00
Julien Fischer
df5b302a60 Update more links.
extras/windows_installer_generator/sample/gen_merc_wxs.m:
    As above.

    Delete trailing whitespace.
2023-02-14 16:32:08 +11:00
Julien Fischer
844e8cb9fa Fix my previous commit.
extras/odbc/odbc.m:
    Use the correct link to the tech report.
2023-02-14 16:20:09 +11:00
Julien Fischer
e54727a01b Update a link to the papers page.
extras/odbc/odbc.m:
    As above.
2023-02-14 16:16:44 +11:00
Julien Fischer
0a8d19b85e Update a link to the papers page.
compiler/accumulator.m:
    As above.
2023-02-14 15:01:03 +11:00
Julien Fischer
41193dc437 Adjust some documentation for the Tcl/Tk binding.
extras/graphics/mercury_tcltk/Mmakefile.MacOSX:
extras/graphics/mercury_tcltk/README:
     As above.
2023-02-13 21:05:09 +11:00
Darren Bane
d2b26c759c Document how to use the Homebrew version of Tcl/Tk. 2023-02-13 21:02:47 +11:00
Julien Fischer
fbd1005eee Add system_error_is_success/1.
library/io.m:
     As above.

library/io.error_util.m:
     Delete the equivalent operation is_success/1 from here and
     just use system_error_is_success/1 instead.

NEWS.md:
     Announce the new predicate.
2023-02-13 11:30:40 +11:00
Darren Bane
7d349d0074 Fix build of extras/net on macOS. 2023-02-10 22:33:36 +11:00
Zoltan Somogyi
1523da6cb2 Merge eight insts at a time instead of four. 2023-02-09 12:51:04 +11:00
Julien Fischer
2c8ada3dcc Delete unused string formatting predicates.
library/string.format.m:
    Delete the old predicates for formatting ints as unsigned values;
    these are now unused.

configure.ac:
    Require the use of a compiler that does not generate references
    to the deleted predicates.

compiler/introduced_call_table.m:
    Delete the above predicates from the introduced call table.
2023-02-09 10:39:58 +11:00
Julien Fischer
500d125f03 Avoid calls to obsolete functions.
extras/lex/regex.m:
    As above.
2023-02-08 22:19:59 +11:00
Zoltan Somogyi
278ebc172a Mark string.*codepoint* as obsolete ...
library/string.m:
    ... in favor of the s/codepoint/code_point/ versions.

NEWS.md:
    Mention that these predicates and functions have been marked obsolete.

    Mention that all the X_to_doc functions in modules other than
    pretty_printer.m have been marked obsolete in favour of the versions
    in pretty_printer.m.

    Standardize on indenting lists of function and predicate names
    by four spaces, not three. (There were more than five times as many
    that were indented by four than by three.)
2023-02-08 19:51:49 +11:00
Zoltan Somogyi
eecf8b6b15 Complain about no clauses for pred/func ...
compiler/typecheck_error_undef.m:
    ... only if that predicate or function was declared by the user.
    If the compiler itself added the pred/func declaration implicitly
    because it saw a clause for that pred/func, but then decided not to
    add that clause to the HLDS after all because it had syntax errors,
    then don't complain about the absence of a clause for a pred/func
    that the user did not declare.

tests/invalid/state_vars_test3.err_exp:
    Expect no complaint about a missing clause in the above situation.
2023-02-08 14:55:40 +11:00
Zoltan Somogyi
bcd520a7d6 Fix typo. 2023-02-03 20:49:47 +11:00
Zoltan Somogyi
3c931d074c Delete old_list_to_set.
library/fat_sparse_bitset.m:
library/sparse_bitset.m:
    As above.

tests/hard_coded/speedtest_bitset.m:
    Delete references to old_list_to_set.
2023-02-03 19:30:53 +11:00
Zoltan Somogyi
d6beab902d Fix comment rot. 2023-02-03 19:06:59 +11:00
Zoltan Somogyi
badadaa761 Fix variable name rot. 2023-02-03 19:06:37 +11:00
Zoltan Somogyi
6cbdc43a45 Delete two unused predicates. 2023-02-03 19:05:46 +11:00
Zoltan Somogyi
86c294a614 Announce fatter_sparse_bitset.m. 2023-02-03 19:04:52 +11:00
Zoltan Somogyi
726da4f03c Prepare to s/codepoint/code_point/ in string.m.
library/string.m:
    For each predicate and function whose name includes "codepoint",

    - create a version in which "codepoint" is replaced by "code_point",
    - make this version the main implementation, making the "codepoint"
      versions forward to the "code_point" versions,
    - add obsolete pragmas for the "codepoint" versions, though these are
      commented out for now. This is so that an installed compiler containing
      this change will already have the recommended alternative available
      when the commenting-out is removed (maybe in a week or so).

NEWS.md:
    Announce the new predicates and functions.

compiler/c_util.m:
compiler/const_prop.m:
compiler/inst_check.m:
compiler/parse_tree_out_term.m:
compiler/structure_reuse.direct.choose_reuse.m:
compiler/write_error_spec.m:
library/pprint.m:
library/pretty_printer.m:
library/string.format.m:
    Replace all uses of the "codepoint" versions with the "code_point"
    versions.
2023-02-02 19:59:10 +11:00
Peter Wang
7005272a5a Cache module file names when writing dependency files.
When writing out dependency files, the compiler would call
module_name_to_file_name often for the same pairs of module name and
file extension. Caching the results of those calls saves on
constructing temporary strings.

This change reduces the time to make dependencies in the compiler
directory from 2.40 seconds to 2.15 seconds on my machine.

compiler/write_deps_file.m:
    Add a predicate make_module_file_name that caches calls to
    module_name_to_file_name.

    Thread the cache map through the predicates in this module.
    Replace calls to module_name_to_file_name with calls to
    make_module_file_name when appropriate.
2023-02-02 16:29:06 +11:00
Peter Wang
a07077914c Optimise digraph.compose.
Benchmarking on randomly generated digraphs shows a speedup of 30-40%.
The time to make dependencies in the compiler directory on my machine
is reduced from 3.65 seconds to 2.40 seconds.

library/digraph.m:
    Rewrite digraph.compose more efficiently.
2023-02-02 16:21:54 +11:00
Zoltan Somogyi
fd424de76f s/http/https/, and fix link rot. 2023-02-02 16:00:25 +11:00
Zoltan Somogyi
b843d53a4c Improve actual/expected mismatch diagnostics.
compiler/typecheck_errors.m:
    Improve the diagnostics we generate for mismatches between actual and
    expected types. If the mismatch was between a single actual type and
    a single expected type, we already printed a message whose format
    was specialized for that case, but in every other case, we fell back
    to a more general but less readable error message template. Improve on this
    by splitting the task into two halves, one for the actual type(s) and one
    for the expected type(s), each of which generates simpler text if
    there is only one such type.

    Separate the actual type part of the diagnostic from the expected type part
    using a semicolon instead of a comma, because we now use commas to
    separate multiple actual types from each other, and multiple expected
    types from each other.

    Don't insist on putting a newline after the "type error:" part of the
    diagnostic.

    Do all of the above in just one predicate, factoring out code that
    used to be duplicated.

    Delete a function that has never been used. (I added it around 2008
    for later use by a student working on software transactional memory,
    but that use never happened.) This used to contain a third copy
    of the code that was factored out.

    For functions that used to take both a typecheck_info and a
    type_error_clause_context, delete the latter argument, since the caller
    invariably took it out of the typecheck_info that it also passed.

compiler/typecheck.m:
    Don't pass now-unneeded type_error_clause_contexts.

compiler/typecheck_error_type_assign.m:
    Fix typo in a field name.

tests/invalid/abstract_eqv.err_exp:
tests/invalid/actual_expected.err_exp:
tests/invalid/actual_more_expected.err_exp:
tests/invalid/bug197.err_exp:
tests/invalid/ext_type_bug.err_exp:
tests/invalid/fbnf.err_exp:
tests/invalid/foreign_procs_exist_type.err_exp:
tests/invalid/higher_order_mode_mismatch.err_exp:
tests/invalid/integral_constant_no_suffix.err_exp:
tests/invalid/method_impl.err_exp:
tests/invalid/mixed_up_streams.err_exp:
tests/invalid/try_bad_params.err_exp:
tests/invalid/type_diff.err_exp:
tests/invalid/type_error_ambiguous.err_exp:
tests/invalid/types2.err_exp:
tests/invalid_nodepend/errors2.err_exp:
tests/invalid_purity/impure_pred_t1_fixed.err_exp:
tests/invalid_purity/impure_pred_t2.err_exp:
tests/invalid_purity/purity_nonsense.err_exp:
tests/invalid_purity/purity_nonsense2.err_exp:
    Update expected error messages.
2023-02-02 15:44:11 +11:00
Julien Fischer
20dffe1137 Adjust a URL.
compiler/notes/todo.html:
    As above.
2023-02-02 13:51:10 +11:00
Zoltan Somogyi
58a10fa97c Minor style fixes. 2023-02-01 18:57:04 +11:00
Zoltan Somogyi
e53bc5fbfa Make some predicates naturally tail recursive.
Make some predicate names more expressive.
2023-02-01 18:56:02 +11:00
Zoltan Somogyi
4bf17516a4 Optimize contains/insert pair in pre_quantification.m. 2023-02-01 18:54:42 +11:00
Zoltan Somogyi
33ae129d45 Optimize contains/insert pairs in digraph.m ...
... by replacing them with insert_new operations.

Delete redundant module qualifications.
2023-02-01 16:45:05 +11:00
Peter Wang
322efbb62b Optimise get_dependencies_from_graph.
This reduces the time to make dependencies in the compiler directory
from 5.85 seconds to 3.60 seconds on my machine.

compiler/write_deps_file.m:
    Use set.list_to_set instead of calling set.insert in a loop.
2023-02-01 11:52:30 +11:00
Julien Fischer
38327d65f4 Add a NEWS section for 22.01.6.
NEWS.md:
    As above.
2023-02-01 01:32:31 +11:00
Zoltan Somogyi
ee0f9f73d7 Add library/fatter_sparse_bitset.m.
library/fatter_sparse_bitset.m:
    Add this version of fat_sparse_bitset.m, which stores *two* words
    worth of bits in each cell, not one. This word would otherwise be unused,
    because the Boehm-Demers-Weiser allocator rounds up requests for three
    word cells to four.

library/MODULES_DOC:
library/library.m:
    Add the new module to the list of library modules.

library/fat_sparse_bitset.m:
library/sparse_bitset.m:
library/tree_bitset.m:
    Update the documentation of all these other bitset modules. Copy
    the same basic introduction to all the relevant modules. Add documentation
    of the differences to tree_bitset.m and fatter_sparse_bitset.m, with
    a pointer in fat_sparse_bitset.m to fatter_sparse_bitset.m.

library/test_bitset.m:
    Test the new module as well as the others.

tests/hard_coded/speedtest_bitset.m:
    Extend the benchmarking of list_to_set operations to the new module.
    To allow the benchmarking to be tough enough to be informative, comment
    out the benchmarking of the old_list_to_set operations.
2023-01-31 18:36:16 +11:00