Commit afb4a8cd by Arnaud Charlet

[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
parent 7c55f410
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
......
......@@ -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,
......
......@@ -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}
......@@ -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,
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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);
......
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment