public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Marc Poulhi?s <dkm@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r14-1966] ada: Introduce -gnateH switch to force reverse Bit_Order threshold to 64
Date: Tue, 20 Jun 2023 07:46:16 +0000 (GMT)	[thread overview]
Message-ID: <20230620074616.6AA1C3858005@sourceware.org> (raw)

https://gcc.gnu.org/g:298a486c58180adddd99c81217b394f7e4d4bd35

commit r14-1966-g298a486c58180adddd99c81217b394f7e4d4bd35
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Thu May 25 16:40:35 2023 +0200

    ada: Introduce -gnateH switch to force reverse Bit_Order threshold to 64
    
    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.

Diff:
---
 .../gnat_ugn/building_executable_programs_with_gnat.rst    |  8 ++++++++
 gcc/ada/gnat_ugn.texi                                      | 14 +++++++++++++-
 gcc/ada/opt.ads                                            |  5 +++++
 gcc/ada/sem_ch13.adb                                       |  4 +++-
 gcc/ada/switch-c.adb                                       |  6 ++++++
 gcc/ada/usage.adb                                          |  5 +++++
 6 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst b/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst
index 20e003d4ac7..8e479679ec1 100644
--- a/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst
+++ b/gcc/ada/doc/gnat_ugn/building_executable_programs_with_gnat.rst
@@ -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}`
diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi
index 88123df4332..021c2672bae 100644
--- a/gcc/ada/gnat_ugn.texi
+++ b/gcc/ada/gnat_ugn.texi
@@ -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)
 
 
diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads
index bcafba9e57d..87399c8a9d3 100644
--- a/gcc/ada/opt.ads
+++ b/gcc/ada/opt.ads
@@ -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
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index 65627321ffe..c3ea8d63566 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -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);
diff --git a/gcc/ada/switch-c.adb b/gcc/ada/switch-c.adb
index f6207e42f62..bbbb536903b 100644
--- a/gcc/ada/switch-c.adb
+++ b/gcc/ada/switch-c.adb
@@ -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' =>
diff --git a/gcc/ada/usage.adb b/gcc/ada/usage.adb
index 58cfa786efa..681ece5d921 100644
--- a/gcc/ada/usage.adb
+++ b/gcc/ada/usage.adb
@@ -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");

                 reply	other threads:[~2023-06-20  7:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230620074616.6AA1C3858005@sourceware.org \
    --to=dkm@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).