re PR bootstrap/40578 (FOPEN double defined used in ada/adaint.h:58)

PR bootstrap/40578
	* adaint.h (FOPEN, STAT, FSTAT, LSTAT, STRUCT_STAT): Rename from these
	(GNAT_FOPEN, GNAT_STAT, GNAT_FSTAT, GNAT_LSTAT, GNAT_STRUCT_STAT): ...
	to these.
	(__gnat_stat): Adjust reference to STAT in prototype.
	* adaint.c (__gnat_try_lock, __gnat_fopen, __gnat_file_length,
	__gnat_named_file_length, __gnat_file_time_name, __gnat_file_time_fd,
	__gnat_get_libraries_from_registry, __gnat_stat, __gnat_file_exists,
	__gnat_is_regular_file, __gnat_is_directory, __gnat_is_readable_file,
	__gnat_is_writable_file, __gnat_is_executable_file,
	__gnat_set_writable, __gnat_set_executable, __gnat_set_non_writable,
	__gnat_set_readable, __gnat_set_non_readable, __gnat_is_symbolic_link,
	__gnat_copy_attribs): Adjust all references to the above.
	* cstreams.c (__gnat_is_regular_file_fd): Likewise.

From-SVN: r150098
This commit is contained in:
Dave Korn 2009-07-26 15:09:10 +00:00 committed by Dave Korn
parent c2600c676c
commit f6c7fcc0d5
4 changed files with 63 additions and 46 deletions

View File

@ -1,3 +1,20 @@
2009-07-16 Dave Korn <dave.korn.cygwin@gmail.com>
PR bootstrap/40578
* adaint.h (FOPEN, STAT, FSTAT, LSTAT, STRUCT_STAT): Rename from these
(GNAT_FOPEN, GNAT_STAT, GNAT_FSTAT, GNAT_LSTAT, GNAT_STRUCT_STAT): ...
to these.
(__gnat_stat): Adjust reference to STAT in prototype.
* adaint.c (__gnat_try_lock, __gnat_fopen, __gnat_file_length,
__gnat_named_file_length, __gnat_file_time_name, __gnat_file_time_fd,
__gnat_get_libraries_from_registry, __gnat_stat, __gnat_file_exists,
__gnat_is_regular_file, __gnat_is_directory, __gnat_is_readable_file,
__gnat_is_writable_file, __gnat_is_executable_file,
__gnat_set_writable, __gnat_set_executable, __gnat_set_non_writable,
__gnat_set_readable, __gnat_set_non_readable, __gnat_is_symbolic_link,
__gnat_copy_attribs): Adjust all references to the above.
* cstreams.c (__gnat_is_regular_file_fd): Likewise.
2009-07-23 Ed Schonberg <schonberg@adacore.com>
* sem.adb (Do_Unit_And_Dependents): Now that specs and bodies are not

View File

@ -521,7 +521,7 @@ __gnat_try_lock (char *dir, char *file)
{
char full_path[256];
char temp_file[256];
STRUCT_STAT stat_result;
GNAT_STRUCT_STAT stat_result;
int fd;
sprintf (full_path, "%s%c%s", dir, DIR_SEPARATOR, file);
@ -776,7 +776,7 @@ __gnat_fopen (char *path, char *mode, int encoding ATTRIBUTE_UNUSED)
#elif defined (VMS)
return decc$fopen (path, mode);
#else
return FOPEN (path, mode);
return GNAT_FOPEN (path, mode);
#endif
}
@ -1020,9 +1020,9 @@ long
__gnat_file_length (int fd)
{
int ret;
STRUCT_STAT statbuf;
GNAT_STRUCT_STAT statbuf;
ret = FSTAT (fd, &statbuf);
ret = GNAT_FSTAT (fd, &statbuf);
if (ret || !S_ISREG (statbuf.st_mode))
return 0;
@ -1039,7 +1039,7 @@ long
__gnat_named_file_length (char *name)
{
int ret;
STRUCT_STAT statbuf;
GNAT_STRUCT_STAT statbuf;
ret = __gnat_stat (name, &statbuf);
if (ret || !S_ISREG (statbuf.st_mode))
@ -1270,7 +1270,7 @@ __gnat_file_time_name (char *name)
}
return (OS_Time) ret;
#else
STRUCT_STAT statbuf;
GNAT_STRUCT_STAT statbuf;
if (__gnat_stat (name, &statbuf) != 0) {
return (OS_Time)-1;
} else {
@ -1362,9 +1362,9 @@ __gnat_file_time_fd (int fd)
return (OS_Time) ret;
#else
STRUCT_STAT statbuf;
GNAT_STRUCT_STAT statbuf;
if (FSTAT (fd, &statbuf) != 0) {
if (GNAT_FSTAT (fd, &statbuf) != 0) {
return (OS_Time) -1;
} else {
#ifdef VMS
@ -1652,7 +1652,7 @@ __gnat_get_libraries_from_registry (void)
}
int
__gnat_stat (char *name, STRUCT_STAT *statbuf)
__gnat_stat (char *name, GNAT_STRUCT_STAT *statbuf)
{
#ifdef __MINGW32__
/* Under Windows the directory name for the stat function must not be
@ -1696,7 +1696,7 @@ __gnat_stat (char *name, STRUCT_STAT *statbuf)
return _tstat (wname, (struct _stat *)statbuf);
#else
return STAT (name, statbuf);
return GNAT_STAT (name, statbuf);
#endif
}
@ -1712,7 +1712,7 @@ __gnat_file_exists (char *name)
S2WSC (wname, name, GNAT_MAX_PATH_LEN + 2);
return GetFileAttributes (wname) != INVALID_FILE_ATTRIBUTES;
#else
STRUCT_STAT statbuf;
GNAT_STRUCT_STAT statbuf;
return !__gnat_stat (name, &statbuf);
#endif
@ -1757,7 +1757,7 @@ int
__gnat_is_regular_file (char *name)
{
int ret;
STRUCT_STAT statbuf;
GNAT_STRUCT_STAT statbuf;
ret = __gnat_stat (name, &statbuf);
return (!ret && S_ISREG (statbuf.st_mode));
@ -1767,7 +1767,7 @@ int
__gnat_is_directory (char *name)
{
int ret;
STRUCT_STAT statbuf;
GNAT_STRUCT_STAT statbuf;
ret = __gnat_stat (name, &statbuf);
return (!ret && S_ISDIR (statbuf.st_mode));
@ -1985,9 +1985,9 @@ __gnat_is_readable_file (char *name)
#else
int ret;
int mode;
STRUCT_STAT statbuf;
GNAT_STRUCT_STAT statbuf;
ret = STAT (name, &statbuf);
ret = GNAT_STAT (name, &statbuf);
mode = statbuf.st_mode & S_IRUSR;
return (!ret && mode);
#endif
@ -2017,9 +2017,9 @@ __gnat_is_writable_file (char *name)
#else
int ret;
int mode;
STRUCT_STAT statbuf;
GNAT_STRUCT_STAT statbuf;
ret = STAT (name, &statbuf);
ret = GNAT_STAT (name, &statbuf);
mode = statbuf.st_mode & S_IWUSR;
return (!ret && mode);
#endif
@ -2047,9 +2047,9 @@ __gnat_is_executable_file (char *name)
#else
int ret;
int mode;
STRUCT_STAT statbuf;
GNAT_STRUCT_STAT statbuf;
ret = STAT (name, &statbuf);
ret = GNAT_STAT (name, &statbuf);
mode = statbuf.st_mode & S_IXUSR;
return (!ret && mode);
#endif
@ -2069,9 +2069,9 @@ __gnat_set_writable (char *name)
SetFileAttributes
(wname, GetFileAttributes (wname) & ~FILE_ATTRIBUTE_READONLY);
#elif ! defined (__vxworks) && ! defined(__nucleus__)
STRUCT_STAT statbuf;
GNAT_STRUCT_STAT statbuf;
if (STAT (name, &statbuf) == 0)
if (GNAT_STAT (name, &statbuf) == 0)
{
statbuf.st_mode = statbuf.st_mode | S_IWUSR;
chmod (name, statbuf.st_mode);
@ -2091,9 +2091,9 @@ __gnat_set_executable (char *name)
__gnat_set_OWNER_ACL (wname, GRANT_ACCESS, FILE_GENERIC_EXECUTE);
#elif ! defined (__vxworks) && ! defined(__nucleus__)
STRUCT_STAT statbuf;
GNAT_STRUCT_STAT statbuf;
if (STAT (name, &statbuf) == 0)
if (GNAT_STAT (name, &statbuf) == 0)
{
statbuf.st_mode = statbuf.st_mode | S_IXUSR;
chmod (name, statbuf.st_mode);
@ -2118,9 +2118,9 @@ __gnat_set_non_writable (char *name)
SetFileAttributes
(wname, GetFileAttributes (wname) | FILE_ATTRIBUTE_READONLY);
#elif ! defined (__vxworks) && ! defined(__nucleus__)
STRUCT_STAT statbuf;
GNAT_STRUCT_STAT statbuf;
if (STAT (name, &statbuf) == 0)
if (GNAT_STAT (name, &statbuf) == 0)
{
statbuf.st_mode = statbuf.st_mode & 07577;
chmod (name, statbuf.st_mode);
@ -2140,9 +2140,9 @@ __gnat_set_readable (char *name)
__gnat_set_OWNER_ACL (wname, GRANT_ACCESS, FILE_GENERIC_READ);
#elif ! defined (__vxworks) && ! defined(__nucleus__)
STRUCT_STAT statbuf;
GNAT_STRUCT_STAT statbuf;
if (STAT (name, &statbuf) == 0)
if (GNAT_STAT (name, &statbuf) == 0)
{
chmod (name, statbuf.st_mode | S_IREAD);
}
@ -2161,9 +2161,9 @@ __gnat_set_non_readable (char *name)
__gnat_set_OWNER_ACL (wname, DENY_ACCESS, FILE_GENERIC_READ);
#elif ! defined (__vxworks) && ! defined(__nucleus__)
STRUCT_STAT statbuf;
GNAT_STRUCT_STAT statbuf;
if (STAT (name, &statbuf) == 0)
if (GNAT_STAT (name, &statbuf) == 0)
{
chmod (name, statbuf.st_mode & (~S_IREAD));
}
@ -2178,9 +2178,9 @@ __gnat_is_symbolic_link (char *name ATTRIBUTE_UNUSED)
#elif defined (_AIX) || defined (__APPLE__) || defined (__unix__)
int ret;
STRUCT_STAT statbuf;
GNAT_STRUCT_STAT statbuf;
ret = LSTAT (name, &statbuf);
ret = GNAT_LSTAT (name, &statbuf);
return (!ret && S_ISLNK (statbuf.st_mode));
#else
@ -3438,10 +3438,10 @@ __gnat_copy_attribs (char *from, char *to, int mode)
return 0;
#else
STRUCT_STAT fbuf;
GNAT_STRUCT_STAT fbuf;
struct utimbuf tbuf;
if (STAT (from, &fbuf) == -1)
if (GNAT_STAT (from, &fbuf) == -1)
{
return -1;
}

View File

@ -49,17 +49,17 @@
tested. */
#if defined (__GLIBC__) || defined (sun) || defined (__sgi)
#define FOPEN fopen64
#define STAT stat64
#define FSTAT fstat64
#define LSTAT lstat64
#define STRUCT_STAT struct stat64
#define GNAT_FOPEN fopen64
#define GNAT_STAT stat64
#define GNAT_FSTAT fstat64
#define GNAT_LSTAT lstat64
#define GNAT_STRUCT_STAT struct stat64
#else
#define FOPEN fopen
#define STAT stat
#define FSTAT fstat
#define LSTAT lstat
#define STRUCT_STAT struct stat
#define GNAT_FOPEN fopen
#define GNAT_STAT stat
#define GNAT_FSTAT fstat
#define GNAT_LSTAT lstat
#define GNAT_STRUCT_STAT struct stat
#endif
/* Type corresponding to GNAT.OS_Lib.OS_Time */
@ -94,7 +94,7 @@ extern int __gnat_open_new (char *, int);
extern int __gnat_open_new_temp (char *, int);
extern int __gnat_mkdir (char *);
extern int __gnat_stat (char *,
STRUCT_STAT *);
GNAT_STRUCT_STAT *);
extern int __gnat_unlink (char *);
extern int __gnat_rename (char *, char *);
extern int __gnat_chdir (char *);

View File

@ -96,7 +96,7 @@ int
__gnat_is_regular_file_fd (int fd)
{
int ret;
STRUCT_STAT statbuf;
GNAT_STRUCT_STAT statbuf;
#ifdef __EMX__
/* Programs using screen I/O may need to reset the FPU after
@ -107,7 +107,7 @@ __gnat_is_regular_file_fd (int fd)
__gnat_init_float();
#endif
ret = FSTAT (fd, &statbuf);
ret = GNAT_FSTAT (fd, &statbuf);
return (!ret && S_ISREG (statbuf.st_mode));
}