* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@197781
138bc75d-0d04-0410-961f-
82ee72b054a4
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
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,
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}
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,
-- --
-- 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- --
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;
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;
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,
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'
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);
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;
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;
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);
("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,