+2012-03-07 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch6.adb (Process_Formals): a generic subprogram with
+ a formal incomplete type does not require a freeze node.
+
+2012-03-07 Bob Duff <duff@adacore.com>
+
+ * sem_util.ads: Minor reformatting.
+
+2012-03-07 Geert Bosch <bosch@adacore.com>
+
+ * 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 <miranda@adacore.com>
* sem_ch3.adb (Analyze_Object_Declaration): If the object
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
-- 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
-- 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.
-- --
-- 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- --
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
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";
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,
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;
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;
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;
-- --
-- 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- --
-- 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,