• 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

修订版0e77949e878dd109ee7daffcda12faa1a8000d29 (tree)
时间2016-07-07 22:05:08
作者Arnaud Charlet <charlet@gcc....>
CommiterArnaud Charlet

Log Message

[multiple changes]

2016-07-07 Ed Schonberg <schonberg@adacore.com>

* sem_prag.ads, sem_prag.adb (Build_Classwide_Expression): Include
overridden operation as parameter, in order to map formals of
the overridden and overring operation properly prior to rewriting
the inherited condition.
* freeze.adb (Check_Inherited_Cnonditions): Change call to
Build_Class_Wide_Expression accordingly. In Spark_Mode, add
call to analyze the contract of the parent operation, prior to
mapping formals between operations.

2016-07-07 Arnaud Charlet <charlet@adacore.com>

* adabkend.adb (Scan_Back_End_Switches): Ignore -o/-G switches
as done in back_end.adb.
(Scan_Compiler_Args): Remove special case for CodePeer/SPARK, no longer
needed, and prevents proper handling of multi-unit sources.

2016-07-07 Thomas Quinot <quinot@adacore.com>

* g-sechas.adb, g-sechas.ads (GNAT.Secure_Hashes.H): Add Hash_Stream
type with Write primitive calling Update on the underlying context
(and dummy Read primitive raising P_E).

2016-07-07 Thomas Quinot <quinot@adacore.com>

* sem_ch13.adb: Minor reformatting.

From-SVN: r238111

更改概述

差异

--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,31 @@
1+2016-07-07 Ed Schonberg <schonberg@adacore.com>
2+
3+ * sem_prag.ads, sem_prag.adb (Build_Classwide_Expression): Include
4+ overridden operation as parameter, in order to map formals of
5+ the overridden and overring operation properly prior to rewriting
6+ the inherited condition.
7+ * freeze.adb (Check_Inherited_Cnonditions): Change call to
8+ Build_Class_Wide_Expression accordingly. In Spark_Mode, add
9+ call to analyze the contract of the parent operation, prior to
10+ mapping formals between operations.
11+
12+2016-07-07 Arnaud Charlet <charlet@adacore.com>
13+
14+ * adabkend.adb (Scan_Back_End_Switches): Ignore -o/-G switches
15+ as done in back_end.adb.
16+ (Scan_Compiler_Args): Remove special case for CodePeer/SPARK, no longer
17+ needed, and prevents proper handling of multi-unit sources.
18+
19+2016-07-07 Thomas Quinot <quinot@adacore.com>
20+
21+ * g-sechas.adb, g-sechas.ads (GNAT.Secure_Hashes.H): Add Hash_Stream
22+ type with Write primitive calling Update on the underlying context
23+ (and dummy Read primitive raising P_E).
24+
25+2016-07-07 Thomas Quinot <quinot@adacore.com>
26+
27+ * sem_ch13.adb: Minor reformatting.
28+
129 2016-07-07 Thomas Quinot <quinot@adacore.com>
230
331 * g-socket.ads: Document performance consideration for stream
--- a/gcc/ada/adabkend.adb
+++ b/gcc/ada/adabkend.adb
@@ -98,31 +98,15 @@ package body Adabkend is
9898 -- affect code generation or falling through if it does, so the
9999 -- switch will get stored.
100100
101- if Is_Internal_GCC_Switch (Switch_Chars) then
101+ -- Skip -o, -G or internal GCC switches together with their argument.
102+
103+ if Switch_Chars (First .. Last) = "o"
104+ or else Switch_Chars (First .. Last) = "G"
105+ or else Is_Internal_GCC_Switch (Switch_Chars)
106+ then
102107 Next_Arg := Next_Arg + 1;
103108 return; -- ignore this switch
104109
105- -- Record that an object file name has been specified. The actual
106- -- file name argument is picked up and saved below by the main body
107- -- of Scan_Compiler_Arguments.
108-
109- elsif Switch_Chars (First .. Last) = "o" then
110- if First = Last then
111- if Opt.Output_File_Name_Present then
112-
113- -- Ignore extra -o when -gnatO has already been specified
114-
115- Next_Arg := Next_Arg + 1;
116-
117- else
118- Opt.Output_File_Name_Present := True;
119- end if;
120-
121- return;
122- else
123- Fail ("invalid switch: " & Switch_Chars);
124- end if;
125-
126110 -- Set optimization indicators appropriately. In gcc-based GNAT this
127111 -- is picked up from imported variables set by the gcc driver, but
128112 -- for compilers with non-gcc back ends we do it here to allow use
@@ -244,16 +228,6 @@ package body Adabkend is
244228 then
245229 if Is_Switch (Argv) then
246230 Fail ("Object file name missing after -gnatO");
247-
248- -- In GNATprove_Mode, such an object file is never written, and
249- -- the call to Set_Output_Object_File_Name may fail (e.g. when
250- -- the object file name does not have the expected suffix).
251- -- So we skip that call when GNATprove_Mode is set. Same for
252- -- CodePeer_Mode.
253-
254- elsif GNATprove_Mode or CodePeer_Mode then
255- Output_File_Name_Seen := True;
256-
257231 else
258232 Set_Output_Object_File_Name (Argv);
259233 Output_File_Name_Seen := True;
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -23,51 +23,52 @@
2323 -- --
2424 ------------------------------------------------------------------------------
2525
26-with Aspects; use Aspects;
27-with Atree; use Atree;
28-with Checks; use Checks;
29-with Debug; use Debug;
30-with Einfo; use Einfo;
31-with Elists; use Elists;
32-with Errout; use Errout;
33-with Exp_Ch3; use Exp_Ch3;
34-with Exp_Ch7; use Exp_Ch7;
35-with Exp_Disp; use Exp_Disp;
36-with Exp_Pakd; use Exp_Pakd;
37-with Exp_Util; use Exp_Util;
38-with Exp_Tss; use Exp_Tss;
39-with Fname; use Fname;
40-with Ghost; use Ghost;
41-with Layout; use Layout;
42-with Lib; use Lib;
43-with Namet; use Namet;
44-with Nlists; use Nlists;
45-with Nmake; use Nmake;
46-with Opt; use Opt;
47-with Restrict; use Restrict;
48-with Rident; use Rident;
49-with Rtsfind; use Rtsfind;
50-with Sem; use Sem;
51-with Sem_Aux; use Sem_Aux;
52-with Sem_Cat; use Sem_Cat;
53-with Sem_Ch6; use Sem_Ch6;
54-with Sem_Ch7; use Sem_Ch7;
55-with Sem_Ch8; use Sem_Ch8;
56-with Sem_Ch13; use Sem_Ch13;
57-with Sem_Eval; use Sem_Eval;
58-with Sem_Mech; use Sem_Mech;
59-with Sem_Prag; use Sem_Prag;
60-with Sem_Res; use Sem_Res;
61-with Sem_Util; use Sem_Util;
62-with Sinfo; use Sinfo;
63-with Snames; use Snames;
64-with Stand; use Stand;
65-with Targparm; use Targparm;
66-with Tbuild; use Tbuild;
67-with Ttypes; use Ttypes;
68-with Uintp; use Uintp;
69-with Urealp; use Urealp;
70-with Warnsw; use Warnsw;
26+with Aspects; use Aspects;
27+with Atree; use Atree;
28+with Checks; use Checks;
29+with Contracts; use Contracts;
30+with Debug; use Debug;
31+with Einfo; use Einfo;
32+with Elists; use Elists;
33+with Errout; use Errout;
34+with Exp_Ch3; use Exp_Ch3;
35+with Exp_Ch7; use Exp_Ch7;
36+with Exp_Disp; use Exp_Disp;
37+with Exp_Pakd; use Exp_Pakd;
38+with Exp_Util; use Exp_Util;
39+with Exp_Tss; use Exp_Tss;
40+with Fname; use Fname;
41+with Ghost; use Ghost;
42+with Layout; use Layout;
43+with Lib; use Lib;
44+with Namet; use Namet;
45+with Nlists; use Nlists;
46+with Nmake; use Nmake;
47+with Opt; use Opt;
48+with Restrict; use Restrict;
49+with Rident; use Rident;
50+with Rtsfind; use Rtsfind;
51+with Sem; use Sem;
52+with Sem_Aux; use Sem_Aux;
53+with Sem_Cat; use Sem_Cat;
54+with Sem_Ch6; use Sem_Ch6;
55+with Sem_Ch7; use Sem_Ch7;
56+with Sem_Ch8; use Sem_Ch8;
57+with Sem_Ch13; use Sem_Ch13;
58+with Sem_Eval; use Sem_Eval;
59+with Sem_Mech; use Sem_Mech;
60+with Sem_Prag; use Sem_Prag;
61+with Sem_Res; use Sem_Res;
62+with Sem_Util; use Sem_Util;
63+with Sinfo; use Sinfo;
64+with Snames; use Snames;
65+with Stand; use Stand;
66+with Targparm; use Targparm;
67+with Tbuild; use Tbuild;
68+with Ttypes; use Ttypes;
69+with Uintp; use Uintp;
70+with Urealp; use Urealp;
71+with Warnsw; use Warnsw;
7172
7273 package body Freeze is
7374
@@ -1417,6 +1418,16 @@ package body Freeze is
14171418 -- overriding operations.
14181419
14191420 if SPARK_Mode = On then
1421+
1422+ -- Analyze the contract items of the parent operation, before
1423+ -- they are rewritten when inherited.
1424+
1425+ Analyze_Entry_Or_Subprogram_Contract
1426+ (Overridden_Operation (Prim));
1427+
1428+ -- Now verify the legality of inherited contracts for LSP
1429+ -- conformance.
1430+
14201431 Collect_Inherited_Class_Wide_Conditions (Prim);
14211432 end if;
14221433 end if;
@@ -1440,15 +1451,15 @@ package body Freeze is
14401451 A_Pre := Find_Aspect (Par_Prim, Aspect_Pre);
14411452
14421453 if Present (A_Pre) and then Class_Present (A_Pre) then
1443- Build_Classwide_Expression (Expression (A_Pre), Prim,
1444- Adjust_Sloc => False);
1454+ Build_Classwide_Expression
1455+ (Expression (A_Pre), Prim, Par_Prim, Adjust_Sloc => False);
14451456 end if;
14461457
14471458 A_Post := Find_Aspect (Par_Prim, Aspect_Post);
14481459
14491460 if Present (A_Post) and then Class_Present (A_Post) then
1450- Build_Classwide_Expression (Expression (A_Post), Prim,
1451- Adjust_Sloc => False);
1461+ Build_Classwide_Expression
1462+ (Expression (A_Post), Prim, Par_Prim, Adjust_Sloc => False);
14521463 end if;
14531464 end if;
14541465
--- a/gcc/ada/g-sechas.adb
+++ b/gcc/ada/g-sechas.adb
@@ -6,7 +6,7 @@
66 -- --
77 -- B o d y --
88 -- --
9--- Copyright (C) 2009-2014, Free Software Foundation, Inc. --
9+-- Copyright (C) 2009-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- --
@@ -341,6 +341,20 @@ package body GNAT.Secure_Hashes is
341341 end return;
342342 end HMAC_Initial_Context;
343343
344+ ----------
345+ -- Read --
346+ ----------
347+
348+ procedure Read
349+ (Stream : in out Hash_Stream;
350+ Item : out Stream_Element_Array;
351+ Last : out Stream_Element_Offset)
352+ is
353+ pragma Unreferenced (Stream, Item, Last);
354+ begin
355+ raise Program_Error with "Hash_Stream is write-only";
356+ end Read;
357+
344358 ------------
345359 -- Update --
346360 ------------
@@ -364,7 +378,6 @@ package body GNAT.Secure_Hashes is
364378 C.M_State.Last := 0;
365379 end if;
366380 end loop;
367-
368381 end Update;
369382
370383 ------------
@@ -422,6 +435,18 @@ package body GNAT.Secure_Hashes is
422435 return Digest (C);
423436 end Wide_Digest;
424437
438+ -----------
439+ -- Write --
440+ -----------
441+
442+ procedure Write
443+ (Stream : in out Hash_Stream;
444+ Item : Stream_Element_Array)
445+ is
446+ begin
447+ Update (Stream.C.all, Item);
448+ end Write;
449+
425450 end H;
426451
427452 -------------------------
--- a/gcc/ada/g-sechas.ads
+++ b/gcc/ada/g-sechas.ads
@@ -6,7 +6,7 @@
66 -- --
77 -- S p e c --
88 -- --
9--- Copyright (C) 2009-2014, Free Software Foundation, Inc. --
9+-- Copyright (C) 2009-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- --
@@ -191,6 +191,12 @@ package GNAT.Secure_Hashes is
191191 -- Wide_Update) on a default initialized Context, followed by Digest
192192 -- on the resulting Context.
193193
194+ type Hash_Stream (C : access Context) is
195+ new Root_Stream_Type with private;
196+ -- Stream wrapper converting Write calls to Update calls on C.
197+ -- Arbitrary data structures can thus be conveniently hashed using
198+ -- their stream attributes.
199+
194200 private
195201
196202 Block_Length : constant Natural := Block_Words * Word_Length;
@@ -215,6 +221,20 @@ package GNAT.Secure_Hashes is
215221 Initial_Context : constant Context (KL => 0) := (others => <>);
216222 -- Initial values are provided by default initialization of Context
217223
224+ type Hash_Stream (C : access Context) is
225+ new Root_Stream_Type with null record;
226+
227+ procedure Read
228+ (Stream : in out Hash_Stream;
229+ Item : out Stream_Element_Array;
230+ Last : out Stream_Element_Offset);
231+ -- Raise Program_Error: hash streams are write-only
232+
233+ procedure Write
234+ (Stream : in out Hash_Stream;
235+ Item : Stream_Element_Array);
236+ -- Call Update
237+
218238 end H;
219239
220240 end GNAT.Secure_Hashes;
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -3823,8 +3823,8 @@ package body Sem_Ch13 is
38233823 U_Ent : Entity_Id;
38243824 -- The underlying entity to which the attribute applies. Generally this
38253825 -- is the Underlying_Type of Ent, except in the case where the clause
3826- -- applies to full view of incomplete type or private type in which case
3827- -- U_Ent is just a copy of Ent.
3826+ -- applies to the full view of an incomplete or private type, in which
3827+ -- case U_Ent is just a copy of Ent.
38283828
38293829 FOnly : Boolean := False;
38303830 -- Reset to True for subtype specific attribute (Alignment, Size)
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -26396,8 +26396,12 @@ package body Sem_Prag is
2639626396 procedure Build_Classwide_Expression
2639726397 (Prag : Node_Id;
2639826398 Subp : Entity_Id;
26399+ Par_Subp : Entity_Id;
2639926400 Adjust_Sloc : Boolean)
2640026401 is
26402+ Par_Formal : Entity_Id;
26403+ Subp_Formal : Entity_Id;
26404+
2640126405 function Replace_Entity (N : Node_Id) return Traverse_Result;
2640226406 -- Replace reference to formal of inherited operation or to primitive
2640326407 -- operation of root type, with corresponding entity for derived type,
@@ -26503,6 +26507,17 @@ package body Sem_Prag is
2650326507 -- Start of processing for Build_Classwide_Expression
2650426508
2650526509 begin
26510+ -- Add mapping from old formals to new formals.
26511+
26512+ Par_Formal := First_Formal (Par_Subp);
26513+ Subp_Formal := First_Formal (Subp);
26514+
26515+ while Present (Par_Formal) and then Present (Subp_Formal) loop
26516+ Primitives_Mapping.Set (Par_Formal, Subp_Formal);
26517+ Next_Formal (Par_Formal);
26518+ Next_Formal (Subp_Formal);
26519+ end loop;
26520+
2650626521 Replace_Condition_Entities (Prag);
2650726522 end Build_Classwide_Expression;
2650826523
@@ -26555,10 +26570,8 @@ package body Sem_Prag is
2655526570 Loc : constant Source_Ptr := Sloc (Prag);
2655626571 Prag_Nam : constant Name_Id := Pragma_Name (Prag);
2655726572 Check_Prag : Node_Id;
26558- Inher_Formal : Entity_Id;
2655926573 Msg_Arg : Node_Id;
2656026574 Nam : Name_Id;
26561- Subp_Formal : Entity_Id;
2656226575
2656326576 -- Start of processing for Build_Pragma_Check_Equivalent
2656426577
@@ -26573,16 +26586,6 @@ package body Sem_Prag is
2657326586
2657426587 Update_Primitives_Mapping (Inher_Id, Subp_Id);
2657526588
26576- -- Add mapping from old formals to new formals.
26577-
26578- Inher_Formal := First_Formal (Inher_Id);
26579- Subp_Formal := First_Formal (Subp_Id);
26580- while Present (Inher_Formal) and then Present (Subp_Formal) loop
26581- Primitives_Mapping.Set (Inher_Formal, Subp_Formal);
26582- Next_Formal (Inher_Formal);
26583- Next_Formal (Subp_Formal);
26584- end loop;
26585-
2658626589 -- Use generic machinery to copy inherited pragma, as if it were an
2658726590 -- instantiation, resetting source locations appropriately, so that
2658826591 -- expressions inside the inherited pragma use chained locations.
@@ -26592,9 +26595,13 @@ package body Sem_Prag is
2659226595 Set_Copied_Sloc_For_Inherited_Pragma
2659326596 (Unit_Declaration_Node (Subp_Id), Inher_Id);
2659426597 Check_Prag := New_Copy_Tree (Source => Prag);
26595- Build_Classwide_Expression (Check_Prag, Subp_Id, Adjust_Sloc => True);
2659626598
26597- -- Otherwise simply copy the original pragma
26599+ -- Build the inherited classwide condition.
26600+
26601+ Build_Classwide_Expression
26602+ (Check_Prag, Subp_Id, Inher_Id, Adjust_Sloc => True);
26603+
26604+ -- If not an inherited condition simply copy the original pragma
2659826605
2659926606 else
2660026607 Check_Prag := New_Copy_Tree (Source => Prag);
@@ -29301,7 +29308,8 @@ package body Sem_Prag is
2930129308 Subp_Id : Entity_Id)
2930229309 is
2930329310 function Overridden_Ancestor (S : Entity_Id) return Entity_Id;
29304- -- ??? what does this routine do?
29311+ -- Locate the primitive operation with the name of S whose controlling
29312+ -- type is the dispatching type of Inher_Id.
2930529313
2930629314 -------------------------
2930729315 -- Overridden_Ancestor --
@@ -29333,7 +29341,7 @@ package body Sem_Prag is
2933329341 Old_Prim : Entity_Id;
2933429342 Prim : Entity_Id;
2933529343
29336- -- Start of processing for Primitive_Mapping
29344+ -- Start of processing for Update_Primitives_Mapping
2933729345
2933829346 begin
2933929347 -- If the types are already in the map, it has been previously built for
--- a/gcc/ada/sem_prag.ads
+++ b/gcc/ada/sem_prag.ads
@@ -247,10 +247,12 @@ package Sem_Prag is
247247 procedure Build_Classwide_Expression
248248 (Prag : Node_Id;
249249 Subp : Entity_Id;
250+ Par_Subp : Entity_Id;
250251 Adjust_Sloc : Boolean);
251252 -- Build the expression for an inherited classwide condition. Prag is
252253 -- the pragma constructed from the corresponding aspect of the parent
253- -- subprogram, and Subp is the overridding operation. Adjust_Sloc is True
254+ -- subprogram, and Subp is the overridding operation and Par_Subp is
255+ -- the overridden operation that has the condition. Adjust_Sloc is True
254256 -- when the sloc of nodes traversed should be adjusted for the inherited
255257 -- pragma. The routine is also called to check whether an inherited
256258 -- operation that is not overridden but has inherited conditions need