Commit 3cd4a210 by Arnaud Charlet

[multiple changes]

2013-10-10  Robert Dewar  <dewar@adacore.com>

	* lib-writ.adb (Write_Unit_Information): Fatal error if linker
	options are detected in a predefined generic unit.

2013-10-10  Thomas Quinot  <quinot@adacore.com>

	* s-oscons-tmplt.c (CLOCK_REALTIME): Always define, possibly using
	a dummy placeholder value.
	(NEED_PTHREAD_CONDATTR_SETCLOCK): Remove, not needed anymore.
	* thread.c: Adjust #if test accordingly.

2013-10-10  Hristian Kirtchev  <kirtchev@adacore.com>

	* exp_ch6.adb (Consequence_Error): Generate an
	implicit if statement.
	(Expand_Contract_Cases): Generate an implicit if statement.
	(Process_Contract_Cases): Do not expand Contract_Cases when no code
	is being generated.

2013-10-10  Robert Dewar  <dewar@adacore.com>

	* sem_attr.adb (Address_Checks): New procedure.

2013-10-10  Ed Schonberg  <schonberg@adacore.com>

	* sinfo.ads, sinfo.adb: New Node Freeze_Generic_Entity, to trigger
	semantic actions at the proper point for entities that previously
	had no explicit freeze point.
	* freeze.adb (Freeze_Generic_Entities): generate new nodes to
	indicate the point at which semantic checks can be performed on
	entities declared in generic packages.
	* sem_ch13.ads, sem_ch13.adb: New procedure
	Analyze_Freeze_Generic_Entity.
	* exp_util.adb (Insert_Actions): Treat new node like Freeze_Entity.
	* sem.adb (Analyze): Call Analyze_Freeze_Generic_Entity.
	* sprint.adb (Sprint_Node): display Analyze_Freeze_Generic_Entity.
	* gcc-interface/trans.c: Ignore Analyze_Freeze_Generic_Entity.
	* gcc-interface/Make-lang.in: Update dependencies.

From-SVN: r203367
parent 882eadaf
2013-10-10 Robert Dewar <dewar@adacore.com>
* lib-writ.adb (Write_Unit_Information): Fatal error if linker
options are detected in a predefined generic unit.
2013-10-10 Thomas Quinot <quinot@adacore.com>
* s-oscons-tmplt.c (CLOCK_REALTIME): Always define, possibly using
a dummy placeholder value.
(NEED_PTHREAD_CONDATTR_SETCLOCK): Remove, not needed anymore.
* thread.c: Adjust #if test accordingly.
2013-10-10 Hristian Kirtchev <kirtchev@adacore.com>
* exp_ch6.adb (Consequence_Error): Generate an
implicit if statement.
(Expand_Contract_Cases): Generate an implicit if statement.
(Process_Contract_Cases): Do not expand Contract_Cases when no code
is being generated.
2013-10-10 Robert Dewar <dewar@adacore.com>
* sem_attr.adb (Address_Checks): New procedure.
2013-10-10 Ed Schonberg <schonberg@adacore.com>
* sinfo.ads, sinfo.adb: New Node Freeze_Generic_Entity, to trigger
semantic actions at the proper point for entities that previously
had no explicit freeze point.
* freeze.adb (Freeze_Generic_Entities): generate new nodes to
indicate the point at which semantic checks can be performed on
entities declared in generic packages.
* sem_ch13.ads, sem_ch13.adb: New procedure
Analyze_Freeze_Generic_Entity.
* exp_util.adb (Insert_Actions): Treat new node like Freeze_Entity.
* sem.adb (Analyze): Call Analyze_Freeze_Generic_Entity.
* sprint.adb (Sprint_Node): display Analyze_Freeze_Generic_Entity.
* gcc-interface/trans.c: Ignore Analyze_Freeze_Generic_Entity.
* gcc-interface/Make-lang.in: Update dependencies.
2013-10-10 Robert Dewar <dewar@adacore.com>
* sem_aggr.adb (Resolve_Array_Aggregate): Identify duplicated
cases.
......
......@@ -4311,7 +4311,7 @@ package body Exp_Ch6 is
if No (Checks) then
Checks :=
Make_If_Statement (Loc,
Make_Implicit_If_Statement (CCs,
Condition => Cond,
Then_Statements => New_List (Error));
......@@ -4481,7 +4481,7 @@ package body Exp_Ch6 is
-- end if;
Append_To (Decls,
Make_If_Statement (Loc,
Make_Implicit_If_Statement (CCs,
Condition => Relocate_Node (Case_Guard),
Then_Statements => New_List (
Set (Flag),
......@@ -4536,7 +4536,7 @@ package body Exp_Ch6 is
end if;
CG_Checks :=
Make_If_Statement (Loc,
Make_Implicit_If_Statement (CCs,
Condition =>
Make_Op_Eq (Loc,
Left_Opnd => New_Reference_To (Count, Loc),
......@@ -9419,7 +9419,7 @@ package body Exp_Ch6 is
-- generated.
if not Expander_Active then
null;
return;
end if;
Prag := Contract_Test_Cases (Contract (Subp_Id));
......
......@@ -3516,7 +3516,8 @@ package body Exp_Util is
-- Freeze entity behaves like a declaration or statement
N_Freeze_Entity
N_Freeze_Entity |
N_Freeze_Generic_Entity
=>
-- Do not insert here if the item is not a list member (this
-- happens for example with a triggering statement, and the
......
......@@ -1698,6 +1698,10 @@ package body Freeze is
-- integer literal without an explicit corresponding size clause. The
-- caller has checked that Utype is a modular integer type.
function Freeze_Generic_Entities (Pack : Entity_Id) return List_Id;
-- Create Freeze_Generic_Entity nodes for types declared in a generic
-- package. Recurse on inner generic packages.
procedure Freeze_Record_Type (Rec : Entity_Id);
-- Freeze each component, handle some representation clauses, and freeze
-- primitive operations if this is a tagged type.
......@@ -1944,6 +1948,34 @@ package body Freeze is
end if;
end Check_Suspicious_Modulus;
-----------------------------
-- Freeze_Generic_Entities --
-----------------------------
function Freeze_Generic_Entities (Pack : Entity_Id) return List_Id is
E : Entity_Id;
F : Node_Id;
Flist : List_Id;
begin
Flist := New_List;
E := First_Entity (Pack);
while Present (E) loop
if Is_Type (E) and then not Is_Generic_Type (E) then
F := Make_Freeze_Generic_Entity (Sloc (Pack));
Set_Entity (F, E);
Append_To (Flist, F);
elsif Ekind (E) = E_Generic_Package then
Append_List_To (Flist, Freeze_Generic_Entities (E));
end if;
Next_Entity (E);
end loop;
return Flist;
end Freeze_Generic_Entities;
------------------------
-- Freeze_Record_Type --
------------------------
......@@ -2830,6 +2862,9 @@ package body Freeze is
return No_List;
end if;
end;
elsif Ekind (E) = E_Generic_Package then
return Freeze_Generic_Entities (E);
end if;
-- Add checks to detect proper initialization of scalars that may appear
......@@ -3501,7 +3536,9 @@ package body Freeze is
if Present (Scope (E))
and then Is_Generic_Unit (Scope (E))
and then not Has_Predicates (E)
and then
(not Has_Predicates (E)
and then not Has_Delayed_Freeze (E))
then
Check_Compile_Time_Size (E);
return No_List;
......@@ -4244,7 +4281,9 @@ package body Freeze is
-- for the case of a private type with record extension (we will do
-- that later when the full type is frozen).
elsif Ekind_In (E, E_Record_Type, E_Record_Subtype) then
elsif Ekind_In (E, E_Record_Type, E_Record_Subtype)
and then not Is_Generic_Unit (Scope (E))
then
Freeze_Record_Type (E);
-- For a concurrent type, freeze corresponding record type. This
......@@ -4548,6 +4587,7 @@ package body Freeze is
if Is_Pure_Unit_Access_Type (E)
and then (Ada_Version < Ada_2005
or else not No_Pool_Assigned (E))
and then not Is_Generic_Unit (Scope (E))
then
Error_Msg_N ("named access type not allowed in pure unit", E);
......
......@@ -1412,7 +1412,7 @@ ada/errout.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/erroutc.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads \
ada/atree.adb ada/casing.ads ada/csets.ads ada/debug.ads ada/einfo.ads \
ada/err_vars.ads ada/erroutc.ads ada/erroutc.adb ada/gnat.ads \
ada/g-byorma.ads ada/hostparm.ads ada/interfac.ads ada/namet.ads \
ada/namet.adb ada/nlists.ads ada/opt.ads ada/output.ads ada/output.adb \
......@@ -1747,10 +1747,11 @@ ada/exp_ch6.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/exp_util.ads ada/exp_util.adb ada/exp_vfpt.ads ada/expander.ads \
ada/fname.ads ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads \
ada/gnat.ads ada/g-hesorg.ads ada/g-htable.ads ada/hostparm.ads \
ada/inline.ads ada/itypes.ads ada/layout.ads ada/lib.ads ada/lib.adb \
ada/lib-list.adb ada/lib-load.ads ada/lib-sort.adb ada/lib-util.ads \
ada/lib-xref.ads ada/namet.ads ada/namet-sp.ads ada/nlists.ads \
ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
ada/inline.ads ada/interfac.ads ada/itypes.ads ada/layout.ads \
ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-load.ads \
ada/lib-sort.adb ada/lib-util.ads ada/lib-xref.ads ada/namet.ads \
ada/namet.adb ada/namet-sp.ads ada/nlists.ads ada/nlists.adb \
ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
ada/put_spark_xrefs.ads ada/restrict.ads ada/restrict.adb \
ada/rident.ads ada/rtsfind.ads ada/rtsfind.adb ada/scans.ads \
ada/scil_ll.ads ada/sem.ads ada/sem.adb ada/sem_attr.ads \
......@@ -3404,24 +3405,24 @@ ada/sem_ch13.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
ada/put_spark_xrefs.ads ada/restrict.ads ada/rident.ads ada/rtsfind.ads \
ada/rtsfind.adb ada/scans.ads ada/sem.ads ada/sem_attr.ads \
ada/sem_aux.ads ada/sem_aux.adb ada/sem_cat.ads ada/sem_ch13.ads \
ada/sem_ch13.adb ada/sem_ch3.ads ada/sem_ch6.ads ada/sem_ch7.ads \
ada/sem_ch8.ads ada/sem_ch9.ads ada/sem_dim.ads ada/sem_disp.ads \
ada/sem_dist.ads ada/sem_eval.ads ada/sem_eval.adb ada/sem_prag.ads \
ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb \
ada/sem_warn.ads ada/set_targ.ads ada/sinfo.ads ada/sinfo.adb \
ada/sinput.ads ada/snames.ads ada/stand.ads ada/stringt.ads \
ada/style.ads ada/styleg.ads ada/styleg.adb ada/stylesw.ads \
ada/system.ads ada/s-assert.ads ada/s-exctab.ads ada/s-exctab.adb \
ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads \
ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads ada/types.ads \
ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
ada/unchdeal.ads ada/urealp.ads ada/urealp.adb ada/validsw.ads \
ada/warnsw.ads ada/widechar.ads
ada/sem_aux.ads ada/sem_aux.adb ada/sem_case.ads ada/sem_case.adb \
ada/sem_cat.ads ada/sem_ch13.ads ada/sem_ch13.adb ada/sem_ch3.ads \
ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_ch9.ads \
ada/sem_dim.ads ada/sem_disp.ads ada/sem_dist.ads ada/sem_eval.ads \
ada/sem_eval.adb ada/sem_prag.ads ada/sem_res.ads ada/sem_type.ads \
ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads ada/set_targ.ads \
ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
ada/stringt.ads ada/style.ads ada/styleg.ads ada/styleg.adb \
ada/stylesw.ads ada/system.ads ada/s-assert.ads ada/s-exctab.ads \
ada/s-exctab.adb ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads \
ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \
ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads \
ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/urealp.adb \
ada/validsw.ads ada/warnsw.ads ada/widechar.ads
ada/sem_ch2.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
......@@ -3909,29 +3910,30 @@ ada/sem_prag.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/restrict.ads ada/restrict.adb ada/rident.ads ada/rtsfind.ads \
ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads \
ada/sem.adb ada/sem_aggr.ads ada/sem_attr.ads ada/sem_aux.ads \
ada/sem_aux.adb ada/sem_cat.ads ada/sem_ch10.ads ada/sem_ch11.ads \
ada/sem_ch12.ads ada/sem_ch13.ads ada/sem_ch13.adb ada/sem_ch2.ads \
ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch5.ads ada/sem_ch6.ads \
ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_ch9.ads ada/sem_dim.ads \
ada/sem_disp.ads ada/sem_dist.ads ada/sem_elab.ads ada/sem_elim.ads \
ada/sem_eval.ads ada/sem_eval.adb ada/sem_intr.ads ada/sem_mech.ads \
ada/sem_prag.ads ada/sem_prag.adb ada/sem_res.ads ada/sem_res.adb \
ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sem_vfpt.ads \
ada/sem_warn.ads ada/sem_warn.adb ada/set_targ.ads ada/sinfo.ads \
ada/sinfo.adb ada/sinfo-cn.ads ada/sinput.ads ada/sinput.adb \
ada/snames.ads ada/snames.adb ada/sprint.ads ada/stand.ads \
ada/stringt.ads ada/stringt.adb ada/style.ads ada/styleg.ads \
ada/styleg.adb ada/stylesw.ads ada/system.ads ada/s-assert.ads \
ada/s-casuti.ads ada/s-carun8.ads ada/s-crc32.ads ada/s-exctab.ads \
ada/s-exctab.adb ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads \
ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \
ada/s-utf_32.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
ada/targparm.ads ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads \
ada/ttypes.ads ada/types.ads ada/types.adb ada/uintp.ads ada/uintp.adb \
ada/uname.ads ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \
ada/urealp.adb ada/validsw.ads ada/warnsw.ads ada/widechar.ads
ada/sem_aux.adb ada/sem_case.ads ada/sem_cat.ads ada/sem_ch10.ads \
ada/sem_ch11.ads ada/sem_ch12.ads ada/sem_ch13.ads ada/sem_ch13.adb \
ada/sem_ch2.ads ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch5.ads \
ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_ch9.ads \
ada/sem_dim.ads ada/sem_disp.ads ada/sem_dist.ads ada/sem_elab.ads \
ada/sem_elim.ads ada/sem_eval.ads ada/sem_eval.adb ada/sem_intr.ads \
ada/sem_mech.ads ada/sem_prag.ads ada/sem_prag.adb ada/sem_res.ads \
ada/sem_res.adb ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb \
ada/sem_vfpt.ads ada/sem_warn.ads ada/sem_warn.adb ada/set_targ.ads \
ada/sinfo.ads ada/sinfo.adb ada/sinfo-cn.ads ada/sinput.ads \
ada/sinput.adb ada/snames.ads ada/snames.adb ada/sprint.ads \
ada/stand.ads ada/stringt.ads ada/stringt.adb ada/style.ads \
ada/styleg.ads ada/styleg.adb ada/stylesw.ads ada/system.ads \
ada/s-assert.ads ada/s-casuti.ads ada/s-carun8.ads ada/s-crc32.ads \
ada/s-exctab.ads ada/s-exctab.adb ada/s-htable.ads ada/s-imenne.ads \
ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads \
ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
ada/s-stoele.ads ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads \
ada/s-unstyp.ads ada/s-utf_32.ads ada/s-wchcon.ads ada/table.ads \
ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tbuild.adb \
ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/types.adb \
ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
ada/unchdeal.ads ada/urealp.ads ada/urealp.adb ada/validsw.ads \
ada/warnsw.ads ada/widechar.ads
ada/sem_res.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
......
......@@ -6988,6 +6988,10 @@ gnat_to_gnu (Node_Id gnat_node)
gnu_result = end_stmt_group ();
break;
case N_Freeze_Generic_Entity:
gnu_result = alloc_stmt_list ();
break;
case N_Itype_Reference:
if (!present_gnu_tree (Itype (gnat_node)))
process_type (Itype (gnat_node));
......
......@@ -38,6 +38,7 @@ with Gnatvsn; use Gnatvsn;
with Opt; use Opt;
with Osint; use Osint;
with Osint.C; use Osint.C;
with Output; use Output;
with Par;
with Par_SCO; use Par_SCO;
with Restrict; use Restrict;
......@@ -615,9 +616,27 @@ package body Lib.Writ is
Write_With_Lines;
-- Output linker option lines
-- Generate the linker option lines
for J in 1 .. Linker_Option_Lines.Last loop
-- Pragma Linker_Options is not allowed in predefined generic
-- units. This is because they won't be read, due to the fact that
-- with lines for generic units lack the file name and lib name
-- parameters (see Lib_Writ spec for an explanation).
if Is_Generic_Unit (Cunit_Entity (Main_Unit))
and then
Is_Predefined_File_Name (Unit_File_Name (Current_Sem_Unit))
then
Set_Standard_Error;
Write_Line
("linker options not allowed in predefined generic unit");
raise Unrecoverable_Error;
end if;
-- Output one linker option line
declare
S : Linker_Option_Entry renames Linker_Option_Lines.Table (J);
begin
......
......@@ -1389,8 +1389,8 @@ CST(Inet_Pton_Linkname, "")
/* Note: On HP-UX, CLOCK_REALTIME is an enum, not a macro. */
#if !(defined (__hpux__) || defined (CLOCK_REALTIME))
# define CLOCK_REALTIME -1
#if !(defined(CLOCK_REALTIME) || defined (__hpux__))
# define CLOCK_REALTIME (-1)
#endif
CND(CLOCK_REALTIME, "System realtime clock")
......@@ -1407,19 +1407,15 @@ CND(CLOCK_FASTEST, "Fastest clock")
#endif
CND(CLOCK_THREAD_CPUTIME_ID, "Thread CPU clock")
#if defined(__APPLE__)
/* There's no clock_gettime or clock_id's on Darwin, generate a dummy value */
# define CLOCK_RT_Ada "-1"
#elif defined(__FreeBSD__) || defined(_AIX)
#if defined(__FreeBSD__) || defined(_AIX)
/** On these platforms use system provided monotonic clock instead of
** the default CLOCK_REALTIME. We then need to set up cond var attributes
** appropriately (see thread.c).
** the default CLOCK_REALTIME. Note: We then need to set up cond var
** attributes appropriately (see thread.c).
**/
# define CLOCK_RT_Ada "CLOCK_MONOTONIC"
# define NEED_PTHREAD_CONDATTR_SETCLOCK 1
#elif defined(HAVE_CLOCK_REALTIME)
#else
/* By default use CLOCK_REALTIME */
# define CLOCK_RT_Ada "CLOCK_REALTIME"
#endif
......@@ -1427,21 +1423,16 @@ CND(CLOCK_THREAD_CPUTIME_ID, "Thread CPU clock")
#ifdef CLOCK_RT_Ada
CNS(CLOCK_RT_Ada, "")
#endif
#ifdef NEED_PTHREAD_CONDATTR_SETCLOCK
CND(NEED_PTHREAD_CONDATTR_SETCLOCK, "")
#endif
#if defined (__APPLE__) || defined (__linux__) || defined (DUMMY)
/*
-- Sizes of pthread data types
*/
#if defined (__APPLE__) || defined (DUMMY)
/*
-- (on Darwin, these are just placeholders)
*/
#define PTHREAD_SIZE __PTHREAD_SIZE__
#define PTHREAD_ATTR_SIZE __PTHREAD_ATTR_SIZE__
......@@ -1463,7 +1454,9 @@ CND(NEED_PTHREAD_CONDATTR_SETCLOCK, "")
#define PTHREAD_RWLOCK_SIZE (sizeof (pthread_rwlock_t))
#define PTHREAD_ONCE_SIZE (sizeof (pthread_once_t))
#endif
/*
*/
CND(PTHREAD_SIZE, "pthread_t")
CND(PTHREAD_ATTR_SIZE, "pthread_attr_t")
CND(PTHREAD_MUTEXATTR_SIZE, "pthread_mutexattr_t")
......
......@@ -242,6 +242,9 @@ package body Sem is
when N_Freeze_Entity =>
Analyze_Freeze_Entity (N);
when N_Freeze_Generic_Entity =>
Analyze_Freeze_Generic_Entity (N);
when N_Full_Type_Declaration =>
Analyze_Full_Type_Declaration (N);
......
......@@ -5421,6 +5421,16 @@ package body Sem_Ch13 is
end if;
end Analyze_Freeze_Entity;
-----------------------------------
-- Analyze_Freeze_Generic_Entity --
-----------------------------------
procedure Analyze_Freeze_Generic_Entity (N : Node_Id) is
begin
-- Semantic checks here
null;
end Analyze_Freeze_Generic_Entity;
------------------------------------------
-- Analyze_Record_Representation_Clause --
------------------------------------------
......
......@@ -33,6 +33,7 @@ package Sem_Ch13 is
procedure Analyze_Enumeration_Representation_Clause (N : Node_Id);
procedure Analyze_Free_Statement (N : Node_Id);
procedure Analyze_Freeze_Entity (N : Node_Id);
procedure Analyze_Freeze_Generic_Entity (N : Node_Id);
procedure Analyze_Record_Representation_Clause (N : Node_Id);
procedure Analyze_Code_Statement (N : Node_Id);
......
......@@ -1104,7 +1104,8 @@ package body Sinfo is
or else NT (N).Nkind in N_Has_Entity
or else NT (N).Nkind = N_Aspect_Specification
or else NT (N).Nkind = N_Attribute_Definition_Clause
or else NT (N).Nkind = N_Freeze_Entity);
or else NT (N).Nkind = N_Freeze_Entity
or else NT (N).Nkind = N_Freeze_Generic_Entity);
return Node4 (N);
end Entity;
......@@ -4251,7 +4252,8 @@ package body Sinfo is
or else NT (N).Nkind in N_Has_Entity
or else NT (N).Nkind = N_Aspect_Specification
or else NT (N).Nkind = N_Attribute_Definition_Clause
or else NT (N).Nkind = N_Freeze_Entity);
or else NT (N).Nkind = N_Freeze_Entity
or else NT (N).Nkind = N_Freeze_Generic_Entity);
Set_Node4 (N, Val); -- semantic field, no parent set
end Set_Entity;
......
......@@ -7319,6 +7319,27 @@ package Sinfo is
-- Note: in the case where a debug source file is generated, the Sloc
-- for this node points to the FREEZE keyword in the Sprint file output.
---------------------------
-- Freeze_Generic_Entity --
---------------------------
-- The freeze point of an entity indicates the point at which the
-- information needed to generate code for the entity is complete.
-- The freeze node for an entity triggers expander activities, such as
-- build initialization procedures, and backend activities, such as
-- completing the elaboration of packages.
-- For entities declared within a generic unit, for which no code is
-- generated, the freeze point is not equally meaningful. However, in
-- Ada 2012 several semantic checks on declarations must be delayed to
-- the freeze point, and we need to include such a mark in the tree to
-- trigger these checks. The Freeze_Generic_Entity node plays no other
-- role, and is ignored by the expander and the back-end.
-- N_Freeze_Generic_Entity
-- Sloc points near freeze point
-- Entity (Node4-Sem)
--------------------------------
-- Implicit Label Declaration --
--------------------------------
......@@ -8085,6 +8106,7 @@ package Sinfo is
N_Formal_Incomplete_Type_Definition,
N_Formal_Signed_Integer_Type_Definition,
N_Freeze_Entity,
N_Freeze_Generic_Entity,
N_Generic_Association,
N_Handled_Sequence_Of_Statements,
N_Index_Or_Discriminant_Constraint,
......@@ -8179,8 +8201,8 @@ package Sinfo is
N_Expanded_Name ..
N_Attribute_Reference;
-- Nodes that have Entity fields
-- Warning: DOES NOT INCLUDE N_Freeze_Entity, N_Aspect_Specification,
-- or N_Attribute_Definition_Clause.
-- Warning: DOES NOT INCLUDE N_Freeze_Entity, N_Freeze_Generic_Entity,
-- N_Aspect_Specification, or N_Attribute_Definition_Clause.
subtype N_Has_Etype is Node_Kind range
N_Error ..
......@@ -11890,6 +11912,13 @@ package Sinfo is
4 => False, -- Entity (Node4-Sem)
5 => False), -- First_Subtype_Link (Node5-Sem)
N_Freeze_Generic_Entity =>
(1 => False, -- unused
2 => False, -- unused
3 => False, -- unused
4 => False, -- Entity (Node4-Sem)
5 => False), -- unused
N_Implicit_Label_Declaration =>
(1 => True, -- Defining_Identifier (Node1)
2 => False, -- Label_Construct (Node2-Sem)
......
......@@ -800,6 +800,7 @@ package body Sprint is
-- do not duplicate the output at this point.
if Nkind (Node) = N_Freeze_Entity
or else Nkind (Node) = N_Freeze_Generic_Entity
or else Nkind (Node) = N_Implicit_Label_Declaration
then
Sprint_Node_Actual (Node);
......@@ -1862,6 +1863,16 @@ package body Sprint is
Write_Rewrite_Str (">>>");
end if;
when N_Freeze_Generic_Entity =>
if Dump_Original_Only then
null;
else
Write_Indent;
Write_Str_With_Col_Check_Sloc ("freeze_generic ");
Write_Id (Entity (Node));
end if;
when N_Full_Type_Declaration =>
Write_Indent_Str_Sloc ("type ");
Sprint_Node (Defining_Identifier (Node));
......
......@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
* Copyright (C) 2011, Free Software Foundation, Inc. *
* Copyright (C) 2011-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- *
......@@ -33,7 +33,10 @@
#include "s-oscons.h"
#ifdef NEED_PTHREAD_CONDATTR_SETCLOCK
/* If the clock we used for tasking (CLOCK_RT_Ada) is not the default
* CLOCK_REALTIME, we need to set cond var attributes accordingly.
*/
#if CLOCK_RT_Ada != CLOCK_REALTIME
# include <pthread.h>
# include <time.h>
......
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