aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2008-08-04 14:52:38 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2008-08-04 14:52:38 +0200
commita07c35938a54e38a3e04d827c2cbf8c3e1b97a9a (patch)
tree544f4111e9742f29bb137945818e234785589ef1 /gcc
parent56a7a3ab67d7ec5c04ba0d784b26ebd9f741001c (diff)
downloadgcc-a07c35938a54e38a3e04d827c2cbf8c3e1b97a9a.zip
gcc-a07c35938a54e38a3e04d827c2cbf8c3e1b97a9a.tar.gz
gcc-a07c35938a54e38a3e04d827c2cbf8c3e1b97a9a.tar.bz2
adaint.c: Refine support for Windows file attributes.
2008-08-04 Pascal Obry <obry@adacore.com> * adaint.c: Refine support for Windows file attributes. From-SVN: r138620
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog29
-rw-r--r--gcc/ada/adaint.c52
2 files changed, 66 insertions, 15 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index fcdd17e..e49c0cd 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -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.
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index a6718bd..20f8d22 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -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;