tests/hard_coded/truncate_to_int.m:
Delete the {int64,uint64,uint32}_to_int predicates, and ...
library/int64.m:
library/uint32.m:
library/uint64.m:
... move them to these modules, where they always were intended to go.
Add proper comments describing them.
In the case of int64.m, it already had a to_int predicate doing a checked
conversion. Replace its definition with the one from truncate_to_int.m,
because it should never be slower, and should be faster on some platforms.
Add det function versions of the new predicates, which abort
instead of failing.
NEWS.md:
Announce the new predicates.
tests/hard_coded/truncate_to_int.m:
Add this test case to test operations that convert int64s, uint64s
and uint32s to ints *safely*.
For now, these conversions are implemented only for C. Until they
have Java and C# definitions as well, they are defined here.
tests/hard_coded/truncate_to_int.exp:
tests/hard_coded/truncate_to_int.exp2:
Expected outputs on 64 and 32 bit platforms.
tests/hard_coded/Mmakefile:
Enable the new case. For now, it will fail in non-C grades.
library/int.m:
library/int{8,16,64}.m:
library/uint.m:
library/uint(8,16,32,64}.m:
Add the new function.
NEWS.md:
Announce the additions.
tests/hard_coded/Mmakefile:
tests/hard_coded/clamp_int*.{m,exp}:
tests/hard_coded/clamp_uint*.{m,exp}:
Add tests for the new functions.
tests/hard_coded/string_code_point.m:
Avoid an ambiguity due to this module defining its own version of clamp/3.
XXX we should replace the local one with a call to int.clamp/3, but this
module constructs ranges where Max < Min and aborts with the new one.
Until now, the only integer type we generated dense switches
(including lookup switches) for was int itself; we did not do so
for any sized and/or unsigned integer types.
compiler/switch_util.m:
Simplify the representation of whether a switch is on an integer type.
The new version makes it impossible to make the mistake that caused
bug582 in the first place: not having a single representation for
for the switch being on *any* kind of integer type.
This fix requires solving a problem we never had to solve before:
representing information such as the min and max case values
in a way that works for every integer type, signed or unsigned,
sized or not. The solution that this diff adopts is to use int32s
to represent those limits, which implies that whatever the type
of the integer value being switched on, we will generate a dense
or a lookup switch for it only if all case values fit into an int32.
Since case values over two billion are vanishingly rare, this should be
an acceptable restriction.
Use uints instead of ints to represent counts of things.
Delete an unneeded pair of arguments.
compiler/lookup_switch_util.m:
Conform to the changes in switch_util.m. Use some of the new types
there to make arguments in arguments lists less confusable.
Provide some new utility operations.
Add XXXs where the basic operations we need seem not to exist.
compiler/dense_switch.m:
compiler/lookup_switch.m:
Use the new types in switch_util.m that can represent switches
on any integer type.
compiler/ml_lookup_switch.m:
compiler/ml_simplify_switch.m:
compiler/ml_string_switch.m:
compiler/ml_switch_gen.m:
compiler/switch_gen.m:
Conform to the changes above, and thereby gain the ability
to generate switches on integer types other than int itself.
library/int64.m:
Add a (commmented-out) declaration of an operation that could
help resolve one of the issues in new code in the modules above.
Similar operations would be needed in the modules of other
sized integer types as well.
library/library.m:
Fix a typo.
tests/hard_coded/bug582.{m,exp}:
Add a test case for this issue. Note that while we test whether
we get the expected output, there is no simple automatic way
to detect whether it was generated using a lookup table.
tests/hard_coded/Mmakefile:
Enable the new test case.
library/int32.m:
Add the new function.
NEWS.md:
As above.
tests/hard_coded/Mmakefile:
tests/hard_coded/clamp_int32.{m,exp}:
Add a test for the new function.
library/list.m:
Adjust my previous fix to the documentation of list.merge_lists.
Fix the documentation of merge_lists_and_remove_dups, which had
the same error as merge_lists.
The old equiv_type.m's growth was organic, not planned. It mixed predicates
operating on different levels, and even predicates on the same level
were not always logically organized.
compiler/equiv_type_parse_tree.m:
This module contains the bulk of the old equiv_type.m, the part
concerned with processing parse tree items and their major components.
compiler/equiv_type.m:
The part of the old equiv_type.m that deals with expanding equivalences
inside basic parts of program representations.
compiler/parse_tree.m:
compiler/notes/compiler_design.html:
Include and document the new module.
compiler/decide_type_repn.m:
compiler/mercury_compile_make_hlds.m:
Conform to the changes above.
compiler/recompilation.record_uses.m:
Rename the eqv_expand_info type to item_recomp_deps to better document
its purpose (it is to record which equivalence expansions *an item
depends on*). Finish documenting the type itself.
Rename the predicates operating on values of that type accordingly,
together with the variables in their clauses.
Since the point of the type is to record info about an item,
make the main predicate that constructs values of this type
take *the id the actual item* as input. Previously, it was just
a sym_name that was part of the item id. We still need that version
in two places (where we don't know the final item id yet), but use it
only when we have to. In each case, document *why* we have to.
compiler/equiv_type.m:
compiler/equiv_type_hlds.m:
compiler/qual_info.m:
compiler/add_pragma_type_spec.m:
Conform to the changes above.
Use a consistent naming scheme for the variables of the renamed type.
In one case, stop using a "some [!StateVar]" scope that hurts
readability more than it helps.
tests/warnings/unused_args_only_rec.{m,err_exp}:
As above.
tests/warnings/Mmakefile:
tests/warnings/Mercury.options:
Enable the new test case with the right options.
extras/cgi/html.m:
There is no HTML tag named "it", it is supposed to be "i".
Fix a misformed attribute value.
Fix incorrect character code character escapes.
compiler/unused_args_warn_pragma.m:
The existing code processed only the first procedure of each predicate,
skipping all the later procedures. It had a comment saying that it
warns about an unused arg only if it was unused in all modes,
but this claim was false.
Replace this old code with new code that
- gathers the set of unused args in each procedure, recording
which ones have mode "unused",
- considers all the procedures of a predicate together, and then
- generates either a single warning for the predicate as a whole,
or separate warnings for each procedure that has unused arguments.
We now generate a single warning for the predicate only if all the
procedures agree both on which arguments are unused, and on
which of those are *marked* by the mode as unused. Of course,
most of the time this will be the case simply because most predicates
have just one procedure.
Stop module qualifying predicate names in the warnings we generate,
since we do not generate warnings for imported predicates.
Color the unqualified name as the subject of the diagnostic.
When reporting unused args, list the arguments with "unused" modes
separately from the other arguments.
Simplify the interface with our caller in unused_args.m.
compiler/unused_args.m:
Conform to the simplified interface with unused_args_warn_pragma.m.
compiler/hlds_error_util.m:
Add a new version of an existing utility function.
tests/warnings/unused_args_some_modes.{m,err_exp}:
Add a test case for the new capability.
tests/warnings/Mmakefile:
Enable the new test case.
Stop mixing "VAR = VALUE" and "Var += VALUE" definitions
of make variables. Give some make variables better names.
Move some dependency definitions out of a block of rules.
tests/warnings/Mercury.options:
Enable --warn-unused-args for the new test case.
Delete some accidentally-duplicated entries.
tests/warnings/unused_args_test.err_exp:
Update the expected output.
library/version_array2d.m:
The row or column out of bounds messages are off by one; fix that.
tests/hard_coded/version_array2d_test.exp:
Conform to the above change.
extras/graphics/mercury_glut/glut.callback.m:
Rename overlay_display_func/2 -> disable_overlay_display_func/2
for consistency with every other pair of callback predicates in
this module.
Add a space before a determinism declaration.
Delete doubled-up tabled_for_io attributes from foreign_procs.
Call the correct GLUT function to disable keyboard up callbacks.
extras/graphics/mercury_glut/glut.color_map.m:
Fix incorrect argument ordering in a documentation comment.
extras/graphics/mercury_glut/glut.font.m:
Fix formatting.
extras/graphics/mercury_glut/glut.m:
Fix the definition of the glut_alpha/0 function, which was returning
the wrong value.
extras/graphics/mercury_glut/glut.overlay.m:
Fix a documentation comment.
Add some tabled_for_io attributes.
extras/graphics/mercury_glut/glut.window.m:
Fix doubled-up-word.
s/__IO/_IO etc.
extras/graphics/mercury_opengl/mogl.m:
Fix incorrect casts in some of the calls to glRasterPosNd.
Fix wording of an exception message.
Fix incorrect constants in some foreign_enum pragmas.
Fix a typo in a comment.