]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Introduce Opt.CCG_Mode
authorArnaud Charlet <charlet@adacore.com>
Fri, 22 Apr 2022 08:32:37 +0000 (08:32 +0000)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 30 May 2022 08:29:02 +0000 (08:29 +0000)
To handle code common to the old and the new CCG code generator.

gcc/ada/

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

gcc/ada/gnat1drv.adb
gcc/ada/opt.ads
gcc/ada/sem_ch7.adb

index 49ddf03d04be5efed597172a792aa280da7b5c60..5c6fd92a825a5b96685c8516f5c45a423db2a690 100644 (file)
@@ -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;
index 2ce24eec332f5d93c22e92c621734c7fb424fdc5..c2abbcee8efd222e2cbbbe6f4103d2cbec037775 100644 (file)
@@ -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
index c43686b10ee122734bd765ebc6ccde961a536e8d..03aecc0c9320ed1ab831a97e276f8f5f70ca442e 100644 (file)
@@ -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