diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2013-04-11 14:46:16 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2013-04-11 14:46:16 +0200 |
commit | afb4a8cda0247500a0084508af16b7ccaf943c8b (patch) | |
tree | e729035d907f2265386759e1f898a7a50170d459 /gcc | |
parent | 7c55f4101789d76d1a9bab69631edb171321f12f (diff) | |
download | gcc-afb4a8cda0247500a0084508af16b7ccaf943c8b.zip gcc-afb4a8cda0247500a0084508af16b7ccaf943c8b.tar.gz gcc-afb4a8cda0247500a0084508af16b7ccaf943c8b.tar.bz2 |
[multiple changes]
2013-04-11 Ed Schonberg <schonberg@adacore.com>
* par-ch6.adb (P_Subprogram): Attach aspects to subprogram stub.
* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Allow aspects on
subprogram stubs.
* sem_ch13.adb (Analyze_Aspect_Specifications): Analyze generated
pre/post pragmas at once before analyzing the proper body.
* sem_prag.adb (Chain_PPC): Handle pragma that comes from an
aspect on a subprogram stub.
* aspects.adb: Aspect specifications can appear on a
subprogram_Body_Stub.
2013-04-11 Vincent Celier <celier@adacore.com>
* gnatname.adb: Minor comment fix.
2013-04-11 Vincent Celier <celier@adacore.com>
* prj-makr.adb (Process_Directory): Create a new temporary
file for each invocation of the compiler, in directory pointed
by environment variable TMPDIR if it exists.
2013-04-11 Arnaud Charlet <charlet@adacore.com>
* gnat_ugn.texi: Minor editing/clean ups.
From-SVN: r197781
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 26 | ||||
-rw-r--r-- | gcc/ada/aspects.adb | 1 | ||||
-rw-r--r-- | gcc/ada/gnat_ugn.texi | 16 | ||||
-rw-r--r-- | gcc/ada/gnatname.adb | 2 | ||||
-rw-r--r-- | gcc/ada/par-ch6.adb | 11 | ||||
-rw-r--r-- | gcc/ada/prj-makr.adb | 33 | ||||
-rw-r--r-- | gcc/ada/sem_ch13.adb | 8 | ||||
-rw-r--r-- | gcc/ada/sem_ch6.adb | 5 | ||||
-rw-r--r-- | gcc/ada/sem_prag.adb | 7 |
9 files changed, 73 insertions, 36 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 3fe0913..918408f 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,31 @@ 2013-04-11 Ed Schonberg <schonberg@adacore.com> + * par-ch6.adb (P_Subprogram): Attach aspects to subprogram stub. + * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Allow aspects on + subprogram stubs. + * sem_ch13.adb (Analyze_Aspect_Specifications): Analyze generated + pre/post pragmas at once before analyzing the proper body. + * sem_prag.adb (Chain_PPC): Handle pragma that comes from an + aspect on a subprogram stub. + * aspects.adb: Aspect specifications can appear on a + subprogram_Body_Stub. + +2013-04-11 Vincent Celier <celier@adacore.com> + + * gnatname.adb: Minor comment fix. + +2013-04-11 Vincent Celier <celier@adacore.com> + + * prj-makr.adb (Process_Directory): Create a new temporary + file for each invocation of the compiler, in directory pointed + by environment variable TMPDIR if it exists. + +2013-04-11 Arnaud Charlet <charlet@adacore.com> + + * gnat_ugn.texi: Minor editing/clean ups. + +2013-04-11 Ed Schonberg <schonberg@adacore.com> + * sem_ch6.adb (Analyze_Null_Procedure): New subprogram, mostly extracted from Analyze_Subprogram_Declaration, to handle null procedure declarations that in ada 2012 can be completions of diff --git a/gcc/ada/aspects.adb b/gcc/ada/aspects.adb index 8186e0c..2ef728c 100644 --- a/gcc/ada/aspects.adb +++ b/gcc/ada/aspects.adb @@ -220,6 +220,7 @@ package body Aspects is N_Subprogram_Body => True, N_Subprogram_Declaration => True, N_Subprogram_Renaming_Declaration => True, + N_Subprogram_Body_Stub => True, N_Subtype_Declaration => True, N_Task_Body => True, N_Task_Type_Declaration => True, diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index 9ef3fe4..5210751 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -3926,23 +3926,19 @@ files. It is possible to supply several file names on the same @command{gcc} command. This causes @command{gcc} to call the appropriate compiler for -each file. For example, the following command lists three separate +each file. For example, the following command lists two separate files to be compiled: @smallexample -$ gcc -c x.adb y.adb z.c +$ gcc -c x.adb y.adb @end smallexample @noindent calls @code{gnat1} (the Ada compiler) twice to compile @file{x.adb} and -@file{y.adb}, and @code{cc1} (the C compiler) once to compile @file{z.c}. -The compiler generates three object files @file{x.o}, @file{y.o} and -@file{z.o} and the two ALI files @file{x.ali} and @file{y.ali} from the -Ada compilations. Any switches apply to all the files ^listed,^listed.^ -@ifclear vms -except for -@option{-gnat@var{x}} switches, which apply only to Ada compilations. -@end ifclear +@file{y.adb}. +The compiler generates two object files @file{x.o} and @file{y.o} +and the two ALI files @file{x.ali} and @file{y.ali}. +Any switches apply to all the files ^listed,^listed.^ @node Switches for gcc @section Switches for @command{gcc} diff --git a/gcc/ada/gnatname.adb b/gcc/ada/gnatname.adb index 3c68731..56157ea 100644 --- a/gcc/ada/gnatname.adb +++ b/gcc/ada/gnatname.adb @@ -88,7 +88,7 @@ procedure Gnatname is Table_Initial => 10, Table_Increment => 100, Table_Name => "Gnatname.Arguments"); - -- Table to accumulate the foreign patterns + -- Table to accumulate directories and patterns package Preprocessor_Switches is new Table.Table (Table_Component_Type => String_Access, diff --git a/gcc/ada/par-ch6.adb b/gcc/ada/par-ch6.adb index 2243ace..42c2a85 100644 --- a/gcc/ada/par-ch6.adb +++ b/gcc/ada/par-ch6.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2013, 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- -- @@ -684,6 +684,15 @@ package body Ch6 is Stub_Node := New_Node (N_Subprogram_Body_Stub, Sloc (Specification_Node)); Set_Specification (Stub_Node, Specification_Node); + + -- The specification has been parsed as part of a subprogram + -- declaration, and aspects have already been collected. + + if Is_Non_Empty_List (Aspects) then + Set_Parent (Aspects, Stub_Node); + Set_Aspect_Specifications (Stub_Node, Aspects); + end if; + Scan; -- past SEPARATE Pop_Scope_Stack; TF_Semicolon; diff --git a/gcc/ada/prj-makr.adb b/gcc/ada/prj-makr.adb index 3b86964..0ed8050 100644 --- a/gcc/ada/prj-makr.adb +++ b/gcc/ada/prj-makr.adb @@ -38,6 +38,7 @@ with Prj.Util; use Prj.Util; with Sdefault; with Snames; use Snames; with Table; use Table; +with Tempdir; with Ada.Characters.Handling; use Ada.Characters.Handling; with GNAT.Directory_Operations; use GNAT.Directory_Operations; @@ -1235,6 +1236,7 @@ package body Prj.Makr is Success : Boolean; Saved_Output : File_Descriptor; Saved_Error : File_Descriptor; + Tmp_File : Path_Name_Type; begin -- If we don't have the path of the compiler yet, @@ -1256,19 +1258,17 @@ package body Prj.Makr is end if; end if; - -- If we don't have yet the file name of the - -- temporary file, get it now. + -- Create the temporary file - if Temp_File_Name = null then - Create_Temp_File (FD, Temp_File_Name); + Tempdir.Create_Temp_File (FD, Tmp_File); - if FD = Invalid_FD then - Prj.Com.Fail - ("could not create temporary file"); - end if; + if FD = Invalid_FD then + Prj.Com.Fail + ("could not create temporary file"); - Close (FD); - Delete_File (Temp_File_Name.all, Success); + else + Temp_File_Name := + new String'(Get_Name_String (Tmp_File)); end if; Args (Args'Last) := new String' @@ -1276,16 +1276,6 @@ package body Prj.Makr is Directory_Separator & Str (1 .. Last)); - -- Create the temporary file - - FD := Create_Output_Text_File - (Name => Temp_File_Name.all); - - if FD = Invalid_FD then - Prj.Com.Fail - ("could not create temporary file"); - end if; - -- Save the standard output and error Saved_Output := Dup (Standout); @@ -1331,7 +1321,8 @@ package body Prj.Makr is if not Is_Valid (File) then Prj.Com.Fail - ("could not read temporary file"); + ("could not read temporary file " & + Temp_File_Name.all); end if; Save_Last_Source_Index := Sources.Last; diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 41a7a2c..6c19a55 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -1693,6 +1693,14 @@ package body Sem_Ch13 is else Insert_After (N, Aitem); + + -- Pre/Postconditions on stubs are analyzed at once, + -- because the proper body is analyzed next, and the + -- contract must be captured before the body. + + if Nkind (N) = N_Subprogram_Body_Stub then + Analyze (Aitem); + end if; end if; goto Continue; diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 8ac527d..e34154c 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -2681,10 +2681,11 @@ package body Sem_Ch6 is end if; -- Ada 2012 aspects may appear in a subprogram body, but only if there - -- is no previous spec. + -- is no previous spec. Ditto for a subprogram stub that does not have + -- a corresponding spec, but for which there may also be a spec_id. if Has_Aspects (N) then - if Present (Corresponding_Spec (N)) then + if Present (Spec_Id) then Error_Msg_N ("aspect specifications must appear in subprogram declaration", N); diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index c581fc6..32d3979 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -2187,13 +2187,18 @@ package body Sem_Prag is ("aspect % requires ''Class for null procedure"); -- Pre/postconditions are legal on a subprogram body if it is not - -- a completion of a declaration. + -- a completion of a declaration. They are also legal on a stub + -- with no previous declarations (this is checked when processing + -- the corresponding aspects). elsif Nkind (PO) = N_Subprogram_Body and then Acts_As_Spec (PO) then null; + elsif Nkind (PO) = N_Subprogram_Body_Stub then + null; + elsif not Nkind_In (PO, N_Subprogram_Declaration, N_Expression_Function, N_Generic_Subprogram_Declaration, |