aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/adaint.c
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2010-10-25 17:26:02 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2010-10-25 17:26:02 +0200
commitff2efe85eb639b398d150365db037fedadecc4d8 (patch)
treedbc2802781e13245b9de316aac743d8ec5a7862b /gcc/ada/adaint.c
parentf6b5dc8e1f88f71b3a523ff651bfdc32aa3c890b (diff)
downloadgcc-ff2efe85eb639b398d150365db037fedadecc4d8.zip
gcc-ff2efe85eb639b398d150365db037fedadecc4d8.tar.gz
gcc-ff2efe85eb639b398d150365db037fedadecc4d8.tar.bz2
[multiple changes]
2010-10-25 Pascal Obry <obry@adacore.com> * adaint.c (__gnat_file_time_name_attr): Use GetFileAttributesEx to get the timestamp. A bit faster than opening/closing the file. (__gnat_stat_to_attr): Remove kludge for Windows. (__gnat_file_exists_attr): Likewise. The timestamp is now retreived using GetFileAttributesEx as faster. 2010-10-25 Javier Miranda <miranda@adacore.com> * sem_ch3.adb (Derive_Interface_Subprogram): New subprogram. (Derive_Subprograms): For abstract private types transfer to the full view entities of uncovered interface primitives. Required because if the interface primitives are left in the private part of the package they will be decorated as hidden when the analysis of the enclosing package completes (and hence the interface primitive is not visible for dispatching calls). 2010-10-25 Matthew Heaney <heaney@adacore.com> * Makefile.rtl, impunit.adb: Added bounded set and bounded map containers. * a-crbltr.ads: Added declaration of generic package for bounded tree types. * a-rbtgbo.ads, a-rbtgbo.adb, a-rbtgbk.ads, a-rbtgbk.adb, a-btgbso.ads, a-btgbso.adb, a-cborse.ads, a-cborse.adb, a-cborma.ads, a-cborma.adb: New. 2010-10-25 Thomas Quinot <quinot@adacore.com> * sem_util.adb: Minor reformatting. * usage.adb: Fix usage line for -gnatwh. 2010-10-25 Thomas Quinot <quinot@adacore.com> * sem_ch12.adb (Analyze_Package_Instantiation): For an instantiation in an RCI spec, omit package body if instantiation comes from source, even as a nested package. * exp_dist.adb (Add_Calling_Stubs_To_Declarations, *_Support.Add_Receiving_Stubs_To_Declarations): Handle the case of nested packages, package instantiations and subprogram instantiations. From-SVN: r165920
Diffstat (limited to 'gcc/ada/adaint.c')
-rw-r--r--gcc/ada/adaint.c50
1 files changed, 17 insertions, 33 deletions
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index a251a4e..855ce34 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -1099,11 +1099,7 @@ __gnat_stat_to_attr (int fd, char* name, struct file_attributes* attr)
either case. */
attr->file_length = statbuf.st_size; /* all systems */
-#ifndef __MINGW32__
- /* on Windows requires extra system call, see comment in
- __gnat_file_exists_attr */
attr->exists = !ret;
-#endif
#if !defined (_WIN32) || defined (RTX)
/* on Windows requires extra system call, see __gnat_is_readable_file_attr */
@@ -1343,7 +1339,8 @@ win32_filetime (HANDLE h)
}
/* As above but starting from a FILETIME. */
-static void f2t (const FILETIME *ft, time_t *t)
+static void
+f2t (const FILETIME *ft, time_t *t)
{
union
{
@@ -1363,18 +1360,14 @@ __gnat_file_time_name_attr (char* name, struct file_attributes* attr)
{
if (attr->timestamp == (OS_Time)-2) {
#if defined (_WIN32) && !defined (RTX)
+ BOOL res;
+ WIN32_FILE_ATTRIBUTE_DATA fad;
time_t ret = -1;
TCHAR wname[GNAT_MAX_PATH_LEN];
S2WSC (wname, name, GNAT_MAX_PATH_LEN);
- HANDLE h = CreateFile
- (wname, GENERIC_READ, FILE_SHARE_READ, 0,
- OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0);
-
- if (h != INVALID_HANDLE_VALUE) {
- ret = win32_filetime (h);
- CloseHandle (h);
- }
+ if (res = GetFileAttributesEx (wname, GetFileExInfoStandard, &fad))
+ f2t (&fad.ftLastWriteTime, &ret);
attr->timestamp = (OS_Time) ret;
#else
__gnat_stat_to_attr (-1, name, attr);
@@ -1713,17 +1706,17 @@ __gnat_stat (char *name, GNAT_STRUCT_STAT *statbuf)
if (res == FALSE)
switch (GetLastError()) {
- case ERROR_ACCESS_DENIED:
- case ERROR_SHARING_VIOLATION:
- case ERROR_LOCK_VIOLATION:
- case ERROR_SHARING_BUFFER_EXCEEDED:
- return EACCES;
- case ERROR_BUFFER_OVERFLOW:
- return ENAMETOOLONG;
- case ERROR_NOT_ENOUGH_MEMORY:
- return ENOMEM;
- default:
- return ENOENT;
+ case ERROR_ACCESS_DENIED:
+ case ERROR_SHARING_VIOLATION:
+ case ERROR_LOCK_VIOLATION:
+ case ERROR_SHARING_BUFFER_EXCEEDED:
+ return EACCES;
+ case ERROR_BUFFER_OVERFLOW:
+ return ENAMETOOLONG;
+ case ERROR_NOT_ENOUGH_MEMORY:
+ return ENOMEM;
+ default:
+ return ENOENT;
}
f2t (&fad.ftCreationTime, &statbuf->st_ctime);
@@ -1758,16 +1751,7 @@ int
__gnat_file_exists_attr (char* name, struct file_attributes* attr)
{
if (attr->exists == ATTR_UNSET) {
-#ifdef __MINGW32__
- /* On Windows do not use __gnat_stat() because of a bug in Microsoft
- _stat() routine. When the system time-zone is set with a negative
- offset the _stat() routine fails on specific files like CON: */
- TCHAR wname [GNAT_MAX_PATH_LEN + 2];
- S2WSC (wname, name, GNAT_MAX_PATH_LEN + 2);
- attr->exists = GetFileAttributes (wname) != INVALID_FILE_ATTRIBUTES;
-#else
__gnat_stat_to_attr (-1, name, attr);
-#endif
}
return attr->exists;