+2011-08-04 Arnaud Charlet <charlet@adacore.com>
+
+ * make.adb (Do_Codepeer_Globalize_Step): Removed. Use CodePeer_Mode
+ instead.
+ (CodePeer_Mode_String): New.
+ (Linking_Phase, Binding_Phase): Call gnatlink with -P switch in
+ CodePeer mode.
+ (Scan_Make_Arg): Do not disable binding/linking phase in CodePeer mode.
+ * bindgen.adb (Gen_Elab_Calls_Ada): Ignore subprograms in CodePeer
+ mode, since no useful elaboration subprogram is needed by CodePeer.
+ * gnatlink.adb (Gnatlink): Add support for -P switch (CodePeer mode).
+ In this mode, compile binder file with -gnatC and do stop after this
+ step.
+
+2011-08-04 Vincent Celier <celier@adacore.com>
+
+ * exp_ch7.adb: Minor comment fix.
+
2011-08-04 Robert Dewar <dewar@adacore.com>
* exp_ch7.adb, make.adb, sem_ch10.adb, bindgen.adb, sem_res.adb,
-- The uname_E increment is skipped if this is a separate spec,
-- since it will be done when we process the body.
- else
+ -- Ignore subprograms in CodePeer mode, since no useful
+ -- elaboration subprogram is needed by CodePeer.
+
+ elsif U.Unit_Kind /= 's' or else not CodePeer_Mode then
if Force_Checking_Of_Elaboration_Flags
or Interface_Library_Unit
or not Bind_Main_Program
function Get_Global_Pool_For_Access_Type (T : Entity_Id) return Entity_Id is
begin
-- Access types whose size is smaller than System.Address size can
- -- exit only on VMS. We can't use the usual global pool which returns
+ -- exist only on VMS. We can't use the usual global pool which returns
-- an object of type Address as truncation will make it invalid.
-- To handle this case, VMS has a dedicated global pool that returns
-- addresses that fit into 32 bit accesses.
-- --
-- B o d y --
-- --
--- Copyright (C) 1996-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 1996-2011, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
(Argument (Next_Arg),
Only_If_No_Suffix => True));
+ when 'P' =>
+ Opt.CodePeer_Mode := True;
+
when 'R' =>
Opt.Run_Path_Option := False;
Write_Eol;
Write_Line (" mainprog.ali the ALI file of the main program");
Write_Eol;
- Write_Line (" -f force object file list to be generated");
+ Write_Line (" -f Force object file list to be generated");
Write_Line (" -g Compile binder source file with debug information");
Write_Line (" -n Do not compile the binder source file");
+ Write_Line (" -P Process files for use by CodePeer");
Write_Line (" -R Do not use a run_path_option");
- Write_Line (" -v verbose mode");
- Write_Line (" -v -v very verbose mode");
+ Write_Line (" -v Verbose mode");
+ Write_Line (" -v -v Very verbose mode");
Write_Eol;
Write_Line (" -o nam Use 'nam' as the name of the executable");
Write_Line (" -b target Compile the binder source to run on target");
-- because bindgen uses brackets encoding for all upper
-- half and wide characters in identifier names.
+ -- In addition, in CodePeer mode compile with -gnatC
+
if Ada_Bind_File then
Binder_Options_From_ALI.Increment_Last;
Binder_Options_From_ALI.Table (Binder_Options_From_ALI.Last) :=
Binder_Options_From_ALI.Increment_Last;
Binder_Options_From_ALI.Table (Binder_Options_From_ALI.Last) :=
new String'("-gnatiw");
+
+ if Opt.CodePeer_Mode then
+ Binder_Options_From_ALI.Increment_Last;
+ Binder_Options_From_ALI.Table (Binder_Options_From_ALI.Last) :=
+ new String'("-gnatC");
+ end if;
end if;
-- Locate all the necessary programs and verify required files are present
end Bind_Step;
end if;
+ -- In CodePeer mode, there's nothing left to do after the binder file has
+ -- been compiled.
+
+ if Opt.CodePeer_Mode then
+ return;
+ end if;
+
-- Now, actually link the program
-- Skip this step for now on JVM since the Java interpreter will do
-- with the switches -c, -b and -l. These flags are reset to True for
-- each invocation of procedure Gnatmake.
- Do_Codepeer_Globalize_Step : Boolean := False;
- -- Flag to indicate whether the CodePeer globalizer should be called
-
Shared_String : aliased String := "-shared";
Force_Elab_Flags_String : aliased String := "-F";
+ CodePeer_Mode_String : aliased String := "-P";
No_Shared_Switch : aliased Argument_List := (1 .. 0 => null);
Shared_Switch : aliased Argument_List := (1 => Shared_String'Access);
then
-- If we compile with -gnatC, enable CodePeer globalize step
- Do_Codepeer_Globalize_Step := True;
+ CodePeer_Mode := True;
end if;
end loop;
declare
Str : String renames Args (Arg_Index).all;
begin
- if Do_Codepeer_Globalize_Step
+ if CodePeer_Mode
and then Str'Length > 2
and then Str (Str'First .. Str'First + 1) = "-m"
then
end;
end if;
- -- Add switch -M to gnatlink if buider switch --create-map-file
+ if CodePeer_Mode then
+ Linker_Switches.Increment_Last;
+ Linker_Switches.Table (Linker_Switches.Last) :=
+ new String'(CodePeer_Mode_String);
+ end if;
+
+ -- Add switch -M to gnatlink if builder switch --create-map-file
-- has been specified.
if Map_File /= null then
Args (Last_Arg) := Force_Elab_Flags_String'Access;
end if;
+ if CodePeer_Mode then
+ Last_Arg := Last_Arg + 1;
+ Args (Last_Arg) := CodePeer_Mode_String'Access;
+ end if;
+
if Main_Project /= No_Project then
-- Put all the source directories in ADA_INCLUDE_PATH,
end if;
end loop Multiple_Main_Loop;
- if Do_Codepeer_Globalize_Step then
+ if CodePeer_Mode then
declare
Success : Boolean := False;
-
begin
Globalize (Success);
Add_Switch (Argv, Compiler, And_Save => And_Save);
Operating_Mode := Check_Semantics;
Check_Object_Consistency := False;
- Compile_Only := True;
- Do_Bind_Step := False;
- Do_Link_Step := False;
+
+ if not CodePeer_Mode
+ and then (Argv'Last < 7 or else Argv (7) /= 'C')
+ then
+ Compile_Only := True;
+ Do_Bind_Step := False;
+ Do_Link_Step := False;
+ end if;
elsif Argv (2 .. Argv'Last) = "nostdlib" then