Commit Graph

4 Commits

Author SHA1 Message Date
Zoltan Somogyi
26be4bb8e3 Add --warn-ambiguous-pragmas.
The new option is on by default, and it generates a warning about pragmas
that specify a name/arity pair that matches both a predicate and a function,
but does not say which one it is intended to apply to.

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

NEWS:
    Announce the new option.

compiler/add_pragma.m:
    Implement the new option.

    Move to one predicate, get_matching_pred_ids, the code for dealing with
    both the absence of any matches, and the presence of more than one match,
    when looking up name/arity pairs in the predicate table. This allows us
    to delete the mostly-duplicate code fragments that did the same thing
    in all of get_matching_pred_ids's callers.

    Simplify the handling of conflicts between marker pragmas.

compiler/hlds_pred.m:
    Separate out no_inline decisions made by the compiler itself from
    the similar decisions made by users, in order to allow that simplification.

    Move the two inline markers next to each other.

compiler/make_hlds_error.m:
    Change a predicate called from add_pragma*.m to take user arities
    in their semantic form, not their int form, which raises the level
    of the predicate's interface, and factors out duplicate code in its
    callers.

compiler/add_pragma_type_spec.m:
compiler/intermod.m:
compiler/table_gen.m:
    Conform to the changes above.

doc/reference_manual.texi:
    Document pred(...) and func(...) wrappers around name/arity pairs
    in pragmas.

    Delete the commented out section on reserve_tag pragmas, which were
    deleted a while ago.

tests/invalid/inline_conflict.m:
    Expand this test case to test the *absence* of a warning for an
    ambiguous pragma with --no-warn-ambiguous-pragma.

tests/invalid/inline_conflict_warn.{m,err_exp}:
tests/invalid/Mercury.options:
    Add a copy of the inline_conflict test case to test the presence of
    a warning for an actually ambiguous pragma.

tests/invalid_nodepend/fact_table_in_interface.err_exp:
    Expect the updated wording of a warning.
2022-07-31 18:17:02 +10:00
Julien Fischer
f3a34e4651 Replace uses of __ as a module qualifier.
samples/muz.zbstract.m:
tests/*/*.m:
    As above.
2022-04-14 20:25:10 +10:00
Zoltan Somogyi
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.
2015-02-16 12:32:18 +11:00
Tyson Dowd
ea6ba74472 Implement `:- pragma no_inline'. This pragma prevents the compiler from
Estimated hours taken: 3

Implement `:- pragma no_inline'. This pragma prevents the compiler from
inlining predicates.

compiler/higher_order.m:
compiler/unused_args.m:
	Create new preds using entire marker list, rather than just
	inlining.

compiler/hlds_out.m:
compiler/mercury_to_mercury.m:
compiler/module_qual.m:
compiler/prog_data.m:
compiler/prog_io_pragma.m:
	Add code to support no_inline marker and pragma.

compiler/hlds_pred.m:
	Add `no_inline' marker.
	Create new preds using entire marker list, rather than just
	inlining.
	Change `pred_info_is_inlined' to `pred_info_requested_inlining',
	as it was inappropriately named, and added
	`pred_info_requested_no_inlining'.

compiler/inlining.m:
	Don't inline predicates with pragma no_inlines

compiler/intermod.m:
	Use `pred_info_requested_inlining'.

compiler/make_hlds.m:
	Add code to check for conflicting markers, check for conflicts
	between `inline' and `no_inline' markers.
	Add `no_inline' markers.
	Rename pragma_set_markers as pragma_add_markers, as it was
	actually adding extra markers to what was already there.

doc/reference_manual.texi:
	Document no_inline.

tests/hard_coded/Mmake:
tests/invalid/Mmake:
tests/hard_coded/no_inline.exp:
tests/hard_coded/no_inline.m:
tests/invalid/inline_conflict.err_exp:
tests/invalid/inline_conflict.m:
	Add test cases for no_inline and conflicts between inline and
	no_inline.
1997-06-27 04:05:22 +00:00