]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Introduce -gnateH switch to force reverse Bit_Order threshold to 64
authorEric Botcazou <ebotcazou@adacore.com>
Thu, 25 May 2023 14:40:35 +0000 (16:40 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 20 Jun 2023 07:30:48 +0000 (09:30 +0200)
This can be helpful for legacy code that still makes use of an original
reverse Bit_Order clause, i.e. without a Scalar_Storage_Order clause.

gcc/ada/

* doc/gnat_ugn/building_executable_programs_with_gnat.rst (Compiler
Switches): Document -gnateH.
* opt.ads (Reverse_Bit_Order_Threshold): New variable.
* sem_ch13.adb (Adjust_Record_For_Reverse_Bit_Order): Use its value
if it is nonnegative instead of System_Max_Integer_Size.
* switch-c.adb (Scan_Front_End_Switches): Deal with -gnateH.
* usage.adb (Usage): Print -gnateH.
* gnat_ugn.texi: Regenerate.

gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst
gcc/ada/gnat_ugn.texi
gcc/ada/opt.ads
gcc/ada/sem_ch13.adb
gcc/ada/switch-c.adb
gcc/ada/usage.adb

index 20e003d4ac7c272d388a13c5512d57a359a2678c..8e479679ec19626da121951ff836e93ff7e7d1fc 100644 (file)
@@ -1612,6 +1612,14 @@ Alphabetical List of All Switches
   Save result of preprocessing in a text file.
 
 
+.. index:: -gnateH  (gcc)
+
+:switch:`-gnateH`
+  Set the threshold from which the RM 13.5.1(13.3/2) clause applies to 64.
+  This is useful only on 64-bit plaforms where this threshold is 128, but
+  used to be 64 in earlier versions of the compiler.
+
+
 .. index:: -gnatei  (gcc)
 
 :switch:`-gnatei{nnn}`
index 88123df4332d45a632862558bce3366d11009cc2..021c2672bae6f50ef41dc66a7c2547d2721ee802 100644 (file)
@@ -19,7 +19,7 @@
 
 @copying
 @quotation
-GNAT User's Guide for Native Platforms , Jun 01, 2023
+GNAT User's Guide for Native Platforms , Jun 16, 2023
 
 AdaCore
 
@@ -9075,6 +9075,18 @@ information.
 Save result of preprocessing in a text file.
 @end table
 
+@geindex -gnateH (gcc)
+
+
+@table @asis
+
+@item @code{-gnateH}
+
+Set the threshold from which the RM 13.5.1(13.3/2) clause applies to 64.
+This is useful only on 64-bit plaforms where this threshold is 128, but
+used to be 64 in earlier versions of the compiler.
+@end table
+
 @geindex -gnatei (gcc)
 
 
index bcafba9e57d57ff8635904be174e7ae02c54dcb0..87399c8a9d30154fd0b640a3f4b889e921217ff4 100644 (file)
@@ -1342,6 +1342,11 @@ package Opt is
    --  GNATPREP
    --  Set to True if -C switch used.
 
+   Reverse_Bit_Order_Threshold : Int := -1;
+   --  GNAT
+   --  Set to the threshold from which the RM 13.5.1(13.3/2) clause applies,
+   --  or -1 if the size of the largest machine scalar is to be used.
+
    RTS_Lib_Path_Name : String_Ptr := null;
    RTS_Src_Path_Name : String_Ptr := null;
    --  GNAT
index 65627321ffe6dbff192627507be2c67e7f979f72..c3ea8d63566a123dacef43fbbe5cb850782574d6 100644 (file)
@@ -426,7 +426,9 @@ package body Sem_Ch13 is
 
    procedure Adjust_Record_For_Reverse_Bit_Order (R : Entity_Id) is
       Max_Machine_Scalar_Size : constant Uint :=
-                                  UI_From_Int (System_Max_Integer_Size);
+        UI_From_Int (if Reverse_Bit_Order_Threshold >= 0
+                     then Reverse_Bit_Order_Threshold
+                     else System_Max_Integer_Size);
       --  We use this as the maximum machine scalar size
 
       SSU : constant Uint := UI_From_Int (System_Storage_Unit);
index f6207e42f62ec1ebd79b8534e0526aba0b57c633..bbbb536903b08096edcb8093630f6ea1e05446e6 100644 (file)
@@ -635,6 +635,12 @@ package body Switch.C is
                      Generate_Processed_File := True;
                      Ptr := Ptr + 1;
 
+                  --  -gnateH (set reverse Bit_Order threshold to 64)
+
+                  when 'H' =>
+                     Reverse_Bit_Order_Threshold := 64;
+                     Ptr := Ptr + 1;
+
                   --  -gnatei (max number of instantiations)
 
                   when 'i' =>
index 58cfa786efad6ed2d77e0543d0c134315767b037..681ece5d921c6cc08c3405dd1527bce8cf8ca1df 100644 (file)
@@ -199,6 +199,11 @@ begin
    Write_Switch_Char ("eG");
    Write_Line ("Generate preprocessed source");
 
+   --  Line for -gnateH switch
+
+   Write_Switch_Char ("eH");
+   Write_Line ("Set reverse Bit_Order threshold to 64");
+
    --  Line for -gnatei switch
 
    Write_Switch_Char ("einn");