[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Wed, 21 Dec 2011 12:03:53 +0000 (13:03 +0100)
committerArnaud Charlet <charlet@gcc.gnu.org>
Wed, 21 Dec 2011 12:03:53 +0000 (13:03 +0100)
2011-12-21  Thomas Quinot  <quinot@adacore.com>

* thread.c, s-oscons-tmplt.c, init.c (pthread_condattr_setclock): For
AIX 5.2, define as a dummy weak symbol in init.c.
(CLOCK_RT_Ada): Set to CLOCK_MONOTONIC on all versions of AIX.

2011-12-21  Thomas Quinot  <quinot@adacore.com>

* snames.ads-tmpl, sem_ch8.adb: Minor reformatting.
* sem_prag.adb: Minor comment clarification.

2011-12-21  Vincent Celier  <celier@adacore.com>

* prj-nmsc.adb (Report_No_Sources): New argument Lang for the
language name as a Name_Id. Do not report no sources if language
is not allowed.
(Add_Source): Do not add source if language is not allowed.
* prj.adb (Add_Restricted_Language): New procedure
(Is_Allowed_Language): New function
* prj.ads (Add_Restricted_Language): New procedure
(Is_Allowed_Language): New function

From-SVN: r182577

gcc/ada/ChangeLog
gcc/ada/init.c
gcc/ada/prj-nmsc.adb
gcc/ada/prj.adb
gcc/ada/prj.ads
gcc/ada/s-oscons-tmplt.c
gcc/ada/sem_ch8.adb
gcc/ada/sem_prag.adb
gcc/ada/snames.ads-tmpl
gcc/ada/thread.c

index a60b9e339570b9093979d6c33ef0fbe9afa16c01..40a663ffdb3f94ef493e9964dea4b27aec4d6d58 100644 (file)
@@ -1,3 +1,25 @@
+2011-12-21  Thomas Quinot  <quinot@adacore.com>
+
+       * thread.c, s-oscons-tmplt.c, init.c (pthread_condattr_setclock): For
+       AIX 5.2, define as a dummy weak symbol in init.c.
+       (CLOCK_RT_Ada): Set to CLOCK_MONOTONIC on all versions of AIX.
+
+2011-12-21  Thomas Quinot  <quinot@adacore.com>
+
+       * snames.ads-tmpl, sem_ch8.adb: Minor reformatting.
+       * sem_prag.adb: Minor comment clarification.
+
+2011-12-21  Vincent Celier  <celier@adacore.com>
+
+       * prj-nmsc.adb (Report_No_Sources): New argument Lang for the
+       language name as a Name_Id. Do not report no sources if language
+       is not allowed.
+       (Add_Source): Do not add source if language is not allowed.
+       * prj.adb (Add_Restricted_Language): New procedure
+       (Is_Allowed_Language): New function
+       * prj.ads (Add_Restricted_Language): New procedure
+       (Is_Allowed_Language): New function
+
 2011-12-21  Robert Dewar  <dewar@adacore.com>
 
        * exp_ch5.adb, sem_dim.adb, sem_dim.ads, sem_ch12.adb, prj-conf.adb:
index cc6c1d2c50bf8932297a0de1ab1321c99dbf81ad..9c11d6b3d9e0a3c0702a372587a5ccd17a534263 100644 (file)
@@ -219,6 +219,19 @@ nanosleep (struct timestruc_t *Rqtp, struct timestruc_t *Rmtp)
 
 #endif /* _AIXVERSION_430 */
 
+/* Version of AIX before 5.3 don't have pthread_condattr_setclock:
+ * supply it as a weak symbol here so that if linking on a 5.3 or newer
+ * machine, we get the real one.
+ */
+
+#ifndef _AIXVERSION_530
+#pragma weak pthread_condattr_setclock
+int
+pthread_condattr_setclock (pthread_condattr_t *attr, clockid_t cl) {
+  return 0;
+}
+#endif
+
 static void
 __gnat_error_handler (int sig,
                      siginfo_t *si ATTRIBUTE_UNUSED,
index 678b6e9f9914bdaf9bc46ee45a64a7cc6897746d..af725de81e634c10784ba17f93bb0ef15926a368 100644 (file)
@@ -486,6 +486,7 @@ package body Prj.Nmsc is
 
    procedure Report_No_Sources
      (Project      : Project_Id;
+      Lang         : Name_Id;
       Lang_Name    : String;
       Data         : Tree_Processing_Data;
       Location     : Source_Ptr;
@@ -642,6 +643,13 @@ package body Prj.Nmsc is
       Source_To_Replace : Source_Id := No_Source;
 
    begin
+      --  Nothing to do if the language is not one of the restricted ones
+
+      if not Is_Allowed_Language (Lang_Id.Name) then
+         Id := No_Source;
+         return;
+      end if;
+
       --  Check if the same file name or unit is used in the prj tree
 
       Add_Src := True;
@@ -1020,6 +1028,56 @@ package body Prj.Nmsc is
      (Project : Project_Id;
       Data    : in out Tree_Processing_Data)
    is
+      procedure Check_Aggregate
+        (Project : Project_Id;
+         Data    : in out Tree_Processing_Data);
+      --  Check the aggregate project attributes, reject any not supported
+      --  attributes.
+
+      ---------------------
+      -- Check_Aggregate --
+      ---------------------
+
+      procedure Check_Aggregate
+        (Project : Project_Id;
+         Data    : in out Tree_Processing_Data)
+      is
+
+         procedure Check_Not_Defined (Name : Name_Id);
+         --  Report an error if Var is defined
+
+         -----------------------
+         -- Check_Not_Defined --
+         -----------------------
+
+         procedure Check_Not_Defined (Name : Name_Id) is
+            Var : constant Prj.Variable_Value :=
+                    Prj.Util.Value_Of
+                      (Name,
+                       Project.Decl.Attributes,
+                       Data.Tree.Shared);
+         begin
+            if not Var.Default then
+               Error_Msg_Name_1 := Name;
+               Error_Msg
+                 (Data.Flags, "wrong attribute %% in aggregate library",
+                  Var.Location, Project);
+            end if;
+         end Check_Not_Defined;
+
+      begin
+         Check_Not_Defined (Snames.Name_Library_Dir);
+         Check_Not_Defined (Snames.Name_Library_Interface);
+         Check_Not_Defined (Snames.Name_Library_Name);
+         Check_Not_Defined (Snames.Name_Library_Ali_Dir);
+         Check_Not_Defined (Snames.Name_Library_Src_Dir);
+         Check_Not_Defined (Snames.Name_Library_Options);
+         Check_Not_Defined (Snames.Name_Library_Standalone);
+         Check_Not_Defined (Snames.Name_Library_Kind);
+         Check_Not_Defined (Snames.Name_Leading_Library_Options);
+         Check_Not_Defined (Snames.Name_Library_Version);
+      end Check_Aggregate;
+
       Shared   : constant Shared_Project_Tree_Data_Access := Data.Tree.Shared;
       Prj_Data : Project_Processing_Data;
 
@@ -1058,7 +1116,12 @@ package body Prj.Nmsc is
 
       Check_Configuration (Project, Data);
 
-      if Project.Qualifier /= Aggregate then
+      if Project.Qualifier = Aggregate then
+         --  For aggregate project checks that no library attributes are
+         --  defined.
+         Check_Aggregate (Project, Data);
+
+      else
          Check_Library_Attributes (Project, Data);
          Check_Package_Naming (Project, Data);
 
@@ -7745,6 +7808,7 @@ package body Prj.Nmsc is
                   if Source = No_Source then
                      Report_No_Sources
                        (Project.Project,
+                        Language.Name,
                         Get_Name_String (Language.Display_Name),
                         Data,
                         Project.Source_List_File_Location,
@@ -8191,21 +8255,23 @@ package body Prj.Nmsc is
 
    procedure Report_No_Sources
      (Project      : Project_Id;
+      Lang         : Name_Id;
       Lang_Name    : String;
       Data         : Tree_Processing_Data;
       Location     : Source_Ptr;
       Continuation : Boolean := False)
    is
    begin
-      case Data.Flags.When_No_Sources is
+      if Is_Allowed_Language (Lang) then
+         case Data.Flags.When_No_Sources is
          when Silent =>
             null;
 
          when Warning | Error =>
             declare
                Msg : constant String :=
-                       "<there are no "
-                       & Lang_Name & " sources in this project";
+                      "<there are no "
+                      & Lang_Name & " sources in this project";
 
             begin
                Error_Msg_Warn := Data.Flags.When_No_Sources = Warning;
@@ -8216,7 +8282,8 @@ package body Prj.Nmsc is
                   Error_Msg (Data.Flags, Msg, Location, Project);
                end if;
             end;
-      end case;
+         end case;
+      end if;
    end Report_No_Sources;
 
    ----------------------
index 7795cc9c50551d5f001502a6cfaae02ba196e7ad..fc5b34ca8612d900038f00a856bb90de2af2a3ad 100644 (file)
@@ -42,6 +42,17 @@ with GNAT.HTable;
 
 package body Prj is
 
+   type Restricted_Lang;
+   type Restricted_Lang_Access is access Restricted_Lang;
+   type Restricted_Lang is record
+      Name : Name_Id;
+      Next : Restricted_Lang_Access;
+   end record;
+
+   Restricted_Languages : Restricted_Lang_Access := null;
+   --  When null, all languages are allowed, otherwise only the languages in
+   --  the list are allowed.
+
    Object_Suffix : constant String := Get_Target_Object_Suffix.all;
    --  File suffix for object files
 
@@ -86,6 +97,20 @@ package body Prj is
    function Contains_ALI_Files (Dir : Path_Name_Type) return Boolean;
    --  Return True if there is at least one ALI file in the directory Dir
 
+   -----------------------------
+   -- Add_Restricted_Language --
+   -----------------------------
+
+   procedure Add_Restricted_Language (Name : String) is
+      N : String (1 .. Name'Length) := Name;
+   begin
+      To_Lower (N);
+      Name_Len := 0;
+      Add_Str_To_Name_Buffer (N);
+      Restricted_Languages :=
+        new Restricted_Lang'(Name => Name_Find, Next => Restricted_Languages);
+   end Add_Restricted_Language;
+
    -------------------
    -- Add_To_Buffer --
    -------------------
@@ -360,6 +385,30 @@ package body Prj is
       return Name_Find;
    end Extend_Name;
 
+   -------------------------
+   -- Is_Allowed_Language --
+   -------------------------
+
+   function Is_Allowed_Language (Name : Name_Id) return Boolean is
+      R : Restricted_Lang_Access := Restricted_Languages;
+      Lang : constant String := Get_Name_String (Name);
+   begin
+      if R = null then
+         return True;
+
+      else
+         while R /= null loop
+            if Get_Name_String (R.Name) = Lang then
+               return True;
+            end if;
+
+            R := R.Next;
+         end loop;
+
+         return False;
+      end if;
+   end Is_Allowed_Language;
+
    ---------------------
    -- Project_Changed --
    ---------------------
@@ -1549,7 +1598,9 @@ package body Prj is
    procedure Debug_Output (Str : String) is
    begin
       if Current_Verbosity > Default then
+         Set_Standard_Error;
          Write_Line ((1 .. Debug_Level * 2 => ' ') & Str);
+         Set_Standard_Output;
       end if;
    end Debug_Output;
 
@@ -1560,7 +1611,9 @@ package body Prj is
    procedure Debug_Indent is
    begin
       if Current_Verbosity = High then
+         Set_Standard_Error;
          Write_Str ((1 .. Debug_Level * 2 => ' '));
+         Set_Standard_Output;
       end if;
    end Debug_Indent;
 
@@ -1572,6 +1625,7 @@ package body Prj is
    begin
       if Current_Verbosity = High then
          Debug_Indent;
+         Set_Standard_Error;
          Write_Str (Str);
 
          if Str2 = No_Name then
@@ -1579,6 +1633,7 @@ package body Prj is
          else
             Write_Line (" """ & Get_Name_String (Str2) & '"');
          end if;
+         Set_Standard_Output;
       end if;
    end Debug_Output;
 
index 7b9c0db7d943075d9c7eb5865e3a5a71b55bf4b0..760e61f0a2257f87a266c10d131600a974a48a4c 100644 (file)
@@ -41,6 +41,14 @@ with GNAT.OS_Lib;          use GNAT.OS_Lib;
 
 package Prj is
 
+   procedure Add_Restricted_Language (Name : String);
+   --  Call by gprbuild for each language specify by switch
+   --  --restricted-to-languages=.
+
+   function Is_Allowed_Language (Name : Name_Id) return Boolean;
+   --  Returns True if --restricted-to-languages= is not used or if Name
+   --  is one of the restricted languages.
+
    All_Other_Names : constant Name_Id := Names_High_Bound;
    --  Name used to replace others as an index of an associative array
    --  attribute in situations where this is allowed.
@@ -1370,6 +1378,10 @@ package Prj is
       Extended  : Project_Id) return Boolean;
    --  Return True if Extending is extending the Extended project
 
+   function Is_Ext
+     (Extending : Project_Id;
+      Extended  : Project_Id) return Boolean renames Is_Extending;
+
    function Has_Ada_Sources (Data : Project_Id) return Boolean;
    --  Return True if the project has Ada sources
 
index 143067c9926730d739d2ad41850f300e063964dc..5f6782054262af43e64d31cfffbb9c9733edecb9 100644 (file)
@@ -1379,7 +1379,7 @@ CND(CLOCK_THREAD_CPUTIME_ID, "Thread CPU clock")
 /* There's no clock_gettime or clock_id's on Darwin, generate a dummy value */
 # define CLOCK_RT_Ada "-1"
 
-#elif defined(FreeBSD) || (defined(_AIX) && defined(_AIXVERSION_530))
+#elif defined(FreeBSD) || defined(_AIX)
 /** On these platforms use system provided monotonic clock instead of
  ** the default CLOCK_REALTIME. We then need to set up cond var attributes
  ** appropriately (see thread.c).
index 8134973d8009a5a917cc6c06e82a8cf889007520..28edc2f857891cd8964f26950ca25fba3fabdd32 100644 (file)
@@ -8031,7 +8031,7 @@ package body Sem_Ch8 is
          end if;
       end Use_Class_Wide_Operations;
 
-   --  Start of processing for Use_One_Type;
+   --  Start of processing for Use_One_Type
 
    begin
       --  It is the type determined by the subtype mark (8.4(8)) whose
index 49460d00b9600dbf700cc817d9aa28a397cc8b6d..a36af20cab3f5ff1b84ff3d3a01183b850a54b5f 100644 (file)
@@ -14887,7 +14887,8 @@ package body Sem_Prag is
    -----------------------------------------
 
    --  This function makes use of the following static table which indicates
-   --  whether a given pragma is significant.
+   --  whether appearance of some name in a given pragma is to be considered
+   --  as a reference for the purposes of warnings about unreferenced objects.
 
    --  -1  indicates that references in any argument position are significant
    --  0   indicates that appearance in any argument is not significant
index f29490f263272a00f1138a678b742999cc5eec8b..a130784b7cb0bb6b99265088a3f417f4ca8434ae 100644 (file)
@@ -35,8 +35,8 @@ package Snames is
 
 --  This package contains definitions of standard names (i.e. entries in the
 --  Names table) that are used throughout the GNAT compiler. It also contains
---  the definitions of some enumeration types whose definitions are tied to
---  the order of these preset names.
+--  the definitions of some enumeration types whose definitions are tied to the
+--  order of these preset names.
 
    ------------------
    -- Preset Names --
@@ -51,13 +51,13 @@ package Snames is
    --  additional pragmas or attributes are introduced which might otherwise
    --  cause a duplicate, then list it only once in this table, and adjust the
    --  definition of the functions for testing for pragma names and attribute
-   --  names, and returning their ID values. Of course everything is simpler
-   --  if no such duplications occur!
+   --  names, and returning their ID values. Of course everything is simpler if
+   --  no such duplications occur!
 
    --  First we have the one character names used to optimize the lookup
    --  process for one character identifiers (to avoid the hashing in this
-   --  case) There are a full 256 of these, but only the entries for lower
-   --  case and upper case letters have identifiers
+   --  case) There are a full 256 of these, but only the entries for lower case
+   --  and upper case letters have identifiers
 
    --  The lower case letter entries are used for one character identifiers
    --  appearing in the source, for example in pragma Interface (C).
@@ -90,8 +90,8 @@ package Snames is
    Name_Z : constant Name_Id := First_Name_Id + Character'Pos ('z');
 
    --  The upper case letter entries are used by expander code for local
-   --  variables that do not require unique names (e.g. formal parameter
-   --  names in constructed procedures)
+   --  variables that do not require unique names (e.g. formal parameter names
+   --  in constructed procedures).
 
    Name_uA : constant Name_Id := First_Name_Id + Character'Pos ('A');
    Name_uB : constant Name_Id := First_Name_Id + Character'Pos ('B');
@@ -291,9 +291,9 @@ package Snames is
    Name_Obj_TypeCode                   : constant Name_Id := N + $;
    Name_Stub                           : constant Name_Id := N + $;
 
-   --  Operator Symbol entries. The actual names have an upper case O at
-   --  the start in place of the Op_ prefix (e.g. the actual name that
-   --  corresponds to Name_Op_Abs is "Oabs".
+   --  Operator Symbol entries. The actual names have an upper case O at the
+   --  start in place of the Op_ prefix (e.g. the actual name that corresponds
+   --  to Name_Op_Abs is "Oabs".
 
    First_Operator_Name                 : constant Name_Id := N + $;
    Name_Op_Abs                         : constant Name_Id := N + $; -- "abs"
@@ -325,21 +325,21 @@ package Snames is
 
    --  The entries marked GNAT are pragmas that are defined by GNAT and that
    --  are implemented in all modes (Ada 83, Ada 95, and Ada 2005) Complete
-   --  descriptions of the syntax of these implementation dependent pragmas
-   --  may be found in the appropriate section in unit Sem_Prag in file
+   --  descriptions of the syntax of these implementation dependent pragmas may
+   --  be found in the appropriate section in unit Sem_Prag in file
    --  sem-prag.adb, and they are documented in the GNAT reference manual.
 
-   --  The entries marked Ada 05 are Ada 2005 pragmas. They are implemented
-   --  in Ada 83 and Ada 95 mode as well, where they are technically considered
-   --  to be implementation dependent pragmas.
+   --  The entries marked Ada 05 are Ada 2005 pragmas. They are implemented in
+   --  Ada 83 and Ada 95 mode as well, where they are technically considered to
+   --  be implementation dependent pragmas.
 
-   --  The entries marked Ada 12 are Ada 2012 pragmas. They are implemented
-   --  in Ada 83, Ada 95, and Ada 2005 mode as well, where they are technically
+   --  The entries marked Ada 12 are Ada 2012 pragmas. They are implemented in
+   --  Ada 83, Ada 95, and Ada 2005 mode as well, where they are technically
    --  considered to be implementation dependent pragmas.
 
-   --  The entries marked VMS are VMS specific pragmas that are recognized
-   --  only in OpenVMS versions of GNAT. They are ignored in other versions
-   --  with an appropriate warning.
+   --  The entries marked VMS are VMS specific pragmas that are recognized only
+   --  in OpenVMS versions of GNAT. They are ignored in other versions with an
+   --  appropriate warning.
 
    --  The entries marked AAMP are AAMP specific pragmas that are recognized
    --  only in GNAT for the AAMP. They are ignored in other versions with
@@ -381,11 +381,11 @@ package Snames is
    Name_Extensions_Allowed             : constant Name_Id := N + $; -- GNAT
    Name_External_Name_Casing           : constant Name_Id := N + $; -- GNAT
 
-   --  Note: Fast_Math is not in this list because its name matches   -- GNAT
-   --  the name of the corresponding attribute. However, it is
-   --  included in the definition of the type Pragma_Id, and the
-   --  functions Get_Pragma_Id, Is_[Configuration_]Pragma_Id, and
-   --  correctly recognize and process Fast_Math.
+   --  Note: Fast_Math is not in this list because its name matches the name of
+   --  the corresponding attribute. However, it is included in the definition
+   --  of the type Pragma_Id, and the functions Get_Pragma_Id,
+   --  Is_[Configuration_]Pragma_Id, and correctly recognize and process
+   --  Fast_Math.
 
    Name_Favor_Top_Level                : constant Name_Id := N + $; -- GNAT
    Name_Float_Representation           : constant Name_Id := N + $; -- GNAT
@@ -432,11 +432,10 @@ package Snames is
    Name_Abort_Defer                    : constant Name_Id := N + $; -- GNAT
    Name_All_Calls_Remote               : constant Name_Id := N + $;
 
-   --  Note: AST_Entry is not in this list because its name matches -- VMS
-   --  the name of the corresponding attribute. However, it is
-   --  included in the definition of the type Pragma_Id, and the
-   --  functions Get_Pragma_Id and Is_Pragma_Id correctly recognize
-   --  and process Name_AST_Entry.
+   --  Note: AST_Entry is not in this list because its name matches the name of
+   --  the corresponding attribute. However, it is included in the definition
+   --  of the type Pragma_Id, and the functions Get_Pragma_Id and Is_Pragma_Id
+   --  correctly recognize and process Name_AST_Entry.
 
    Name_Assert                         : constant Name_Id := N + $; -- Ada 05
    Name_Asynchronous                   : constant Name_Id := N + $;
@@ -485,11 +484,10 @@ package Snames is
    Name_Inline_Generic                 : constant Name_Id := N + $; -- GNAT
    Name_Inspection_Point               : constant Name_Id := N + $;
 
-   --  Note: Interface is not in this list because its name         -- GNAT
-   --  matches an Ada 05 keyword. However it is included in
-   --  the definition of the type Attribute_Id, and the functions
-   --  Get_Pragma_Id and Is_Pragma_Id correctly recognize and
-   --  process Name_Storage_Size.
+   --  Note: Interface is not in this list because its name matches an Ada 05
+   --  keyword. However it is included in the definition of the type
+   --  Attribute_Id, and the functions Get_Pragma_Id and Is_Pragma_Id correctly
+   --  recognize and process Name_Storage_Size.
 
    Name_Interface_Name                 : constant Name_Id := N + $; -- GNAT
    Name_Interrupt_Handler              : constant Name_Id := N + $;
@@ -524,11 +522,11 @@ package Snames is
    Name_Preelaborate                   : constant Name_Id := N + $;
    Name_Preelaborate_05                : constant Name_Id := N + $; -- GNAT
 
-   --  Note: Priority is not in this list because its name matches
-   --  the name of the corresponding attribute. However, it is
-   --  included in the definition of the type Pragma_Id, and the
-   --  functions Get_Pragma_Id and Is_Pragma_Id correctly recognize
-   --  and process Priority. Priority is a standard Ada 95 pragma.
+   --  Note: Priority is not in this list because its name matches the name of
+   --  the corresponding attribute. However, it is included in the definition
+   --  of the type Pragma_Id, and the functions Get_Pragma_Id and Is_Pragma_Id
+   --  correctly recognize and process Priority. Priority is a standard Ada 95
+   --  pragma.
 
    Name_Psect_Object                   : constant Name_Id := N + $; -- VMS
    Name_Pure                           : constant Name_Id := N + $;
@@ -542,14 +540,13 @@ package Snames is
    Name_Shared                         : constant Name_Id := N + $; -- Ada 83
    Name_Shared_Passive                 : constant Name_Id := N + $;
 
-   --  Note: Storage_Size is not in this list because its name
-   --  matches the name of the corresponding attribute. However,
-   --  it is included in the definition of the type Attribute_Id,
-   --  and the functions Get_Pragma_Id and Is_Pragma_Id correctly
-   --  recognize and process Name_Storage_Size.
+   --  Note: Storage_Size is not in this list because its name matches the name
+   --  of the corresponding attribute. However, it is included in the
+   --  definition of the type Attribute_Id, and the functions Get_Pragma_Id and
+   --  Is_Pragma_Id correctly recognize and process Name_Storage_Size.
 
-   --  Note: Storage_Unit is also omitted from the list because
-   --  of a clash with an attribute name, and is treated similarly.
+   --  Note: Storage_Unit is also omitted from the list because of a clash with
+   --  an attribute name, and is treated similarly.
 
    Name_Source_Reference               : constant Name_Id := N + $; -- GNAT
    Name_Static_Elaboration_Desired     : constant Name_Id := N + $; -- GNAT
@@ -580,8 +577,8 @@ package Snames is
 
    --  Language convention names for pragma Convention/Export/Import/Interface
    --  Note that Name_C is not included in this list, since it was already
-   --  declared earlier in the context of one-character identifier names
-   --  (where the order is critical to the fast look up process).
+   --  declared earlier in the context of one-character identifier names (where
+   --  the order is critical to the fast look up process).
 
    --  Note: there are no convention names corresponding to the conventions
    --  Entry and Protected, this is because these conventions cannot be
@@ -721,10 +718,10 @@ package Snames is
    --  are attributes that are defined in Ada 83, but not in Ada 95. These
    --  attributes are implemented in both Ada 83 and Ada 95 modes in GNAT.
 
-   --  The entries marked GNAT are attributes that are defined by GNAT
-   --  and implemented in both Ada 83 and Ada 95 modes. Full descriptions
-   --  of these implementation dependent attributes may be found in the
-   --  appropriate section in package Sem_Attr in file sem-attr.ads.
+   --  The entries marked GNAT are attributes that are defined by GNAT and
+   --  implemented in both Ada 83 and Ada 95 modes. Full descriptions of these
+   --  implementation dependent attributes may be found in the appropriate
+   --  section in Sem_Attr.
 
    --  The entries marked VMS are recognized only in OpenVMS implementations
    --  of GNAT, and are treated as illegal in all other contexts.
@@ -900,8 +897,8 @@ package Snames is
 
    --  Remaining attributes are ones that return entities
 
-   --  Note that Elab_Subp_Body is not considered to be a valid attribute
-   --  name unless we are operating in CodePeer mode.
+   --  Note that Elab_Subp_Body is not considered to be a valid attribute name
+   --  unless we are operating in CodePeer mode.
 
    First_Entity_Attribute_Name         : constant Name_Id := N + $;
    Name_Elab_Body                      : constant Name_Id := N + $; -- GNAT
@@ -929,9 +926,9 @@ package Snames is
 
    --  Names of recognized queuing policy identifiers
 
-   --  Note: policies are identified by the first character of the
-   --  name (e.g. F for FIFO_Queuing). If new policy names are added,
-   --  the first character must be distinct.
+   --  Note: policies are identified by the first character of the name (e.g. F
+   --  for FIFO_Queuing). If new policy names are added, the first character
+   --  must be distinct.
 
    First_Queuing_Policy_Name           : constant Name_Id := N + $;
    Name_FIFO_Queuing                   : constant Name_Id := N + $;
@@ -940,9 +937,9 @@ package Snames is
 
    --  Names of recognized task dispatching policy identifiers
 
-   --  Note: policies are identified by the first character of the
-   --  name (e.g. F for FIFO_Within_Priorities). If new policy names
-   --  are added, the first character must be distinct.
+   --  Note: policies are identified by the first character of the name (e.g. F
+   --  for FIFO_Within_Priorities). If new policy names are added, the first
+   --  character must be distinct.
 
    First_Task_Dispatching_Policy_Name    : constant Name_Id := N + $;
    Name_EDF_Across_Priorities            : constant Name_Id := N + $;
@@ -1088,8 +1085,8 @@ package Snames is
    Name_Raise_Exception                  : constant Name_Id := N + $;
 
    --  Additional reserved words and identifiers used in GNAT Project Files
-   --  Note that Name_External is already previously declared
-   --  The names with the -- GB annotation are only used in gprbuild
+   --  Note that Name_External is already previously declared.
+   --  The names with the -- GB annotation are only used in gprbuild.
 
    Name_Aggregate                          : constant Name_Id := N + $;
    Name_Archive_Builder                    : constant Name_Id := N + $;
index a55accefef0ed4b7d137f3ea432e9d334cfb35e7..87d7603cfa095ad144c500fb520b966c29519d45 100644 (file)
 # include <pthread.h>
 # include <time.h>
 
+#ifndef _AIXVERSION_530
+/* We use the same runtime library for AIX 5.2 and 5.3, but pthread_condattr_
+ * setclock exists only on the latter, so for the former provide a dummy
+ * implementation (declared below, weak symbol defined in init.c).
+ *
+ * Note: this means that under AIX 5.2 we'll be using CLOCK_MONOTONIC
+ * timestamps from clock_gettime() as arguments to pthread_cond_timedwait,
+ * which expects a CLOCK_REALTIME value, which is technically wrong, but
+ * inocuous in practice on that particular platform since both clocks happen
+ * to use close epochs.
+ */
+
+extern int pthread_condattr_setclock (pthread_condattr_t *attr, clockid_t cl);
+#endif
+
 int
 __gnat_pthread_condattr_setup(pthread_condattr_t *attr) {
 /*