summaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2009-04-16 14:17:56 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2009-04-16 14:17:56 +0200
commit4e0079cc3ce34e5d73d82ad99c96b43b7f5184e7 (patch)
tree8a23d332bae4e014e749fa8c79b5f8910a336c66 /gcc/ada
parent9093359a7b5a48d0d93cd9f4f7620647c8d09d40 (diff)
downloadgcc-4e0079cc3ce34e5d73d82ad99c96b43b7f5184e7.tar.gz
[multiple changes]
2009-04-16 Thomas Quinot <quinot@adacore.com> * snames.ads-tmpl (Name_Defined): New predefined name for use by the integrated preprocessor. * prep.ads, prep.adb (Setup_Hooks): New subprogram. (Initialize): Split into two subprograms, Initialize (to be called prior to compiler command line processing) and Setup_Hooks (to be called later on when the first source file is loaded). * gprep.adb: Change call to Prep.Initialize to call to Prep.Setup_Hooks. Add call to Prep.Initialize. * sinput-l.adb, prepcomp.adb: Change call to Prep.Initialize to call to Prep.Setup_Hooks. 2009-04-16 Pascal Obry <obry@adacore.com> * adaint.h, adaint.c (__gnat_chdir): New routine. Simple wrapper routines used to convert to proper encoding on Windows. * s-crtl.ads: Use __gnat_chdir instead of direct call to the C library. * a-direct.adb, g-dirope.adb: Use chdir from System.CRTL. From-SVN: r146174
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog26
-rw-r--r--gcc/ada/a-direct.adb4
-rw-r--r--gcc/ada/adaint.c17
-rw-r--r--gcc/ada/adaint.h1
-rw-r--r--gcc/ada/frontend.adb2
-rw-r--r--gcc/ada/g-dirope.adb4
-rw-r--r--gcc/ada/gprep.adb3
-rw-r--r--gcc/ada/prep.adb42
-rw-r--r--gcc/ada/prep.ads6
-rw-r--r--gcc/ada/prepcomp.adb2
-rw-r--r--gcc/ada/s-crtl.ads3
-rw-r--r--gcc/ada/sinput-l.adb4
-rw-r--r--gcc/ada/snames.ads-tmpl4
13 files changed, 85 insertions, 33 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 58642f6f87d..188671c7384 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,29 @@
+2009-04-16 Thomas Quinot <quinot@adacore.com>
+
+ * snames.ads-tmpl (Name_Defined): New predefined name for use by the
+ integrated preprocessor.
+
+ * prep.ads, prep.adb (Setup_Hooks): New subprogram.
+ (Initialize): Split into two subprograms, Initialize (to be called
+ prior to compiler command line processing) and Setup_Hooks (to be called
+ later on when the first source file is loaded).
+
+ * gprep.adb: Change call to Prep.Initialize to call to Prep.Setup_Hooks.
+ Add call to Prep.Initialize.
+
+ * sinput-l.adb, prepcomp.adb: Change call to Prep.Initialize to call
+ to Prep.Setup_Hooks.
+
+2009-04-16 Pascal Obry <obry@adacore.com>
+
+ * adaint.h, adaint.c (__gnat_chdir): New routine.
+ Simple wrapper routines used to convert to proper encoding on
+ Windows.
+
+ * s-crtl.ads: Use __gnat_chdir instead of direct call to the C library.
+
+ * a-direct.adb, g-dirope.adb: Use chdir from System.CRTL.
+
2009-04-16 Quentin Ochem <ochem@adacore.com>
* sinput-p.adb (Clear_Source_File_Table): Use Sinput.Initialize instead
diff --git a/gcc/ada/a-direct.adb b/gcc/ada/a-direct.adb
index 32ddce9e5b3..07f5836ff03 100644
--- a/gcc/ada/a-direct.adb
+++ b/gcc/ada/a-direct.adb
@@ -1044,10 +1044,6 @@ package body Ada.Directories is
procedure Set_Directory (Directory : String) is
C_Dir_Name : constant String := Directory & ASCII.NUL;
-
- function chdir (Dir_Name : String) return Integer;
- pragma Import (C, chdir, "chdir");
-
begin
if not Is_Valid_Path_Name (Directory) then
raise Name_Error with
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 4f38528c648..a777467e27d 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -708,6 +708,23 @@ __gnat_rename (char *from, char *to)
#endif
}
+/* Changing directory. */
+
+int
+__gnat_chdir (char *path)
+{
+#if defined (__MINGW32__) && ! defined (__vxworks) && ! defined (CROSS_COMPILE)
+ {
+ TCHAR wpath[GNAT_MAX_PATH_LEN];
+
+ S2WSU (wpath, path, GNAT_MAX_PATH_LEN);
+ return _tchdir (wpath);
+ }
+#else
+ return chdir (path);
+#endif
+}
+
FILE *
__gnat_fopen (char *path, char *mode, int encoding ATTRIBUTE_UNUSED)
{
diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h
index 925143c9354..134cca30302 100644
--- a/gcc/ada/adaint.h
+++ b/gcc/ada/adaint.h
@@ -72,6 +72,7 @@ extern int __gnat_stat (char *,
struct stat *);
extern int __gnat_unlink (char *);
extern int __gnat_rename (char *, char *);
+extern int __gnat_chdir (char *);
extern FILE *__gnat_fopen (char *, char *, int);
extern FILE *__gnat_freopen (char *, char *, FILE *,
diff --git a/gcc/ada/frontend.adb b/gcc/ada/frontend.adb
index ac3b2c8202b..7109383555f 100644
--- a/gcc/ada/frontend.adb
+++ b/gcc/ada/frontend.adb
@@ -42,6 +42,7 @@ with Nlists; use Nlists;
with Opt; use Opt;
with Osint;
with Par;
+with Prep;
with Prepcomp;
with Restrict; use Restrict;
with Rident; use Rident;
@@ -84,6 +85,7 @@ begin
Fname.UF.Initialize;
Checks.Initialize;
Sem_Warn.Initialize;
+ Prep.Initialize;
-- Create package Standard
diff --git a/gcc/ada/g-dirope.adb b/gcc/ada/g-dirope.adb
index ad03db8c7b7..33086ed1766 100644
--- a/gcc/ada/g-dirope.adb
+++ b/gcc/ada/g-dirope.adb
@@ -168,10 +168,6 @@ package body GNAT.Directory_Operations is
procedure Change_Dir (Dir_Name : Dir_Name_Str) is
C_Dir_Name : constant String := Dir_Name & ASCII.NUL;
-
- function chdir (Dir_Name : String) return Integer;
- pragma Import (C, chdir, "chdir");
-
begin
if chdir (C_Dir_Name) /= 0 then
raise Directory_Error;
diff --git a/gcc/ada/gprep.adb b/gcc/ada/gprep.adb
index c4cf14ba93c..ec56bcc171f 100644
--- a/gcc/ada/gprep.adb
+++ b/gcc/ada/gprep.adb
@@ -167,10 +167,11 @@ package body GPrep is
Namet.Initialize;
Snames.Initialize;
Stringt.Initialize;
+ Prep.Initialize;
-- Initialize the preprocessor
- Prep.Initialize
+ Prep.Setup_Hooks
(Error_Msg => Errutil.Error_Msg'Access,
Scan => Scanner.Scan'Access,
Set_Ignore_Errors => Errutil.Set_Ignore_Errors'Access,
diff --git a/gcc/ada/prep.adb b/gcc/ada/prep.adb
index 810669917f3..52328b236bb 100644
--- a/gcc/ada/prep.adb
+++ b/gcc/ada/prep.adb
@@ -119,9 +119,6 @@ package body Prep is
String_False : String_Id;
-- "false", as a string_id
- Name_Defined : Name_Id;
- -- defined, as a name_id
-
---------------
-- Behaviour --
---------------
@@ -691,13 +688,7 @@ package body Prep is
-- Initialize --
----------------
- procedure Initialize
- (Error_Msg : Error_Msg_Proc;
- Scan : Scan_Proc;
- Set_Ignore_Errors : Set_Ignore_Errors_Proc;
- Put_Char : Put_Char_Proc;
- New_EOL : New_EOL_Proc)
- is
+ procedure Initialize is
begin
if not Already_Initialized then
Start_String;
@@ -707,22 +698,12 @@ package body Prep is
Start_String;
Empty_String := End_String;
- Name_Len := 7;
- Name_Buffer (1 .. Name_Len) := "defined";
- Name_Defined := Name_Find;
-
Start_String;
Store_String_Chars ("False");
String_False := End_String;
Already_Initialized := True;
end if;
-
- Prep.Error_Msg := Error_Msg;
- Prep.Scan := Scan;
- Prep.Set_Ignore_Errors := Set_Ignore_Errors;
- Prep.Put_Char := Put_Char;
- Prep.New_EOL := New_EOL;
end Initialize;
------------------
@@ -1470,4 +1451,25 @@ package body Prep is
Source_Modified := No_Error_Found and Modified;
end Preprocess;
+ -----------------
+ -- Setup_Hooks --
+ -----------------
+
+ procedure Setup_Hooks
+ (Error_Msg : Error_Msg_Proc;
+ Scan : Scan_Proc;
+ Set_Ignore_Errors : Set_Ignore_Errors_Proc;
+ Put_Char : Put_Char_Proc;
+ New_EOL : New_EOL_Proc)
+ is
+ begin
+ pragma Assert (Already_Initialized);
+
+ Prep.Error_Msg := Error_Msg;
+ Prep.Scan := Scan;
+ Prep.Set_Ignore_Errors := Set_Ignore_Errors;
+ Prep.Put_Char := Put_Char;
+ Prep.New_EOL := New_EOL;
+ end Setup_Hooks;
+
end Prep;
diff --git a/gcc/ada/prep.ads b/gcc/ada/prep.ads
index 0f595e64dfb..801167ee5fb 100644
--- a/gcc/ada/prep.ads
+++ b/gcc/ada/prep.ads
@@ -95,12 +95,16 @@ package Prep is
type New_EOL_Proc is access procedure;
- procedure Initialize
+ procedure Initialize;
+ -- Initialize the preprocessor's global structures
+
+ procedure Setup_Hooks
(Error_Msg : Error_Msg_Proc;
Scan : Scan_Proc;
Set_Ignore_Errors : Set_Ignore_Errors_Proc;
Put_Char : Put_Char_Proc;
New_EOL : New_EOL_Proc);
+ -- Set the i/o hooks used by the preprocessor
procedure Parse_Def_File;
-- Parse the definition file. The definition file must have already been
diff --git a/gcc/ada/prepcomp.adb b/gcc/ada/prepcomp.adb
index fc5acb6eddf..108fe47d1a9 100644
--- a/gcc/ada/prepcomp.adb
+++ b/gcc/ada/prepcomp.adb
@@ -662,7 +662,7 @@ package body Prepcomp is
-- Initialize the preprocessor and set the characteristics of the
-- scanner for a definition file.
- Prep.Initialize
+ Prep.Setup_Hooks
(Error_Msg => Errout.Error_Msg'Access,
Scan => Scn.Scanner.Scan'Access,
Set_Ignore_Errors => Errout.Set_Ignore_Errors'Access,
diff --git a/gcc/ada/s-crtl.ads b/gcc/ada/s-crtl.ads
index e7d6055d890..e2d586b4607 100644
--- a/gcc/ada/s-crtl.ads
+++ b/gcc/ada/s-crtl.ads
@@ -167,6 +167,9 @@ package System.CRTL is
procedure rmdir (dir_name : String);
pragma Import (C, rmdir, "rmdir");
+ function chdir (dir_name : String) return int;
+ pragma Import (C, chdir, "__gnat_chdir");
+
function setvbuf
(stream : FILEs;
buffer : chars;
diff --git a/gcc/ada/sinput-l.adb b/gcc/ada/sinput-l.adb
index ac9877f7ad8..08cc5f8301a 100644
--- a/gcc/ada/sinput-l.adb
+++ b/gcc/ada/sinput-l.adb
@@ -494,9 +494,9 @@ package body Sinput.L is
Prep_Buffer_Last := 0;
- -- Initialize the preprocessor
+ -- Initialize the preprocessor hooks
- Prep.Initialize
+ Prep.Setup_Hooks
(Error_Msg => Errout.Error_Msg'Access,
Scan => Scn.Scanner.Scan'Access,
Set_Ignore_Errors => Errout.Set_Ignore_Errors'Access,
diff --git a/gcc/ada/snames.ads-tmpl b/gcc/ada/snames.ads-tmpl
index 8943b7a53a5..cec5f5124b3 100644
--- a/gcc/ada/snames.ads-tmpl
+++ b/gcc/ada/snames.ads-tmpl
@@ -220,6 +220,10 @@ package Snames is
Name_Put_Line : constant Name_Id := N + $;
Name_To : constant Name_Id := N + $;
+ -- Name used by the integrated preprocessor
+
+ Name_Defined : constant Name_Id := N + $;
+
-- Names for packages that are treated specially by the compiler
Name_Exception_Traces : constant Name_Id := N + $;