diff options
author | Vincent Celier <celier@adacore.com> | 2010-09-09 10:24:43 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2010-09-09 12:24:43 +0200 |
commit | 0e35524dec6e62dfe35360f11eee7c7031c5ab2e (patch) | |
tree | 5854c37f793c47152017e57fd9a3f7d8ff206d5c /gcc/ada | |
parent | 099ace5e09a8e7c350cf3c1d0e223db247552eeb (diff) | |
download | gcc-0e35524dec6e62dfe35360f11eee7c7031c5ab2e.tar.gz |
adaint.c: New function __gnat_get_env_vars_case_sensitive...
2010-09-09 Vincent Celier <celier@adacore.com>
* adaint.c: New function __gnat_get_env_vars_case_sensitive, returns 0
for VMS and Windows, and 1 for all other platforms.
* adaint.h: New function __gnat_get_env_vars_case_sensitive
* osint.ads, osint.adb (Canonical_Case_Env_Var_Name): New procedure.
* prj-ext.adb (Add): Call Canonical_Case_Env_Var_Name instead of
Canonical_Case_File_Name, as we are dealing with environment variables,
not files.
From-SVN: r164069
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/ada/adaint.c | 12 | ||||
-rw-r--r-- | gcc/ada/adaint.h | 3 | ||||
-rw-r--r-- | gcc/ada/osint.adb | 26 | ||||
-rw-r--r-- | gcc/ada/osint.ads | 17 | ||||
-rw-r--r-- | gcc/ada/prj-ext.adb | 4 |
6 files changed, 65 insertions, 7 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 914e9672f37..8f4232310ce 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,13 @@ +2010-09-09 Vincent Celier <celier@adacore.com> + + * adaint.c: New function __gnat_get_env_vars_case_sensitive, returns 0 + for VMS and Windows, and 1 for all other platforms. + * adaint.h: New function __gnat_get_env_vars_case_sensitive + * osint.ads, osint.adb (Canonical_Case_Env_Var_Name): New procedure. + * prj-ext.adb (Add): Call Canonical_Case_Env_Var_Name instead of + Canonical_Case_File_Name, as we are dealing with environment variables, + not files. + 2010-09-09 Robert Dewar <dewar@adacore.com> * sem_util.adb: Minor reformatting diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c index cc1dd99ead6..bba176db3fa 100644 --- a/gcc/ada/adaint.c +++ b/gcc/ada/adaint.c @@ -586,6 +586,18 @@ __gnat_get_file_names_case_sensitive (void) #endif } +/* Return nonzero if environment variables are case sensitive. */ + +int +__gnat_get_env_vars_case_sensitive (void) +{ +#if defined (VMS) || defined (WINNT) + return 0; +#else + return 1; +#endif +} + char __gnat_get_default_identifier_character_set (void) { diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h index 7af079e35a9..a43f9b23f4e 100644 --- a/gcc/ada/adaint.h +++ b/gcc/ada/adaint.h @@ -6,7 +6,7 @@ * * * C Header File * * * - * Copyright (C) 1992-2009, Free Software Foundation, Inc. * + * Copyright (C) 1992-2010, 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- * @@ -101,6 +101,7 @@ extern void __gnat_to_gm_time (OS_Time *, int *, int *, extern int __gnat_get_maximum_file_name_length (void); extern int __gnat_get_switches_case_sensitive (void); extern int __gnat_get_file_names_case_sensitive (void); +extern int __gnat_get_env_vars_case_sensitive (void); extern char __gnat_get_default_identifier_character_set (void); extern void __gnat_get_current_dir (char *, int *); extern void __gnat_get_object_suffix_ptr (int *, diff --git a/gcc/ada/osint.adb b/gcc/ada/osint.adb index 75995e3fca4..5ecf7fa615a 100644 --- a/gcc/ada/osint.adb +++ b/gcc/ada/osint.adb @@ -696,15 +696,33 @@ package body Osint is if not File_Names_Case_Sensitive then for J in S'Range loop if S (J) in 'A' .. 'Z' then - S (J) := Character'Val ( - Character'Pos (S (J)) + - Character'Pos ('a') - - Character'Pos ('A')); + S (J) := + Character'Val + (Character'Pos (S (J)) + + (Character'Pos ('a') - Character'Pos ('A'))); end if; end loop; end if; end Canonical_Case_File_Name; + --------------------------------- + -- Canonical_Case_Env_Var_Name -- + --------------------------------- + + procedure Canonical_Case_Env_Var_Name (S : in out String) is + begin + if not Env_Vars_Case_Sensitive then + for J in S'Range loop + if S (J) in 'A' .. 'Z' then + S (J) := Character'Val ( + Character'Pos (S (J)) + + Character'Pos ('a') - + Character'Pos ('A')); + end if; + end loop; + end if; + end Canonical_Case_Env_Var_Name; + --------------------------- -- Create_File_And_Check -- --------------------------- diff --git a/gcc/ada/osint.ads b/gcc/ada/osint.ads index a1d9d05d4c4..ebb1fb14fae 100644 --- a/gcc/ada/osint.ads +++ b/gcc/ada/osint.ads @@ -94,6 +94,23 @@ package Osint is -- this call converts the given string to canonical all lower case form, -- so that two file names compare equal if they refer to the same file. + function Get_Env_Vars_Case_Sensitive return Int; + pragma Import (C, Get_Env_Vars_Case_Sensitive, + "__gnat_get_env_vars_case_sensitive"); + Env_Vars_Case_Sensitive : constant Boolean := + Get_File_Names_Case_Sensitive /= 0; + -- Set to indicate whether the operating system convention is for + -- environment variable names to be case sensitive (e.g., in Unix, set + -- True), or non case sensitive (e.g., in Windows, set False). + + procedure Canonical_Case_Env_Var_Name (S : in out String); + -- Given an environment variable name, converts it to canonical case form. + -- For systems where environment variable names are case sensitive, this + -- procedure has no effect. If environment variable names are not case + -- sensitive, then this call converts the given string to canonical all + -- lower case form, so that two environment variable names compare equal if + -- they refer to the same environment variable. + function Number_Of_Files return Int; -- Gives the total number of filenames found on the command line diff --git a/gcc/ada/prj-ext.adb b/gcc/ada/prj-ext.adb index 51da2a3e82c..d867353ed33 100644 --- a/gcc/ada/prj-ext.adb +++ b/gcc/ada/prj-ext.adb @@ -60,7 +60,7 @@ package body Prj.Ext is The_Value := Name_Find; Name_Len := External_Name'Length; Name_Buffer (1 .. Name_Len) := External_Name; - Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); + Canonical_Case_Env_Var_Name (Name_Buffer (1 .. Name_Len)); The_Key := Name_Find; Name_To_Name_HTable.Set (Tree.External_References, The_Key, The_Value); end Add; @@ -327,7 +327,7 @@ package body Prj.Ext is Name : String := Get_Name_String (External_Name); begin - Canonical_Case_File_Name (Name); + Canonical_Case_Env_Var_Name (Name); Name_Len := Name'Length; Name_Buffer (1 .. Name_Len) := Name; The_Value := |