diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 41b7b0de966..46068b71cd6 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,21 @@ +2012-03-07 Ed Schonberg + + * sem_ch6.adb (Process_Formals): a generic subprogram with + a formal incomplete type does not require a freeze node. + +2012-03-07 Bob Duff + + * sem_util.ads: Minor reformatting. + +2012-03-07 Geert Bosch + + * targparm.ads: New target parameter Atomic_Sync_Default, + defaulting to True. + * targparm.adb (Get_Target_Parameters): Add processing for + Atomic_Sync_Default. + * gnat1drv.adb (Adjust_Global_Switches): Adjust Supress_Options + based on ASD. + 2012-03-07 Javier Miranda * sem_ch3.adb (Analyze_Object_Declaration): If the object diff --git a/gcc/ada/gnat1drv.adb b/gcc/ada/gnat1drv.adb index 7665c2bd39a..7d96468e5f4 100644 --- a/gcc/ada/gnat1drv.adb +++ b/gcc/ada/gnat1drv.adb @@ -345,6 +345,13 @@ procedure Gnat1drv is Suppress_Options (Overflow_Check) := True; end if; + -- Set default for atomic synchronization. As this synchronization + -- between atomic accesses can be expensive, and not typically needed + -- on some targets, an optional target parameter can turn the option + -- off. Note Atomic Synchronization is implemented as check. + + Suppress_Options (Atomic_Synchronization) := not Atomic_Sync_Default; + -- Set switch indicating if we can use N_Expression_With_Actions -- Debug flag -gnatd.X decisively sets usage on diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 10d4a637a79..09d7597c16d 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -10592,9 +10592,15 @@ package body Sem_Ch6 is -- Check is done on package exit. For access to subprograms, -- the use is legal for Taft-amendment types. + -- Ada 2012: tagged incomplete types are allowed as generic + -- formal types. They do not introduce dependencies and the + -- corresponding generic subprogram does not have a delayed + -- freeze, because it does not need a freeze node. + if Is_Tagged_Type (Formal_Type) then if Ekind (Scope (Current_Scope)) = E_Package and then not From_With_Type (Formal_Type) + and then not Is_Generic_Type (Formal_Type) and then not Is_Class_Wide_Type (Formal_Type) then if not Nkind_In diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads index 2ef728d4246..8d3138662de 100644 --- a/gcc/ada/sem_util.ads +++ b/gcc/ada/sem_util.ads @@ -1094,7 +1094,7 @@ package Sem_Util is -- and the one in Nmake are both potentially use-visible, it will cause -- a compilation error. Note that type and value are irrelevant. - N_Return_Statement : constant := -2**33; + N_Return_Statement : constant := -2 ** 33; -- Attempt to prevent accidental uses of N_Return_Statement; similar to -- Make_Return_Statement above. diff --git a/gcc/ada/targparm.adb b/gcc/ada/targparm.adb index 7868446e862..193858ac898 100644 --- a/gcc/ada/targparm.adb +++ b/gcc/ada/targparm.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1999-2011, Free Software Foundation, Inc. -- +-- Copyright (C) 1999-2012, 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- -- @@ -40,6 +40,7 @@ package body Targparm is type Targparm_Tags is (AAM, -- AAMP ACR, -- Always_Compatible_Rep + ASD, -- Atomic_Sync_Default BDC, -- Backend_Divide_Checks BOC, -- Backend_Overflow_Checks CLA, -- Command_Line_Args @@ -75,6 +76,7 @@ package body Targparm is AAM_Str : aliased constant Source_Buffer := "AAMP"; ACR_Str : aliased constant Source_Buffer := "Always_Compatible_Rep"; + ASD_Str : aliased constant Source_Buffer := "Atomic_Sync_Default"; BDC_Str : aliased constant Source_Buffer := "Backend_Divide_Checks"; BOC_Str : aliased constant Source_Buffer := "Backend_Overflow_Checks"; CLA_Str : aliased constant Source_Buffer := "Command_Line_Args"; @@ -110,6 +112,7 @@ package body Targparm is Targparm_Str : constant array (Targparm_Tags) of Buffer_Ptr := (AAM_Str'Access, ACR_Str'Access, + ASD_Str'Access, BDC_Str'Access, BOC_Str'Access, CLA_Str'Access, @@ -548,6 +551,7 @@ package body Targparm is case K is when AAM => AAMP_On_Target := Result; when ACR => Always_Compatible_Rep_On_Target := Result; + when ASD => Atomic_Sync_Default := Result; when BDC => Backend_Divide_Checks_On_Target := Result; when BOC => Backend_Overflow_Checks_On_Target := Result; when CLA => Command_Line_Args_On_Target := Result; @@ -556,6 +560,10 @@ package body Targparm is VM_Target := CLI_Target; Tagged_Type_Expansion := False; end if; + -- This is wrong, this processing should be done in + -- Gnat1drv.Adjust_Global_Switches. It is not the + -- right level for targparm to know about tagged + -- type extension??? when CRT => Configurable_Run_Time_On_Target := Result; when D32 => Duration_32_Bits_On_Target := Result; @@ -568,6 +576,10 @@ package body Targparm is VM_Target := JVM_Target; Tagged_Type_Expansion := False; end if; + -- This is wrong, this processing should be done in + -- Gnat1drv.Adjust_Global_Switches. It is not the + -- right level for targparm to know about tagged + -- type extension??? when MOV => Machine_Overflows_On_Target := Result; when MRN => Machine_Rounds_On_Target := Result; diff --git a/gcc/ada/targparm.ads b/gcc/ada/targparm.ads index 971769b9957..be1c9af0218 100644 --- a/gcc/ada/targparm.ads +++ b/gcc/ada/targparm.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1999-2011, Free Software Foundation, Inc. -- +-- Copyright (C) 1999-2012, 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- -- @@ -388,6 +388,19 @@ package Targparm is -- used at the source level, and the corresponding flag is false, then an -- error message will be issued saying the feature is not supported. + Atomic_Sync_Default : Boolean := True; + -- Access to atomic variables requires memory barrier synchronization in + -- the general case to ensure proper behavior when such accesses are used + -- on a multi-processor to synchronize tasks (e.g. by using spin locks). + -- The setting of this flag determines the default behavior. Normally this + -- is True, which will mean that appropriate synchronization instructions + -- are generated by default. If it is False, then the default will be that + -- these synchronization instructions are not generated. This may be a more + -- appropriate default in some cases, e.g. on embedded targets which do not + -- allow the possibility of multi-processors. The default can be overridden + -- using pragmas Enable/Disable_Atomic_Synchronization and also by use of + -- the debug flags gnat.d and gnatd.e. + Support_Aggregates_On_Target : Boolean := True; -- In the general case, the use of aggregates may generate calls -- to run-time routines in the C library, including memset, memcpy,