2011-08-02 Vincent Celier <celier@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 Aug 2011 15:36:49 +0000 (15:36 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 Aug 2011 15:36:49 +0000 (15:36 +0000)
* adaint.c (file_names_case_sensitive_cache): New static int.
(__gnat_get_file_names_case_sensitive): Cache the return value in
file_names_case_sensitive_cache at the first invocation, to avoid
multiple calls to getenv.

2011-08-02  Bob Duff  <duff@adacore.com>

* sem_ch12.adb (Validate_Derived_Type_Instance): Implement AI05-0218-1.

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

gcc/ada/ChangeLog
gcc/ada/adaint.c
gcc/ada/sem_ch12.adb

index b74d7a5..bafa761 100644 (file)
@@ -1,3 +1,14 @@
+2011-08-02  Vincent Celier  <celier@adacore.com>
+
+       * adaint.c (file_names_case_sensitive_cache): New static int.
+       (__gnat_get_file_names_case_sensitive): Cache the return value in
+       file_names_case_sensitive_cache at the first invocation, to avoid
+       multiple calls to getenv.
+
+2011-08-02  Bob Duff  <duff@adacore.com>
+
+       * sem_ch12.adb (Validate_Derived_Type_Instance): Implement AI05-0218-1.
+
 2011-08-02  Yannick Moy  <moy@adacore.com>
 
        * sem_ch3.adb, sem_ch5.adb, sem_ch9.adb, sem_prag.adb, sem.ads,
index 446f500..bfaa31a 100644 (file)
@@ -592,21 +592,27 @@ __gnat_get_maximum_file_name_length (void)
 
 /* Return nonzero if file names are case sensitive.  */
 
+static int file_names_case_sensitive_cache = -1;
+
 int
 __gnat_get_file_names_case_sensitive (void)
 {
-  const char *sensitive = getenv ("GNAT_FILE_NAME_CASE_SENSITIVE");
+  if (file_names_case_sensitive_cache == -1)
+    {
+      const char *sensitive = getenv ("GNAT_FILE_NAME_CASE_SENSITIVE");
 
-  if (sensitive != NULL
-      && (sensitive[0] == '0' || sensitive[0] == '1')
-      && sensitive[1] == '\0')
-    return sensitive[0] - '0';
-  else
+      if (sensitive != NULL
+          && (sensitive[0] == '0' || sensitive[0] == '1')
+          && sensitive[1] == '\0')
+        file_names_case_sensitive_cache = sensitive[0] - '0';
+      else
 #if defined (VMS) || defined (WINNT) || defined (__APPLE__)
-    return 0;
+        file_names_case_sensitive_cache = 0;
 #else
-    return 1;
+        file_names_case_sensitive_cache = 1;
 #endif
+    }
+  return file_names_case_sensitive_cache;
 }
 
 /* Return nonzero if environment variables are case sensitive.  */
index 22c8bc3..3c93ca3 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2010, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2011, 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- --
@@ -9835,17 +9835,15 @@ package body Sem_Ch12 is
             end if;
          end if;
 
-         --  Perform atomic/volatile checks (RM C.6(12))
+         --  Perform atomic/volatile checks (RM C.6(12)). Note that AI05-0218-1
+         --  removes the second instance of the phrase "or allow pass by copy".
 
          if Is_Atomic (Act_T) and then not Is_Atomic (Ancestor) then
             Error_Msg_N
               ("cannot have atomic actual type for non-atomic formal type",
                Actual);
 
-         elsif Is_Volatile (Act_T)
-           and then not Is_Volatile (Ancestor)
-           and then Is_By_Reference_Type (Ancestor)
-         then
+         elsif Is_Volatile (Act_T) and then not Is_Volatile (Ancestor) then
             Error_Msg_N
               ("cannot have volatile actual type for non-volatile formal type",
                Actual);