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.
Estimated hours taken: 12
Branches: main
Implement `:- pragma foreign_export'. This is intended to be a replacement
for `:- pragma export'. The principle difference is that `:- pragma
foreign_export' allows you to restrict exports to a particular foreign
language. This language will usually be the target language but in the case
of backends that support multiple foreign languages, e.g. the IL backend, it
also allows us to restrict the exports to a subset of the available foreign
languages.
Add some support for exporting procedures in the Java backend. This is
currently undocumented because I cannot test it properly while the Java
backend is not working. (The reason for adding the support was to make sure
that all of the MLDS backends were handling foreign_export declarations
correctly.)
Make the compiler emit warnings about exports for Java, IL, C# and MC++ not
yet being implemented. For the latter two this is true. As mentioned above
this change adds some support for exports in the Java backend and there was
some pre-existing (but undocumented) support for exports to IL. (The warnings
can be deleted once exports for these languages are properly documented and/or
implemented.)
compiler/prog_item.m:
Rename the export item to foreign_export for consistency with the
rest of the items concerned with the foreign language interface.
Add an extra field to that item. The new field stores the foreign
language that the pragma applies to.
compiler/prog_io_pragma.m:
Parse foreign_export pragmas.
Implement `:- pragma export' declarations as a special case of
`:- pragma foreign_export' declarations.
compiler/add_pramga.m:
Rename some predicates.
Emit warnings about foreign_exports to languages that we do not
currently support.
compiler/export.m:
Rename some of the predicates in this module to make them more C
specific.
Handle foreign exports for the lowlevel C backend.
compiler/hlds_module.m:
Add an extra field to the pragma_exported_proc structure to hold the
name of the foreign language that the corresponding foreign_export
declaration is for.
compiler/mercury_to_mercury.m:
Add code to output foreign_export pragmas.
compiler/ml_code_gen.m:
Don't filter out exports for Java, C# and MC++. The Java exports
can now be passed down to mlds_to_java.m and the other two ought to
be caught by the frontend of the compiler.
compiler/mlds_to_java.m
Add a tentative implementation of pragma foreign_export for Java.
This is currently not documented in the reference manual because
it is (largely) untested.
compiler/mlds_to_c.m:
Change an if-then-else to a switch.
Add a sanity check. Exports for languages other than C should not
reach here.
compiler/mlds_to_il.m:
Update the TODO list at the head of this file.
Add a sanity check. Exports for languages other than IL should not
reach here.
compiler/dead_proc_elim.m:
compiler/det_analysis.m:
compiler/foreign.m:
compiler/handle_options.m:
compiler/make_hlds_passes.m:
compiler/mlds.m:
compiler/mlds_to_managed.m:
compiler/module_qual.m:
compiler/modules.m:
compiler/recompilation.version.m:
Conform to the above changes.
Minor formatting changes.
doc/reference_manual.texi:
Add a new section to the foreign language interface chapter
documenting the new pragma.
Update the descriptions of the language specific bindings to include
the new pragma.
tests/hard_coded/Mmakefile:
tests/hard_coded/pragma_foreign_export.{m,exp}:
Make sure that we can parse the new syntax and run a simple program
that uses exported procedures.
tests/invalid/invalid_export_detism.{m,err_exp}:
Update this test case to conform to the new pragma name.
Estimated hours taken: 1.5
Branches: main
Do not display the `For more information try recompiling with `-E'' prompt
unless we really mean it, i.e. there is actually more information available.
XXX This change is incomplete for the mode_errors module because that
module requires more substantial changes to make this work - I'll do
that as a separate diff.
compiler/globals.m
Add a new global (and access predicates) that keeps track of whether
we have any verbose error information that could be displayed if we
recompiled with `-E'.
compiler/mercury_compile.m
Check the new global flag before prompting the user to recompile with
`-E'.
compiler/mode_errors.m
Add an XXX comment about needing to respect the extra error info flag
properly.
compiler/accumulator.m
compiler/add_clause.m
compiler/add_pred.m
compiler/add_type.m
compiler/assertion.m
compiler/check_typeclass.m
compiler/det_report.m
compiler/magic_util.m
compiler/make_hlds_error.m
compiler/modes.m
compiler/module_qual.m
compiler/modules.m
compiler/post_typecheck.m
compiler/purity.m
compiler/stratify.m
compiler/typecheck_errors.m
Set the new global flag when we come across an error
for which we have a verbose error message.
tests/recompilation/*:
tests/invalid/*:
Update expected error files.
Estimated hours taken: 3
Branches: main
Catch errors concerning pragma export and model_non code
earlier than we do at the moment. Currently, we just generate
#error directives in the C code and let the C preprocessor
report the error.
compiler/make_hlds.m:
Emit an error message if pragma export is used on a
procedure that has a declared determinism of multi
or nondet.
compiler/det_analysis.m:
compiler/det_report.m:
As above, but handle the case where the determinism
needs to be inferred.
compiler/export.m:
Abort rather than trying to generate code for model_non
pragma exports.
tests/invalid/Mmakefile:
tests/invalid/invalid_export_detism.err_exp:
tests/invalid/invalid_export_detism.m:
Test case for the above.