This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] fix gnatchop with non ASCII char on Windows + PR 29856


Manually tested on i686-mingw
Tested on i686-linux

The problem was that on Windows there is a specific circuitry in the
this OS, the API is either standard ASCII or UTF-16 Unicode ISO/IEC
10646). gnatchop has been modified to use the UTF-8 oriented API so
the filenames can now be properly encoded.
There is no automatic test. When the following program is sent through
gnatchop using :
   $ gnatchop -w -gnatif test.ada
The file named Test_It_<LATIN CAPITAL LETTER A WITH GRAVE> must be created.
--
package Test_It_["C0"] is
    I : Integer;
end;

Also, when opening a file for proper Ada semantics it is required to check
if the file exists in some cases. A call to stat() routine is made
for this check but this will fail (because a Microsoft C runtime bug
present on VS2003 and fixed in VS2005) on specific devices like CON:
or AUX: when the time zone offset is negative. To workaround this
problem the GNAT runtime uses now GetFileAttributes() Win32 API
instead of stat().
--
The following program must not raise an exception :
--
with Ada.Text_Io;
procedure Main is
  Screen_File_Name : constant String := "CON:";
  Screen_File : Ada.Text_IO.File_Type;
begin
  Ada.Text_IO.Open
          (File => Screen_File,
           Mode => Ada.Text_Io.Out_File,
           Name => Screen_File_Name);
end Main;

Finally, fix PR ada/29856 by adding missing braces

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

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]