aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/bindgen.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2011-08-04 12:09:06 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2011-08-04 12:09:06 +0200
commitc2db4b320dc594f7f5724c712fec7612e1744918 (patch)
treeee88f2d362365e5135d7544118b03fafb9e771d2 /gcc/ada/bindgen.adb
parentceb0dcaaad6b6dc2fbea74a76531ca7b05101d9c (diff)
downloadgcc-c2db4b320dc594f7f5724c712fec7612e1744918.zip
gcc-c2db4b320dc594f7f5724c712fec7612e1744918.tar.gz
gcc-c2db4b320dc594f7f5724c712fec7612e1744918.tar.bz2
[multiple changes]
2011-08-04 Arnaud Charlet <charlet@adacore.com> * prj-env.adb: Remove local debug traces. 2011-08-04 Yannick Moy <moy@adacore.com> * checks.adb (Apply_Float_Conversion_Check): correct a typo where Lo_OK was used instead of Hi_OK, which could cause a read of an uninitialized value later on. Detected while working on the new warning. * exp_ch9.adb (Expand_N_Entry_Declaration): remove useless assignment to local variable. * sem_ch5.adb (Analyze_Assignment): set the last assignment component in more cases, in order to detect more unreferenced values. * sem_util.adb, sem_util.ads (Get_Enclosing_Object): return enclosing object for expression, if any. 2011-08-04 Eric Botcazou <ebotcazou@adacore.com> * exp_intr.adb (Expand_Binary_Operator_Call): Look at the RM size of the operand types instead of the Esize. 2011-08-04 Steve Baird <baird@adacore.com> * switch-b.adb (Scan_Binder_Switches): Add -P binder switch, used to enable CodePeer_Mode. * bindusg.adb (Display): Add help message describing -P binder switch. * gnat_ugn.texi: Document -P binder switch. * bindgen.adb (Gen_Main_Ada): If CodePeer_Mode is set, then call the user-defined main program directly. (Gen_Output_File_Ada): If CodePeer_Mode is set, generate a with of the user-defined main program in the context clause of the package body. From-SVN: r177355
Diffstat (limited to 'gcc/ada/bindgen.adb')
-rw-r--r--gcc/ada/bindgen.adb22
1 files changed, 21 insertions, 1 deletions
diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb
index a4e7cca..f13667e 100644
--- a/gcc/ada/bindgen.adb
+++ b/gcc/ada/bindgen.adb
@@ -2218,7 +2218,20 @@ package body Bindgen is
if not No_Main_Subprogram then
WBI (" Break_Start;");
- if ALIs.Table (ALIs.First).Main_Program = Proc then
+ if CodePeer_Mode then
+ -- Bypass Ada_Main_Program; its Import pragma confuses CodePeer.
+ Get_Name_String (Units.Table (First_Unit_Entry).Uname);
+ declare
+ Callee_Name : String renames Name_Buffer (1 .. Name_Len - 2);
+ -- strip trailing "%b"
+ begin
+ if ALIs.Table (ALIs.First).Main_Program = Proc then
+ WBI (" " & Callee_Name & ";");
+ else
+ WBI (" Result := " & Callee_Name & ";");
+ end if;
+ end;
+ elsif ALIs.Table (ALIs.First).Main_Program = Proc then
WBI (" Ada_Main_Program;");
else
WBI (" Result := Ada_Main_Program;");
@@ -3062,6 +3075,13 @@ package body Bindgen is
WBI ("with Ada.Exceptions;");
end if;
+ if CodePeer_Mode then
+ -- For CodePeer, main program is not called via an Import pragma.
+ Get_Name_String (Units.Table (First_Unit_Entry).Uname);
+ WBI ("with " & Name_Buffer (1 .. Name_Len - 2) & ";");
+ -- strip trailing "%b"
+ end if;
+
WBI ("");
WBI ("package body " & Ada_Main & " is");
WBI (" pragma Warnings (Off);");