[m-rev.] for review: --warn-suspicious-foreign-procs

Julien Fischer juliensf at csse.unimelb.edu.au
Sat Sep 5 16:56:06 AEST 2009


On Sat, 5 Sep 2009, Mark Brown wrote:

> On 05-Sep-2009, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
>>
>> Add a new warning, --warn-suspicious-foreign-procs.
>> This checks the bodies of foreign_proc pragmas for possible errors.
>> Currently, these errors are:
>>
>> (1) the presence of SUCCESS_INDICATOR (or in Java, succeeded),
>> in foreign procs. for predicates that cannot fail.
>>
>> (2) the lack of SUCCESS_INDICATOR (succeeded) in foreign procs.
>> for predicates that can fail.
>>
>> (3) the presence of "return" (or "ret" or "jmp" in IL).  This could
>> indicate the presence of a return statement in the foreign proc.
>>
>> Potentially, we could also check for the presence of the this
>> pointer in Java and C# foreign_procs, but that isn't implemented
>> at the moment.
>>
>> The warning is disabled by default, since it will produce spurious
>> results if the things it checks for occur in foreign language
>> comments.
>
> (2) would always be an error, wouldn't it?

In Java, C# and Erlang, yes.  In C, you could play games with macros
that expand to an assignment for SUCCESS_INDICATOR; (2) doesn't
catch that.

Julien.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list