OSDN Git Service

2008-08-04 Pascal Obry <obry@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 4 Aug 2008 12:52:38 +0000 (12:52 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 4 Aug 2008 12:52:38 +0000 (12:52 +0000)
* adaint.c: Refine support for Windows file attributes.

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

gcc/ada/ChangeLog
gcc/ada/adaint.c

index fcdd17e..e49c0cd 100644 (file)
@@ -1,3 +1,32 @@
+2008-08-04  Pascal Obry  <obry@adacore.com>
+
+       * adaint.h: Add missing prototype.
+
+       * adaint.c: Refine support for Windows file attributes.
+
+2008-08-04  Robert Dewar  <dewar@adacore.com>
+
+       * sem_res.adb:
+       (Valid_Conversion): Catch case of designated types having different
+       sizes, even though they statically match.
+
+2008-08-04  Javier Miranda  <miranda@adacore.com>
+
+       * sem_eval.adb (Subtypes_Statically_Match): Remove superfluous patch
+       added in previous patch to handle access to subprograms.
+
+2008-08-04  Robert Dewar  <dewar@adacore.com>
+
+       * freeze.adb:
+       (Freeze_Entity): Only check No_Default_Initialization restriction for
+       constructs that come from source
+
+2008-08-04  Thomas Quinot  <quinot@adacore.com>
+
+       * exp_ch6.adb: Minor comment fix.
+
+       * sem_ch4.adb: Minor reformatting.
+
 2008-08-04  Robert Dewar  <dewar@adacore.com>
 
        * sem_res.adb: (Large_Storage_Type): Improve previous change.
index a6718bd..20f8d22 100644 (file)
@@ -1687,11 +1687,10 @@ __gnat_is_directory (char *name)
 /*  This MingW section contains code to work with ACL. */
 static int
 __gnat_check_OWNER_ACL
-(char *name,
+(TCHAR *wname,
  DWORD CheckAccessDesired,
  GENERIC_MAPPING CheckGenericMapping)
 {
-  TCHAR wname [GNAT_MAX_PATH_LEN + 2];
   DWORD dwAccessDesired, dwAccessAllowed;
   PRIVILEGE_SET PrivilegeSet;
   DWORD dwPrivSetSize = sizeof (PRIVILEGE_SET);
@@ -1700,8 +1699,6 @@ __gnat_check_OWNER_ACL
   DWORD nLength;
   SECURITY_DESCRIPTOR* pSD = NULL;
 
-  S2WSU (wname, name, GNAT_MAX_PATH_LEN + 2);
-
   GetFileSecurity
     (wname, OWNER_SECURITY_INFORMATION |
      GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION,
@@ -1752,7 +1749,7 @@ __gnat_check_OWNER_ACL
 
 static void
 __gnat_set_OWNER_ACL
-(char *name,
+(TCHAR *wname,
  DWORD AccessMode,
  DWORD AccessPermissions)
 {
@@ -1763,10 +1760,6 @@ __gnat_set_OWNER_ACL
   TCHAR username [100];
   DWORD unsize = 100;
 
-  TCHAR wname [GNAT_MAX_PATH_LEN + 2];
-
-  S2WSU (wname, name, GNAT_MAX_PATH_LEN + 2);
-
   HANDLE file = CreateFile
     (wname, READ_CONTROL | WRITE_DAC, 0, NULL,
      OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
@@ -1821,11 +1814,15 @@ int
 __gnat_is_readable_file (char *name)
 {
 #if defined (_WIN32) && !defined (RTX)
+  TCHAR wname [GNAT_MAX_PATH_LEN + 2];
   GENERIC_MAPPING GenericMapping;
+
+  S2WSU (wname, name, GNAT_MAX_PATH_LEN + 2);
+
   ZeroMemory (&GenericMapping, sizeof (GENERIC_MAPPING));
   GenericMapping.GenericRead = GENERIC_READ;
 
-  return __gnat_check_OWNER_ACL (name, FILE_READ_DATA, GenericMapping);
+  return __gnat_check_OWNER_ACL (wname, FILE_READ_DATA, GenericMapping);
 #else
   int ret;
   int mode;
@@ -1841,12 +1838,17 @@ int
 __gnat_is_writable_file (char *name)
 {
 #if defined (_WIN32) && !defined (RTX)
+  TCHAR wname [GNAT_MAX_PATH_LEN + 2];
   GENERIC_MAPPING GenericMapping;
+
+  S2WSU (wname, name, GNAT_MAX_PATH_LEN + 2);
+
   ZeroMemory (&GenericMapping, sizeof (GENERIC_MAPPING));
   GenericMapping.GenericWrite = GENERIC_WRITE;
 
   return __gnat_check_OWNER_ACL
-    (name, FILE_WRITE_DATA | FILE_APPEND_DATA, GenericMapping);
+    (wname, FILE_WRITE_DATA | FILE_APPEND_DATA, GenericMapping)
+    && !(GetFileAttributes (wname) & FILE_ATTRIBUTE_READONLY);
 #else
   int ret;
   int mode;
@@ -1862,11 +1864,15 @@ int
 __gnat_is_executable_file (char *name)
 {
 #if defined (_WIN32) && !defined (RTX)
+  TCHAR wname [GNAT_MAX_PATH_LEN + 2];
   GENERIC_MAPPING GenericMapping;
+
+  S2WSU (wname, name, GNAT_MAX_PATH_LEN + 2);
+
   ZeroMemory (&GenericMapping, sizeof (GENERIC_MAPPING));
   GenericMapping.GenericExecute = GENERIC_EXECUTE;
 
-  return __gnat_check_OWNER_ACL (name, FILE_EXECUTE, GenericMapping);
+  return __gnat_check_OWNER_ACL (wname, FILE_EXECUTE, GenericMapping);
 #else
   int ret;
   int mode;
@@ -1882,7 +1888,13 @@ void
 __gnat_set_writable (char *name)
 {
 #if defined (_WIN32) && !defined (RTX)
-  __gnat_set_OWNER_ACL (name, GRANT_ACCESS, GENERIC_WRITE);
+  TCHAR wname [GNAT_MAX_PATH_LEN + 2];
+
+  S2WSU (wname, name, GNAT_MAX_PATH_LEN + 2);
+
+  __gnat_set_OWNER_ACL (wname, GRANT_ACCESS, GENERIC_WRITE);
+  SetFileAttributes
+    (wname, GetFileAttributes (wname) & ~FILE_ATTRIBUTE_READONLY);
 #elif ! defined (__vxworks) && ! defined(__nucleus__)
   struct stat statbuf;
 
@@ -1898,7 +1910,11 @@ void
 __gnat_set_executable (char *name)
 {
 #if defined (_WIN32) && !defined (RTX)
-  __gnat_set_OWNER_ACL (name, GRANT_ACCESS, GENERIC_EXECUTE);
+  TCHAR wname [GNAT_MAX_PATH_LEN + 2];
+
+  S2WSU (wname, name, GNAT_MAX_PATH_LEN + 2);
+
+  __gnat_set_OWNER_ACL (wname, GRANT_ACCESS, GENERIC_EXECUTE);
 #elif ! defined (__vxworks) && ! defined(__nucleus__)
   struct stat statbuf;
 
@@ -1914,7 +1930,13 @@ void
 __gnat_set_readonly (char *name)
 {
 #if defined (_WIN32) && !defined (RTX)
-  __gnat_set_OWNER_ACL (name, SET_ACCESS, GENERIC_READ);
+  TCHAR wname [GNAT_MAX_PATH_LEN + 2];
+
+  S2WSU (wname, name, GNAT_MAX_PATH_LEN + 2);
+
+  __gnat_set_OWNER_ACL (wname, SET_ACCESS, GENERIC_READ);
+  SetFileAttributes
+    (wname, GetFileAttributes (wname) | FILE_ATTRIBUTE_READONLY);
 #elif ! defined (__vxworks) && ! defined(__nucleus__)
   struct stat statbuf;