From b191a12525973bac726397a591bbd636dc465e07 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Tue, 2 Aug 2011 17:36:49 +0200 Subject: [PATCH] [multiple changes] 2011-08-02 Vincent Celier * 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 * sem_ch12.adb (Validate_Derived_Type_Instance): Implement AI05-0218-1. From-SVN: r177189 --- gcc/ada/ChangeLog | 11 +++++++++++ gcc/ada/adaint.c | 22 ++++++++++++++-------- gcc/ada/sem_ch12.adb | 10 ++++------ 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index b74d7a5faf7..bafa761e5eb 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,14 @@ +2011-08-02 Vincent Celier + + * 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 + + * sem_ch12.adb (Validate_Derived_Type_Instance): Implement AI05-0218-1. + 2011-08-02 Yannick Moy * sem_ch3.adb, sem_ch5.adb, sem_ch9.adb, sem_prag.adb, sem.ads, diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c index 446f50018da..bfaa31a941a 100644 --- a/gcc/ada/adaint.c +++ b/gcc/ada/adaint.c @@ -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. */ diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index 22c8bc3f580..3c93ca3f84b 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -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); -- 2.30.2