[Ada] Fix invalid JSON real numbers generated with -gnatRj

Pierre-Marie de Rodat derodat@adacore.com
Mon Jun 21 11:05:33 GMT 2021

The -gnatR output contains information about fixed-point types declared
in the program and it comprises real numbers, which are displayed using
a custom format specific to the compiler, which is not always compatible
with the JSON data interchange format.

The change also fixes an off-by-one bug in Decimal_Exponent_Lo and also
tweaks Decimal_Exponent_Hi for the sake of consistency.

Tested on x86_64-pc-linux-gnu, committed on trunk


	* urealp.ads (UR_Write_To_JSON): Declare.
	* urealp.adb (Decimal_Exponent_Hi): Treat numbers in base 10
	specially and rewrite handling of numbers in other bases.
	(Decimal_Exponent_Lo): Likewise.
	(Normalize): Minor tweak.
	(UR_Write_To_JSON): New wrapper procedure around UR_Write.
	* repinfo.adb (List_Type_Info): When the output is to JSON, call
	UR_Write_To_JSON instead of UR_Write.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-diff
Size: 7098 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20210621/25236094/attachment-0001.bin>

More information about the Gcc-patches mailing list