mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-18 19:03:45 +00:00
083d376e6598628362ee91c2da170febd83590f4
14 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
7e93bbd325 |
Use the same code for foreign{_export,}_enums where possible.
compiler/add_foreign_enum.m:
The biggest part of processing both foreign_enums and foreign_export_enums
is validating the mapping from the Mercury names of the enum's constants
to the string giving their user-chosen tag values (for foreign_enums)
or to the string naming the foreign language variable to which their
compiler chosen tag values should be assigned. There is a difference
(the mapping must mention all constants in the type only for
foreign_enums), but it is minor.
We nevetheless used to use completely separate code for validating
the maps, and for other related tasks (such as checking that the type
consists *only* of constants) for the two pragmas. Change this, and use
the same code for validation, with some minor parameterization.
This also allows us to use the same, or closely related, error messages
for the kinds of errors that can occur in both kinds of pragmas.
Change the wording of those error messages to talk about mappings being
"inconsistent", as opposed to them "not being a bijection", since the
latter terminology will be unfamiliar to some Mercury users.
tests/invalid/bug436.err_exp:
Expect the list of incorrectly-mentioned constants in the order of their
appearance (which also happens to be their sorted order, in this case),
since the code that generates the error message now preserves the order
from the pragma.
tests/invalid/ee_invalid.err_exp:
Expect the "inconsistent" wording for two error messages.
tests/invalid/foreign_enum_invalid.err_exp:
Expect the "inconsistent" wording for two error messages,
and expect the *reasons* for the inconsistency to be listed also,
since we now generate this information for foreign_enums as well
(not just for foreign_export_enums, as before).
|
||
|
|
f4bd666ec6 |
Simplify the handling of foreign_export_enums.
compiler/hlds_module.m:
Change the representation of the mapping from Mercury constants
to their exported foreign names from being a sym_name->string map
to being a plain string->string map. Several parts of the compiler
already required the sym_name key to be unqualified, which meant
that its information content was just the constant's name anyway.
This change enforces that invariant by encoding it in the data type.
Document the fields of exported_enum_info. Put those fields into
an order that makes this documentation flow logically.
compiler/add_foreign_enum.m:
Rationalize the way foreign_export_enums (FEEs) are processed and checked.
Check each entry in the override map just once, when it is first processed,
and string away its module qualification then (after checking it).
(Leaving the qualification check until later was probably the reason
for the choice of a sym_name->string map in the old version.)
Check whether the override map deviates from a bijection by keeping track
of which Mercury constant names and which foreign names we have seen so
far. This allows the error messages about "not a bijection" to say *why*
the mapping is not a bijection. It also fixes an old bug that generated
a "not a bijection" error for override maps that *were* bijections,
but were bijections that covered only *some* of the enum type's constants.
In error messages that include lists of constants or foreign names,
consistently precede those lists with nl_indent_delta(2).
Use a more consistent variable naming scheme.
compiler/export.m:
compiler/ml_type_gen.m:
Conform to the changes in hlds_module.m.
tests/invalid/ee_invalid.err_exp:
tests/invalid/exported_foreign_enum.err_exp:
Include the updated error messages in these expected outputs.
Don't expect *any* error message for the FEE on line 75 of ee_invalid.m,
which has a bijective (though incomplete) override map.
|
||
|
|
61d0c67243 |
Improve diagnostics for foreign_{export_,}enum pragmas.
We can now generate error messages for types that have both foreign_enum
and reserve_tag pragmas, which we couldn't before. (In some cases,
we used to get a compiler abort.)
compiler/add_foreign_enum.m:
Don't stop after finding the first problem with a foreign_export_enum
or foreign_enum pragma; if a pragma has more than one problem,
generate reports for them all.
When reporting that the type named in a foreign_export_enum or
foreign_enum is not an enum type, have the error message say *why*.
Fill in the two new fields in exported_enum_infos (see below).
compiler/make_hlds_passes.m:
Add reserve_tag pragmas to the HLDS before adding foreign_export_enum
and foreign_enum pragmas. Since such a pragma would convert an enum
type into a non-enum type, this is needed to ensure that the code
in add_foreign_enum.m that checks whether a type is an enum type
is operating on data that is final. Without that, it may make
wrong decisions.
compiler/make_hlds_separate_items.m:
compiler/add_pragma.m:
Provide the support needed by the new code in make_hlds_passes.m.
In add_pragma.m, rename some insts to avoid name ambiguities,
and simplify an if-then-else.
compiler/hlds_module.m:
Add two fields to exported_enum_infos, to make processing them easier.
(We couldn't do this earlier, since add_foreign_enum.m didn't have
access to the final forms of the bodies of du type definitions,
which is where the values of the two new fields come from.)
compiler/export.m:
compiler/ml_type_gen.m:
Simplify some code using the new fields in exported_enum_infos.
compiler/error_util.m:
Provide a mechanism to control whether sym_names in cons_ids
are module qualified or not. This is "needed" by the new error
messages created in add_foreign_enum.m.
compiler/check_promise.m:
compiler/det_report.m:
compiler/parse_inst_mode_name.m:
compiler/typecheck_errors.m:
Conform to the change to error_util.m.
compiler/make_tags.m:
Clean up some code and some comments.
tests/invalid/exported_foreign_enum.{m,err_exp}:
A new test case to test the new capability to print more than one
error message for the same pragma.
tests/invalid/Mmakefile:
Enable the new test case.
tests/invalid/ee_invalid.err_exp:
Expect improved error messages.
|
||
|
|
1a77161e3a |
Minor fix for an error message.
compiler/add_foreign_enum.m:
The error message for non-matching constructors in a
foreign_export_enum pragma should include the word "error".
tests/invalid/ee_invalid.err_exp:
Update the expected output.
|
||
|
|
71eff078a4 |
Fix error messages for qualification errors in pragma declarations.
Improve test coverage for qualification errors in pragma declarations.
compiler/module_qual.qual_errors.m:
The identifying context pieces for qualification errors in pragmas are
currently of the form "pragma foo"; change them to the form
"`:- pragma foo' declaration" as in the rest of the compiler.
Fix an error where the names of the tabling pragmas were not being
used in error messages, the were all being reported as "pragma tabled".
tests/invalid/Mmakefile:
tests/invalid/pragma_qual_error.{m,err_exp}:
Add further tests for qualification errors in pragmas.
tests/invalid/ee_invalid.err_exp:
tests/invalid/oisu_check_add_pragma_errors.err_exp:
Conform to the above changes.
|
||
|
|
934f5eee9a |
Improve error messages for missing foreign values in foreign_enum pragmas.
Currently, if a foreign_enum pragma is missing cases in the constructor -
foreign value mapping we report that there are some missing foreign values but
do not list the affected constructors unless --verbose-error-messages is
enabled. For cases where there are a small number of missing foreign values
this is a bit irritating as you need to recompile to find out what they are.
Change the compiler so the error message lists upto the first 10 constructors
that do not have a foreign value.
(If --verbose-error-messages is enabled then we list all of them as before.)
compiler/add_foreign_enum.m:
Make the above change.
In error messages for foreign_enum and foreign_export_enum pragmas, add
the word "type" before the name that is printed in error messages.
tests/invalid/Mmakefile:
tests/invalid/Mercury.options:
tests/fe_unmapped_nonverbose.{m,err_exp}:
tests/fe_napped_verbose.{m,err_exp}:
Test the new error messages for missing constructors in the constructor -
foreign value mapping.
tests/invalid/ee_invalid.err_exp:
tests/invalid/foreign_enum_import.err_exp:
tests/invalid/foreign_enum_invalid.err_exp:
Conform to the above changes.
|
||
|
|
a8b8878286 |
Improve consistency in an error message.
compiler/add_foreign_enum.m:
Refer to "builtin" types rather than "atomic" types in some
error messages.
tests/invalid/ee_invalid.err_exp:
Conform to the above change.
|
||
|
|
8a9e623546 |
Convert (C->T;E) to (if C then T else E).
compiler/add_*.m:
Convert the syntax of if-then-elses in the modules that construct
the HLDS.
In a few places, eliminate double negation by replacing (~C->T;E)
with (if C then E else T). In a few other places, replace if-then-elses
by switches.
In add_foreign_enum.m, make an error message more informative
if --verbose-errors is not given, and more compact if it is given.
tests/invalid/ee_invalid.err_exp:
Expect the updated error message.
|
||
|
|
fdd141bf77 |
Clean up the tests in the other test directories.
tests/invalid/*.{m,err_exp}:
tests/misc_tests/*.m:
tests/mmc_make/*.m:
tests/par_conj/*.m:
tests/purity/*.m:
tests/stm/*.m:
tests/string_format/*.m:
tests/structure_reuse/*.m:
tests/submodules/*.m:
tests/tabling/*.m:
tests/term/*.m:
tests/trailing/*.m:
tests/typeclasses/*.m:
tests/valid/*.m:
tests/warnings/*.{m,exp}:
Make these tests use four-space indentation, and ensure that
each module is imported on its own line. (I intend to use the latter
to figure out which subdirectories' tests can be executed in parallel.)
These changes usually move code to different lines. For the tests
that check compiler error messages, expect the new line numbers.
browser/cterm.m:
browser/tree234_cc.m:
Import only one module per line.
tests/hard_coded/boyer.m:
Fix something I missed.
|
||
|
|
ef6af8bab9 |
Improve consistency of error and warning messages.
Add two new format components to the error_util library: decl/1 and
pragma_decl/1. These are converted into strings as follows:
decl(<Decl>) ==> `:- <Decl>'
pragma_decl(<Decl>) ==> `:- pragma <Decl>'
The motivation for this change is that error messages about declarations
often contain text similar to:
... in `:- foo' declaration ...
At least that is what occurs most of the time; in some cases the `:-' part is
omitted, in other cases the quotes are omitted. Using the new format
components makes these consistency problems less likely to occur. The error
specs are also more concise as well.
This commit also addresses a number of other minor issues related to error.
compiler/error_util.m:
Add the two new format components describe above.
Use add_quotes/1 as a single point of control for how single quotes
are added where possible in this module.
Call unexpected/3 in preference to error/1.
compiler/goal_expr_to_goal.m;
Quote the word 'else' when referring the 'else' part of a try goal
in an error message.
compiler/hlds_out_util.m:
Add an XXX comment about cons_ids being incorrectly quoted in
error messages.
compiler/det_report.m:
Pass the message description to report_determinism_problem/7 as a list
of format_components rather than as a string.
compiler/make_hlds_warn.m:
Capitalize the word "Warning" when it occurs at the beginning of a warning.
compiler/typecheck_errors.m:
compiler/modules.m:
Fix problems I noticed during my previous change.
compiler/add_pragma.m:
compiler/add_type.m:
compiler/det_analysis.m:
compiler/make_hlds_passes.m:
compiler/modules.m:
compiler/oisu_check.m:
compiler/prog_io.m:
compiler/prog_io_mode_defn.m:
compiler/prog_io_mutable.m:
compiler/prog_io_pragma.m:
compiler/prog_io_sym_name.m:
compiler/term_constr_errors.m:
compiler/term_errors.m
compiler/termination.m:
compiler/typecheck_errors.m:
Conform to the above changes.
tests/invalid/bad_finalise_decl.err_exp:
tests/invalid/bad_initialise_decl.err_exp:
tests/invalid/bad_mutable.err_exp:
tests/invalid/bug83.err_exp:
tests/invalid/ee_invalid.err_exp:
tests/invalid/foreign_enum_import.err_exp:
tests/invalid/foreign_enum_invalid.err_exp:
tests/invalid/foreign_type_missing.err_exp:
tests/invalid/hawkins_mm_fail_reset.err_exp:
tests/invalid/loopcheck.err_exp:
tests/invalid/nested_impl_in_int.err_exp:
tests/invalid/oisu_check_add_pragma_errors.err_exp:
tests/invalid/oisu_check_semantic_errors.err_exp:
tests/invalid/reserve_tag.err_exp:
tests/invalid/try_io_else.err_exp:
tests/warnings/foreign_term_invalid.exp:
tests/warnings/warn_return.exp*:
tests/warnings/warn_succ_ind.exp*:
Update expected (error) outputs to conform to the above.
|
||
|
|
6d43c71948 |
Implement semantic checks for oisu (order independent state update) pragmas.
Estimated hours taken: 30
Branches: main
Implement semantic checks for oisu (order independent state update) pragmas.
compiler/hlds_pred.m:
Record for each procedure whether it implements an operation
on a oisu type, and if yes, what kind of operation.
compiler/hlds_module.m:
Add to module_infos a data structure that lists the oisu pragmas
in the module, and the procedures mentioned in them. These are intended
to be used later during code generation.
compiler/add_pragma.m:
Add such pragmas to the HLDS, after checking whatever properties
can be checked during the creation of the HLDS.
compiler/oisu_check.m:
A new module, whose job it is to check those aspects of oisu pragmas
that can be checked only after other semantics are complete on the
module.
compiler/check_hlds.m:
Add the new module.
compiler/notes/compiler_design.html:
Document the new module.
compiler/mercury_compile_front_end.m:
Invoke the new module.
compiler/error_util.m:
Add the new semantic check as a phase.
compiler/mercury_to_mercury.m:
Fix typos in the code for writing out oisu pragmas.
compiler/prog_io_pragmas.m:
Fix typos in the code for reading in oisu pragmas.
compiler/module_qual.m:
Improve the error messages generated for any problems discovered during
module qualification inside pragmas, by writing out what *kind* of
pragma the problem was discovered in.
compiler/modules.m:
Fix a bug: oisu pragmas *can* appear in module interfaces.
compiler/stratify.m:
Give a predicate a better interface and a name.
compiler/hlds_goal.m:
Remove a duplicate comment.
compiler/make_hlds_passes.m:
Fix formatting.
tests/hard_coded/oisu_check_main.{m,exp}:
tests/hard_coded/oisu_check_db.m:
A new multimodule test case, which uses oisu pragmas correctly.
tests/invalid/oisu_check_add_pragma_errors.{m,err_exp}:
A new test case, which tests add_pragma.m's ability to diagnose
the problems it is supposed to diagnose.
tests/invalid/oisu_check_semantic_errors.{m,err_exp}:
A new test case, which tests oisu_check.m's ability to diagnose
the problems it is supposed to diagnose.
tests/hard_coded/Mmakefile:
tests/invalid/Mmakefile:
Enable the new test cases.
|
||
|
|
12281f3419 |
Implement a type representation optimisation ("direct argument functors"),
Branches: main
Implement a type representation optimisation ("direct argument functors"),
where a functor with exactly one argument can be represented by a tagged
pointer to the argument value, which itself does not require the tag bits,
e.g.
:- type maybe_foo ---> yes(foo) ; no.
:- type foo ---> foo(int, int). % aligned pointer
To ensure that all modules which could construct or deconstruct the functor
agree on the type representation, I had planned to automatically output
extra information to .int files to notify importing modules about functors
using the optimised representation:
:- type maybe_foo ---> yes(foo) ; no
where direct_arg is [yes/1].
However, the compiler does not perform enough (or any) semantic analysis
while making interface files. The fallback solution is to only use the
optimised representation when all importing modules can be guaranteed to
import both the top-level type and the argument type, namely, when both
types are exported from the same module. We also allow certain built-in
argument types; currently this only includes tuples.
Non-exported types may use the optimised representation, but when
intermodule optimisation is enabled, they may be written out to .opt files.
Then, we *do* add direct_arg attributes to .opt files to ensure that importing
modules agree on the type representation. The attributes may also be added by
Mercury programmers to source files, which will be copied directly into .int
files without analysis. They will be checked when the module is actually
compiled.
This patch includes work by Zoltan, who independently implemented a version
of this change.
compiler/hlds_data.m:
Record the direct arg functors in hlds_du_type.
Add a new option to cons_tag.
Fix some comments.
compiler/prog_data.m:
compiler/prog_io_type_defn.m:
Parse and record `direct_arg' attributes on type definitions.
compiler/prog_io_pragma.m:
Issue an error if the `direct_arg' attribute is used with a foreign
type.
compiler/make_tags.m:
compiler/mercury_compile_front_end.m:
Add a pass to convert suitable functors to use the direct argument
representation. The argument type must have been added to the type
table, so we do this after all type definitions have been added.
Move code to compute cheaper_tag_test here.
compiler/ml_unify_gen.m:
compiler/unify_gen.m:
Generate different code to construct/deconstruct direct argument
functors.
compiler/intermod.m:
Write `direct_arg' attributes to .opt files for functors
using the direct argument representation.
compiler/mercury_to_mercury.m:
Write out `direct_arg' attributes.
compiler/rtti.m:
compiler/rtti_out.m:
compiler/rtti_to_mlds.m:
Add an option to the types which describe the location of secondary
tag options. The functors which can use the optimised representation
are a subset of those which require no secondary tag.
Output "MR_SECTAG_NONE_DIRECT_ARG" instead of "MR_SECTAG_NONE" in
RTTI structures when applicable.
compiler/add_pragma.m:
compiler/add_type.m:
compiler/bytecode_gen.m:
compiler/check_typeclass.m
compiler/code_info.m:
compiler/equiv_type.m:
compiler/export.m:
compiler/foreign.m:
compiler/hlds_code_util.m:
compiler/hlds_out_module.m:
compiler/inst_check.m:
compiler/ml_proc_gen.m:
compiler/ml_switch_gen.m:
compiler/ml_tag_switch.m:
compiler/ml_type_gen.m:
compiler/module_qual.m:
compiler/modules.m:
compiler/post_term_analysis.m:
compiler/post_typecheck.m:
compiler/recompilation.check.m:
compiler/recompilation.usage.m:
compiler/recompilation.version.m:
compiler/simplify.m:
compiler/structure_reuse.direct.choose_reuse.m:
compiler/switch_gen.m:
compiler/switch_util.m:
compiler/tag_switch.m:
compiler/term_norm.m:
compiler/type_ctor_info.m:
compiler/type_util.m:
compiler/unify_proc.m:
compiler/unused_imports.m:
compiler/xml_documentation.m:
Conform to changes.
Bump RTTI version number.
doc/reference_manual.texi:
Add commented out documentation for `direct_arg' attributes.
library/construct.m:
Handle MR_SECTAG_NONE_DIRECT_ARG in construct.construct/3.
library/private_builtin.m:
Add MR_SECTAG_NONE_DIRECT_ARG constant for Java for consistency,
though it won't be used.
runtime/mercury_grade.h:
Bump binary compatibility version number.
runtime/mercury_type_info.h:
Bump RTTI version number.
Add MR_SECTAG_NONE_DIRECT_ARG.
runtime/mercury_deconstruct.c:
runtime/mercury_deep_copy_body.h:
runtime/mercury_ml_expand_body.h:
runtime/mercury_table_type_body.h:
runtime/mercury_term_size.c:
runtime/mercury_unify_compare_body.h:
Handle MR_SECTAG_NONE_DIRECT_ARG in RTTI code.
tests/debugger/Mmakefile:
tests/debugger/chooser_tag_test.exp:
tests/debugger/chooser_tag_test.inp:
tests/debugger/chooser_tag_test.m:
tests/hard_coded/Mercury.options:
tests/hard_coded/Mmakefile:
tests/hard_coded/construct_test.exp:
tests/hard_coded/construct_test.m:
tests/hard_coded/direct_arg_cyclic1.exp:
tests/hard_coded/direct_arg_cyclic1.m:
tests/hard_coded/direct_arg_cyclic2.m:
tests/hard_coded/direct_arg_cyclic3.m:
tests/hard_coded/direct_arg_intermod1.exp:
tests/hard_coded/direct_arg_intermod1.m:
tests/hard_coded/direct_arg_intermod2.m:
tests/hard_coded/direct_arg_intermod3.m:
tests/hard_coded/direct_arg_parent.exp:
tests/hard_coded/direct_arg_parent.m:
tests/hard_coded/direct_arg_sub.m:
tests/invalid/Mmakefile:
tests/invalid/where_direct_arg.err_exp:
tests/invalid/where_direct_arg.m:
tests/invalid/where_direct_arg2.err_exp:
tests/invalid/where_direct_arg2.m:
Add test cases.
tests/invalid/ee_invalid.err_exp:
Update expected output.
|
||
|
|
cc1711071e |
Make all the pre-HLDS and front-end passes of the compiler gather up
Estimated hours taken: 50 Branches: main Make all the pre-HLDS and front-end passes of the compiler gather up all their error messages and print them all at once, in sorted order, unless the user asked for progress messages, in which case we print all the errors accumulated so far just before each printing each progress message. This should make error message output significantly easier to interpret. compiler/module_imports.m: Add a new field to the module_imports structure (the main pre-HLDS representation of the parse tree) to hold the list of error messages generated so far. Rename the module_imports structure as the module_and_imports structure, since it holds the module's items as well as information about its imports. Update the access predicates to encourage getting the items, the error messages and the error indication all at once. Add mechanisms for updating the error indication and the error messages. Add a distinguishing prefix to the field names of the structure. compiler/error_util.m: compiler/hlds_error_util.m: Add facilities for printing error messages in batches. In error_util.m, delete an unused argument from several predicates. compiler/mercury_compile.m: compiler/intermod.m: Gather up error messages to print in batches. In the parts of the code affected by the above, explicitly pass around a globals structure, instead of having all the predicates get it of the I/O state. Since some code (e.g. the start recompilation system) still uses the copy in the I/O state, we ensure that this copy is kept in sync with the explicitly passed around copy. Rename some predicates to avoid ambiguities. compiler/modules.m: Return errors in the module_and_imports structure, not separately. Gather up error messages to print in batches. Explicitly pass around globals structures. compiler/read_modules.m: Rename the read_modules type to have_read_module_map, since this is more explicit. For each module we have already read, remember not just the items we read from it, but also the error messages we generated during the reading. This is so these error messages can be printed together with other errors from other sources. Explicitly pass around globals structures. compiler/prog_io.m: compiler/purity.m: compiler/stratify.m: Rename several predicates to avoid ambiguities. compiler/modes.m: Change the interface of the main predicate to avoid the need for a lambda expression in mercury_compile.m. compiler/recompilation.check.m: Add a distinguishing prefix to the field names of a structure. Fix a wrong definition of this_file. Conform to the changes above. compiler/compiler_target_code.m: compiler/deps_map.m: compiler/make.m: compiler/make.dependencies.m: compiler/make.module_dep_file.m: compiler/make.module_target.m: compiler/make.program_target.m: compiler/make.util.m: compiler/make_hlds.m: compiler/make_hlds_passes.m: compiler/trans_opt.m: compiler/write_deps_file.m: Conform to the changes above. compiler/add_clause.m: compiler/add_pragma.m: compiler/state_var.m: Add an import of io, since their parent make_hlds.m does not import io anymore. In add_pragma, update an error message that did not mention trseg as well as tr as indicating a trailing grade. tests/hard_coded/Mmakefile: Move two tests that cannot pass in debug grades due to the lack of tail recursion to the list containing the other tests with this property. tests/invalid/test_feature_set.err_exp: Update the expected output of this test to expect the updated error message from add_pragma. tests/invalid/test_feature_set.err_exp2: Add this file as the expected output for trailing grades. tests/invalid/*.err_exp: tests/warnings/*.err_exp: Update the expected output for many tests to expect the error messages in sorted order. |
||
|
|
75a8a4a9b3 |
Add a new pragma, foreign_export_enum, that allows the names of constructors
Estimated hours taken: 30
Branches: main
Add a new pragma, foreign_export_enum, that allows the names of constructors
of Mercury enumeration types to be exported across the foreign language
interface and referred to by code in the foreign language.
The new pragma is intended to be used to avoid a situation that frequently
occurs when creating Mercury bindings to foreign language libraries, namely
arguments and return values being passed across the foreign language boundary
as small integers. Exporting the names of enumeration values to foreign
languages should make this task less error prone and more portable.
Using the new construct programmers can either specify a foreign language name
for each enumeration constructor, or since this is tedious, there is also a
default mapping defined for each foreign language that should work in most
cases for that language. (In the cases where it does not work the compiler
requires the programmer to provide a valid name.)
Currently, pragma foreign_export_enum is only supported by the C backends.
compiler/prog_data.m:
compiler/prog_item.m:
Add a new item to the parse tree for representing
foreign_export_enum pragmas.
compiler/prog_io_pragma.m:
Parse the new pragma.
compiler/module_qual.m:
Handle foreign_export_enum pragmas.
Add a predicate to for module qualifying type_ctors, i.e. a
type identified by its sym_name and arity, for use by the
above.
compiler/mercury_to_mercury.m:
Write out foreign_export_enum pragmas.
compiler/hlds_module.m:
Add a type to represent exported enumerations.
Add a field to the module_info to hold information about
exported enumerations. Add access procedures for this.
compiler/make_hlds_passes.m:
compiler/add_pragma.m:
Handle foreign_export_enum pragmas: generate the set of foreign names
for each of the constructors of an enumeration type and check that
their validity in the foreign language. Attach this information to
the HLDS.
compiler/export.m:
Output #defined constants for C foreign_export_enum pragmas in
.mh files.
compiler/mlds.m:
Add an MLDS specific representation of exported enumerations.
compiler/ml_type_gen.m:
Convert the HLDS representation of exported enumerations into
an MLDS specific one.
compiler/mlds_to_c.m:
Output #defined constants for C foreign_export_enum pragmas in
.mih files.
compiler/ml_code_gen.m:
compiler/ml_elim_nested.m:
compiler/ml_tailcall.m:
compiler/mlds_to_gcc.m:
compiler/mlds_to_il.m:
compiler/mlds_to_ilasm.m:
compiler/mlds_to_java.m:
compiler/mlds_to_managed.m:
Conform to the above changes to the MLDS.
compiler/mercury_compile.m:
Pass the list of export enumerations to the code that writes
out .mh files.
compiler/c_util.m:
Add a predicate that tests if a string is a valid C identifier.
compiler/modules.m:
compiler/recompilation.version.m:
Conform to the above changes.
doc/reference_manual.texi:
Document the new pragma.
tests/hard_coded/Mmakefile:
tests/hard_coded/ee_dummy.{m,exp}:
tests/hard_coded/ee_valid.{m,exp}:
Test valid uses of foreign_export_enum pragmas.
tests/invalid/Mmakefile:
tests/invalid/Mercury.options:
tests/invalid/ee_invalid.{m,err_exp}:
Check we generate error messages for invalid
foreign_export_enum pragmas.
NEWS:
Announce the new pragma.
vim/syntax/mercury.vim:
Highlight the new syntax.
|