From 241bea26410d0aec26d5f98d032061d9fa455a74 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Mon, 17 Aug 2009 12:33:58 +0200 Subject: [PATCH] [multiple changes] 2009-08-17 Vasiliy Fofanov * a-calend-vms.adb: Fix typo. 2009-08-17 Tristan Gingold * s-taprop-posix.adb: Round up the stack size to avoid failure on Darwin. 2009-08-17 Gary Dismukes * sem_cat.adb (Validate_Static_Object_Name): Update comment. 2009-08-17 Vincent Celier * make.adb (Arguments_Collected): Unneeded, removed (Change_To_Object_Directory): Use Project directly. Add pragma Assert to ensure caller does not pass in No_Project. (Compile): Add new parameter Project. Let procedure Collect_Arguments_And_Compile provide the proper value. * switch-c.adb: Add documentation for -gnatea and -gnatez 2009-08-17 Ben Brosgol * gnat_ugn.texi: Changed name of package in SAL example, to avoid clash with Ada 2005 reserved word (interface). From-SVN: r150838 --- gcc/ada/ChangeLog | 28 +++++++++++++ gcc/ada/a-calend-vms.adb | 2 +- gcc/ada/gnat_ugn.texi | 4 +- gcc/ada/make.adb | 80 ++++++++++++++------------------------ gcc/ada/s-taprop-posix.adb | 9 ++++- gcc/ada/sem_cat.adb | 6 +-- gcc/ada/switch-c.adb | 15 ++++++- 7 files changed, 83 insertions(+), 61 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index d77bb1afbf4..8dfceb4b01b 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,31 @@ +2009-08-17 Vasiliy Fofanov + + * a-calend-vms.adb: Fix typo. + +2009-08-17 Tristan Gingold + + * s-taprop-posix.adb: Round up the stack size to avoid failure on + Darwin. + +2009-08-17 Gary Dismukes + + * sem_cat.adb (Validate_Static_Object_Name): Update comment. + +2009-08-17 Vincent Celier + + * make.adb (Arguments_Collected): Unneeded, removed + (Change_To_Object_Directory): Use Project directly. Add pragma Assert to + ensure caller does not pass in No_Project. + (Compile): Add new parameter Project. Let procedure + Collect_Arguments_And_Compile provide the proper value. + + * switch-c.adb: Add documentation for -gnatea and -gnatez + +2009-08-17 Ben Brosgol + + * gnat_ugn.texi: Changed name of package in SAL example, to avoid + clash with Ada 2005 reserved word (interface). + 2009-08-17 Robert Dewar * a-crbtgk.adb, a-crdlli.adb, a-direct.adb, a-caldel-vms.adb, diff --git a/gcc/ada/a-calend-vms.adb b/gcc/ada/a-calend-vms.adb index 3daf4e0c185..788ff28a4d0 100644 --- a/gcc/ada/a-calend-vms.adb +++ b/gcc/ada/a-calend-vms.adb @@ -921,7 +921,7 @@ package body Ada.Calendar is -- Step 3: Handle leap second occurrences - tm_Sec := (if Leap_Sec then 60 else Second); + tm_sec := (if Leap_Sec then 60 else Second); end To_Struct_Tm; ------------------ diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index 97e5cf49301..7a65203b7fe 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -19433,7 +19433,7 @@ or @code{pragma Convention}. Here is an example of simple library interface for use with C main program: @smallexample @c ada -package Interface is +package My_Package is procedure Do_Something; pragma Export (C, Do_Something, "do_something"); @@ -19441,7 +19441,7 @@ package Interface is procedure Do_Something_Else; pragma Export (C, Do_Something_Else, "do_something_else"); -end Interface; +end My_Package; @end smallexample @noindent diff --git a/gcc/ada/make.adb b/gcc/ada/make.adb index 59d794cc884..20fc989a015 100644 --- a/gcc/ada/make.adb +++ b/gcc/ada/make.adb @@ -519,10 +519,6 @@ package body Make is Last_Argument : Natural := 0; -- Last index of arguments in Arguments above - Arguments_Collected : Boolean := False; - -- Set to True when the arguments for the next invocation of the compiler - -- have been collected. - Arguments_Project : Project_Id; -- Project id, if any, of the source to be compiled @@ -1359,32 +1355,24 @@ package body Make is -------------------------------- procedure Change_To_Object_Directory (Project : Project_Id) is - Actual_Project : Project_Id; Object_Directory : Path_Name_Type; begin - -- For sources outside of any project, compilation occurs in the object - -- directory of the main project, otherwise we use the project given. - - if Project = No_Project then - Actual_Project := Main_Project; - else - Actual_Project := Project; - end if; + pragma Assert (Project /= No_Project); -- Nothing to do if the current working directory is already the correct -- object directory. - if Project_Of_Current_Object_Directory /= Actual_Project then - Project_Of_Current_Object_Directory := Actual_Project; - Object_Directory := Actual_Project.Object_Directory.Name; + if Project_Of_Current_Object_Directory /= Project then + Project_Of_Current_Object_Directory := Project; + Object_Directory := Project.Object_Directory.Name; -- Set the working directory to the object directory of the actual -- project. if Verbose_Mode then Write_Str ("Changing to object directory of """); - Write_Name (Actual_Project.Display_Name); + Write_Name (Project.Display_Name); Write_Str (""": """); Write_Name (Object_Directory); Write_Line (""""); @@ -1399,9 +1387,9 @@ package body Make is when Directory_Error => Make_Failed ("unable to change to object directory """ & Path_Or_File_Name - (Actual_Project.Object_Directory.Name) & + (Project.Object_Directory.Name) & """ of project " & - Get_Name_String (Actual_Project.Display_Name)); + Get_Name_String (Project.Display_Name)); end Change_To_Object_Directory; ----------- @@ -2201,7 +2189,6 @@ package body Make is Args : Argument_List) is begin - Arguments_Collected := True; Arguments_Project := No_Project; Last_Argument := 0; Add_Arguments (Args); @@ -2502,13 +2489,12 @@ package body Make is procedure Check_Standard_Library; -- Check if s-stalib.adb needs to be compiled - procedure Collect_Arguments_And_Compile - (Source_File : File_Name_Type; - Source_Index : Int); + procedure Collect_Arguments_And_Compile (Source_Index : Int); -- Collect arguments from project file (if any) and compile function Compile - (S : File_Name_Type; + (Project : Project_Id; + S : File_Name_Type; L : File_Name_Type; Source_Index : Int; Args : Argument_List) return Process_Id; @@ -2709,23 +2695,13 @@ package body Make is -- Collect_Arguments_And_Compile -- ----------------------------------- - procedure Collect_Arguments_And_Compile - (Source_File : File_Name_Type; - Source_Index : Int) - is + procedure Collect_Arguments_And_Compile (Source_Index : Int) is begin -- Process_Created will be set True if an attempt is made to compile -- the source, that is if it is not in an externally built project. Process_Created := False; - -- If arguments not yet collected (in Check), collect them now - - if not Arguments_Collected then - Collect_Arguments - (Source_File, Source_Index, Source_File = Main_Source, Args); - end if; - -- If we use mapping file (-P or -C switches), then get one if Create_Mapping_File then @@ -2769,13 +2745,10 @@ package body Make is end; end if; - -- Change to object directory of the project file, if necessary - - Change_To_Object_Directory (Arguments_Project); - Pid := Compile - (File_Name_Type (Arguments_Path_Name), + (Arguments_Project, + File_Name_Type (Arguments_Path_Name), Lib_File, Source_Index, Arguments (1 .. Last_Argument)); @@ -2786,12 +2759,13 @@ package body Make is -- If this is a source outside of any project file, make sure it -- will be compiled in object directory of the main project file. - if Main_Project /= No_Project then - Change_To_Object_Directory (Arguments_Project); - end if; - - Pid := Compile (Full_Source_File, Lib_File, Source_Index, - Arguments (1 .. Last_Argument)); + Pid := + Compile + (Main_Project, + Full_Source_File, + Lib_File, + Source_Index, + Arguments (1 .. Last_Argument)); Process_Created := True; end if; end Collect_Arguments_And_Compile; @@ -2801,7 +2775,8 @@ package body Make is ------------- function Compile - (S : File_Name_Type; + (Project : Project_Id; + S : File_Name_Type; L : File_Name_Type; Source_Index : Int; Args : Argument_List) return Process_Id @@ -2985,6 +2960,12 @@ package body Make is Comp_Last := Comp_Last + 1; Comp_Args (Comp_Last) := new String'(Name_Buffer (1 .. Name_Len)); + -- Change to object directory of the project file, if necessary + + if Project /= No_Project then + Change_To_Object_Directory (Project); + end if; + GNAT.OS_Lib.Normalize_Arguments (Comp_Args (Args'First .. Comp_Last)); Comp_Last := Comp_Last + 1; @@ -3225,8 +3206,6 @@ package body Make is -- The source file that we are checking can be located else - Arguments_Collected := False; - Collect_Arguments (Source_File, Source_Index, Source_File = Main_Source, Args); @@ -3314,8 +3293,7 @@ package body Make is -- Start the compilation and record it. We can do -- this because there is at least one free process. - Collect_Arguments_And_Compile - (Source_File, Source_Index); + Collect_Arguments_And_Compile (Source_Index); -- Make sure we could successfully start -- the Compilation. diff --git a/gcc/ada/s-taprop-posix.adb b/gcc/ada/s-taprop-posix.adb index 8e9ba26ce64..ac147000b7a 100644 --- a/gcc/ada/s-taprop-posix.adb +++ b/gcc/ada/s-taprop-posix.adb @@ -926,6 +926,7 @@ package body System.Task_Primitives.Operations is is Attributes : aliased pthread_attr_t; Adjusted_Stack_Size : Interfaces.C.size_t; + Page_Size : constant Interfaces.C.size_t := Get_Page_Size; Result : Interfaces.C.int; function Thread_Body_Access is new @@ -946,9 +947,15 @@ package body System.Task_Primitives.Operations is -- to be sure the effective stack size is greater than what -- has been asked. - Adjusted_Stack_Size := Adjusted_Stack_Size + 2 * Get_Page_Size; + Adjusted_Stack_Size := Adjusted_Stack_Size + 2 * Page_Size; end if; + -- Round stack size as this is required by some OSes (Darwin) + + Adjusted_Stack_Size := Adjusted_Stack_Size + Page_Size - 1; + Adjusted_Stack_Size := + Adjusted_Stack_Size - Adjusted_Stack_Size mod Page_Size; + Result := pthread_attr_init (Attributes'Access); pragma Assert (Result = 0 or else Result = ENOMEM); diff --git a/gcc/ada/sem_cat.adb b/gcc/ada/sem_cat.adb index d5d38235f36..c8d06e8cfec 100644 --- a/gcc/ada/sem_cat.adb +++ b/gcc/ada/sem_cat.adb @@ -2191,10 +2191,8 @@ package body Sem_Cat is Flag_Non_Static_Expr ("non-static object name in preelaborated unit", N); - -- We take the view that a constant defined in another preelaborated - -- unit is preelaborable, even though it may have a private type and - -- thus appear non-static in a client. This must be the intent of - -- the language, but currently is an RM gap ??? + -- Give an error for a reference to a nonstatic constant, unless the + -- constant is in another GNAT library unit that is preelaborable. elsif Ekind (Entity (N)) = E_Constant and then not Is_Static_Expression (N) diff --git a/gcc/ada/switch-c.adb b/gcc/ada/switch-c.adb index 6825f4ec038..1ecae61a013 100644 --- a/gcc/ada/switch-c.adb +++ b/gcc/ada/switch-c.adb @@ -309,6 +309,11 @@ package body Switch.C is case Switch_Chars (Ptr) is + -- -gnatea (initial delimiter of explicit switches) + -- All switches that come before -gnatea have been added by + -- the GCC driver and are not stored in the ALI file. + -- See also -gnatez below. + when 'a' => Store_Switch := False; Enable_Switch_Storing; @@ -462,14 +467,20 @@ package body Switch.C is Ptr := Max + 1; - -- -gnatez ??? + -- -gnatez (final delimiter of explicit switches) + -- All switches that come after -gnatez have been added by + -- the GCC driver and are not stored in the ALI file. + -- See also -gnatea above. when 'z' => Store_Switch := False; Disable_Switch_Storing; Ptr := Ptr + 1; - -- -gnateS (Store SCO information) + -- -gnateS (generate SCO information) + -- Include Source Coverage Obligation information in ALI + -- files for the benefit of source coverage analysis tools + -- (xcov). when 'S' => Generate_SCO := True;