2026-02-01 05:32 AEDT

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000580mercuryFeature Requestpublic2026-01-30 23:59
Reporterwangp 
Assigned Tozs 
PrioritynormalSeverityfeatureReproducibilityalways
StatusresolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0000580: parse foreign_proc body into comments vs non-comments
DescriptionIt should be relatively easy to parse C/C#/Java foreign_proc bodies into comments and non-comment sections. Then we could avoid false positive warnings about "return" statements when the word "return" appears within a comment.

There are cases where we deliberately name a variable within a comment to suppress a warning about a variable not occurring, but perhaps in those cases the variable would have an underscore prefix, e.g.

:- pragma foreign_proc("C#",
    min(_Array::in, Min::out),
    [will_not_call_mercury, promise_pure, thread_safe],
"
    // Array not used.
    Min = 0;
").

Also, in C at least, that code could have been written as (void)Array;
TagsNo tags attached.
Attached Files

-Relationships
+Relationships

-Notes

~0001239

zs (developer)

Would anyone object if, as part of the fix, I changed the compiler to check both the argument lists and the bodies of *all* foreign_procs, and not just of the foreign_procs that happen to be for the current backend?

~0001240

zs (developer)

Committed 2026 jan 29.
+Notes

-Issue History
Date Modified Username Field Change
2026-01-15 14:10 wangp New Issue
2026-01-27 03:21 zs Assigned To => zs
2026-01-27 03:21 zs Status new => assigned
2026-01-27 03:23 zs Note Added: 0001239
2026-01-30 23:59 zs Status assigned => resolved
2026-01-30 23:59 zs Resolution open => fixed
2026-01-30 23:59 zs Note Added: 0001240
+Issue History