2012-03-07 Ed Schonberg <schonberg@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 7 Mar 2012 14:58:43 +0000 (14:58 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 7 Mar 2012 14:58:43 +0000 (14:58 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@185056 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/gnat1drv.adb
gcc/ada/sem_ch6.adb
gcc/ada/sem_util.ads
gcc/ada/targparm.adb
gcc/ada/targparm.ads

index 41b7b0d..46068b7 100644 (file)
@@ -1,3 +1,21 @@
+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
index 7665c2b..7d96468 100644 (file)
@@ -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
index 10d4a63..09d7597 100644 (file)
@@ -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
index 2ef728d..8d31386 100644 (file)
@@ -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.
 
index 7868446..193858a 100644 (file)
@@ -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;
index 971769b..be1c9af 100644 (file)
@@ -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,