[multiple changes]
2014-06-11 Robert Dewar <dewar@adacore.com> * gnat_rm.texi, switch-c.adb, sem_prag.adb, a-tgdico.ads, par-prag.adb, opt.ads, a-finali.ads, snames.ads-tmpl: Remove all traces of pragma/aspects Pure_05 Pure_12 Preelaborate_05. * errout.adb (Output_Messages): Avoid duplicate output for library level instance. * sem_elab.adb (Is_Call_Of_Generic_Formal): Moved to outer level (Check_Elab_Call): Add call to Is_Call_Of_Generic_Formal * exp_ch4.adb (Expand_N_Op_Expon): New interface for Exp_Modular. * s-expmod.ads, s-expmod.adb (Exp_Modular): Change interface to accomodate largest modulus value. * gnat_ugn.texi: Minor updates. 2014-06-11 Ed Schonberg <schonberg@adacore.com> * sem_ch12.adb (Instantiate_Package_Body): Do not attempt to load body of generic package or its parent, if body is optional and the unit does not require a body. From-SVN: r211459
This commit is contained in:
parent
f852ffee9a
commit
e9daba5169
|
@ -1,3 +1,23 @@
|
|||
2014-06-11 Robert Dewar <dewar@adacore.com>
|
||||
|
||||
* gnat_rm.texi, switch-c.adb, sem_prag.adb, a-tgdico.ads, par-prag.adb,
|
||||
opt.ads, a-finali.ads, snames.ads-tmpl: Remove all traces of
|
||||
pragma/aspects Pure_05 Pure_12 Preelaborate_05.
|
||||
* errout.adb (Output_Messages): Avoid duplicate output for
|
||||
library level instance.
|
||||
* sem_elab.adb (Is_Call_Of_Generic_Formal): Moved to outer level
|
||||
(Check_Elab_Call): Add call to Is_Call_Of_Generic_Formal
|
||||
* exp_ch4.adb (Expand_N_Op_Expon): New interface for Exp_Modular.
|
||||
* s-expmod.ads, s-expmod.adb (Exp_Modular): Change interface to
|
||||
accomodate largest modulus value.
|
||||
* gnat_ugn.texi: Minor updates.
|
||||
|
||||
2014-06-11 Ed Schonberg <schonberg@adacore.com>
|
||||
|
||||
* sem_ch12.adb (Instantiate_Package_Body): Do not attempt to
|
||||
load body of generic package or its parent, if body is optional
|
||||
and the unit does not require a body.
|
||||
|
||||
2014-06-11 Robert Dewar <dewar@adacore.com>
|
||||
|
||||
* gnat_rm.texi: Document System.Unsigned_Types.
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
-- --
|
||||
-- S p e c --
|
||||
-- --
|
||||
-- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
|
||||
-- Copyright (C) 1992-2014, Free Software Foundation, Inc. --
|
||||
-- --
|
||||
-- This specification is derived from the Ada Reference Manual for use with --
|
||||
-- GNAT. The copyright notice above, and the license provisions that follow --
|
||||
|
@ -38,12 +38,7 @@ with System.Finalization_Root;
|
|||
pragma Warnings (On);
|
||||
|
||||
package Ada.Finalization is
|
||||
pragma Pure_12;
|
||||
-- Ada.Finalization is declared pure in Ada 2012 (AI05-0212)
|
||||
|
||||
pragma Preelaborate;
|
||||
pragma Remote_Types;
|
||||
-- The above apply in versions of Ada before Ada 2012
|
||||
pragma Pure;
|
||||
|
||||
type Controlled is abstract tagged private;
|
||||
pragma Preelaborable_Initialization (Controlled);
|
||||
|
|
|
@ -27,7 +27,3 @@ function Ada.Tags.Generic_Dispatching_Constructor
|
|||
Params : not null access Parameters) return T'Class;
|
||||
pragma Preelaborate (Generic_Dispatching_Constructor);
|
||||
pragma Import (Intrinsic, Generic_Dispatching_Constructor);
|
||||
-- Note: the reason that we use Preelaborate_05 here is so that this will
|
||||
-- compile fine during the normal build procedures. In Ada 2005 mode (which
|
||||
-- is required for this package anyway), this will be treated as Preelaborate
|
||||
-- so everything will be fine.
|
||||
|
|
|
@ -1851,8 +1851,14 @@ package body Errout is
|
|||
|
||||
and then
|
||||
(No (Cunit_Entity (U))
|
||||
or else Comes_From_Source (Cunit_Entity (U))
|
||||
or else not Is_Subprogram (Cunit_Entity (U)))
|
||||
or else Comes_From_Source (Cunit_Entity (U))
|
||||
or else not Is_Subprogram (Cunit_Entity (U)))
|
||||
|
||||
-- If the compilation unit associated with this unit does not
|
||||
-- come from source, it means it is an instantiation that should
|
||||
-- not be included in the source listing.
|
||||
|
||||
and then Comes_From_Source (Cunit (U))
|
||||
then
|
||||
declare
|
||||
Sfile : constant Source_File_Index := Source_Index (U);
|
||||
|
|
|
@ -7593,7 +7593,7 @@ package body Exp_Ch4 is
|
|||
Make_Function_Call (Loc,
|
||||
Name => New_Occurrence_Of (RTE (RE_Exp_Modular), Loc),
|
||||
Parameter_Associations => New_List (
|
||||
Convert_To (Standard_Integer, Base),
|
||||
Convert_To (RTE (RE_Unsigned), Base),
|
||||
Make_Integer_Literal (Loc, Modulus (Rtyp)),
|
||||
Exp))));
|
||||
|
||||
|
|
|
@ -218,7 +218,6 @@ Implementation Defined Pragmas
|
|||
* Pragma Precondition::
|
||||
* Pragma Predicate::
|
||||
* Pragma Preelaborable_Initialization::
|
||||
* Pragma Preelaborate_05::
|
||||
* Pragma Pre_Class::
|
||||
* Pragma Priority_Specific_Dispatching::
|
||||
* Pragma Profile::
|
||||
|
@ -226,8 +225,6 @@ Implementation Defined Pragmas
|
|||
* Pragma Propagate_Exceptions::
|
||||
* Pragma Provide_Shift_Operators::
|
||||
* Pragma Psect_Object::
|
||||
* Pragma Pure_05::
|
||||
* Pragma Pure_12::
|
||||
* Pragma Pure_Function::
|
||||
* Pragma Ravenscar::
|
||||
* Pragma Refined_State::
|
||||
|
@ -297,9 +294,6 @@ Implementation Defined Aspects
|
|||
* Aspect Object_Size::
|
||||
* Aspect Persistent_BSS::
|
||||
* Aspect Predicate::
|
||||
* Aspect Preelaborate_05::
|
||||
* Aspect Pure_05::
|
||||
* Aspect Pure_12::
|
||||
* Aspect Pure_Function::
|
||||
* Aspect Refined_State::
|
||||
* Aspect Remote_Access_Type::
|
||||
|
@ -1054,7 +1048,6 @@ consideration, the use of these pragmas should be minimized.
|
|||
* Pragma Precondition::
|
||||
* Pragma Predicate::
|
||||
* Pragma Preelaborable_Initialization::
|
||||
* Pragma Preelaborate_05::
|
||||
* Pragma Pre_Class::
|
||||
* Pragma Priority_Specific_Dispatching::
|
||||
* Pragma Profile::
|
||||
|
@ -1062,8 +1055,6 @@ consideration, the use of these pragmas should be minimized.
|
|||
* Pragma Propagate_Exceptions::
|
||||
* Pragma Provide_Shift_Operators::
|
||||
* Pragma Psect_Object::
|
||||
* Pragma Pure_05::
|
||||
* Pragma Pure_12::
|
||||
* Pragma Pure_Function::
|
||||
* Pragma Ravenscar::
|
||||
* Pragma Refined_State::
|
||||
|
@ -5598,24 +5589,6 @@ This pragma is standard in Ada 2005, but is available in all earlier
|
|||
versions of Ada as an implementation-defined pragma.
|
||||
See Ada 2012 Reference Manual for details.
|
||||
|
||||
@node Pragma Preelaborate_05
|
||||
@unnumberedsec Pragma Preelaborate_05
|
||||
@findex Preelaborate_05
|
||||
@noindent
|
||||
Syntax:
|
||||
|
||||
@smallexample @c ada
|
||||
pragma Preelaborate_05 [(library_unit_NAME)];
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
This pragma is only available in GNAT mode (@option{-gnatg} switch set)
|
||||
and is intended for use in the standard run-time library only. It has
|
||||
no effect in Ada 83 or Ada 95 mode, but is
|
||||
equivalent to @code{pragma Prelaborate} when operating in later
|
||||
Ada versions. This is used to handle some cases where packages
|
||||
not previously preelaborable became so in Ada 2005.
|
||||
|
||||
@node Pragma Pre_Class
|
||||
@unnumberedsec Pragma Pre_Class
|
||||
@cindex Pre_Class
|
||||
|
@ -5903,42 +5876,6 @@ EXTERNAL_SYMBOL ::=
|
|||
@noindent
|
||||
This pragma is identical in effect to pragma @code{Common_Object}.
|
||||
|
||||
@node Pragma Pure_05
|
||||
@unnumberedsec Pragma Pure_05
|
||||
@findex Pure_05
|
||||
@noindent
|
||||
Syntax:
|
||||
|
||||
@smallexample @c ada
|
||||
pragma Pure_05 [(library_unit_NAME)];
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
This pragma is only available in GNAT mode (@option{-gnatg} switch set)
|
||||
and is intended for use in the standard run-time library only. It has
|
||||
no effect in Ada 83 or Ada 95 mode, but is
|
||||
equivalent to @code{pragma Pure} when operating in later
|
||||
Ada versions. This is used to handle some cases where packages
|
||||
not previously pure became so in Ada 2005.
|
||||
|
||||
@node Pragma Pure_12
|
||||
@unnumberedsec Pragma Pure_12
|
||||
@findex Pure_12
|
||||
@noindent
|
||||
Syntax:
|
||||
|
||||
@smallexample @c ada
|
||||
pragma Pure_12 [(library_unit_NAME)];
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
This pragma is only available in GNAT mode (@option{-gnatg} switch set)
|
||||
and is intended for use in the standard run-time library only. It has
|
||||
no effect in Ada 83, Ada 95, or Ada 2005 modes, but is
|
||||
equivalent to @code{pragma Pure} when operating in later
|
||||
Ada versions. This is used to handle some cases where packages
|
||||
not previously pure became so in Ada 2012.
|
||||
|
||||
@node Pragma Pure_Function
|
||||
@unnumberedsec Pragma Pure_Function
|
||||
@findex Pure_Function
|
||||
|
@ -7920,9 +7857,6 @@ clause.
|
|||
* Aspect Object_Size::
|
||||
* Aspect Persistent_BSS::
|
||||
* Aspect Predicate::
|
||||
* Aspect Preelaborate_05::
|
||||
* Aspect Pure_05::
|
||||
* Aspect Pure_12::
|
||||
* Aspect Pure_Function::
|
||||
* Aspect Refined_State::
|
||||
* Aspect Remote_Access_Type::
|
||||
|
@ -8126,24 +8060,6 @@ predicate is static or dynamic is controlled by the form of the
|
|||
expression. It is also separately controllable using pragma
|
||||
@code{Assertion_Policy}.
|
||||
|
||||
@node Aspect Preelaborate_05
|
||||
@unnumberedsec Aspect Preelaborate_05
|
||||
@findex Preelaborate_05
|
||||
@noindent
|
||||
This aspect is equivalent to pragma @code{Preelaborate_05}.
|
||||
|
||||
@node Aspect Pure_05
|
||||
@unnumberedsec Aspect Pure_05
|
||||
@findex Pure_05
|
||||
@noindent
|
||||
This aspect is equivalent to pragma @code{Pure_05}.
|
||||
|
||||
@node Aspect Pure_12
|
||||
@unnumberedsec Aspect Pure_12
|
||||
@findex Pure_12
|
||||
@noindent
|
||||
This aspect is equivalent to pragma @code{Pure_12}.
|
||||
|
||||
@node Aspect Pure_Function
|
||||
@unnumberedsec Aspect Pure_Function
|
||||
@findex Pure_Function
|
||||
|
|
|
@ -15098,7 +15098,7 @@ Ada source code into XML.
|
|||
|
||||
@menu
|
||||
* Switches for gnat2xml::
|
||||
* Driving gnat2xml with gnatmake or gprbuild::
|
||||
* Driving gnat2xml with gnatmake::
|
||||
* Other Programs::
|
||||
* Structure of the XML::
|
||||
@end menu
|
||||
|
@ -15157,8 +15157,6 @@ Options:
|
|||
-v -- verbose (print out the command line options, and the names of
|
||||
output files as they are generated).
|
||||
|
||||
-t -- do not delete tree files when done (they are deleted by default).
|
||||
|
||||
-cargs ... -- options to pass to gcc
|
||||
@end smallexample
|
||||
|
||||
|
@ -15167,21 +15165,9 @@ If a project file is specified and no argument source is explicitly
|
|||
specified, and no @option{-U} is specified, then the set of processed
|
||||
sources is all the immediate units of the argument project.
|
||||
|
||||
|
||||
You can generate the ``tree files'' ahead of time using the -gnatct switch:
|
||||
|
||||
@smallexample
|
||||
gnatmake -gnat2012 -gnatct *.ad[sb]
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
If tree files do not exist, @command{gnat2xml} will create them by running gcc.
|
||||
See the ASIS documentation for more information on tree files.
|
||||
|
||||
Example:
|
||||
|
||||
@smallexample
|
||||
mkdir xml-files
|
||||
gnat2xml -v -mxml-files *.ad[sb] -cargs -gnat2012
|
||||
@end smallexample
|
||||
|
||||
|
@ -15192,34 +15178,31 @@ body source code lives in mumble-dumble.ads and mumble-dumble.adb,
|
|||
the above will produce xml-files/mumble-dumble.ads.xml and
|
||||
xml-files/mumble-dumble.adb.xml.
|
||||
|
||||
@node Driving gnat2xml with gnatmake or gprbuild
|
||||
@section Driving @command{gnat2xml} with @command{gnatmake} or @command{gprbuild}
|
||||
@node Driving gnat2xml with gnatmake
|
||||
@section Driving @command{gnat2xml} with @command{gnatmake}
|
||||
|
||||
@noindent
|
||||
You can use gnatmake or gprbuild to drive @command{gnat2xml} to get
|
||||
incremental updates of the XML files on a per-source-file basis. For
|
||||
example, if you already have a bunch of XML files, and then you change
|
||||
one source file, it will regenerate XML files only for that source
|
||||
file, and other source files that depend on it. Gnatmake and gprbuild
|
||||
take care of tracking inter-file dependencies. For example, if
|
||||
this.adb says @code{with That;}, then this.adb depends on that.ads.
|
||||
You can use gnatmake to drive @command{gnat2xml} to get incremental
|
||||
updates of the XML files on a per-source-file basis. For example, if
|
||||
you already have a bunch of XML files, and then you change one source
|
||||
file, it will regenerate XML files only for that source file, and
|
||||
other related source files. Gnatmake takes care of tracking inter-file
|
||||
dependencies.
|
||||
|
||||
To do this, you tell gnatmake/gprbuild to pretend that
|
||||
@command{gnat2xml} is the Ada compiler (instead of using gcc as the
|
||||
Ada compiler, as is normal).
|
||||
To do this, you tell gnatmake to pretend that @command{gnat2xml} is
|
||||
the Ada compiler (instead of using gcc as the Ada compiler, as is
|
||||
normal).
|
||||
|
||||
To tell gnatmake to use @command{gnat2xml} instead of gcc as the
|
||||
``compiler'', for example:
|
||||
|
||||
@smallexample
|
||||
gnatmake -gnatc *.adb --GCC="gnat2xml -t -mxml"
|
||||
gnatmake -gnatc main.adb --GCC="gnat2xml -mxml"
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
The @option{--GCC=} switch tells gnatmake that the ``compiler'' to run
|
||||
is @command{gnat2xml -t -mxml}. The @option{-t} switch means to keep the tree
|
||||
files, so they can be reused on the next run. (@command{gnat2xml}
|
||||
deletes them by default.) As usual, @option{-mxml} means to put the
|
||||
is @command{gnat2xml -mxml}. As usual, @option{-mxml} means to put the
|
||||
XML files in the @file{xml} subdirectory.
|
||||
|
||||
You must give the @option{-gnatc} switch to gnatmake, which means
|
||||
|
@ -15227,40 +15210,6 @@ You must give the @option{-gnatc} switch to gnatmake, which means
|
|||
complain about missing object (*.o) files; @command{gnat2xml} of
|
||||
course does not generate *.o files.
|
||||
|
||||
Using gprbuild is similar: you tell it to use @command{gnat2xml}
|
||||
instead of gcc. First write a project file, such as my_project.gpr:
|
||||
|
||||
@smallexample @c projectfile
|
||||
project My_Project is
|
||||
|
||||
package Compiler is
|
||||
for Driver ("ada") use "gnat2xml";
|
||||
-- Use gnat2xml instead of the usual gcc.
|
||||
|
||||
for Default_Switches ("ada") use ("-t", "-mxml");
|
||||
-- Same switches as in the gnatmake case.
|
||||
end Compiler;
|
||||
|
||||
end My_Project;
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
Then:
|
||||
|
||||
@smallexample @c projectfile
|
||||
gprbuild --no-object-check -P my_project.gpr
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
The @option{--no-object-check} switch serves the same purpose as
|
||||
@option{-gnatc} in the gnatmake case --- it tells gprbuild not to
|
||||
expect that the ``compiler'' (really @command{gnat2xml}) will produce
|
||||
*.o files.
|
||||
|
||||
See the gprbuild documentation for information on many other things
|
||||
you can put in the project file, such as telling it where to find
|
||||
the source files.
|
||||
|
||||
@node Other Programs
|
||||
@section Other Programs
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
-- --
|
||||
-- S p e c --
|
||||
-- --
|
||||
-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
|
||||
-- Copyright (C) 1992-2014, 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- --
|
||||
|
@ -137,12 +137,11 @@ package Opt is
|
|||
|
||||
Ada_Version_Explicit : Ada_Version_Type := Ada_Version_Default;
|
||||
-- GNAT
|
||||
-- Like Ada_Version, but does not get set implicitly for predefined
|
||||
-- or internal units, so it reflects the Ada version explicitly set
|
||||
-- using configuration pragmas or compiler switches (or if neither
|
||||
-- appears, it remains set to Ada_Version_Default). This is used in
|
||||
-- the rare cases (notably for pragmas Preelaborate_05 and Pure_05/12)
|
||||
-- where in the run-time we want the explicit version set.
|
||||
-- Like Ada_Version, but does not get set implicitly for predefined or
|
||||
-- internal units, so it reflects the Ada version explicitly set using
|
||||
-- configuration pragmas or compiler switches (or if neither appears, it
|
||||
-- remains set to Ada_Version_Default). This is used in the rare cases
|
||||
-- (notably pragma Obsolescent) where we want the explicit version set.
|
||||
|
||||
Ada_Version_Runtime : Ada_Version_Type := Ada_2012;
|
||||
-- GNAT
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
-- --
|
||||
-- B o d y --
|
||||
-- --
|
||||
-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
|
||||
-- Copyright (C) 1992-2014, 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- --
|
||||
|
@ -1271,7 +1271,6 @@ begin
|
|||
Pragma_Precondition |
|
||||
Pragma_Predicate |
|
||||
Pragma_Preelaborate |
|
||||
Pragma_Preelaborate_05 |
|
||||
Pragma_Pre_Class |
|
||||
Pragma_Priority |
|
||||
Pragma_Priority_Specific_Dispatching |
|
||||
|
@ -1281,8 +1280,6 @@ begin
|
|||
Pragma_Provide_Shift_Operators |
|
||||
Pragma_Psect_Object |
|
||||
Pragma_Pure |
|
||||
Pragma_Pure_05 |
|
||||
Pragma_Pure_12 |
|
||||
Pragma_Pure_Function |
|
||||
Pragma_Queuing_Policy |
|
||||
Pragma_Refined_Depends |
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
-- --
|
||||
-- B o d y --
|
||||
-- --
|
||||
-- Copyright (C) 1992-2009 Free Software Foundation, Inc. --
|
||||
-- Copyright (C) 1992-2014, 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- --
|
||||
|
@ -30,35 +30,27 @@
|
|||
------------------------------------------------------------------------------
|
||||
|
||||
package body System.Exp_Mod is
|
||||
use System.Unsigned_Types;
|
||||
|
||||
-----------------
|
||||
-- Exp_Modular --
|
||||
-----------------
|
||||
|
||||
function Exp_Modular
|
||||
(Left : Integer;
|
||||
Modulus : Integer;
|
||||
Right : Natural)
|
||||
return Integer
|
||||
(Left : Unsigned;
|
||||
Modulus : Unsigned;
|
||||
Right : Natural) return Unsigned
|
||||
is
|
||||
Result : Integer := 1;
|
||||
Factor : Integer := Left;
|
||||
Result : Unsigned := 1;
|
||||
Factor : Unsigned := Left;
|
||||
Exp : Natural := Right;
|
||||
|
||||
function Mult (X, Y : Integer) return Integer;
|
||||
pragma Inline (Mult);
|
||||
function Mult (X, Y : Unsigned) return Unsigned is
|
||||
(Unsigned (Long_Long_Unsigned (X) * Long_Long_Unsigned (Y)
|
||||
mod Long_Long_Unsigned (Modulus)));
|
||||
-- Modular multiplication. Note that we can't take advantage of the
|
||||
-- compiler's circuit, because the modulus is not known statically.
|
||||
|
||||
function Mult (X, Y : Integer) return Integer is
|
||||
begin
|
||||
return Integer
|
||||
(Long_Long_Integer (X) * Long_Long_Integer (Y)
|
||||
mod Long_Long_Integer (Modulus));
|
||||
end Mult;
|
||||
|
||||
-- Start of processing for Exp_Modular
|
||||
|
||||
begin
|
||||
-- We use the standard logarithmic approach, Exp gets shifted right
|
||||
-- testing successive low order bits and Factor is the value of the
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
-- --
|
||||
-- S p e c --
|
||||
-- --
|
||||
-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
|
||||
-- Copyright (C) 1992-2014, 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- --
|
||||
|
@ -33,13 +33,14 @@
|
|||
-- modulus values. Arithmetic is done in Long_Long_Unsigned, with explicit
|
||||
-- accounting for the modulus value which is passed as the second argument.
|
||||
|
||||
with System.Unsigned_Types;
|
||||
|
||||
package System.Exp_Mod is
|
||||
pragma Pure;
|
||||
|
||||
function Exp_Modular
|
||||
(Left : Integer;
|
||||
Modulus : Integer;
|
||||
Right : Natural)
|
||||
return Integer;
|
||||
(Left : System.Unsigned_Types.Unsigned;
|
||||
Modulus : System.Unsigned_Types.Unsigned;
|
||||
Right : Natural) return System.Unsigned_Types.Unsigned;
|
||||
|
||||
end System.Exp_Mod;
|
||||
|
|
|
@ -10037,9 +10037,21 @@ package body Sem_Ch12 is
|
|||
Opt.SPARK_Mode_Pragma := Body_Info.SPARK_Mode_Pragma;
|
||||
|
||||
if No (Gen_Body_Id) then
|
||||
Load_Parent_Of_Generic
|
||||
(Inst_Node, Specification (Gen_Decl), Body_Optional);
|
||||
Gen_Body_Id := Corresponding_Body (Gen_Decl);
|
||||
|
||||
-- Do not look for parent of generic body if none is required.
|
||||
-- This may happen when the routine is called as part of the
|
||||
-- Pending_Instantiations processing, when nested instances
|
||||
-- may precede the one generated from the main unit.
|
||||
|
||||
if not Unit_Requires_Body (Defining_Entity (Gen_Decl))
|
||||
and then Body_Optional
|
||||
then
|
||||
return;
|
||||
else
|
||||
Load_Parent_Of_Generic
|
||||
(Inst_Node, Specification (Gen_Decl), Body_Optional);
|
||||
Gen_Body_Id := Corresponding_Body (Gen_Decl);
|
||||
end if;
|
||||
end if;
|
||||
|
||||
-- Establish global variable for sloc adjustment and for error recovery
|
||||
|
|
|
@ -257,6 +257,9 @@ package body Sem_Elab is
|
|||
-- or instantiation node for which the check code is required. C is the
|
||||
-- test whose failure triggers the raise.
|
||||
|
||||
function Is_Call_Of_Generic_Formal (N : Node_Id) return Boolean;
|
||||
-- Returns True if node N is a call to a generic formal subprogram
|
||||
|
||||
function Is_Finalization_Procedure (Id : Entity_Id) return Boolean;
|
||||
-- Determine whether entity Id denotes a [Deep_]Finalize procedure
|
||||
|
||||
|
@ -312,9 +315,9 @@ package body Sem_Elab is
|
|||
procedure Supply_Bodies (N : Node_Id);
|
||||
-- Given a node, N, that is either a subprogram declaration or a package
|
||||
-- declaration, this procedure supplies dummy bodies for the subprogram
|
||||
-- or for all subprograms in the package. If the given node is not one
|
||||
-- of these two possibilities, then Supply_Bodies does nothing. The
|
||||
-- dummy body contains a single Raise statement.
|
||||
-- or for all subprograms in the package. If the given node is not one of
|
||||
-- these two possibilities, then Supply_Bodies does nothing. The dummy body
|
||||
-- contains a single Raise statement.
|
||||
|
||||
procedure Supply_Bodies (L : List_Id);
|
||||
-- Calls Supply_Bodies for all elements of the given list L
|
||||
|
@ -541,31 +544,6 @@ package body Sem_Elab is
|
|||
-- warnings on the scope are also suppressed. For the internal case,
|
||||
-- we ignore this flag.
|
||||
|
||||
function Is_Call_Of_Generic_Formal return Boolean;
|
||||
-- Returns True if node N is a call to a generic formal subprogram
|
||||
|
||||
-------------------------------
|
||||
-- Is_Call_Of_Generic_Formal --
|
||||
-------------------------------
|
||||
|
||||
function Is_Call_Of_Generic_Formal return Boolean is
|
||||
begin
|
||||
return Nkind_In (N, N_Function_Call, N_Procedure_Call_Statement)
|
||||
|
||||
-- Always return False if debug flag -gnatd.G is set
|
||||
|
||||
and then not Debug_Flag_Dot_GG
|
||||
|
||||
-- For now, we detect this by looking for the strange identifier
|
||||
-- node, whose Chars reflect the name of the generic formal, but
|
||||
-- the Chars of the Entity references the generic actual.
|
||||
|
||||
and then Nkind (Name (N)) = N_Identifier
|
||||
and then Chars (Name (N)) /= Chars (Entity (Name (N)));
|
||||
end Is_Call_Of_Generic_Formal;
|
||||
|
||||
-- Start of processing for Check_A_Call
|
||||
|
||||
begin
|
||||
-- If the call is known to be within a local Suppress Elaboration
|
||||
-- pragma, nothing to check. This can happen in task bodies. But
|
||||
|
@ -573,7 +551,7 @@ package body Sem_Elab is
|
|||
|
||||
if Nkind (N) in N_Subprogram_Call
|
||||
and then No_Elaboration_Check (N)
|
||||
and then not Is_Call_Of_Generic_Formal
|
||||
and then not Is_Call_Of_Generic_Formal (N)
|
||||
then
|
||||
return;
|
||||
end if;
|
||||
|
@ -801,7 +779,7 @@ package body Sem_Elab is
|
|||
if Unit_Caller /= No_Unit
|
||||
and then Unit_Callee /= Unit_Caller
|
||||
and then not Dynamic_Elaboration_Checks
|
||||
and then not Is_Call_Of_Generic_Formal
|
||||
and then not Is_Call_Of_Generic_Formal (N)
|
||||
then
|
||||
E_Scope := Spec_Entity (Cunit_Entity (Unit_Caller));
|
||||
|
||||
|
@ -1302,6 +1280,7 @@ package body Sem_Elab is
|
|||
-- First case, we are in elaboration code
|
||||
|
||||
From_Elab_Code := not In_Subprogram_Or_Concurrent_Unit;
|
||||
|
||||
if From_Elab_Code then
|
||||
|
||||
-- Complain if call that comes from source in preelaborated unit
|
||||
|
@ -1482,7 +1461,15 @@ package body Sem_Elab is
|
|||
Inter_Unit_Only => False,
|
||||
In_Init_Proc => In_Init_Proc);
|
||||
|
||||
elsif Elaboration_Checks_Suppressed (Current_Scope) then
|
||||
-- Nothing to do if elaboration checks suppressed for this scope.
|
||||
-- However, an interesting exception, the fact that elaboration checks
|
||||
-- are suppressed within an instance (because we can trace the body when
|
||||
-- we process the template) does not extend to calls to generic formal
|
||||
-- subprograms.
|
||||
|
||||
elsif Elaboration_Checks_Suppressed (Current_Scope)
|
||||
and then not Is_Call_Of_Generic_Formal (N)
|
||||
then
|
||||
null;
|
||||
|
||||
elsif From_Elab_Code then
|
||||
|
@ -2594,6 +2581,26 @@ package body Sem_Elab is
|
|||
In_Task_Activation := False;
|
||||
end Check_Task_Activation;
|
||||
|
||||
-------------------------------
|
||||
-- Is_Call_Of_Generic_Formal --
|
||||
-------------------------------
|
||||
|
||||
function Is_Call_Of_Generic_Formal (N : Node_Id) return Boolean is
|
||||
begin
|
||||
return Nkind_In (N, N_Function_Call, N_Procedure_Call_Statement)
|
||||
|
||||
-- Always return False if debug flag -gnatd.G is set
|
||||
|
||||
and then not Debug_Flag_Dot_GG
|
||||
|
||||
-- For now, we detect this by looking for the strange identifier
|
||||
-- node, whose Chars reflect the name of the generic formal, but
|
||||
-- the Chars of the Entity references the generic actual.
|
||||
|
||||
and then Nkind (Name (N)) = N_Identifier
|
||||
and then Chars (Name (N)) /= Chars (Entity (Name (N)));
|
||||
end Is_Call_Of_Generic_Formal;
|
||||
|
||||
--------------------------------
|
||||
-- Set_Elaboration_Constraint --
|
||||
--------------------------------
|
||||
|
|
|
@ -18185,44 +18185,6 @@ package body Sem_Prag is
|
|||
end if;
|
||||
end Preelaborate;
|
||||
|
||||
---------------------
|
||||
-- Preelaborate_05 --
|
||||
---------------------
|
||||
|
||||
-- pragma Preelaborate_05 [(library_unit_NAME)];
|
||||
|
||||
-- This pragma is useable only in GNAT_Mode, where it is used like
|
||||
-- pragma Preelaborate but it is only effective in Ada 2005 mode
|
||||
-- (otherwise it is ignored). This is used to implement AI-362 which
|
||||
-- recategorizes some run-time packages in Ada 2005 mode.
|
||||
|
||||
when Pragma_Preelaborate_05 => Preelaborate_05 : declare
|
||||
Ent : Entity_Id;
|
||||
|
||||
begin
|
||||
GNAT_Pragma;
|
||||
Check_Valid_Library_Unit_Pragma;
|
||||
|
||||
if not GNAT_Mode then
|
||||
Error_Pragma ("pragma% only available in GNAT mode");
|
||||
end if;
|
||||
|
||||
if Nkind (N) = N_Null_Statement then
|
||||
return;
|
||||
end if;
|
||||
|
||||
-- This is one of the few cases where we need to test the value of
|
||||
-- Ada_Version_Explicit rather than Ada_Version (which is always
|
||||
-- set to Ada_2012 in a predefined unit), we need to know the
|
||||
-- explicit version set to know if this pragma is active.
|
||||
|
||||
if Ada_Version_Explicit >= Ada_2005 then
|
||||
Ent := Find_Lib_Unit_Name;
|
||||
Set_Is_Preelaborated (Ent);
|
||||
Set_Suppress_Elaboration_Warnings (Ent);
|
||||
end if;
|
||||
end Preelaborate_05;
|
||||
|
||||
--------------
|
||||
-- Priority --
|
||||
--------------
|
||||
|
@ -18834,88 +18796,6 @@ package body Sem_Prag is
|
|||
Set_Suppress_Elaboration_Warnings (Ent);
|
||||
end Pure;
|
||||
|
||||
-------------
|
||||
-- Pure_05 --
|
||||
-------------
|
||||
|
||||
-- pragma Pure_05 [(library_unit_NAME)];
|
||||
|
||||
-- This pragma is useable only in GNAT_Mode, where it is used like
|
||||
-- pragma Pure but it is only effective in Ada 2005 mode (otherwise
|
||||
-- it is ignored). It may be used after a pragma Preelaborate, in
|
||||
-- which case it overrides the effect of the pragma Preelaborate.
|
||||
-- This is used to implement AI-362 which recategorizes some run-time
|
||||
-- packages in Ada 2005 mode.
|
||||
|
||||
when Pragma_Pure_05 => Pure_05 : declare
|
||||
Ent : Entity_Id;
|
||||
|
||||
begin
|
||||
GNAT_Pragma;
|
||||
Check_Valid_Library_Unit_Pragma;
|
||||
|
||||
if not GNAT_Mode then
|
||||
Error_Pragma ("pragma% only available in GNAT mode");
|
||||
end if;
|
||||
|
||||
if Nkind (N) = N_Null_Statement then
|
||||
return;
|
||||
end if;
|
||||
|
||||
-- This is one of the few cases where we need to test the value of
|
||||
-- Ada_Version_Explicit rather than Ada_Version (which is always
|
||||
-- set to Ada_2012 in a predefined unit), we need to know the
|
||||
-- explicit version set to know if this pragma is active.
|
||||
|
||||
if Ada_Version_Explicit >= Ada_2005 then
|
||||
Ent := Find_Lib_Unit_Name;
|
||||
Set_Is_Preelaborated (Ent, False);
|
||||
Set_Is_Pure (Ent);
|
||||
Set_Suppress_Elaboration_Warnings (Ent);
|
||||
end if;
|
||||
end Pure_05;
|
||||
|
||||
-------------
|
||||
-- Pure_12 --
|
||||
-------------
|
||||
|
||||
-- pragma Pure_12 [(library_unit_NAME)];
|
||||
|
||||
-- This pragma is useable only in GNAT_Mode, where it is used like
|
||||
-- pragma Pure but it is only effective in Ada 2012 mode (otherwise
|
||||
-- it is ignored). It may be used after a pragma Preelaborate, in
|
||||
-- which case it overrides the effect of the pragma Preelaborate.
|
||||
-- This is used to implement AI05-0212 which recategorizes some
|
||||
-- run-time packages in Ada 2012 mode.
|
||||
|
||||
when Pragma_Pure_12 => Pure_12 : declare
|
||||
Ent : Entity_Id;
|
||||
|
||||
begin
|
||||
GNAT_Pragma;
|
||||
Check_Valid_Library_Unit_Pragma;
|
||||
|
||||
if not GNAT_Mode then
|
||||
Error_Pragma ("pragma% only available in GNAT mode");
|
||||
end if;
|
||||
|
||||
if Nkind (N) = N_Null_Statement then
|
||||
return;
|
||||
end if;
|
||||
|
||||
-- This is one of the few cases where we need to test the value of
|
||||
-- Ada_Version_Explicit rather than Ada_Version (which is always
|
||||
-- set to Ada_2012 in a predefined unit), we need to know the
|
||||
-- explicit version set to know if this pragma is active.
|
||||
|
||||
if Ada_Version_Explicit >= Ada_2012 then
|
||||
Ent := Find_Lib_Unit_Name;
|
||||
Set_Is_Preelaborated (Ent, False);
|
||||
Set_Is_Pure (Ent);
|
||||
Set_Suppress_Elaboration_Warnings (Ent);
|
||||
end if;
|
||||
end Pure_12;
|
||||
|
||||
-------------------
|
||||
-- Pure_Function --
|
||||
-------------------
|
||||
|
@ -25917,7 +25797,6 @@ package body Sem_Prag is
|
|||
Pragma_Predicate => -1,
|
||||
Pragma_Preelaborable_Initialization => -1,
|
||||
Pragma_Preelaborate => -1,
|
||||
Pragma_Preelaborate_05 => -1,
|
||||
Pragma_Pre_Class => -1,
|
||||
Pragma_Priority => -1,
|
||||
Pragma_Priority_Specific_Dispatching => -1,
|
||||
|
@ -25927,8 +25806,6 @@ package body Sem_Prag is
|
|||
Pragma_Provide_Shift_Operators => -1,
|
||||
Pragma_Psect_Object => -1,
|
||||
Pragma_Pure => -1,
|
||||
Pragma_Pure_05 => -1,
|
||||
Pragma_Pure_12 => -1,
|
||||
Pragma_Pure_Function => -1,
|
||||
Pragma_Queuing_Policy => -1,
|
||||
Pragma_Rational => -1,
|
||||
|
|
|
@ -578,7 +578,6 @@ package Snames is
|
|||
Name_Predicate : constant Name_Id := N + $; -- GNAT
|
||||
Name_Preelaborable_Initialization : constant Name_Id := N + $; -- Ada 05
|
||||
Name_Preelaborate : constant Name_Id := N + $;
|
||||
Name_Preelaborate_05 : constant Name_Id := N + $; -- GNAT
|
||||
Name_Pre_Class : constant Name_Id := N + $; -- GNAT
|
||||
|
||||
-- Note: Priority is not in this list because its name matches the name of
|
||||
|
@ -590,8 +589,6 @@ package Snames is
|
|||
Name_Provide_Shift_Operators : constant Name_Id := N + $; -- GNAT
|
||||
Name_Psect_Object : constant Name_Id := N + $; -- VMS
|
||||
Name_Pure : constant Name_Id := N + $;
|
||||
Name_Pure_05 : constant Name_Id := N + $; -- GNAT
|
||||
Name_Pure_12 : constant Name_Id := N + $; -- GNAT
|
||||
Name_Pure_Function : constant Name_Id := N + $; -- GNAT
|
||||
Name_Refined_Depends : constant Name_Id := N + $; -- GNAT
|
||||
Name_Refined_Global : constant Name_Id := N + $; -- GNAT
|
||||
|
@ -1893,13 +1890,10 @@ package Snames is
|
|||
Pragma_Predicate,
|
||||
Pragma_Preelaborable_Initialization,
|
||||
Pragma_Preelaborate,
|
||||
Pragma_Preelaborate_05,
|
||||
Pragma_Pre_Class,
|
||||
Pragma_Provide_Shift_Operators,
|
||||
Pragma_Psect_Object,
|
||||
Pragma_Pure,
|
||||
Pragma_Pure_05,
|
||||
Pragma_Pure_12,
|
||||
Pragma_Pure_Function,
|
||||
Pragma_Refined_Depends,
|
||||
Pragma_Refined_Global,
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
-- --
|
||||
-- B o d y --
|
||||
-- --
|
||||
-- Copyright (C) 2001-2013, Free Software Foundation, Inc. --
|
||||
-- Copyright (C) 2001-2014, 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- --
|
||||
|
@ -815,11 +815,6 @@ package body Switch.C is
|
|||
System_Extend_Unit := Empty;
|
||||
Warning_Mode := Treat_As_Error;
|
||||
Style_Check_Main := True;
|
||||
|
||||
-- Set Ada 2012 mode explicitly. We don't want to rely on the
|
||||
-- implicit setting here, since for example, we want
|
||||
-- Preelaborate_05 treated as Preelaborate
|
||||
|
||||
Ada_Version := Ada_2012;
|
||||
Ada_Version_Explicit := Ada_2012;
|
||||
Ada_Version_Pragma := Empty;
|
||||
|
|
Loading…
Reference in New Issue