public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Introduce Opt.CCG_Mode
@ 2022-05-30  8:32 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-05-30  8:32 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 185 bytes --]

To handle code common to the old and the new CCG code generator.

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

gcc/ada/

	* gnat1drv.adb, opt.ads, sem_ch7.adb: Introduce CCG_Mode.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 1833 bytes --]

diff --git a/gcc/ada/gnat1drv.adb b/gcc/ada/gnat1drv.adb
--- a/gcc/ada/gnat1drv.adb
+++ b/gcc/ada/gnat1drv.adb
@@ -180,6 +180,7 @@ procedure Gnat1drv is
       --  Set all flags required when generating C code
 
       if Generate_C_Code then
+         CCG_Mode := True;
          Modify_Tree_For_C := True;
          Transform_Function_Array := True;
          Unnest_Subprogram_Mode := True;


diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads
--- a/gcc/ada/opt.ads
+++ b/gcc/ada/opt.ads
@@ -262,6 +262,9 @@ package Opt is
    --  Set to True to build, bind and link all the sources of a project file
    --  (switch -B)
 
+   CCG_Mode : Boolean := False;
+   --  Set to True when running as CCG (either via -gnatceg or via -emit-c)
+
    Check_Aliasing_Of_Parameters : Boolean := False;
    --  GNAT
    --  Set to True to detect whether subprogram parameters and function results


diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb
--- a/gcc/ada/sem_ch7.adb
+++ b/gcc/ada/sem_ch7.adb
@@ -409,7 +409,7 @@ package body Sem_Ch7 is
                      --  should occur, so we need to catch all cases where the
                      --  subprogram may be inlined by the client.
 
-                     if not Generate_C_Code
+                     if not CCG_Mode
                        and then (Is_Inlined (Decl_Id)
                                   or else Has_Pragma_Inline (Decl_Id))
                      then
@@ -431,7 +431,7 @@ package body Sem_Ch7 is
                      --  unless we generate C code since inlining is then
                      --  handled by the C compiler.
 
-                     if not Generate_C_Code
+                     if not CCG_Mode
                        and then (Is_Inlined (Decl_Id)
                                   or else Has_Pragma_Inline (Decl_Id))
                      then



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-30  8:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-30  8:32 [Ada] Introduce Opt.CCG_Mode Pierre-Marie de Rodat

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).