[m-rev.] for review: Remove MR_INT_LEAST64_LENGTH_MODIFIER.

Julien Fischer jfischer at opturion.com
Wed Dec 20 14:43:44 AEDT 2023



On Tue, 19 Dec 2023, Peter Wang wrote:

> We had configure choose the format string length modifier for
> MR_int_least64_t based on whether the type is an alias for "int",
> "long", "long long" or "__int64". That does not work for some versions
> of MinGW-w64, which warn about the "ll" length modifier even though
> MR_int_least64_t is an alias for "long long". The reason is that
> we would be calling the MSVC runtime *printf functions,
> which require the "I64" length modifier instead of "ll".
>
> The only place MR_INT_LEAST64_LENGTH_MODIFIER is used in the Mercury
> system is in the hidden function float64_bits_string (which is also
> no longer used by the Mercury compiler after the removal of the hl
> grades). We can replace that use with PRIdLEAST64 from inttypes.h.
>
> Users are unlikely to be using MR_INT_LEAST64_LENGTH_MODIFIER,
> so it should be safe to remove it.
>
> configure.ac:
> runtime/mercury_conf.h.in:
>    Don't define MR_INT_LEAST64_LENGTH_MODIFIER.
>
> library/float.m:
>    Replace use of MR_INT_LEAST64_LENGTH_MODIFIER with PRIdLEAST64
>    in float64_bits_string.
>
>    Mark all float32_bits_string and float64_bits_string foreign procs
>    as 'may_not_export_body'. There is no need to opt-export procedures
>    that will rarely be used, if ever.
>
> runtime/mercury_types.h:
>    Mention that a comment is out of date.

That's fine.

> diff --git a/runtime/mercury_types.h b/runtime/mercury_types.h
> index 11085e550..53e35f56c 100644
> --- a/runtime/mercury_types.h
> +++ b/runtime/mercury_types.h
> @@ -44,6 +44,7 @@
> #endif
> 
> // This section defines types similar to C9X's <stdint.h> header.
> +// XXX The following is out of date.
> // We do not use <stdint.h>, or the <inttypes.h> or <sys/types.h> files
> // that substitute for it on some systems because (a) some such files
> // do not define the types we need, and (b) some such files include

Reason (a) is very much out of date; reason (b) (which is that
the headers may define inline functions) is presuambly still
a possible issue.

Julien.


More information about the reviews mailing list