diff options
author | Arnaud Charlet <charlet@adacore.com> | 2019-07-03 08:14:00 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2019-07-03 08:14:00 +0000 |
commit | 97edd4267e6fef2da066feafc39c107f2687ee37 (patch) | |
tree | c4db6474b9676fdbe1cf19491771c2c04c6b4a64 | |
parent | 81c10c3f91cb42ecf1b32de800f09282bed31553 (diff) | |
download | gcc-97edd4267e6fef2da066feafc39c107f2687ee37.zip gcc-97edd4267e6fef2da066feafc39c107f2687ee37.tar.gz gcc-97edd4267e6fef2da066feafc39c107f2687ee37.tar.bz2 |
[Ada] Add a gnatbind option to generate C code
2019-07-03 Arnaud Charlet <charlet@adacore.com>
gcc/ada/
* bindgen.adb (Gen_Main): Disable generation of reference to
Ada_Main_Program_Name for CCG.
* bindusg.adb (Display): Add -G to the command-line usage for
gnatbind.
* opt.ads (Generate_C_Code): Update comment.
* switch-b.adb (Scan_Binder_Switches): Add handling for -G.
From-SVN: r272965
-rw-r--r-- | gcc/ada/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/ada/bindgen.adb | 9 | ||||
-rw-r--r-- | gcc/ada/bindusg.adb | 5 | ||||
-rw-r--r-- | gcc/ada/opt.ads | 4 | ||||
-rw-r--r-- | gcc/ada/switch-b.adb | 6 |
5 files changed, 29 insertions, 4 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index d1b11ce..755c9fb 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,14 @@ 2019-07-03 Arnaud Charlet <charlet@adacore.com> + * bindgen.adb (Gen_Main): Disable generation of reference to + Ada_Main_Program_Name for CCG. + * bindusg.adb (Display): Add -G to the command-line usage for + gnatbind. + * opt.ads (Generate_C_Code): Update comment. + * switch-b.adb (Scan_Binder_Switches): Add handling for -G. + +2019-07-03 Arnaud Charlet <charlet@adacore.com> + * sem_ch7.adb (Has_Referencer): Do not consider inlined subprograms when generating C code, which allows us to generate static inline subprograms. diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb index b5637a4..9efc873 100644 --- a/gcc/ada/bindgen.adb +++ b/gcc/ada/bindgen.adb @@ -1805,13 +1805,18 @@ package body Bindgen is -- referenced elsewhere in the generated program, but is needed by -- the debugger (that's why it is generated in the first place). The -- reference stops Ada_Main_Program_Name from being optimized away by - -- smart linkers, such as the AiX linker. + -- smart linkers. -- Because this variable is unused, we make this variable "aliased" -- with a pragma Volatile in order to tell the compiler to preserve -- this variable at any level of optimization. - if Bind_Main_Program and not CodePeer_Mode then + -- CodePeer and CCG do not need this extra code on the other hand. + + if Bind_Main_Program + and then not CodePeer_Mode + and then not Generate_C_Code + then WBI (" Ensure_Reference : aliased System.Address := " & "Ada_Main_Program_Name'Address;"); WBI (" pragma Volatile (Ensure_Reference);"); diff --git a/gcc/ada/bindusg.adb b/gcc/ada/bindusg.adb index d4ac1b3..8c51d11 100644 --- a/gcc/ada/bindusg.adb +++ b/gcc/ada/bindusg.adb @@ -133,6 +133,11 @@ package body Bindusg is Write_Line (" -F Force checking of elaboration Flags"); + -- Line for -G switch + + Write_Line + (" -G Generate binder file suitable for CCG"); + -- Line for -h switch Write_Line diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads index 4ee5fdb..16b5cba 100644 --- a/gcc/ada/opt.ads +++ b/gcc/ada/opt.ads @@ -746,9 +746,9 @@ package Opt is -- file name with extension stripped. Generate_C_Code : Boolean := False; - -- GNAT + -- GNAT, GNATBIND -- If True, the Cprint circuitry to generate C code output is activated. - -- Set True by use of -gnateg or -gnatd.V. + -- Set True by use of -gnateg or -gnatd.V for GNAT, and -G for GNATBIND. Generate_CodePeer_Messages : Boolean := False; -- GNAT diff --git a/gcc/ada/switch-b.adb b/gcc/ada/switch-b.adb index 2f8831b..fdba595 100644 --- a/gcc/ada/switch-b.adb +++ b/gcc/ada/switch-b.adb @@ -294,6 +294,12 @@ package body Switch.B is Debugger_Level := 2; end if; + -- Processing for G switch + + when 'G' => + Ptr := Ptr + 1; + Generate_C_Code := True; + -- Processing for h switch when 'h' => |