While the existing obsolete pragma declares an entire predicate or function
obsolete, the new obsolete_proc pragma does this for only THE NAMED MODE
of a predicate or function.
NEWS:
doc/reference_manual.texi:
Mention and document the new pragma.
compiler/prog_item.m:
Add the new pragma. Rename the old pragma to "obsolete_pred". (This affects
only the compiler's internal name; the user visible name stays the same.)
Move a type definition next to its related types.
compiler/parse_pragma.m:
Read in the new pragma.
compiler/hlds_pred.m:
Create a slot in proc_infos for the information in the new pragma.
compiler/add_pragma.m:
Add the new pragma to the HLDS.
To avoid adding to the substantial existing code duplication in this
module, factor out two commonly recurring pieces of code: one that
looks up the (hopefully unique) pred_id specified by a pragma, and
one that looks up and (if found) transforms the procedure specified
by a pragma.
Use error-message phraseology consistent with that employed by
the newly-factored-out predicate even in places that cannot use them.
Move the code handling foreign_export pragma here from add_foreign_proc.m
to take advantage of the newly-factored out predicates.
compiler/add_foreign_proc.m:
Delete the code moved to add_pragma.m.
Fix the structure of the remaining code by putting related code fragments
next to each other.
compiler/simplify_goal_call.m:
Generate warnings to obsolete procedures as well as obsolete predicates.
compiler/parse_tree_out_pragma.m:
Output the new pragma.
Factor out existing common code.
compiler/hlds_code_util.m:
Put a predicate's arguments into a more meaningful order.
compiler/make_hlds_error.m:
Allow the caller of report_undefined_pred_or_func_error to specify
whether the error applies to a predicate or a function. Most callers
don't have that info, but some do, and using this info when available
allows us to generate a more specific error message.
compiler/add_clause.m:
Conform to the changes above.
Make a predicate easier to read by moving unimportant code out-of-line.
compiler/intermod.m:
Conform to the changes above. Do this in a way that is adaptable to
making intermod.m generate lists of items instead of simply writing
stuff out, even though this makes the diff to this file more complex
than immediately necessary.
compiler/add_mutable_aux_preds.m:
compiler/add_pragma_type_spec.m:
compiler/canonicalize_interface.m:
compiler/equiv_type.m:
compiler/get_dependencies.m:
compiler/item_util.m:
compiler/make_hlds_passes.m:
compiler/make_hlds_separate_items.m:
compiler/module_qual.qualify_items.m:
compiler/prog_data_pragma.m:
compiler/prog_item_stats.m:
compiler/recompilation.version.m:
Conform to the changes above.
compiler/options.m:
Provide a simple way for the configure script to test for the presence
of this new addition.
tests/invalid/obsolete_proc_pragma.{m,err_exp}:
A test case for the new pragma.
tests/invalid/Mmakefile:
tests/invalid/Mercury.options:
Enable the new test case, and set it to run with --halt-at-warn.
tests/invalid/bug83.err_exp:
tests/invalid/require_tailrec_invalid.err_exp:
Update these two files to expect updated error messages.
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.
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.
Estimated hours taken: 1
Branches: main
Fix bug #83. The compiler was incorrectly reporting ambiguous predicate
or function names in `pragma foreign_export' declarations as not existing.
compiler/add_pragma.m:
Report ambiguous predicate or function names in foreign_export
pragmas properly.
tests/invalid/Mercury.options:
tests/invalid/Mmakefile:
tests/invalid/bug83.{m,err_exp}:
Test for the above.