mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 09:23:44 +00:00
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.
32 lines
710 B
Mathematica
32 lines
710 B
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
% This is a copy of inline_conflict.m that is compiled with different options.
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module inline_conflict_warn.
|
|
|
|
:- interface.
|
|
|
|
:- pred foo(int::in, int::out) is det.
|
|
|
|
:- implementation.
|
|
|
|
foo(X, Y) :-
|
|
bar(X, Y).
|
|
|
|
:- pred bar(int::in, int::out) is det.
|
|
|
|
:- pragma inline(bar/2).
|
|
:- pragma no_inline(bar/2).
|
|
|
|
bar(X, X).
|
|
|
|
:- pred baz(int::in, int::out) is det.
|
|
:- func baz(int, int) = int.
|
|
|
|
:- pragma inline(baz/2).
|
|
|
|
baz(X, X).
|
|
baz(X, _Y) = X.
|