--no-ansi (mgnuc) and --no-ansi-c (mmc) have not actually done anything for
many years now. Deprecate these options and remove their "use" throughout most
of the Mercury system. (The remaining uses are in the Makefiles for the Boehm
GC, which need to be updated separately.)
Also deprecate the internal compiler option --cflags-for-ansi.
compiler/options.m:
Document that --no-ansi-c is now deprecated.
Document that the internal option --cflags-for-ansi is now
deprecated.
compiler/compile_target_code.m:
Do not pass the ANSI options to the C compiler.
scripts/mgnuc.in:
scripts/mgnuc_file_opts.sh-subr:
Deprecate the --no-ansi option; delete code that no longer does
anything useful.
configure.ac:
Delete the configuration variable CFLAGS_FOR_ANSI; it is only ever
set to be empty. (The comment talks about --no-ansi doing other things
in the mgnuc script. It used to also cause some preprocessor macros
to be defined for compatibility with the system headers on some
platforms -- that has not been the case since 2013.)
doc/user_guide.texi:
Document that --no-ansi-c is deprecated.
bytecode/Mmakefile:
compiler/Mercury.options:
library/Mercury.options:
extras/odbc/odbc.m:
runtime/Mmakefile:
scripts/Mercury.config.bootstrap.in:
scripts/Mercury.config.in:
tests/hard_coded/Mercury.options:
tests/valid/Mercury.options:
trace/Mmakefile:
util/Mmakefile:
Conform to the above change.
NEWS.md:
Announce the above.
library/string.m:
Even though format_table_max is a minor tweak on format_table,
its implementation used to be completely separate. Act on an old XXX
and make format_table use the same primitive ops as format_table_max.
Document the operation of format_table a bit better.
Change the way that format_table_max handles column-width limits,
by accepting overlong column contents *without* starting a new line.
Document the new semantics.
Use predmode decls when possible.
tests/general/string_test.{m,exp}:
Add a test of format_table_max, which previously did not have one.
tests/hard_coded/write_binary.m:
Print the term whose write-out-and-read-back is being tested
before the test, not after. Print the result of the test after this.
If the test succeeds, don't print the term out again.
Put blank lines between different kinds of tests, and between
tests of different terms.
Return error messages as strings, rather than as exceptions,
where possible.
Make the diagnostic for "read back term differs from original"
more useful for debugging write_binary/read_binary.
Put the declaration of a predicate just before the predicate.
tests/hard_coded/write_binary.exp:
Expect the updated output.
... and make {input,output}_stream synonyms for them, rather than vice versa.
library/io.m:
As above.
library/bitmap.m:
library/dir.m:
library/io.primitives_read.m:
library/io.stream_db.m:
library/io.text_read.m:
library/mercury_term_lexer.m:
library/stream.string_writer.m:
Conform to the change above.
tests/hard_coded/stream_string_writer_types.exp:
Expect the new type_ctor for text streams.
compiler/det_report.m:
In some cases described in the new test case, the error message
we print for a missing switch inside an arm of a larger switch
is misleading unless we print *which* arm of the larger switch
we are complaining about, so print that information.
tests/invalid/require_complete_nested_switch.{m,err_exp}:
A test case derived from the real-life error that motivated this diff.
tests/invalid/Mmakefile:
Enable the new test case.
compiler/const_prop.m:
Replace pairs and maybes with a semantically meaningful type.
Restrict this type to the part we actually use.
Optimize ubits_per_{int,uint} the same way we have long optimized
bits_per_{int,uint}.
compiler/simplify_goal_call.m:
Improve the wording of some warnings.
When constructing those warnings, don't test the value of warn_simple_code
twice.
compiler/uint_emu.m:
Fix copy-and-paste typo.
tests/warnings/unsigned_zero_cmp.exp:
Expect the updated text of the above warnings.
tests/invalid/Mmakefile:
Some tests cases in this directory have target-specific make rules
if (and only if) the test flags include --intermod-opt. We used to include
these tests in the lists of tests that do not have target-specific rules,
which lead to messages about "overriding recipe for <target>" from make.
Fix this by including test cases in the list of tests that do not have
target-specific rules only if they belong there.
Delete inappropriate entries from REDIRECT_OPT_ERROR_MODULES, the list
of tests cases that have target-specific make rules if (and only if)
the test flags include --intermod-opt. Some of the modules that used
to be in this list have since been moved to the invalid_make_int directory,
where they don't need special handling (because what is special here
is standard there). Some other modules in this list either never existed
or have been deleted from the test suite as a whole. Delete both of these
kinds of test case names from that list.
Move the rules that figure out whether to enable a category of tests
(e.g. the trailed tests) just after the definition of the list of tests
in that category.
Delete an obsolete comment, whose up-to-date form has been nearby
for a while now.
Add an XXX.
tests/invalid_make_int/Mmakefile:
Note which test cases that have been moved here were included in
REDIRECT_OPT_ERROR_MODULES, in case that does turn out to be useful later.
compiler/hlds_error_util.m:
When converting lists of arguments mode to strings for error messages,
replace from/to pairs of insts that stand for standard modes with the
names of those standard modes.
compiler/prog_mode.m:
Add a utility function for doing that standardization.
tests/invalid/io_in_ite_cond.err_exp:
tests/invalid_manual/gh118.err_exp:
Expect the standard forms of modes.
tests/invalid_manual/Mmakefile:
Specify the grade for the test independently of the grade of the
workspace or of the last bootcheck. Make the Mercury compiler flags
specific to the test.
tests/invalid_manual/gh118.err_exp:
tests/invalid_manual/gh118.gh118_helper.m:
tests/invalid_manual/gh118.m:
As above. The invalid_manual directory is a new test directory.
Its tests are not executed by tools/bootcheck.
tests/invalid_manual/Mmakefile:
Add a make rule for executing the test.
tests/invalid_manual/Mercury.options:
Add this options file (currently empty).
compiler/det_report.m:
Redirect comments to the actual location of the test case.
Github issue #118 reports a compiler abort that happens when
table_gen.m attempts to perform that transformation that implements
the tabling of I/O actions for declarative debugging, and a sanity check
finds that the procedure's determinism is not model_det.
We could change table_gen.m to not transform the affected predicate
in such cases. This change could fix *this specific* compiler abort,
but it is better to fix the root cause, which is that our semantic analysis
passes have not detected and reported a violation of our semantic rules,
and have allowed the affected predicate to flow through to the middle end
to be processed.
compiler/det_analysis.m:
compiler/det_report.m:
We used to check whether predicates with I/O state arguments have
one of the permitted model_det determinisms as part of det_infer_proc.
Github issue #118 arose because det_infer_proc processes only
predicates defined in the current module. It was also strange that
some properties of mode declarations were checked by det_infer_proc
in det_analysis.m (which can be invoked on a procedure more than once
during mode inference), while others were checked by
check_determinism_of_procs in det_report.m (which is only ever invoked
on a procedure once, at the end of determinism analysis).
Move the checks on mode declarations all to det_report.m. Partly
this is to fix the above code smell, but mainly so that we can add
check_determinism_of_imported_procs, which performs the part of
the job of check_determinism_of_procs that is appropriate for
imported procedures.
Make the error message for invalid mode declarations more specific
by listing the given invalid determinism as well as the possible
valid determinisms.
To make the above possible without doing unnecessary checks on
compiler-constructed procedures that are "born correct", separate out
imported procedures from born-correct procedures. Previously, they
were lumped together as "no inference needed" procedures.
tests/invalid/ho_unique_error.err_exp:
tests/invalid/mostly_uniq1.err_exp:
tests/invalid/mostly_uniq2.err_exp:
Expect the extra detail in error messages.
tests/invalid/io_in_ite_cond.err_exp:
tests/invalid/magicbox.err_exp:
tests/invalid/try_detism.err_exp:
Expect an error message about the invalid determinism of a procedure
with I/O state args. Previously, we did not generate an error message
for these issues.
compiler/det_analysis.m:
Carve three separate predicates out of det_infer_proc. Besides improving
readability, one of the new predicates should be useful in the fix for
github issue #118.
Factor out the common initial and final parts of two related but
different long error messages.
Improve the wording of some error messages.
Replace two separate traversals of the list of pragma exported procedures
with one.
tests/invalid/ho_unique_error.err_exp:
tests/invalid/mostly_uniq1.err_exp:
tests/invalid/mostly_uniq2.err_exp:
tests/invalid/one_member.err_exp:
Expect the updated wording in error messages.
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.
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.
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.
... by using the algorithm now in sparse_bitset.list_to_set.
Keep the old list_to_set algorithm around in both modules for a short while
to allow comparative benchmarking.
library/fat_sparse_bitset.m:
library/sparse_bitset.m:
As above.
tests/hard_coded/speedtest_bitset.m:
A benchmark program to compare the old and new list_to_set algorithms,
both versus each other, and between sparse_bitset and fat_sparse_bitset.
library/test_bitset.m:
Instead of comparing just one bitset module (tree_bitset by default)
against set_ordlist, compare all of them (tree_bitset, sparse_bitset,
and fat_sparse_bitset) against set_ordlist.
tests/hard_coded/test_bitsets.{m,exp}:
Rename this test case from test_tree_bitset to test_bitsets, since
(through library/test_bitset.m) we now test ALL bitset implementations,
not just tree_bitset.
tests/hard_coded/Mmakefile:
Refer to the test by its new name.
The current implementation of the unsigned conversion specifiers (i.e. %x, %X,
%o, %u) for fixed-size 8-, 16- and 32-bit signed integers works by casting
theses values into (word-sized) ints and then using the existing code for
formatting ints as unsigned values. This does not work for negative values as
they are being sign extended when converted to ints. For example,
io.format("%x", [i8(min_int8)], !IO)
prints:
ffffffffffffff80 (on a 64-bit machine)
rather than just:
80
Fix the above problem by casting ints, int8s, int16s etc. that are being
formatted as unsigned values to uints and using the uint formatting code.
NOTE: the formatting code for 64-bit integers follows a different code path
and is not affected by any of this.
library/string.format.m:
Implement unsigned conversion specifiers for non-64-bit signed
integers by casting to uint and using the uint formatting code.
Add predicates for converting signed integers into uints.
The format_unsigned_int_* predicates can be deleted after this change
is installed.
compiler/format_call.m:
Implement unsigned conversion specifiers for non-64-bit signed
integers by casting to uint and using the uint formatting code.
compiler/introduced_call_table.m:
Update the table of introduced predicates.
compiler/options.m:
Add an option that can be used to test whether this fix is
installed.
tests/hard_coded/Mmakefile:
tests/hard_coded/Mercury.options:
tests/hard_coded/opt_format_sign_extend.{m,exp}:
Test that formatting code introduced by the compiler does not
accidentally sign-extend negative values.
tests/string_format/string_format_{o,x,u}.{m,exp,exp2}:
Make these tests much more comprehensive then they previously
were.
Implement two transitive closure algorithms in the digraph module:
- Basic_TC by Yannis Ioannidis et al.
- STACK_TC by Esko Nuutila, a refinement of the SIMPLE_TC algorithm
previously implemented
On 450 graphs randomly generated by tests/hard_coded/digraph_tc.m,
ranging from 100 to 3000 vertices:
- basic_tc ran from 0.79 to 1.66 times as fast as simple_tc
(mean 1.139, stdev 0.136)
- basic_tc ran from 0.83 to 1.81 times as fast as stack_tc
(mean 1.131, stdev 0.160)
Therefore, after this commit, I will delete the simple_tc and stack_tc
implementations, but they will be available in the version history.
library/digraph.m:
Implement Basic_TC and STACK_TC.
Use map.transform_value in key_set_map_union to replace a search
followed by update.
tests/hard_coded/digraph_tc.m:
Test and benchmark the new algorithms.
Also compare inverse graphs to check that predecessor maps are
maintained properly.
library/sparse_bitset.m:
library/fat_sparse_bitset.m:
Speed up the remove_leq and remove_gt operations by moving a
loop invariant computation, the conversion of the boundary item's index
into an <offset,bitposn> pair, out of the loop.
Eliminate some unnecessary differences between the two modules,
e.g. clear_bit being a predicate rather than a function.
library/test_bitset.m:
Add facilities to test the remove_leq and remove_gt operations
of sparse_bitset.m, fat_sparse_bitset.m, and tree_bitset.m
against the same operations on plain old set_ordlists.
Bring this module up to date by requiring set elements to be
members of the uenum typeclass, not the enum typeclass.
Make the test_bitset type a bespoke type.
library/tree_bitset.m:
Add predicate versions of the remove_leq and remove_gt operations
alongside the existing function versions, to allow the new code
in test_bitset.m to work the same way regardless of which bitset module
it is testing.
For uniformity with the other bitset modules, require set elements to be
members of the uenum typeclass, not the enum typeclass.
Change the other integers, such as level numbers, to be unsigned
as well, to avoid the need for casts.
NEWS:
Announce the new additions and changes.
tests/hard_coded/test_tree_bitset.{m,exp}:
Use those new facilities to test those operations, and add some
test sets designed for that purpose.
Add a comment about the limitations of this testing strategy.
tests/hard_coded/bitset_tester.m:
Delete this long-unused module. (It was the original basis of
the test_bitset.m module in the library directory, but it became unused
when test_tree_bitset.m switched to using that module a long time ago.)
library/digraph.m:
Delete digraph.old_tc, digraph.old_rtc and digraph.slow_rtc.
tests/hard_coded/digraph_tc.m:
tests/hard_coded/digraph_tc.exp:
Delete comparisons using old_tc, old_rtc and slow_rtc.
Implement transitive closure using the simple_tc algorithm from
Esko Nuutila's doctoral thesis.
On a sample of graphs randomly generated by tests/hard_coded/digraph_tc.m,
ranging from 100 to 3000 vertices, the simple_tc implementation ran
from 2.33 to 93 times as fast as the old implementation on my machine.
library/digraph.m:
Rename digraph.tc and digraph.rtc to digraph.old_tc and
digraph.old_rtc. They are kept around for benchmarking,
and will be deleted soon.
Use the simple_tc algorithm to implement digraph.tc.
Use digraph.tc to implement digraph.rtc.
Let key_set_map_add call sparse_bitset.insert_new instead of
sparse_bitset.contains followed by sparse_bitset.insert.
tests/hard_coded/digraph_tc.m:
Add code to benchmark the new and old TC implementations.
library/std_util.m:
Make std_util.pow/3 throw an exception if it is called with a negative
integer as its second argument.
tests/hard_coded/Mmakefile:
tests/hard_coded/func_exp.{m,exp}:
Add a test of pow/3.
NEWS:
Announce the above change.
The implementation of digraph.rtc was incorrect (as demonstrated in the
new test case), which meant that digraph.tc was also incorrect.
library/digraph.m:
Fix the implementation of rtc (reflexive transitive closure):
- Following the algorithm used in digraph.cliques, it needs to
traverse the graph G in *reverse* depth-first order.
- To find the clique containing a vertex X, it needs to do a DFS on
the *reversed* graph to find the vertices with a path to X.
The vertices that were previously unvisited will be members of
the same clique as X.
- Previously it found the "followers" of the elements of the clique,
and the followers of those followers, then added edges from the
members of the current clique to those followers. However, that
only includes vertices two steps removed from the clique.
I have fixed it to add edges to *all* vertices reachable from
members of the clique.
Add straightforward implementations of tc and rtc for comparison.
Add some comments.
tests/hard_coded/Mmakefile:
tests/hard_coded/digraph_tc.exp:
tests/hard_coded/digraph_tc.inp:
tests/hard_coded/digraph_tc.m:
Add test case.
NEWS:
Announce the fixes.
library/array.m:
library/char.m:
library/float.m:
library/int.m:
library/int16.m:
library/int32.m:
library/int64.m:
library/int8.m:
library/list.m:
library/one_or_more.m:
library/string.m:
library/tree234.m:
library/uint.m:
library/uint16.m:
library/uint32.m:
library/uint64.m:
library/uint8.m:
library/version_array.m:
Mark the X_to_doc function in each of these modules as obsolete,
and make it a forwarding function to the actual implementation
in pretty_printer.m. The intention is that when these forwarding
functions are eventually removed, this will also remove the dependency
of these modules on pretty_printer.m. This should help at least some
of these modules escape the giant SCC in the library's dependency graph.
(It does not make sense that a library module that adds code to increment
an int thereby becomes dependent on pretty_printer.m through int.m.)
library/pretty_printer.m:
Move all the X_to_doc functions from the above modules here.
Fix the one_or_more_to_doc function, which was
- missing the comma between the two arguments of the one_or_more
function symbol, and
- would print "..., ...]" instead of just "...]" at the end of the
tail list when that list exceeded the limits of the specified pp_params.
Rename one of the moved types along with its function symbols,
to reduce ambiguity.
Put arrays before their indexes in the argument lists of some of
the moved functions.
Some of the moved X_to_doc functions for compound types returned
a doc that had an indent wrapper. These indents differed between the
various X_to_doc functions without any visible reason, but they are
also redundant. The callers can trivially add such wrappers if they
want to, but taking them off, if they want them off, is harder.
Eliminate the problem by deleting all such indent wrappers.
Add formatters for the intN, uintN and one_or_more types to the
default formatter map. Their previous absence was an oversight.
Add a function, get_formatter_map_entry_types, that returns the ids
of the types in the formatter_map given to the function. It is intended
for tests/hard_coded/test_pretty_printer_defaults.m, but is exported
for anyone to use.
tests/hard_coded/test_pretty_printer_defaults.{m,exp}:
Use get_formatter_map_entry_types to print the default formatter map
in a format that is much more easily readable.
NEWS:
Announce all the user-visible changes above.
The recent change to sparse_bitsets broke the lex library in extras.
Specifically, we now now need to make characters an instance of the
uenum typeclass. This diff does so.
library/char.m:
Add predicates and functions for converting between unsigned integers
and characters.
Make characters an instance of the uenum typeclass.
tests/hard_coded/Mmakefile:
tests/hard_coded/char_uint_conv.{m,exp,exp2}:
Add a test of the above conversions.
NEWS:
Announce the additions.
extras/lex/lex.m:
Conform to recent changes.
... along with their unchecked equivalents. These differ from <<, >> and
their unchecked equivalents in that they take the shift amount as a uint,
instead of an int.
library/int.m:
library/int16.m:
library/int32.m:
library/int64.m:
library/int8.m:
library/uint.m:
library/uint16.m:
library/uint32.m:
library/uint64.m:
library/uint8.m:
As above. The unchecked versions have only declarations, since
these operations have been recognized as builtins for a while now.
NEWS:
Document the new operations, and the recent change to recognize
<<u and >>u as single tokens, and fix a typo in a recent addition.
configure.ac:
Require the compiler to be sufficiently recent to be able to parse
<<u and >>u as operators.
compiler/options.m:
Provide a way for a later change to configure.ac to detect the presence
of this change.
tests/hard_coded/bitwise_int.exp:
tests/hard_coded/bitwise_int.exp2:
tests/hard_coded/bitwise_int.m:
tests/hard_coded/bitwise_int16.exp:
tests/hard_coded/bitwise_int16.m:
tests/hard_coded/bitwise_int32.exp:
tests/hard_coded/bitwise_int32.m:
tests/hard_coded/bitwise_int64.exp:
tests/hard_coded/bitwise_int64.m:
tests/hard_coded/bitwise_int8.exp:
tests/hard_coded/bitwise_int8.m:
tests/hard_coded/bitwise_uint.exp:
tests/hard_coded/bitwise_uint.exp2:
tests/hard_coded/bitwise_uint.m:
tests/hard_coded/bitwise_uint16.exp:
tests/hard_coded/bitwise_uint16.m:
tests/hard_coded/bitwise_uint32.exp:
tests/hard_coded/bitwise_uint32.m:
tests/hard_coded/bitwise_uint64.exp:
tests/hard_coded/bitwise_uint64.m:
tests/hard_coded/bitwise_uint8.exp:
tests/hard_coded/bitwise_uint8.m:
Check that <<u and >>u compute the same results as << and >> respectively.
tests/hard_coded/bitwise_int.m:
tests/hard_coded/bitwise_int16.m:
tests/hard_coded/bitwise_int32.m:
tests/hard_coded/bitwise_int64.m:
tests/hard_coded/bitwise_int8.m:
tests/hard_coded/bitwise_uint.m:
tests/hard_coded/bitwise_uint16.m:
tests/hard_coded/bitwise_uint32.m:
tests/hard_coded/bitwise_uint64.m:
tests/hard_coded/bitwise_uint8.m:
Most of the expected output files of these test cases were
easily readable already, but there were some exceptions caused
by unnecessary differences between their source codes.
The main problem was with bitwise_uint.m (uint_bitwise.m until recently),
whose .exp file contained very long lines of the form A op B = C
where A, B and C could each be 64 bits (and chars) long. Fix this
by adopting the format used by the other modules:
A op
B =
C
The other problem was that in some test cases, the indentation had
an off-by-one bug. They generated output such as
\ aaaa =
bbbb
instead of the much-easier-to-visually-check
\ aaaa =
bbbb
A third, much less important change is the deletion of unnecessary
blank lines.
tests/hard_coded/bitwise_int.exp:
tests/hard_coded/bitwise_int16.exp:
tests/hard_coded/bitwise_int32.exp:
tests/hard_coded/bitwise_int64.exp:
tests/hard_coded/bitwise_int8.exp:
tests/hard_coded/bitwise_uint.exp:
tests/hard_coded/bitwise_uint16.exp:
tests/hard_coded/bitwise_uint32.exp:
tests/hard_coded/bitwise_uint64.exp:
tests/hard_coded/bitwise_uint8.exp:
Conform to the changes in codes of the tests.
Commit 5f50259d16 inadvertently wrote out
the list of fact table file names in a .module_dep file without quoting,
so the .module_dep parser would fail to read it back.
compiler/make.module_dep_file.m:
Write fact table file names in .module_dep files as quoted strings.
tests/mmc_make/Mmakefile:
tests/mmc_make/factt.m:
tests/mmc_make/factt_examples:
Add a test case.
NEWS:
Mention all the user-visible changes below.
library/enum.m:
Add the typeclass uenum, which is a version of the existing enum typeclass
that maps items to uints, not ints. It also uses a semidet predicate,
not a semidet function, to get back to the item from the uint.
library/sparse_bitset.m:
library/fat_sparse_bitset.m:
Make these modules operate on uints, which means requiring the items
in the sets to be instances of uenum, not enum.
If a few places, improve loops by doing previously-repeated conversions
of [u]ints into <offset, bit-to-set> pairs just once.
library/counter.m:
Define ucounters, which allocate uints. Improve documentation.
library/digraph.m:
Change digraph_keys from ints to uints, since we put them into
sparse_bitsets.
library/int.m:
Make int an instance of the uenum typeclass. This can help users
who currently put ints into sparse_bitsets.
library/pprint.m:
Prettyprint sparse_bitsets as lists of uints.
library/term.m:
Make vars instances of uenum as well as enum.
library/uint.m:
Make uint an instance of the uenum typeclass.
Add the ubits_per_uint function, which allows some casts to be avoided.
compiler/make.deps_set.m:
Change the indexes we put into sparse_bitsets from ints to uints.
compiler/make.make_info.m:
Change the source of those indexes from ints to uints.
compiler/make.top_level.m:
compiler/make.util.m:
Conform to the changes above.
compiler/pre_quantification.m:
Change zones from ints to uints, since we put them into sparse_bitsets.
tests/hard_coded/int_uenum.{m,exp}:
tests/hard_coded/Mmakefile:
Enable the new test case.
tests/valid/use_import_only_for_instance.m:
Update this extract from library/digraph.m the same way as
library/digraph.m itself.
compiler/det_report.m:
... when a "declared det, inferred multi" kind of determinism error
is caused by the (probably unexpected, possibly hard-to-see) presence
of a disjunction.
Change the wording to refer to "disjuncts" instead of "clauses";
while in Mercury, all clauses in multi-clause definitions are implicitly
also disjuncts, not all disjuncts are whole clauses.
tests/invalid/bug496.err_exp:
tests/invalid/det_errors.err_exp:
tests/invalid/not_a_switch.err_exp:
tests/invalid/require_scopes.err_exp:
tests/invalid/switch_arm_multi_not_det.err_exp:
Expect the updated form of the error message.
compiler/typecheck_errors.m:
When we are reporting a type error in a var-functor unification
where the functor is the name of a function defined in library/int.m,
such as A = B - C or D = E + F, check whether
(a) the types of any of the variables involved in the error, *and*
(b) the expected argument or result types involved
are builtin integer types whose modules have NOT been imported.
If so, then add a note to the error message that points out
that operations on these type(s) require importing the corresponding
modules.
Do the same when reporting type errors in calls to predicates
whose name is the name of a predicate defined in library/int.m.
Fix an old ZZZ.
compiler/type_assign.m:
Fix typo in a (so far unused) field name.
tests/invalid/arith_wrong_module.{m,err_exp}:
A new test case with three errors, which respectively test the changes
to the three error-message-generating predicates modified by this diff.
tests/invalid/Mmakefile:
Enable the new test case.
compiler/check_typeclass.m:
As above. This makes future changes to the main code of the module easier.
In some cases, this required carving error message generating code
out of larger predicates.
Some errors were being generated by functions that returned an error_spec,
and others by predicates that added the new error_spec to !Specs.
Standardize on the latter scheme.
Use some recently-added auxiliary functions to generate parts of some
error messages, to present the same info the same way in different
error messages. This part of the diff causes the changes to .err_exp files
below.
Start the name of all the predicates that generate error with "report_".
Return !:Specs. Do not take an an initial !.Specs argument, because
any error_specs in it would screw up a test. Our caller always passed us
[] anyway.
The non-error-reporting code in this module is (currently) divided into
six passes. The code that checks for cycles between typeclasses is the
third pass, but its code was after the code of the fourth pass; fix that.
Turn some functions into predicates to allow the use of state variables.
Rename a function symbol to avoid an ambiguity.
Fix comment rot.
compiler/mercury_compile_front_end.m:
Don't pass [] as the initial !.Specs.
compiler/hlds_class.m:
Move a type definition to its proper place.
tests/invalid/bad_instance2.err_exp:
tests/invalid/constraint_proof_bug_lib.err_exp:
tests/invalid/invalid_instance_declarations.err_exp:
Expect updated error messages.
We don't need to prevent building the 'parse' test on platforms that
don't support static linking any more, as the static linking aspect of
that test case was disabled in commit fd088a4f6.
tests/hard_coded/Mmakefile:
Delete conditions to avoid static linking on some platforms.
Rename STATIC_LINK_PROGS to DEBUG_PROGS.
Since the compiler now refuses to allow debugging in parallel grades,
tests that require debugging need to be skipped over in low-level
parallel grades or deleted.
tests/hard_coded/Mmakefile:
Disable 'parse' test in parallel grades as it happens to link with
debug libraries.
tests/par_conj/Mercury.options:
tests/par_conj/Mmakefile:
tests/par_conj/par_ddeath.exp:
tests/par_conj/par_ddeath.m:
tests/par_conj/par_ddeath_2.exp:
tests/par_conj/par_ddeath_2.m:
Delete par_ddeath and par_ddeath_2 tests that once triggered a
compiler abort with --trace deep in parallel grades.
I don't think there is much value in keeping them around.
tests/valid/Mmake.valid.common:
Skip LLDS_PROGS (i.e. test cases that required debugging) in
parallel grades.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/untuple_bug.m:
Delete untuple_bug. It tests an old bug in the untupling
transformation, which was more a programming exercise than something
that should be used anyway.
Class and instance definitions both contain lists of methods,
predicates and/or functions, that each have one or more procedures.
Until now, we represented the methods in class and instance definitions
as lists of nothing more than pred_proc_ids. This fact complicated
several operations,
- partly because there was no simple way to tell which procedures
were part of the same predicate or function, and
- partly because the order of the list is important (we identify
each method procedure in our equivalent of vtables with a number,
which is simply the procedure's position in this list), but there was
absolutely no information about recorded about this.
This diff therefore replaces the lists of pred_proc_ids with lists of
method_infos. Each method_info contains
- the method procedure number, i.e. the vtable index,
- the pred_or_func, sym_name and user arity of the predicate or function
that the method procedure is a part of, to make it simple to test
whether two method_infos represent different modes of the same predicate
or function, or not,
- the original pred_proc_id of the method procedure, which never changes,
and
- the current pred_proc_id, which program transformations *can* change.
compiler/hlds_class.m:
Make the change above in the representations of class and instance
definitions.
Put the fields of both types into a better order, by putting
related fields next to each other.
Put a notag wrapper around method procedure numbers to prevent
accidentally mixing them up with plain integers.
Add some utility functions.
compiler/prog_data.m:
Replace three fields containing pred_or_func, sym_name and arity
in the parse tree representation of instance methods with just one,
which contains all three pieces of info. This makes it easier to operate
on them as a unit.
Change the representation of methods defined by clauses from a list
of clauses to a cord of clauses, since this supports constant-time
append.
compiler/hlds_goal.m:
Switch from plain ints to the new notag representation of method
procedure numbers in method call goals.
compiler/add_class.m:
Simplify the code for adding new classes to the HLDS.
Give some predicates better names.
compiler/check_typeclass.m:
Significantly simplify the code for that generates the pred_infos and
proc_infos implementing all the methods of an instances definition,
and construct lists of method_infos instead of lists of pred_proc_ids.
Give some predicates better names.
Some error messages about problems in instance definitions started with
In instance declaration for class/arity:
while others started with
In instance declaration for class(module_a.foo, module_b.bar):
Replace both with
In instance declaration for class(foo, bar):
because it contains more useful information than the first, and less
non-useful information than the second. Improve the wording of some
error messages.
Factor out some common code.
compiler/prog_mode.m:
compiler/prog_type.m:
compiler/prog_util.m:
Generalize the existing predicates for stripping "builtin.m" module
qualifiers from sym_names, cons_ids, insts, types and modes
to allow also the stripping of *all* module qualifiers. This capability
is now used when we print an instance's type vector as a context
for diagnostics about problems inside instance definitions.
compiler/add_pred.m:
Add a mechanism for returning the pred_id of a newly created pred_info,
whether or not it was declared using a predmode declaration. This
capability is now needed by add_class.m.
Move the code creating an error message into its own function, and export
that function for add_class.m.
compiler/polymorphism_type_info.m:
Fix some comment rot.
compiler/base_typeclass_info.m:
compiler/call_gen.m:
compiler/dead_proc_elim.m:
compiler/deep_profiling.m:
compiler/direct_arg_in_out.m:
compiler/error_msg_inst.m:
compiler/float_regs.m:
compiler/get_dependencies.m:
compiler/higher_order.m:
compiler/hlds_error_util.m:
compiler/hlds_out_goal.m:
compiler/hlds_out_typeclass_table.m:
compiler/instance_method_clauses.m:
compiler/intermod.m:
compiler/make_hlds_error.m:
compiler/ml_call_gen.m:
compiler/mode_errors.m:
compiler/modes.m:
compiler/module_qual.qualify_items.m:
compiler/old_type_constraints.m:
compiler/parse_class.m:
compiler/parse_tree_out.m:
compiler/parse_tree_out_inst.m:
compiler/polymorphism_post_copy.m:
compiler/polymorphism_type_class_info.m:
compiler/prog_item.m:
compiler/prog_rep.m:
compiler/recompilation.usage.m:
compiler/state_var.m:
compiler/type_class_info.m:
compiler/typecheck_debug.m:
compiler/typecheck_error_type_assign.m:
compiler/typecheck_errors.m:
compiler/typecheck_msgs.m:
compiler/unused_imports.m:
compiler/xml_documentation.m:
Conform to the changes above.
tests/invalid/bug476.err_exp:
tests/invalid/tc_err1.err_exp:
tests/invalid/tc_err2.err_exp:
tests/invalid/typeclass_bogus_method.err_exp:
tests/invalid/typeclass_missing_mode.err_exp:
tests/invalid/typeclass_missing_mode_2.err_exp:
tests/invalid/typeclass_mode.err_exp:
tests/invalid/typeclass_mode_2.err_exp:
tests/invalid/typeclass_mode_3.err_exp:
tests/invalid/typeclass_mode_4.err_exp:
tests/invalid/typeclass_test_10.err_exp:
tests/invalid/typeclass_test_3.err_exp:
tests/invalid/typeclass_test_4.err_exp:
tests/invalid/typeclass_test_5.err_exp:
tests/invalid/typeclass_test_9.err_exp:
Expect the updated wording of some error messages.