int __gnat_max_path_len = GNAT_MAX_PATH_LEN;
int max_path_len = GNAT_MAX_PATH_LEN;
+/* Control whether we can use ACL on Windows. */
+
+int __gnat_use_acl = 1;
+
/* The following macro HAVE_READDIR_R should be defined if the
system provides the routine readdir_r. */
#undef HAVE_READDIR_R
char *encoding ATTRIBUTE_UNUSED, int *e_length)
{
#if defined (_WIN32) && ! defined (__vxworks) && ! defined (IS_CROSS)
- WS2SC (os_name, (TCHAR *)w_filename, o_length);
+ WS2SC (os_name, (TCHAR *)w_filename, (DWORD)o_length);
*o_length = strlen (os_name);
strcpy (encoding, "encoding=utf8");
*e_length = strlen (encoding);
for (index = 0; res == ERROR_SUCCESS; index++)
{
value_size = name_size = 256;
- res = RegEnumValueA (reg_key, index, (TCHAR*)name, &name_size, 0,
+ res = RegEnumValueA (reg_key, index, name, &name_size, 0,
&type, (LPBYTE)value, &value_size);
if (res == ERROR_SUCCESS && type == REG_SZ)
if (name_len == 2 && wname[1] == _T(':'))
_tcscat (wname, _T("\\"));
- return _tstat (wname, statbuf);
+ return _tstat (wname, (struct _stat *)statbuf);
#else
return stat (name, statbuf);
TCHAR wname [GNAT_MAX_PATH_LEN + 2];
GENERIC_MAPPING GenericMapping;
- S2WSC (wname, name, GNAT_MAX_PATH_LEN + 2);
+ if (__gnat_use_acl)
+ {
+ S2WSC (wname, name, GNAT_MAX_PATH_LEN + 2);
- ZeroMemory (&GenericMapping, sizeof (GENERIC_MAPPING));
- GenericMapping.GenericRead = GENERIC_READ;
+ ZeroMemory (&GenericMapping, sizeof (GENERIC_MAPPING));
+ GenericMapping.GenericRead = GENERIC_READ;
+
+ return __gnat_check_OWNER_ACL (wname, FILE_READ_DATA, GenericMapping);
+ }
+ else
+ return 1;
- return __gnat_check_OWNER_ACL (wname, FILE_READ_DATA, GenericMapping);
#else
int ret;
int mode;
S2WSC (wname, name, GNAT_MAX_PATH_LEN + 2);
- ZeroMemory (&GenericMapping, sizeof (GENERIC_MAPPING));
- GenericMapping.GenericWrite = GENERIC_WRITE;
+ if (__gnat_use_acl)
+ {
+ ZeroMemory (&GenericMapping, sizeof (GENERIC_MAPPING));
+ GenericMapping.GenericWrite = GENERIC_WRITE;
+
+ return __gnat_check_OWNER_ACL
+ (wname, FILE_WRITE_DATA | FILE_APPEND_DATA, GenericMapping)
+ && !(GetFileAttributes (wname) & FILE_ATTRIBUTE_READONLY);
+ }
+ else
+ return !(GetFileAttributes (wname) & FILE_ATTRIBUTE_READONLY);
- return __gnat_check_OWNER_ACL
- (wname, FILE_WRITE_DATA | FILE_APPEND_DATA, GenericMapping)
- && !(GetFileAttributes (wname) & FILE_ATTRIBUTE_READONLY);
#else
int ret;
int mode;
S2WSC (wname, name, GNAT_MAX_PATH_LEN + 2);
- ZeroMemory (&GenericMapping, sizeof (GENERIC_MAPPING));
- GenericMapping.GenericExecute = GENERIC_EXECUTE;
+ if (__gnat_use_acl)
+ {
+ ZeroMemory (&GenericMapping, sizeof (GENERIC_MAPPING));
+ GenericMapping.GenericExecute = GENERIC_EXECUTE;
+
+ return __gnat_check_OWNER_ACL (wname, FILE_EXECUTE, GenericMapping);
+ }
+ else
+ return GetFileAttributes (wname) != INVALID_FILE_ATTRIBUTES
+ && _tcsstr (wname, _T(".exe")) - wname == (_tcslen (wname) - 4);
- return __gnat_check_OWNER_ACL (wname, FILE_EXECUTE, GenericMapping);
#else
int ret;
int mode;
S2WSC (wname, name, GNAT_MAX_PATH_LEN + 2);
- __gnat_set_OWNER_ACL (wname, GRANT_ACCESS, FILE_GENERIC_WRITE);
+ if (__gnat_use_acl)
+ __gnat_set_OWNER_ACL (wname, GRANT_ACCESS, FILE_GENERIC_WRITE);
+
SetFileAttributes
(wname, GetFileAttributes (wname) & ~FILE_ATTRIBUTE_READONLY);
#elif ! defined (__vxworks) && ! defined(__nucleus__)
#if defined (_WIN32) && !defined (RTX)
TCHAR wname [GNAT_MAX_PATH_LEN + 2];
- S2WSC (wname, name, GNAT_MAX_PATH_LEN + 2);
+ if (__gnat_use_acl)
+ {
+ S2WSC (wname, name, GNAT_MAX_PATH_LEN + 2);
- __gnat_set_OWNER_ACL (wname, GRANT_ACCESS, FILE_GENERIC_EXECUTE);
+ __gnat_set_OWNER_ACL (wname, GRANT_ACCESS, FILE_GENERIC_EXECUTE);
+ }
#elif ! defined (__vxworks) && ! defined(__nucleus__)
struct stat statbuf;
S2WSC (wname, name, GNAT_MAX_PATH_LEN + 2);
- __gnat_set_OWNER_ACL
- (wname, DENY_ACCESS,
- FILE_WRITE_DATA | FILE_APPEND_DATA |
- FILE_WRITE_EA | FILE_WRITE_ATTRIBUTES);
+ if (__gnat_use_acl)
+ __gnat_set_OWNER_ACL
+ (wname, DENY_ACCESS,
+ FILE_WRITE_DATA | FILE_APPEND_DATA |
+ FILE_WRITE_EA | FILE_WRITE_ATTRIBUTES);
+
SetFileAttributes
(wname, GetFileAttributes (wname) | FILE_ATTRIBUTE_READONLY);
#elif ! defined (__vxworks) && ! defined(__nucleus__)
#if defined (_WIN32) && !defined (RTX)
TCHAR wname [GNAT_MAX_PATH_LEN + 2];
- S2WSC (wname, name, GNAT_MAX_PATH_LEN + 2);
+ if (__gnat_use_acl)
+ {
+ S2WSC (wname, name, GNAT_MAX_PATH_LEN + 2);
- __gnat_set_OWNER_ACL (wname, GRANT_ACCESS, FILE_GENERIC_READ);
+ __gnat_set_OWNER_ACL (wname, GRANT_ACCESS, FILE_GENERIC_READ);
+ }
#elif ! defined (__vxworks) && ! defined(__nucleus__)
struct stat statbuf;
#if defined (_WIN32) && !defined (RTX)
TCHAR wname [GNAT_MAX_PATH_LEN + 2];
- S2WSC (wname, name, GNAT_MAX_PATH_LEN + 2);
+ if (__gnat_use_acl)
+ {
+ S2WSC (wname, name, GNAT_MAX_PATH_LEN + 2);
- __gnat_set_OWNER_ACL (wname, DENY_ACCESS, FILE_GENERIC_READ);
+ __gnat_set_OWNER_ACL (wname, DENY_ACCESS, FILE_GENERIC_READ);
+ }
#elif ! defined (__vxworks) && ! defined(__nucleus__)
struct stat statbuf;
-- pre-allocate a freeze node, and set the proper link to the first
-- subtype. Freeze_Entity will use this preallocated freeze node when
-- it freezes the entity.
+
-- This does not apply if the base type is a generic type, whose
-- declaration is independent of the current derived definition.
Lo :=
Make_Attribute_Reference (Loc,
Attribute_Name => Name_First,
- Prefix => New_Reference_To (Derived_Type, Loc));
+ Prefix => New_Reference_To (Derived_Type, Loc));
Set_Etype (Lo, Derived_Type);
Hi :=
Make_Attribute_Reference (Loc,
Attribute_Name => Name_Last,
- Prefix => New_Reference_To (Derived_Type, Loc));
+ Prefix => New_Reference_To (Derived_Type, Loc));
Set_Etype (Hi, Derived_Type);
Set_Scalar_Range (Derived_Type,
Make_Range (Loc,
- Low_Bound => Lo,
+ Low_Bound => Lo,
High_Bound => Hi));
else
-- Analyze subtype indication and verify compatibility
-- with parent type.
- if
- Base_Type
- (Process_Subtype (Indic, N)) /= Base_Type (Parent_Type)
+ if Base_Type (Process_Subtype (Indic, N)) /=
+ Base_Type (Parent_Type)
then
Error_Msg_N
("illegal constraint for formal discrete type", N);
"full declaration of } must be a record extension",
Prev, Id);
- -- Set some attributes to produce a usable full view.
+ -- Set some attributes to produce a usable full view
Set_Is_Tagged_Type (Id);
Set_Primitive_Operations (Id, New_Elmt_List);