Commit Graph

7 Commits

Author SHA1 Message Date
Zoltan Somogyi
24ec389860 Improve diagnostics about missing ::mode annotations.
compiler/add_clause.m:
    When a mode-specific clause is missing a ::mode annotation from some
    arguments, print the identities of those arguments.

compiler/add_pred.m:
    Improve the wording of a diagnostic.

tests/invalid/mode_decl_in_wrong_section.err_exp:
tests/invalid/multimode_dcg.err_exp:
tests/invalid/multimode_dcg.m:
tests/invalid/multimode_syntax.err_exp:
    Expect updated diagnostics.
2024-05-30 22:19:22 +10:00
Zoltan Somogyi
0fa51cc45c Use color in typecheck_error_undef.m ...
... and change the coloring done in many other modules.

compiler/typecheck_error_undef.m:
    Add color to the diagnostics generated by this module.

    In a few cases, improve the wording of the diagnostic.

    Make the name of a function and of a function symbol more descriptive.

    Convert some predicates from using many clauses to using
    an explicit disjunction.

    Delete a function that was sort-of a specialize version of a
    utility function in error_spec.m.

compiler/hlds_error_util.m:
    Change the functions that return descriptions of predicates and procedures,
    mostly for use in diagnostics, to allow the parts of those descriptions
    specific to an individual predicate or procedure to be colored *without*
    coloring the generic parts (such as the word "predicate" or "function").

    Add simpler versions of the affected functions for use cases that
    do not need any coloring.

compiler/accumulator.m:
compiler/add_clause.m:
compiler/add_pragma.m:
compiler/check_pragma_format_call.m:
compiler/check_typeclass.m:
compiler/dead_proc_elim.m:
compiler/det_analysis.m:
compiler/det_report.m:
compiler/direct_arg_in_out.m:
compiler/fact_table.m:
compiler/float_regs.m:
compiler/format_call.m:
compiler/hlds_out_module.m:
compiler/hlds_statistics.m:
compiler/inst_mode_type_prop.m:
compiler/make_hlds_error.m:
compiler/mode_errors.m:
compiler/modes.m:
compiler/oisu_check.m:
compiler/old_type_constraints.m:
compiler/ordering_mode_constraints.m:
compiler/parse_module.m:
compiler/post_typecheck.m:
compiler/prop_mode_constraints.m:
compiler/purity.m:
compiler/simplify_goal_call.m:
compiler/stratify.m:
compiler/style_checks.m:
compiler/table_gen.m:
compiler/tabling_analysis.m:
compiler/term_constr_errors.m:
compiler/term_errors.m:
compiler/termination.m:
compiler/trailing_analysis.m:
compiler/typecheck.m:
compiler/typecheck_clauses.m:
compiler/typecheck_error_overload.m:
compiler/typecheck_error_util.m:
compiler/typecheck_errors.m:
compiler/typecheck_msgs.m:
    Conform to the changes in hlds_error_util.m.

    In many cases, improve the affected diagnostics, and maybe other nearby
    diagnostics, in other ways as well.

compiler/hlds_data.m:
    Fix comments.

tests/invalid/bad_exported_mode.err_exp:
tests/invalid/bad_fact_table_data.err_exp:
tests/invalid/bad_fact_table_data.err_exp2:
tests/invalid/bad_fact_table_decls.err_exp:
tests/invalid/bad_format_call.err_exp:
tests/invalid/bad_pred_arity.err_exp:
tests/invalid/bad_sv_unify_msg.err_exp:
tests/invalid/bug10.err_exp:
tests/invalid/bug113.err_exp:
tests/invalid/bug150.err_exp:
tests/invalid/bug184.err_exp:
tests/invalid/bug197.err_exp:
tests/invalid/bug214.err_exp:
tests/invalid/bug238.err_exp:
tests/invalid/bug257.err_exp:
tests/invalid/bug476.err_exp:
tests/invalid/bug496.err_exp:
tests/invalid/builtin_proc.err_exp:
tests/invalid/coerce_syntax.err_exp:
tests/invalid/coerce_void.err_exp:
tests/invalid/constructor_warning.err_exp:
tests/invalid/det_atomic_goal_msgs.err_exp:
tests/invalid/det_errors.err_exp:
tests/invalid/det_errors_and_io.err_exp:
tests/invalid/det_errors_cc.err_exp:
tests/invalid/erroneous_throw_promise.err_exp:
tests/invalid/exist_foreign_error.err_exp:
tests/invalid/exported_mode.err_exp:
tests/invalid/exported_unify.err_exp:
tests/invalid/field_syntax_error.err_exp:
tests/invalid/foreign_purity_mismatch.err_exp:
tests/invalid/foreign_purity_mismatch.err_exp2:
tests/invalid/foreign_purity_mismatch.err_exp3:
tests/invalid/foreign_type_2.err_exp:
tests/invalid/freefree.err_exp:
tests/invalid/getopt_io_old.err_exp:
tests/invalid/getopt_old_se.err_exp:
tests/invalid/gh72_errors.err_exp:
tests/invalid/hawkins_mm_fail_reset.err_exp:
tests/invalid/ho_unique_error.err_exp:
tests/invalid/impure_method_impl.err_exp:
tests/invalid/invalid_event.err_exp:
tests/invalid/invalid_new.err_exp:
tests/invalid/io_in_ite_cond.err_exp:
tests/invalid/loopcheck.err_exp:
tests/invalid/magicbox.err_exp:
tests/invalid/make_opt_error.err_exp:
tests/invalid/method_impl.err_exp:
tests/invalid/missing_det_decls.err_exp:
tests/invalid/mode_decl_in_wrong_section.err_exp:
tests/invalid/mostly_uniq1.err_exp:
tests/invalid/mostly_uniq2.err_exp:
tests/invalid/multimode_missing_impure.err_exp:
tests/invalid/multimode_syntax.err_exp:
tests/invalid/multiply_star.err_exp:
tests/invalid/no_method.err_exp:
tests/invalid/not_a_switch.err_exp:
tests/invalid/one_member.err_exp:
tests/invalid/pragma_c_code_dup_var.err_exp:
tests/invalid/pragma_c_code_no_det.err_exp:
tests/invalid/pragma_c_code_no_det.err_exp2:
tests/invalid/pragma_c_code_no_det.err_exp3:
tests/invalid/pragma_qual_error.err_exp:
tests/invalid/qual_basic_test2.err_exp:
tests/invalid/qualified_cons_id2.err_exp:
tests/invalid/quant_constraint_1.err_exp:
tests/invalid/quant_constraint_2.err_exp:
tests/invalid/record_syntax_errors.err_exp:
tests/invalid/ref_to_implicit_comma.err_exp:
tests/invalid/ref_to_implicit_pred.err_exp:
tests/invalid/spurious_mode_error.err_exp:
tests/invalid/state_vars_test_3.err_exp:
tests/invalid/string_format_bad.err_exp:
tests/invalid/string_format_unknown.err_exp:
tests/invalid/test_promise_equivalent_clauses.err_exp:
tests/invalid/test_type_spec.err_exp:
tests/invalid/transitive_import_class.err_exp:
tests/invalid/try_detism.err_exp:
tests/invalid/type_error_use_module.err_exp:
tests/invalid/type_inf_loop.err_exp:
tests/invalid/typeclass_dup_method_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_8.err_exp:
tests/invalid/types2.err_exp:
tests/invalid/undeclared_mode.err_exp:
tests/invalid/undef_mode_and_no_clauses.err_exp:
tests/invalid/undef_symbol.err_exp:
tests/invalid/unsatisfiable_constraint.err_exp:
tests/invalid/user_field_access_decl_override_1.err_exp:
tests/invalid/wrong_arity_function.err_exp:
tests/invalid_make_int/bad_end_module.int_err_exp:
tests/invalid_make_int/missing_initial_section.int_err_exp:
tests/invalid_nodepend/after_end_module.err_exp:
tests/invalid_nodepend/bad_fact_table.err_exp:
tests/invalid_nodepend/bigtest.err_exp:
tests/invalid_nodepend/bug410.err_exp:
tests/invalid_nodepend/constrained_poly_insts.err_exp:
tests/invalid_nodepend/duplicate_modes.err_exp:
tests/invalid_nodepend/errors_1.err_exp:
tests/invalid_nodepend/errors_2.err_exp:
tests/invalid_nodepend/errors_3.err_exp:
tests/invalid_nodepend/external.err_exp:
tests/invalid_nodepend/funcs_as_preds.err_exp:
tests/invalid_nodepend/impl_def_literal_syntax.err_exp:
tests/invalid_nodepend/invalid_binary_literal.err_exp:
tests/invalid_nodepend/invalid_decimal_literal.err_exp:
tests/invalid_nodepend/invalid_float_literal.err_exp:
tests/invalid_nodepend/invalid_hex_literal.err_exp:
tests/invalid_nodepend/invalid_main.err_exp:
tests/invalid_nodepend/invalid_octal_literal.err_exp:
tests/invalid_nodepend/no_exports.err_exp:
tests/invalid_nodepend/null_char.err_exp:
tests/invalid_nodepend/occurs.err_exp:
tests/invalid_nodepend/pragma_export.err_exp:
tests/invalid_nodepend/prog_io_erroneous.err_exp:
tests/invalid_nodepend/reserved_type_name.err_exp:
tests/invalid_nodepend/test_with_type.err_exp:
tests/invalid_nodepend/typeclass_test_1.err_exp:
tests/invalid_nodepend/typeclass_test_2.err_exp:
tests/invalid_nodepend/types.err_exp:
tests/invalid_nodepend/unbound_type_vars.err_exp:
tests/invalid_nodepend/unterminated_octal_escape.err_exp:
tests/invalid_nodepend/vars_in_wrong_places.err_exp:
tests/invalid_purity/impure_func_t2.err_exp:
tests/invalid_purity/impure_func_t3.err_exp:
tests/invalid_purity/impure_func_t4.err_exp:
tests/invalid_purity/pragma_c_and_mercury.err_exp:
tests/invalid_purity/purity.err_exp:
tests/invalid_purity/purity_nonsense_1.err_exp:
tests/invalid_purity/purity_nonsense_2.err_exp:
tests/invalid_submodules/exported_unify3.err_exp:
tests/invalid_submodules/func_class.err_exp:
tests/invalid_submodules/undef_mod_qual.err_exp:
tests/recompilation/typeclass_method_pragma_r.err_exp.2:
tests/recompilation/with_type_re.err_exp.2:
tests/warnings/arg_order_rearrangment.err_exp:
tests/warnings/bug477.err_exp:
tests/warnings/det_infer_warning.err_exp:
tests/warnings/disabled_warning.err_exp:
tests/warnings/foreign_term_invalid.err_exp:
tests/warnings/format_call_multi.err_exp:
tests/warnings/format_call_warning.err_exp:
tests/warnings/infinite_recursion.err_exp:
tests/warnings/non_contiguous_decls.err_exp:
tests/warnings/non_stratification.err_exp:
tests/warnings/obsolete_proc_pragma.err_exp:
tests/warnings/pragma_term_conflict.err_exp:
tests/warnings/purity_warnings.err_exp:
tests/warnings/save.err_exp:
tests/warnings/simple_code.err_exp:
tests/warnings/singleton_test.err_exp:
tests/warnings/spurious_obsolete.err_exp:
tests/warnings/suspicious_recursion.err_exp:
tests/warnings/unneeded_mode_specific_clause.err_exp:
tests/warnings/unsigned_zero_cmp.err_exp:
tests/warnings/warn_dead_procs.err_exp:
tests/warnings/warn_dead_procs_trace.err_exp:
tests/warnings/warn_non_contiguous.err_exp:
tests/warnings/warn_non_contiguous_foreign.err_exp:
tests/warnings/warn_stubs.err_exp:
    Expect updated diagnostics.
2024-05-20 18:31:15 +10:00
Zoltan Somogyi
899e8eaafe Use color in more modules.
compiler/check_pragma_format_call.m:
compiler/make_hlds_passes.m:
compiler/modes.m:
compiler/polymorphism_lambda.m:
compiler/qual_info.m:
compiler/stratify.m:
compiler/style_checks.m:
compiler/unused_imports.m:
    Add color to the diagnostics generated by these modules.

    In a few cases, improve the wording of the diagnostic.

tests/invalid/bad_format_call.err_exp:
tests/invalid/higher_order_no_detism.err_exp:
tests/invalid/mode_decl_in_wrong_section.err_exp:
tests/invalid/typeclass_mode_3.err_exp:
tests/invalid/typeclass_mode_4.err_exp:
tests/invalid/undeclared_mode.err_exp:
tests/invalid_nodepend/bad_finalise_decl.err_exp:
tests/invalid_nodepend/bad_initialise_decl.err_exp:
tests/invalid_nodepend/bigtest.err_exp:
tests/invalid_nodepend/constrained_poly_insts.err_exp:
tests/invalid_nodepend/invalid_main.err_exp:
tests/warnings/bug412.err_exp:
tests/warnings/inconsistent_pred_order.err_exp:
tests/warnings/non_contiguous_decls.err_exp:
tests/warnings/non_stratification.err_exp:
    Expect updated diagnostics.
2024-05-13 04:01:24 +10:00
Zoltan Somogyi
edfd7b6cff Use color to add_pred.m.
compiler/add_pred.m:
    Add color to the diagnostics generated by this module.

tests/invalid/bad_detism.err_exp:
tests/invalid/missing_det_decls.err_exp:
tests/invalid/mode_decl_in_wrong_section.err_exp:
tests/invalid/record_syntax_errors.err_exp:
tests/invalid/tc_err1.err_exp:
tests/invalid/typeclass_bad_method_mode.err_exp:
tests/invalid/typeclass_missing_det.err_exp:
tests/invalid/typeclass_missing_det_2.err_exp:
tests/invalid/typeclass_missing_det_3.err_exp:
tests/invalid/undef_lambda_mode.err_exp:
tests/invalid_nodepend/func_errors.err_exp:
    Expect updated diagnostics.
2024-05-10 06:41:54 +10:00
Zoltan Somogyi
ee0a21b98c Replace some 'arity's with {pred_form,user}_arity.
This removes uncertainty in the affected places in the compiler,
because unlike the 'arity' type, the pred_form_arity and user_arity
types specify *which definition* of arity they represent.

Whether I replaced a use of arity with pred_form_arity or user_arity
depended on whether I believed the original arity to have been intended to be
- a pred_form_arity without the wrapper, or
- a user_arity without the wrapper.
The reason for the size of this diff is that when I replaced one use of
arity with pred_form_arity or user_arity, I often could not be sure about
the right way to propagate this change to the rest of the affected code
without making similar replacements elsewhere, and seeing whether
*that* worked. This diff is in effect the "smallest fixpoint" of this process.

In places where the pred form arity of predicate or function
is inherent in a list which has one element for each argument
(the element may be a term, a type, a mode, etc), do not take
a separate arity argument as well, since (a) it is not needed, and
(b) it is a potential source of inconsistencies. The only downside
is that we may need to take the length of a list in both the caller
and the callee, but this cost is negligible.

Add "XXX ARITY" comments to mark opportunities for future improvements.

compiler/hlds_clauses.m:
    Make clauses_info_init take a pred_form_arity instead of an arity
    as argument.

compiler/hlds_pred.m:
    Make pred_info_init take a pred_form_arity instead of an arity
    as argument.

compiler/prog_data.m:
    Specify that the arity part of the pf_sym_name_arity type
    is a pred_form_arity.

    Add a variant of the sym_name_arity type, which does not say
    what kind of arity it contains, which does say that it contains
    a pred_form_arity.

    Store the arities of instance methods as user_arity, not arity.

    Move the definition of an instance method out of between
    the instance's name and its arity.

    Add a convenience function for computing the pred_form_arity
    of an argument list.

    Delete a type moved to parse_sym_name.m.

compiler/prog_item.m:
    Use user_arities in item_initialise_infos and item_finalise_infos.

compiler/typecheck_errors.m:
    Specify that the arity in an arg_vector_plain_pred_call,
    and in the argument list of a function that construct a message
    for a related type error, is a pred_form_arity.

compiler/add_class.m:
    In the predicate that converts clauses to instance methods,
    delete its arity argument, given that another argument is
    the list of argument terms.

    Move the generator of a variable before its first consumer.

compiler/add_clause.m:
    In predicates that add clauses to the HLDS, delete their arity argument
    where another argument is the list of argument terms.

compiler/superhomogeneous.m:
    Explicit specify that the arity of a clause is recorded as a
    pred_form_arity.

compiler/add_foreign_proc.m:
    In predicates that add foreign_procs to the HLDS, delete their arity
    argument where another argument is the list of argument terms.

compiler/check_typeclass.m:
    Record the arity of the method being checked as user_arity.

    Fix incorrect arities in the error messages we generate.

compiler/make_hlds_error.m:
    Get callers to specify the pred_form_arity of a missing predicate or
    function. If that predicate or function exists with other arities,
    we try to be helpful and print out those arities in the error message.
    This process had some bugs, which this diff fixes.

compiler/typecheck_info.m:
    Specify that the arity we record for overloaded symbols is the
    pred_form_arity.

compiler/dep_par_conj.m:
    Conform to the changes above.

    Move a comment to the code it is about.

compiler/hlds_out_pred.m:
compiler/hlds_out_util.m:
    Conform to the changes above.

    In two comments, write out the user arities of function methods,
    not their pred form arity.

compiler/make_hlds_passes.m:
    Conform to the change in the representation of initialise and finalise
    items.

    Use the new method for constructing target names in prog_foreign.m.

    Indent the code example part of an error message.

compiler/prog_foreign.m:
    Provide a single predicate for creating target language names
    for initialise and finalise predicates. This new predicate factors out
    what used to be duplicate code in make_hlds_passes.m.

compiler/parse_sym_name.m:
    Move a type here from prog_data.m, since it is used only by
    parse_sym_name.m and the modules that call it.

compiler/add_pragma_tabling.m:
compiler/add_pragma_type_spec.m:
compiler/add_pred.m:
compiler/add_special_pred.m:
compiler/check_promise.m:
compiler/det_report.m:
compiler/get_dependencies.m:
compiler/goal_expr_to_goal.m:
compiler/higher_order.m:
compiler/hlds_out_typeclass_table.m:
compiler/intermod.m:
compiler/mark_tail_calls.m:
compiler/parse_class.m:
compiler/parse_mutable.m:
compiler/parse_tree_out.m:
compiler/pred_name.m:
compiler/prog_mutable.m:
compiler/prog_out.m:
compiler/state_var.m:
compiler/table_gen.m:
compiler/typecheck.m:
compiler/unused_args.m:
    Conform to the changes above.

compiler/make_hlds.m:
    Conform to the change in add_class.m.

tests/invalid/bad_pred_arity.err_exp:
tests/invalid/mode_decl_in_wrong_section.err_exp:
tests/invalid/pragma_c_code_dup_var.err_exp:
tests/invalid/state_vars_test3.err_exp:
tests/invalid/typeclass_bogus_method.err_exp:
tests/invalid/typeclass_test_3.err_exp:
tests/invalid/typeclass_test_4.err_exp:
    Update these expected outputs for the bug fixes above.

tests/invalid_nodepend/bad_finalise_decl.err_exp:
tests/invalid_nodepend/bad_initialise_decl.err_exp:
    Update these expected outputs for formatting change above.

tests/invalid/no_method.{m,err_exp}:
    A new test case for an arity-related error message that wasn't
    being exercised before.

tests/invalid/Mmakefile:
    Enable the new test case.
2022-02-17 22:21:16 +11:00
Zoltan Somogyi
95ff02b1bf Add options to check the ordering of module contents.
One option, --warn-non-contiguous-decls, generates warnings if the
mode declarations of a predicate or function aren't in a contiguous block
immediately following the pred or func declaration. Since this is a rare
kind of "style error", this option is enabled by default.

Two options, --warn-inconsistent-pred-order-clauses and
--warn-inconsistent-pred-order-foreign-procs, warn about inconsistencies
between (a) the order in which predicates (and functions) are declared,
and (b) the order in which they are defined. The two options differ in
their scope. The latter applies to all predicates and functions defined
in the module, while the former applies only to those whose definitions
include Mercury clauses.

Since an exported predicate or function may need nonexported auxiliary
predicates and/or functions, imposing a single order the declarations and
definitions of *all* the predicates and functions in a module is not a good
idea. Instead, both options divide the predicates and functions defined
in a module two groups, the exported and the nonexported, and expect
a consistent order only within each group.

The result is output that looks like this:

    time.m:021: Warning: the order of the declarations and definitions of the
    time.m:021:   exported predicates is inconsistent, as shown by this diff:
    time.m:021:
    time.m:021:   --- declaration order
    time.m:021:   +++ definition order
    time.m:021:   @@ -1,7 +1,7 @@
    time.m:021:    predicate `clock'/3
    time.m:021:   -predicate `time'/3
    time.m:021:    predicate `times'/4
    time.m:021:    function `clk_tck'/0
    time.m:021:   +predicate `time'/3
    time.m:021:    function `difftime'/2
    time.m:021:    predicate `localtime'/4
    time.m:021:    function `localtime'/1

compiler/options.m:
doc/user_guide.texi:
    Add the new options.

compiler/style_checks.m:
    A new module that generates the new warnings if warranted.

compiler/check_hlds.m:
compiler/notes/compiler_design.html:
    Include and document the new module.

compiler/mercury_compile_front_end.m:
    Invoke the new module if any of the three new options is set.

compiler/hlds_pred.m:
    Record the item number of every predicate, function, and mode declaration
    in the module being compiled. We need this for information for the
    new warnings.

compiler/hlds_module.m:
    Record the context of the module declaration. We use this context
    for warnings about inconsistent order, since there isn't a better one.

compiler/hlds_clauses.m:
    Add a mechanism to retrieve the item numbers of a set of clauses
    even if they are contiguous.

    Document some old data types.

compiler/error_util.m:
    Add a new phase for style checks.

compiler/accumulator.m:
compiler/add_class.m:
compiler/add_mutable_aux_preds.m:
compiler/add_pragma_tabling.m:
compiler/add_pred.m:
compiler/add_solver.m:
compiler/add_special_pred.m:
compiler/check_typeclass.m:
compiler/clause_to_proc.m:
compiler/from_ground_term_util.m:
compiler/lambda.m:
compiler/make_hlds.m:
compiler/make_hlds_passes.m:
compiler/mercury_compile.m:
compiler/par_loop_control.m:
compiler/polymorphism.m:
compiler/stm_expand.m:
compiler/table_gen.m:
compiler/unify_proc.m:
    Conform the changes to the HLDS above.

compiler/typecheck_errors.m:
    Fix style of error messages.

library/array2d.m:
library/assoc_list.m:
library/benchmarking.m:
library/bit_buffer.write.m:
library/bool.m:
library/builtin.m:
library/construct.m:
library/cord.m:
library/counter.m:
library/float.m:
library/injection.m:
library/lazy.m:
library/lexer.m:
library/ops.m:
library/private_builtin.m:
library/profiling_builtin.m:
library/prolog.m:
library/queue.m:
library/rational.m:
library/require.m:
library/stack.m:
library/std_util.m:
library/store.m:
library/thread.semaphore.m:
library/tree234.m:
library/univ.m:
library/version_store.m:
    Move declarations or definitions around to avoid some of the warnings
    that we can now generate. (There are many more left.)

    Make some minor style improvements in the process.

tests/warnings/inconsistent_pred_order.{m,exp}:
tests/warnings/non_contiguous_decls.{m,exp}:
    New test cases to test the new options. They are both copies of
    tests/benchmarks/queens.m, with intentionally-screwed-up style.

tests/warnings/Mmakefile:
    Enable the new test cases.

tests/warnings/Mercury.options:
    Specify the options being tested for the new test cases.

tests/benchmarks/queens.m:
    Bring the style of this module up to date (before copying it).

tests/invalid/mode_decl_in_wrong_section.err_exp:
    Expect the warnings we now generate.
2016-10-15 17:26:32 +11:00
Zoltan Somogyi
a0760327b6 Do stricter checking of mode and determinism declarations.
Specifically, we now do three new checks:

BAD_DETISM: We now generate error messages for predicate declarations
that specify a determinism without also specifying argument modes.

BAD_PREDMODE: We now generate error messages for standalone mode declarations
for predicates whose predicate declaration includes modes for the arguments.

BAD_MODE_SECTION: We now generate error messages for standalone mode
declarations that are not in the same section as the predicate's (or
function's) type declaration.

compiler/hlds_pred.m:
    Add a slot to the pred_sub_info. If the predicate is explicitly defined by
    the user in the current module, this contains the id of the section that
    contains its predicate declaration (for the BAD_MODE_SECTION check)
    and whether that predicate declaration also had modes for the arguments
    (for the BAD_PREDMODE check).

compiler/add_pred.m:
    When adding adding new predicate declarations, perform the BAD_DETISM
    check, and record the info needed for the BAD_PREDMODE and BAD_MODE_SECTION
    checks.

    When adding adding new mode declarations, perform the BAD_PREDMODE
    and BAD_MODE_SECTION checks.

compiler/add_class.m:
compiler/add_mutable_aux_preds.m:
compiler/add_pragma_tabling.m:
compiler/add_pragma_type_spec.m:
compiler/add_solver.m:
compiler/add_special_pred.m:
compiler/check_typeclass.m:
compiler/dep_par_conj.m:
compiler/higher_order.m:
compiler/make_hlds_passes.m:
compiler/table_gen.m:
compiler/unused_args.m:
    Conform to the changes above.

mdbcomp/builtin_modules.m:
    Add a utility predicate for use by new code in add_pred.m.

compiler/comp_unit_interface.m:
compiler/goal_util.m:
compiler/prog_rename.m:
compiler/quantification.m:
deep_profiler/program_representation_utils.m:
library/calendar.m:
library/mutvar.m:
library/pretty_printer.m:
library/random.m:
library/set_ctree234.m:
library/solutions.m:
library/stream.string_writer.m:
profiler/globals.m:
tests/accumulator/nonrec.m:
tests/accumulator/out_to_in.m:
tests/declarative_debugging/library_forwarding.m:
tests/dppd/applast_impl.m:
tests/dppd/grammar_impl.m:
tests/dppd/regexp.m:
tests/dppd/transpose_impl.m:
tests/hard_coded/copy_pred.m:
tests/hard_coded/ho_func_default_inst.m:
tests/recompilation/unchanged_pred_nr_2.m.1:
tests/recompilation/unchanged_pred_nr_2.m.2:
tests/valid/det_switch.m:
tests/valid/inlining_bug.m:
    Delete determinism declarations from predicate and function declarations
    that have no argument mode information, since the BAD_DETISM check
    now makes these errors.

tests/valid/two_pragma_c_codes.m:
    Move some mode declarations to the right section, since the
    BAD_MODE_SECTION check now generates an error for the old code.

tests/invalid/typeclass_bad_method_mode.{m,err_exp}:
    New test case to test for the BAD_PREDMODE check.

tests/invalid/mode_decl_in_wrong_section.{m,err_exp}:
    New test case to test for the BAD_MODE_SECTION check.

tests/invalid/bad_detism.err_exp:
    Add an expected output for this old, but never enabled test case,
    which tests for new check BAD_DETISM.

tests/invalid/Mmakefile:
    Enable the new test cases.

tests/invalid/typeclass_dup_method_mode.m:
    This test case used to have two bugs. One is now by itself in the new
    typeclass_bad_method_mode.m test case, so modify it to contain only
    the other (indistinguishable modes).

tests/invalid/func_errors.err_exp:
tests/invalid/tc_err1.err_exp:
tests/invalid/undef_lambda_mode.err_exp:
tests/invalid/undef_type_mode_qual.err_exp:
    Expect an extra error message from the BAD_DETISM check.
2016-01-13 02:03:16 +11:00