Files
mercury/tests/invalid/bug363.m
Zoltan Somogyi 31e7fdde70 Generate better messages for errors in foreign_procs.
This fixes mantis bug 363.

compiler/prog_io_pragma.m:
    Remove the old code that deliberately used an old-style argument number
    (derived from the syntax of the long-ago-removed pragma_c_code pragma,
    which did not have a foreign_lang argument) for error messages.
    This was mantis bug 363.

    Put the code for parsing the main components of foreign_procs in
    one place, and parse them in order. If more than one component has
    errors, return all their error messages.

    Change the code that parses foreign_proc attribute lists to return
    an error message for each unrecognized attribute, instead of just
    printing "invalid attribute list".

compiler/error_util.m:
    Have nth_fixed generate words ("fourth", "fifth" etc) up to N = 10,
    and generate e.g. 42nd instead of 42th.

tests/invalid/bug363.{m,err_exp}:
    Add an expanded version of the mantis 363 test case.

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

tests/invalid/test_nested.err_exp:
    Conform to the change in error_util.m.
2015-08-23 14:48:13 +10:00

19 lines
305 B
Mathematica

% vim: ts=4 sw=4 et ft=mercury
:- module bug363.
:- interface.
:- func foo = int.
:- implementation.
foo = 42.
:- pragma foreign_proc("C",
foo = (F::out),
[will_not_call_mercury, promise_pure thread_safe, will_not_modify_trail,
does_not_affect_liveness, bad_attr],
"
F = 561;
").