• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GCC with patches for OS216


Commit MetaInfo

修订版0640c7d139ea91870c378de96cab14d708517593 (tree)
时间2016-07-07 22:17:51
作者Arnaud Charlet <charlet@gcc....>
CommiterArnaud Charlet

Log Message

[multiple changes]

2016-07-07 Vadim Godunko <godunko@adacore.com>

* adainit.h, adainit.c (gnat_is_read_accessible_file): New
subprogram.
(
gnat_is_write_accessible_file): New subprogram.
* s-os_lib.ads, s-os_lib.adb (Is_Read_Accessible_File): New subprogram.
(Is_Write_Accessible_File): New subprogram.

2016-07-07 Justin Squirek <squirek@adacore.com>

* sem_ch12.adb (Install_Body): Minor refactoring in the order
of local functions.
(In_Same_Scope): Change loop condition to be more expressive.

From-SVN: r238116

更改概述

差异

--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,17 @@
1+2016-07-07 Vadim Godunko <godunko@adacore.com>
2+
3+ * adainit.h, adainit.c (__gnat_is_read_accessible_file): New
4+ subprogram.
5+ (__gnat_is_write_accessible_file): New subprogram.
6+ * s-os_lib.ads, s-os_lib.adb (Is_Read_Accessible_File): New subprogram.
7+ (Is_Write_Accessible_File): New subprogram.
8+
9+2016-07-07 Justin Squirek <squirek@adacore.com>
10+
11+ * sem_ch12.adb (Install_Body): Minor refactoring in the order
12+ of local functions.
13+ (In_Same_Scope): Change loop condition to be more expressive.
14+
115 2016-07-07 Gary Dismukes <dismukes@adacore.com>
216
317 * sem_ch3.adb, sem_prag.adb, sem_prag.ads, prj-ext.adb, freeze.adb,
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -1912,6 +1912,20 @@ __gnat_is_readable_file_attr (char* name, struct file_attributes* attr)
19121912 }
19131913
19141914 int
1915+__gnat_is_read_accessible_file (char *name)
1916+{
1917+#if defined (_WIN32)
1918+ TCHAR wname [GNAT_MAX_PATH_LEN + 2];
1919+
1920+ S2WSC (wname, name, GNAT_MAX_PATH_LEN + 2);
1921+
1922+ return !_access (wname, 4);
1923+#else
1924+ return !access (name, R_OK);
1925+#endif
1926+}
1927+
1928+int
19151929 __gnat_is_readable_file (char *name)
19161930 {
19171931 struct file_attributes attr;
@@ -1962,6 +1976,20 @@ __gnat_is_writable_file (char *name)
19621976 }
19631977
19641978 int
1979+__gnat_is_write_accessible_file (char *name)
1980+{
1981+#if defined (_WIN32)
1982+ TCHAR wname [GNAT_MAX_PATH_LEN + 2];
1983+
1984+ S2WSC (wname, name, GNAT_MAX_PATH_LEN + 2);
1985+
1986+ return !_access (wname, 2);
1987+#else
1988+ return !access (name, W_OK);
1989+#endif
1990+}
1991+
1992+int
19651993 __gnat_is_executable_file_attr (char* name, struct file_attributes* attr)
19661994 {
19671995 if (attr->executable == ATTR_UNSET)
--- a/gcc/ada/adaint.h
+++ b/gcc/ada/adaint.h
@@ -6,7 +6,7 @@
66 * *
77 * C Header File *
88 * *
9- * Copyright (C) 1992-2015, Free Software Foundation, Inc. *
9+ * Copyright (C) 1992-2016, Free Software Foundation, Inc. *
1010 * *
1111 * GNAT is free software; you can redistribute it and/or modify it under *
1212 * terms of the GNU General Public License as published by the Free Soft- *
@@ -207,6 +207,8 @@ extern int __gnat_is_directory (char *);
207207 extern int __gnat_is_writable_file (char *);
208208 extern int __gnat_is_readable_file (char *name);
209209 extern int __gnat_is_executable_file (char *name);
210+extern int __gnat_is_write_accessible_file (char *name);
211+extern int __gnat_is_read_accessible_file (char *name);
210212
211213 extern void __gnat_reset_attributes (struct file_attributes *);
212214 extern int __gnat_error_attributes (struct file_attributes *);
--- a/gcc/ada/s-os_lib.adb
+++ b/gcc/ada/s-os_lib.adb
@@ -1495,6 +1495,21 @@ package body System.OS_Lib is
14951495 return Is_Directory (F_Name'Address);
14961496 end Is_Directory;
14971497
1498+ -----------------------------
1499+ -- Is_Read_Accessible_File --
1500+ -----------------------------
1501+
1502+ function Is_Read_Accessible_File (Name : String) return Boolean is
1503+ function Is_Read_Accessible_File (Name : Address) return Integer;
1504+ pragma Import
1505+ (C, Is_Read_Accessible_File, "__gnat_is_read_accessible_file");
1506+ F_Name : String (1 .. Name'Length + 1);
1507+ begin
1508+ F_Name (1 .. Name'Length) := Name;
1509+ F_Name (F_Name'Last) := ASCII.NUL;
1510+ return Is_Read_Accessible_File (F_Name'Address) /= 0;
1511+ end Is_Read_Accessible_File;
1512+
14981513 ----------------------
14991514 -- Is_Readable_File --
15001515 ----------------------
@@ -1571,6 +1586,21 @@ package body System.OS_Lib is
15711586 return Is_Symbolic_Link (F_Name'Address);
15721587 end Is_Symbolic_Link;
15731588
1589+ ------------------------------
1590+ -- Is_Write_Accessible_File --
1591+ ------------------------------
1592+
1593+ function Is_Write_Accessible_File (Name : String) return Boolean is
1594+ function Is_Write_Accessible_File (Name : Address) return Integer;
1595+ pragma Import
1596+ (C, Is_Write_Accessible_File, "__gnat_is_write_accessible_file");
1597+ F_Name : String (1 .. Name'Length + 1);
1598+ begin
1599+ F_Name (1 .. Name'Length) := Name;
1600+ F_Name (F_Name'Last) := ASCII.NUL;
1601+ return Is_Write_Accessible_File (F_Name'Address) /= 0;
1602+ end Is_Write_Accessible_File;
1603+
15741604 ----------------------
15751605 -- Is_Writable_File --
15761606 ----------------------
--- a/gcc/ada/s-os_lib.ads
+++ b/gcc/ada/s-os_lib.ads
@@ -6,7 +6,7 @@
66 -- --
77 -- S p e c --
88 -- --
9--- Copyright (C) 1995-2015, Free Software Foundation, Inc. --
9+-- Copyright (C) 1995-2016, Free Software Foundation, Inc. --
1010 -- --
1111 -- GNAT is free software; you can redistribute it and/or modify it under --
1212 -- terms of the GNU General Public License as published by the Free Soft- --
@@ -457,6 +457,14 @@ package System.OS_Lib is
457457 -- not actually be writable due to some other process having exclusive
458458 -- access.
459459
460+ function Is_Read_Accessible_File (Name : String) return Boolean;
461+ -- Determines if the given string, Name, is the name of an existing file
462+ -- that is readable. Returns True if so, False otherwise.
463+
464+ function Is_Write_Accessible_File (Name : String) return Boolean;
465+ -- Determines if the given string, Name, is the name of an existing file
466+ -- that is writable. Returns True if so, False otherwise.
467+
460468 function Locate_Exec_On_Path (Exec_Name : String) return String_Access;
461469 -- Try to locate an executable whose name is given by Exec_Name in the
462470 -- directories listed in the environment Path. If the Exec_Name does not
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -713,7 +713,10 @@ package body Sem_Ch12 is
713713 -- body. Early instantiations can also appear if generic, instance and
714714 -- body are all in the declarative part of a subprogram or entry. Entities
715715 -- of packages that are early instantiations are delayed, and their freeze
716- -- node appears after the generic body.
716+ -- node appears after the generic body. This rather complex machinery is
717+ -- needed when nested instantiations are present, because the source does
718+ -- not carry any indication of where the corresponding instance bodies must
719+ -- be installed and frozen.
717720
718721 procedure Install_Formal_Packages (Par : Entity_Id);
719722 -- Install the visible part of any formal of the parent that is a formal
@@ -8927,23 +8930,13 @@ package body Sem_Ch12 is
89278930 Gen_Body : Node_Id;
89288931 Gen_Decl : Node_Id)
89298932 is
8930- Act_Id : constant Entity_Id := Corresponding_Spec (Act_Body);
8931- Act_Unit : constant Node_Id := Unit (Cunit (Get_Source_Unit (N)));
8932- Gen_Id : constant Entity_Id := Corresponding_Spec (Gen_Body);
8933- Par : constant Entity_Id := Scope (Gen_Id);
8934- Gen_Unit : constant Node_Id :=
8935- Unit (Cunit (Get_Source_Unit (Gen_Decl)));
8936- Orig_Body : Node_Id := Gen_Body;
8937- F_Node : Node_Id;
8938- Body_Unit : Node_Id;
8939-
8940- Must_Delay : Boolean;
89418933
8942- function In_Same_Scope (Generic_Id, Actual_Id : Node_Id) return Boolean;
8943- -- Check if the generic definition's scope tree and the instantiation's
8944- -- scope tree share a dependency.
8934+ function In_Same_Scope (Gen_Id, Act_Id : Node_Id) return Boolean;
8935+ -- Check if the generic definition and the instantiation come from
8936+ -- a common scope, in which case the instance must be frozen after
8937+ -- the generic body.
89458938
8946- function True_Sloc (N : Node_Id) return Source_Ptr;
8939+ function True_Sloc (N, Act_Unit : Node_Id) return Source_Ptr;
89478940 -- If the instance is nested inside a generic unit, the Sloc of the
89488941 -- instance indicates the place of the original definition, not the
89498942 -- point of the current enclosing instance. Pending a better usage of
@@ -8955,20 +8948,22 @@ package body Sem_Ch12 is
89558948 -- In_Same_Scope --
89568949 -------------------
89578950
8958- function In_Same_Scope (Generic_Id, Actual_Id : Node_Id) return Boolean
8959- is
8960- Act_Scop : Entity_Id := Scope (Actual_Id);
8961- Gen_Scop : Entity_Id := Scope (Generic_Id);
8951+ function In_Same_Scope (Gen_Id, Act_Id : Node_Id) return Boolean is
8952+ Act_Scop : Entity_Id := Scope (Act_Id);
8953+ Gen_Scop : Entity_Id := Scope (Gen_Id);
8954+
89628955 begin
8963- while Scope_Depth_Value (Act_Scop) > 0
8964- and then Scope_Depth_Value (Gen_Scop) > 0
8956+ while Act_Scop /= Standard_Standard
8957+ and then Gen_Scop /= Standard_Standard
89658958 loop
89668959 if Act_Scop = Gen_Scop then
89678960 return True;
89688961 end if;
8962+
89698963 Act_Scop := Scope (Act_Scop);
89708964 Gen_Scop := Scope (Gen_Scop);
89718965 end loop;
8966+
89728967 return False;
89738968 end In_Same_Scope;
89748969
@@ -8976,7 +8971,7 @@ package body Sem_Ch12 is
89768971 -- True_Sloc --
89778972 ---------------
89788973
8979- function True_Sloc (N : Node_Id) return Source_Ptr is
8974+ function True_Sloc (N, Act_Unit : Node_Id) return Source_Ptr is
89808975 Res : Source_Ptr;
89818976 N1 : Node_Id;
89828977
@@ -8994,6 +8989,18 @@ package body Sem_Ch12 is
89948989 return Res;
89958990 end True_Sloc;
89968991
8992+ Act_Id : constant Entity_Id := Corresponding_Spec (Act_Body);
8993+ Act_Unit : constant Node_Id := Unit (Cunit (Get_Source_Unit (N)));
8994+ Gen_Id : constant Entity_Id := Corresponding_Spec (Gen_Body);
8995+ Par : constant Entity_Id := Scope (Gen_Id);
8996+ Gen_Unit : constant Node_Id :=
8997+ Unit (Cunit (Get_Source_Unit (Gen_Decl)));
8998+ Orig_Body : Node_Id := Gen_Body;
8999+ F_Node : Node_Id;
9000+ Body_Unit : Node_Id;
9001+
9002+ Must_Delay : Boolean;
9003+
89979004 -- Start of processing for Install_Body
89989005
89999006 begin
@@ -9058,7 +9065,8 @@ package body Sem_Ch12 is
90589065 and then (Nkind_In (Gen_Unit, N_Package_Declaration,
90599066 N_Generic_Package_Declaration)
90609067 or else (Gen_Unit = Body_Unit
9061- and then True_Sloc (N) < Sloc (Orig_Body)))
9068+ and then True_Sloc (N, Act_Unit)
9069+ < Sloc (Orig_Body)))
90629070 and then Is_In_Main_Unit (Original_Node (Gen_Unit))
90639071 and then (In_Same_Scope (Gen_Id, Act_Id)));
90649072