2026-01-29 03:39 AEDT

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000580mercuryFeature Requestpublic2026-01-27 03:23
Reporterwangp 
Assigned Tozs 
PrioritynormalSeverityfeatureReproducibilityalways
StatusassignedResolutionopen 
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?
+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
+Issue History