[m-rev.] for review: may_ignore_without_warning

Peter Wang novalazy at gmail.com
Tue Aug 18 15:54:51 AEST 2020


On Tue, 18 Aug 2020 14:35:43 +1000 "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> Does anyone object to me implementing this small addition
> to the language, to let us shut up warnings about pragma memos
> in the compiler in non-C grades?

No objection.

> 
> Does anyone have a better proposal for the name of the new attribute?

Maybe disable_warning_if_ignored?

> diff --git a/NEWS b/NEWS
> index 574591395..76945e584 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -99,6 +99,18 @@ Changes to the Mercury standard library
>      - pred `merge_subst_without_names/1`
>                                      (replacement: merge_renaming_without_names)
>  
> +Changes to the Mercury language
> +-------------------------------
> +
> +* The compiler can implement tabling only when generating C code.
> +  When compiling a predicate that has a `pragma memo' specified for it
> +  in a non-C grade, it necessarily ignores the pragma, but normally
> +  it prints a warning about this fact. The compiler now supports
> +  a new attribute, `may_ignore_without_warning', that suppresses
> +  such warnings for a `pragma memo' if included in the pragma's
> +  attribute list, like this:

Use `backticks` in markdown.

> +
> +  :- pragma memo(predname/arity, [may_ignore_without_warning])]).

Indent this to column 9 to make it a code block.

>  NEWS for Mercury 20.06.1
>  ========================
> diff --git a/doc/reference_manual.texi b/doc/reference_manual.texi
> index 32ee02cf7..15d62c0dc 100644
> --- a/doc/reference_manual.texi
> +++ b/doc/reference_manual.texi
> @@ -11188,9 +11188,12 @@ by computing solutions using a ``minimal model'' semantics.
>  (Specifically, the minimal model computed by our implementation
>  is the perfect model.)
>  
> -The current Mercury implementation supports
> +When targeting the generation of C code,
> +the current Mercury implementation supports
>  three different pragmas for tabling, to cover these three cases:
>  @samp{loop_check}, @samp{memo}, and @samp{minimal_model}.
> +(None of these are supported when targeting the generation
> +C#, Java, or Erlang code.)

of

>  
>  @itemize @bullet
>  @item
> @@ -11321,6 +11324,21 @@ in the Mercury standard library.
>  That module also contains a predicate for printing out this information
>  in a programmer-friendly format.
>  
> +As mentioned above, the Mercury compiler implements tabling
> +only when targeting the generation of C code.
> + at c ... and when the gc method is not accurate,
> + at c but since no-one actually uses accurate gc ...
> +In other grades, the compiler normally generates a warning
> +for each tabling pragma that it is forced to ignore.
> +The @samp{may_ignore_without_warning} attribute tells the compiler
> +not to generate such a warning for the pragma it is attached to,

full stop

> +Since the @samp{loopcheck} and @samp{minimal_model} pragmas
> +affect the semantics of the program,
> +and such changes should not be made silently,
> +this attribute may not be specified for them.
> +But this attribute may be specified for @samp{memo} pragmas,
> +since these affect only the program's performance, not its semantics.
> +
>  The remaining two attributes, @samp{fast_loose} and @samp{specified},
>  control how arguments are looked up in the memo table.
>  The default implementation

Peter


More information about the reviews mailing list