[m-rev.] for review: disable_warnings scope
Zoltan Somogyi
zoltan.somogyi at runbox.com
Thu Jan 19 10:47:19 AEDT 2017
On Wed, 11 Jan 2017 14:13:57 +1100 (AEDT), "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> Instead, I think I can implement the disabling of warnings generated by
> ml_tailcalls.m by
>
> - adding a field to the state of the HLDS-to-MLDS code generator that gives
> a list of the warnings disabled by any disable_warnings scopes surrounding
> the goal it is currently translating,
> - when it translates a call, marking the ml_stmt_call it generates with the
> disabled warnings applicable to that calls (currently only the warning
> we are talking about now, but later possible others as well),
> - having ml_tailcall.m not generate its warning if the call's markings
> say the warning should be disabled.
>
> This gets information about suppressing the warning from the HLDS
> to the MLDS without having to introduce a scope construct to the MLDS.
>
> Alternatively, instead of marking calls at code generation time,
> we could have an earlier pass (maybe simplification) attach a goal feature
> to HLDS call goals, and the HLDS-to-MLDS code generator could mark
> ml_stmt_calls based on the absence or presence of this feature.
> The difference would be in whether we mark calls that are (a) in the scope
> when the code generator sees it, or (b) in the scope in the source that
> the programmer sees. The difference is in code transformations that can move
> code in or out of scopes.
The attached diff implements option (a), as the above email and the reply
to it agreed. It fixes the failure of the require_tailrec_1 test case in MLDS grades.
Once this is installed, we can publically document the ability to disable
warnings about non-tail recursive calls.
For review by anyone.
Zoltan.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Log.mltr
Type: application/octet-stream
Size: 1294 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20170119/e642db31/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DIFF.mltr
Type: application/octet-stream
Size: 33504 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20170119/e642db31/attachment-0003.obj>
More information about the reviews
mailing list