Commit d7598e11 by Pascal Obry Committed by Arnaud Charlet

re PR ada/29856 (broken if..else in gcc/ada/adaint.c)

2007-04-20  Pascal Obry  <obry@adacore.com>

	* gnatchop.adb (Write_Source_Reference_Pragma): Change implementation
	to use Stream_IO.File_Type. This is needed to make use of the UTF-8
	encoding support of Stream_IO.
	(Write_Unit): Idem.

	* adaint.h, adaint.c (__gnat_os_filename): New routine. Returns the
	filename and corresponding encoding to match the OS requirement.
	(__gnat_file_exists): Do not call __gnat_stat() on Windows as this
	routine will fail on specific devices like CON: AUX: ...

	PR ada/29856: Add missing braces

From-SVN: r124347
parent 9a60b02d
2007-05-02 Pascal Obry <obry@adacore.com>
* gnatchop.adb (Write_Source_Reference_Pragma): Change implementation
to use Stream_IO.File_Type. This is needed to make use of the UTF-8
encoding support of Stream_IO.
(Write_Unit): Idem.
* adaint.h, adaint.c (__gnat_os_filename): New routine. Returns the
filename and corresponding encoding to match the OS requirement.
(__gnat_file_exists): Do not call __gnat_stat() on Windows as this
routine will fail on specific devices like CON: AUX: ...
PR ada/29856: Add missing braces
2007-04-22 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR ada/31660
......@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
* Copyright (C) 1992-2006, Free Software Foundation, Inc. *
* Copyright (C) 1992-2007, Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
......@@ -619,6 +619,25 @@ __gnat_get_debuggable_suffix_ptr (int *len, const char **value)
return;
}
/* Returns the OS filename and corresponding encoding. */
void
__gnat_os_filename (char *filename, char *w_filename,
char *os_name, int *o_length,
char *encoding, int *e_length)
{
#if defined (_WIN32) && ! defined (__vxworks) && ! defined (CROSS_DIRECTORY_STRUCTURE)
WS2SU (os_name, (TCHAR *)w_filename, o_length);
*o_length = strlen (os_name);
strcpy (encoding, "encoding=utf8");
*e_length = strlen (encoding);
#else
strcpy (os_name, filename);
*o_length = strlen (filename);
*e_length = 0;
#endif
}
FILE *
__gnat_fopen (char *path, char *mode, int encoding)
{
......@@ -991,8 +1010,10 @@ __gnat_readdir (DIR *dirp, char *buffer, int *len)
#elif defined (HAVE_READDIR_R)
/* If possible, try to use the thread-safe version. */
if (readdir_r (dirp, buffer) != NULL)
*len = strlen (((struct dirent*) buffer)->d_name);
return ((struct dirent*) buffer)->d_name;
{
*len = strlen (((struct dirent*) buffer)->d_name);
return ((struct dirent*) buffer)->d_name;
}
else
return NULL;
......@@ -1513,9 +1534,19 @@ __gnat_stat (char *name, struct stat *statbuf)
int
__gnat_file_exists (char *name)
{
#ifdef __MINGW32__
/* On Windows do not use __gnat_stat() because 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];
S2WSU (wname, name, GNAT_MAX_PATH_LEN + 2);
return GetFileAttributes (wname) != INVALID_FILE_ATTRIBUTES;
#else
struct stat statbuf;
return !__gnat_stat (name, &statbuf);
#endif
}
int
......
......@@ -6,7 +6,7 @@
* *
* C Header File *
* *
* Copyright (C) 1992-2006, Free Software Foundation, Inc. *
* Copyright (C) 1992-2007, Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
......@@ -47,10 +47,9 @@ typedef long OS_Time; /* Type corresponding to GNAT.OS_Lib.OS_Time */
extern int __gnat_max_path_len;
extern OS_Time __gnat_current_time (void);
extern void __gnat_to_gm_time (OS_Time *, int *,
int *, int *,
int *, int *,
int *);
extern void __gnat_to_gm_time (OS_Time *, int *, int *,
int *, int *,
int *, int *);
extern int __gnat_get_maximum_file_name_length (void);
extern int __gnat_get_switches_case_sensitive (void);
extern int __gnat_get_file_names_case_sensitive (void);
......@@ -72,7 +71,8 @@ extern int __gnat_mkdir (char *);
extern int __gnat_stat (char *,
struct stat *);
extern FILE *__gnat_fopen (char *, char *, int);
extern FILE *__gnat_freopen (char *, char *, FILE *, int);
extern FILE *__gnat_freopen (char *, char *, FILE *,
int);
extern int __gnat_open_read (char *, int);
extern int __gnat_open_rw (char *, int);
extern int __gnat_open_create (char *, int);
......@@ -165,6 +165,9 @@ extern int __gnat_set_close_on_exec (int, int);
extern int __gnat_dup (int);
extern int __gnat_dup2 (int, int);
extern void __gnat_os_filename (char *, char *, char *,
int *, char *, int *);
#ifdef __MINGW32__
extern void __gnat_plist_init (void);
#endif
......@@ -175,7 +178,7 @@ extern void __gnat_plist_init (void);
#endif
/* This function returns the version of GCC being used. Here it's GCC 3. */
extern int get_gcc_version (void);
extern int get_gcc_version (void);
extern int __gnat_binder_supports_auto_init (void);
extern int __gnat_sals_init_using_constructors (void);
extern int __gnat_binder_supports_auto_init (void);
extern int __gnat_sals_init_using_constructors (void);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment