2017-11-09 Ed Schonberg <schonberg@adacore.com>
+ * sem_ch12.adb (Analyze_Generic_Package_Declaration): Handle properly
+ the pragma Compile_Time_Error when it appears in a generic package
+ declaration and uses an expanded name to denote the current unit.
+
+2017-11-09 Jerome Lambourg <lambourg@adacore.com>
+
+ * libgnarl/s-taprop__qnx.adb: Fix incorrect casing for pthread_self.
+ * tracebak.c: Add support for tracebacks in QNX.
+
+2017-11-09 Eric Botcazou <ebotcazou@adacore.com>
+
+ * exp_aggr.adb (Aggr_Size_OK): Bump base limit from 50000 to 500000.
+
+2017-11-09 Yannick Moy <moy@adacore.com>
+
+ * erroutc.adb, set_targ.adb: Remove pragma Annotate for CodePeer
+ justification.
+
+2017-11-09 Joel Brobecker <brobecker@adacore.com>
+
+ * doc/gnat_ugn/platform_specific_information.rst: Document packages
+ needed on GNU/Linux by GNAT.
+ * gnat_ugn.texi: Regenerate.
+
+2017-11-09 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * contracts.adb (Analyze_Contracts): Remove the three parameter
+ version. This routine now only analyzes contracts and does not perform
+ any freezing actions.
+ (Analyze_Previous_Contracts): Removed.
+ (Freeze_Previous_Contracts): New routine.
+ * contracts.ads (Analyze_Previous_Contracts): Removed.
+ (Freeze_Previous_Contracts): New routine.
+ * sem_ch3.adb (Analyze_Declarations): Analyze the contract of an
+ enclosing package spec regardless of whether the list denotes the
+ visible or private declarations. Fix the removal of partial state
+ refinements when the context is a package spec.
+ * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Freeze previous
+ contracts.
+ * sem_ch7.adb (Analyze_Package_Body_Helper): Freeze previous contracts.
+ * sem_ch9.adb (Analyze_Entry_Body): Freeze previous contracts.
+ (Analyze_Protected_Body): Freeze previous contracts.
+ (Analyze_Task_Body): Freeze previous contracts.
+ * sem_prag.adb: Comment reformatting.
+
+2017-11-09 Bob Duff <duff@adacore.com>
+
+ * libgnarl/g-thread.ads, libgnarl/g-thread.adb: (Make_Independent):
+ Export this so users can use it without importing
+ System.Tasking.Utilities.
+ * libgnarl/s-tassta.adb (Vulnerable_Complete_Task): Relax assertion
+ that fails when Make_Independent is called on a user task.
+ * libgnarl/s-taskin.ads (Master_Of_Task): Avoid unusual
+ capitalization style ((style) bad casing of "Master_of_Task").
+
+2017-11-09 Ed Schonberg <schonberg@adacore.com>
+
* sem_ch12.adb (Analyze_Subprogram_Instantiation): Correct use of
uninitialized variable uncovered by Codepeer.
package body Contracts is
- procedure Analyze_Contracts
- (L : List_Id;
- Freeze_Nod : Node_Id;
- Freeze_Id : Entity_Id);
- -- Subsidiary to the one parameter version of Analyze_Contracts and routine
- -- Analyze_Previous_Constracts. Analyze the contracts of all constructs in
- -- the list L. If Freeze_Nod is set, then the analysis stops when the node
- -- is reached. Freeze_Id is the entity of some related context which caused
- -- freezing up to node Freeze_Nod.
-
procedure Build_And_Analyze_Contract_Only_Subprograms (L : List_Id);
-- (CodePeer): Subsidiary procedure to Analyze_Contracts which builds the
-- contract-only subprogram body of eligible subprograms found in L, adds
-----------------------
procedure Analyze_Contracts (L : List_Id) is
+ Decl : Node_Id;
+
begin
if CodePeer_Mode and then Debug_Flag_Dot_KK then
Build_And_Analyze_Contract_Only_Subprograms (L);
end if;
- Analyze_Contracts (L, Freeze_Nod => Empty, Freeze_Id => Empty);
- end Analyze_Contracts;
-
- procedure Analyze_Contracts
- (L : List_Id;
- Freeze_Nod : Node_Id;
- Freeze_Id : Entity_Id)
- is
- Decl : Node_Id;
-
- begin
Decl := First (L);
while Present (Decl) loop
- -- The caller requests that the traversal stops at a particular node
- -- that causes contract "freezing".
-
- if Present (Freeze_Nod) and then Decl = Freeze_Nod then
- exit;
- end if;
-
-- Entry or subprogram declarations
if Nkind_In (Decl, N_Abstract_Subprogram_Declaration,
Subp_Id : constant Entity_Id := Defining_Entity (Decl);
begin
- Analyze_Entry_Or_Subprogram_Contract (Subp_Id, Freeze_Id);
+ Analyze_Entry_Or_Subprogram_Contract (Subp_Id);
-- If analysis of a class-wide pre/postcondition indicates
-- that a class-wide clone is needed, analyze its declaration
-- Objects
elsif Nkind (Decl) = N_Object_Declaration then
- Analyze_Object_Contract
- (Obj_Id => Defining_Entity (Decl),
- Freeze_Id => Freeze_Id);
+ Analyze_Object_Contract (Defining_Entity (Decl));
-- Protected units
then
Analyze_Task_Contract (Defining_Entity (Decl));
- -- For type declarations, we need to do the pre-analysis of
- -- Iterable aspect specifications.
+ -- For type declarations, we need to do the pre-analysis of Iterable
+ -- aspect specifications.
+
-- Other type aspects need to be resolved here???
elsif Nkind (Decl) = N_Private_Type_Declaration
declare
E : constant Entity_Id := Defining_Identifier (Decl);
It : constant Node_Id := Find_Aspect (E, Aspect_Iterable);
+
begin
if Present (It) then
Validate_Iterable_Aspect (E, It);
end Analyze_Package_Contract;
--------------------------------
- -- Analyze_Previous_Contracts --
- --------------------------------
-
- procedure Analyze_Previous_Contracts (Body_Decl : Node_Id) is
- Body_Id : constant Entity_Id := Defining_Entity (Body_Decl);
- Orig_Decl : constant Node_Id := Original_Node (Body_Decl);
-
- Par : Node_Id;
-
- begin
- -- A body that is in the process of being inlined appears from source,
- -- but carries name _parent. Such a body does not cause "freezing" of
- -- contracts.
-
- if Chars (Body_Id) = Name_uParent then
- return;
- end if;
-
- -- Climb the parent chain looking for an enclosing package body. Do not
- -- use the scope stack, as a body uses the entity of its corresponding
- -- spec.
-
- Par := Parent (Body_Decl);
- while Present (Par) loop
- if Nkind (Par) = N_Package_Body then
- Analyze_Package_Body_Contract
- (Body_Id => Defining_Entity (Par),
- Freeze_Id => Defining_Entity (Body_Decl));
-
- exit;
-
- -- Do not look for an enclosing package body when the construct which
- -- causes freezing is a body generated for an expression function and
- -- it appears within a package spec. This ensures that the traversal
- -- will not reach too far up the parent chain and attempt to freeze a
- -- package body which should not be frozen.
-
- -- package body Enclosing_Body
- -- with Refined_State => (State => Var)
- -- is
- -- package Nested is
- -- type Some_Type is ...;
- -- function Cause_Freezing return ...;
- -- private
- -- function Cause_Freezing is (...);
- -- end Nested;
- --
- -- Var : Nested.Some_Type;
-
- elsif Nkind (Par) = N_Package_Declaration
- and then Nkind (Orig_Decl) = N_Expression_Function
- then
- exit;
- end if;
-
- Par := Parent (Par);
- end loop;
-
- -- Analyze the contracts of all eligible construct up to the body which
- -- caused the "freezing".
-
- if Is_List_Member (Body_Decl) then
- Analyze_Contracts
- (L => List_Containing (Body_Decl),
- Freeze_Nod => Body_Decl,
- Freeze_Id => Body_Id);
- end if;
- end Analyze_Previous_Contracts;
-
- --------------------------------
-- Analyze_Protected_Contract --
--------------------------------
end if;
end Expand_Subprogram_Contract;
+ -------------------------------
+ -- Freeze_Previous_Contracts --
+ -------------------------------
+
+ procedure Freeze_Previous_Contracts (Body_Decl : Node_Id) is
+ function Causes_Contract_Freezing (N : Node_Id) return Boolean;
+ pragma Inline (Causes_Contract_Freezing);
+ -- Determine whether arbitrary node N causes contract freezing
+
+ procedure Freeze_Contracts;
+ pragma Inline (Freeze_Contracts);
+ -- Freeze the contracts of all eligible constructs which precede body
+ -- Body_Decl.
+
+ procedure Freeze_Enclosing_Package_Body;
+ pragma Inline (Freeze_Enclosing_Package_Body);
+ -- Freeze the contract of the nearest package body (if any) which
+ -- encloses body Body_Decl.
+
+ ------------------------------
+ -- Causes_Contract_Freezing --
+ ------------------------------
+
+ function Causes_Contract_Freezing (N : Node_Id) return Boolean is
+ begin
+ return Nkind_In (N, N_Entry_Body,
+ N_Package_Body,
+ N_Protected_Body,
+ N_Subprogram_Body,
+ N_Subprogram_Body_Stub,
+ N_Task_Body);
+ end Causes_Contract_Freezing;
+
+ ----------------------
+ -- Freeze_Contracts --
+ ----------------------
+
+ procedure Freeze_Contracts is
+ Body_Id : constant Entity_Id := Defining_Entity (Body_Decl);
+ Decl : Node_Id;
+
+ begin
+ -- Nothing to do when the body which causes freezing does not appear
+ -- in a declarative list because there cannot possibly be constructs
+ -- with contracts.
+
+ if not Is_List_Member (Body_Decl) then
+ return;
+ end if;
+
+ -- Inspect the declarations preceding the body, and freeze individual
+ -- contracts of eligible constructs.
+
+ Decl := Prev (Body_Decl);
+ while Present (Decl) loop
+
+ -- Stop the traversal when a preceding construct that causes
+ -- freezing is encountered as there is no point in refreezing
+ -- the already frozen constructs.
+
+ if Causes_Contract_Freezing (Decl) then
+ exit;
+
+ -- Entry or subprogram declarations
+
+ elsif Nkind_In (Decl, N_Abstract_Subprogram_Declaration,
+ N_Entry_Declaration,
+ N_Generic_Subprogram_Declaration,
+ N_Subprogram_Declaration)
+ then
+ Analyze_Entry_Or_Subprogram_Contract
+ (Subp_Id => Defining_Entity (Decl),
+ Freeze_Id => Body_Id);
+
+ -- Objects
+
+ elsif Nkind (Decl) = N_Object_Declaration then
+ Analyze_Object_Contract
+ (Obj_Id => Defining_Entity (Decl),
+ Freeze_Id => Body_Id);
+
+ -- Protected units
+
+ elsif Nkind_In (Decl, N_Protected_Type_Declaration,
+ N_Single_Protected_Declaration)
+ then
+ Analyze_Protected_Contract (Defining_Entity (Decl));
+
+ -- Subprogram body stubs
+
+ elsif Nkind (Decl) = N_Subprogram_Body_Stub then
+ Analyze_Subprogram_Body_Stub_Contract (Defining_Entity (Decl));
+
+ -- Task units
+
+ elsif Nkind_In (Decl, N_Single_Task_Declaration,
+ N_Task_Type_Declaration)
+ then
+ Analyze_Task_Contract (Defining_Entity (Decl));
+ end if;
+
+ Prev (Decl);
+ end loop;
+ end Freeze_Contracts;
+
+ -----------------------------------
+ -- Freeze_Enclosing_Package_Body --
+ -----------------------------------
+
+ procedure Freeze_Enclosing_Package_Body is
+ Orig_Decl : constant Node_Id := Original_Node (Body_Decl);
+ Par : Node_Id;
+
+ begin
+ -- Climb the parent chain looking for an enclosing package body. Do
+ -- not use the scope stack, because a body utilizes the entity of its
+ -- corresponding spec.
+
+ Par := Parent (Body_Decl);
+ while Present (Par) loop
+ if Nkind (Par) = N_Package_Body then
+ Analyze_Package_Body_Contract
+ (Body_Id => Defining_Entity (Par),
+ Freeze_Id => Defining_Entity (Body_Decl));
+
+ exit;
+
+ -- Do not look for an enclosing package body when the construct
+ -- which causes freezing is a body generated for an expression
+ -- function and it appears within a package spec. This ensures
+ -- that the traversal will not reach too far up the parent chain
+ -- and attempt to freeze a package body which must not be frozen.
+
+ -- package body Enclosing_Body
+ -- with Refined_State => (State => Var)
+ -- is
+ -- package Nested is
+ -- type Some_Type is ...;
+ -- function Cause_Freezing return ...;
+ -- private
+ -- function Cause_Freezing is (...);
+ -- end Nested;
+ --
+ -- Var : Nested.Some_Type;
+
+ elsif Nkind (Par) = N_Package_Declaration
+ and then Nkind (Orig_Decl) = N_Expression_Function
+ then
+ exit;
+
+ -- Prevent the search from going too far
+
+ elsif Is_Body_Or_Package_Declaration (Par) then
+ exit;
+ end if;
+
+ Par := Parent (Par);
+ end loop;
+ end Freeze_Enclosing_Package_Body;
+
+ -- Local variables
+
+ Body_Id : constant Entity_Id := Defining_Entity (Body_Decl);
+
+ -- Start of processing for Freeze_Previous_Contracts
+
+ begin
+ pragma Assert (Causes_Contract_Freezing (Body_Decl));
+
+ -- A body that is in the process of being inlined appears from source,
+ -- but carries name _parent. Such a body does not cause freezing of
+ -- contracts.
+
+ if Chars (Body_Id) = Name_uParent then
+ return;
+ end if;
+
+ Freeze_Enclosing_Package_Body;
+ Freeze_Contracts;
+ end Freeze_Previous_Contracts;
+
---------------------------------
-- Inherit_Subprogram_Contract --
---------------------------------
-- --
-- S p e c --
-- --
--- Copyright (C) 2015-2016, Free Software Foundation, Inc. --
+-- Copyright (C) 2015-2017, 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- --
-- Initializes
-- Part_Of
- procedure Analyze_Previous_Contracts (Body_Decl : Node_Id);
- -- Analyze the contracts of all source constructs found in the declarative
- -- list which contains entry, package, protected, subprogram, or task body
- -- denoted by Body_Decl. The analysis stops once Body_Decl is reached. In
- -- addition, analyze the contract of the nearest enclosing package body.
-
procedure Analyze_Protected_Contract (Prot_Id : Entity_Id);
-- Analyze all delayed pragmas chained on the contract of protected unit
-- Prot_Id if they appeared at the end of a declarative region. Currently
-- generic body denoted by Unit by collecting all source contract-related
-- pragmas in the contract of the unit.
+ procedure Freeze_Previous_Contracts (Body_Decl : Node_Id);
+ -- Freeze the contracts of all source constructs found in the declarative
+ -- list which contains entry, package, protected, subprogram, or task body
+ -- denoted by Body_Decl. In addition, freeze the contract of the nearest
+ -- enclosing package body.
+
procedure Inherit_Subprogram_Contract
(Subp : Entity_Id;
From_Subp : Entity_Id);
It gets the effective user id, and if it's not 0 (i.e. root), it raises
Program_Error.
+.. index:: Linux
+.. index:: GNU/Linux
+
+.. _GNU_Linux_Topics:
+
+GNU/Linux Topics
+================
+
+This section describes topics that are specific to GNU/Linux platforms.
+
+.. _Required_packages_on_GNU_Linux:
+
+Required Packages on GNU/Linux:
+-------------------------------
+
+GNAT requires the C library developer's package to be installed.
+The name of of that package depends on your GNU/Linux distribution:
+
+* RedHat, SUSE: ``glibc-devel``;
+* Debian, Ubuntu: ``libc6-dev`` (normally installed by default).
+
+If using the 32-bit version of GNAT on a 64-bit version of GNU/Linux,
+you'll need the 32-bit version of that package instead:
+
+* RedHat, SUSE: ``glibc-devel.i686``;
+* Debian, Ubuntu: ``libc6-dev:i386``.
+
+Other GNU/Linux distributions might be choosing a different name
+for that package.
+
.. index:: Windows
.. _Microsoft_Windows_Topics:
-- so now we output a tab to match up with the text.
if Src (P) = ASCII.HT then
- pragma Annotate
- (CodePeer, False_Positive, "validity check",
- "Src(P) is initialized at this point");
Write_Char (ASCII.HT);
P := P + 1;
-- Start of processing for Aggr_Size_OK
begin
- -- The normal aggregate limit is 50000, but we increase this limit to
+ -- The normal aggregate limit is 500000, but we increase this limit to
-- 2**24 (about 16 million) if Restrictions (No_Elaboration_Code) or
-- Restrictions (No_Implicit_Loops) is specified, since in either case
-- we are at risk of declaring the program illegal because of this
-- Finally, we use a small limit in CodePeer mode where we favor loops
-- instead of thousands of single assignments (from large aggregates).
- Max_Aggr_Size := 50000;
+ Max_Aggr_Size := 500000;
if CodePeer_Mode then
Max_Aggr_Size := 100;
and then Has_Interfaces (Rec_Type)
then
declare
- Elab_List : List_Id := New_List;
Elab_Sec_DT_Stmts_List : constant List_Id := New_List;
+ Elab_List : List_Id := New_List;
begin
Init_Secondary_Tags
Root_Typ := Full_View (Root_Typ);
end if;
- Static_DT := Building_Static_Dispatch_Tables
- and then Is_Library_Level_Tagged_Type (Typ)
+ Static_DT :=
+ Building_Static_Dispatch_Tables
+ and then Is_Library_Level_Tagged_Type (Typ)
- -- If the type is derived from a CPP class we cannot statically
- -- build the dispatch tables because we must inherit primitives
- -- from the CPP side.
+ -- If the type is derived from a CPP class we cannot statically
+ -- build the dispatch tables because we must inherit primitives
+ -- from the CPP side.
- and then not Is_CPP_Class (Root_Typ);
+ and then not Is_CPP_Class (Root_Typ);
if not Static_DT then
Check_Restriction (Static_Dispatch_Tables, Typ);
Root_Typ := Full_View (Root_Typ);
end if;
- Static_DT := Building_Static_DT (Full_Typ)
- and then not Is_Interface (Full_Typ)
- and then Has_Interfaces (Full_Typ)
- and then (Full_Typ = Root_Typ
- or else not Is_Variable_Size_Record (Etype (Full_Typ)));
+ Static_DT :=
+ Building_Static_DT (Full_Typ)
+ and then not Is_Interface (Full_Typ)
+ and then Has_Interfaces (Full_Typ)
+ and then (Full_Typ = Root_Typ
+ or else not Is_Variable_Size_Record (Etype (Full_Typ)));
if not Static_DT
and then not Is_Interface (Full_Typ)
AI := First_Elmt (Typ_Ifaces);
while Present (AI) loop
if Is_Ancestor (Node (AI), Typ, Use_Full_View => True) then
- Sec_DT_Tag :=
- New_Occurrence_Of (DT_Ptr, Loc);
+ Sec_DT_Tag := New_Occurrence_Of (DT_Ptr, Loc);
+
else
Elmt :=
Next_Elmt
pragma Assert (Has_Thunks (Node (Elmt)));
while Is_Tag (Node (Elmt))
- and then not
- Is_Ancestor (Node (AI), Related_Type (Node (Elmt)),
- Use_Full_View => True)
+ and then not
+ Is_Ancestor (Node (AI), Related_Type (Node (Elmt)),
+ Use_Full_View => True)
loop
pragma Assert (Has_Thunks (Node (Elmt)));
Next_Elmt (Elmt);
pragma Assert (Ekind (Node (Elmt)) = E_Constant
and then not
Has_Thunks (Node (Next_Elmt (Next_Elmt (Elmt)))));
+
Sec_DT_Tag :=
- New_Occurrence_Of (Node (Next_Elmt (Next_Elmt (Elmt))),
- Loc);
+ New_Occurrence_Of
+ (Node (Next_Elmt (Next_Elmt (Elmt))), Loc);
end if;
-- For static dispatch tables compute Offset_To_Top using
Next_Elmt (Iface_Elmt);
Next_Elmt (Iface_Comp_Elmt);
end loop;
+
pragma Assert (Present (Iface_Comp));
Offset_To_Top :=
end if;
Append_To (TSD_Ifaces_List,
- Make_Aggregate (Loc,
- Expressions => New_List (
+ Make_Aggregate (Loc,
+ Expressions => New_List (
-- Iface_Tag
-- Secondary_DT
- Unchecked_Convert_To (RTE (RE_Tag), Sec_DT_Tag)
-
- )));
+ Unchecked_Convert_To (RTE (RE_Tag), Sec_DT_Tag))));
Next_Elmt (AI);
end loop;
Constraints => New_List (
Make_Integer_Literal (Loc, Num_Ifaces)))),
- Expression => Make_Aggregate (Loc,
- Expressions => New_List (
- Make_Integer_Literal (Loc, Num_Ifaces),
- Make_Aggregate (Loc, TSD_Ifaces_List)))));
+ Expression =>
+ Make_Aggregate (Loc,
+ Expressions => New_List (
+ Make_Integer_Literal (Loc, Num_Ifaces),
+ Make_Aggregate (Loc, TSD_Ifaces_List)))));
Append_To (Result,
Make_Attribute_Definition_Clause (Loc,
-- is transformed into
- -- Val : Constrained_Subtype_of_T := Maybe_Modified_Expr;
+ -- Val : Constrained_Subtype_Of_T := Maybe_Modified_Expr;
--
-- Here are the main cases :
--
* Run-Time Libraries::
* Specifying a Run-Time Library::
+* GNU/Linux Topics::
* Microsoft Windows Topics::
* Mac OS Topics::
* Choosing the Scheduling Policy::
+GNU/Linux Topics
+
+* Required Packages on GNU/Linux;: Required Packages on GNU/Linux.
+
Microsoft Windows Topics
* Using GNAT on Windows::
@menu
* Run-Time Libraries::
* Specifying a Run-Time Library::
+* GNU/Linux Topics::
* Microsoft Windows Topics::
* Mac OS Topics::
@end multitable
-@node Specifying a Run-Time Library,Microsoft Windows Topics,Run-Time Libraries,Platform-Specific Information
+@node Specifying a Run-Time Library,GNU/Linux Topics,Run-Time Libraries,Platform-Specific Information
@anchor{gnat_ugn/platform_specific_information specifying-a-run-time-library}@anchor{1d6}@anchor{gnat_ugn/platform_specific_information id4}@anchor{1d7}
@section Specifying a Run-Time Library
It gets the effective user id, and if it's not 0 (i.e. root), it raises
Program_Error.
+@geindex Linux
+
+@geindex GNU/Linux
+
+@node GNU/Linux Topics,Microsoft Windows Topics,Specifying a Run-Time Library,Platform-Specific Information
+@anchor{gnat_ugn/platform_specific_information id6}@anchor{1da}@anchor{gnat_ugn/platform_specific_information gnu-linux-topics}@anchor{1db}
+@section GNU/Linux Topics
+
+
+This section describes topics that are specific to GNU/Linux platforms.
+
+@menu
+* Required Packages on GNU/Linux;: Required Packages on GNU/Linux.
+
+@end menu
+
+@node Required Packages on GNU/Linux,,,GNU/Linux Topics
+@anchor{gnat_ugn/platform_specific_information id7}@anchor{1dc}@anchor{gnat_ugn/platform_specific_information required-packages-on-gnu-linux}@anchor{1dd}
+@subsection Required Packages on GNU/Linux:
+
+
+GNAT requires the C library developer's package to be installed.
+The name of of that package depends on your GNU/Linux distribution:
+
+
+@itemize *
+
+@item
+RedHat, SUSE: @code{glibc-devel};
+
+@item
+Debian, Ubuntu: @code{libc6-dev} (normally installed by default).
+@end itemize
+
+If using the 32-bit version of GNAT on a 64-bit version of GNU/Linux,
+you'll need the 32-bit version of that package instead:
+
+
+@itemize *
+
+@item
+RedHat, SUSE: @code{glibc-devel.i686};
+
+@item
+Debian, Ubuntu: @code{libc6-dev:i386}.
+@end itemize
+
+Other GNU/Linux distributions might be choosing a different name
+for that package.
+
@geindex Windows
-@node Microsoft Windows Topics,Mac OS Topics,Specifying a Run-Time Library,Platform-Specific Information
-@anchor{gnat_ugn/platform_specific_information id6}@anchor{1da}@anchor{gnat_ugn/platform_specific_information microsoft-windows-topics}@anchor{2c}
+@node Microsoft Windows Topics,Mac OS Topics,GNU/Linux Topics,Platform-Specific Information
+@anchor{gnat_ugn/platform_specific_information microsoft-windows-topics}@anchor{2c}@anchor{gnat_ugn/platform_specific_information id8}@anchor{1de}
@section Microsoft Windows Topics
@end menu
@node Using GNAT on Windows,Using a network installation of GNAT,,Microsoft Windows Topics
-@anchor{gnat_ugn/platform_specific_information using-gnat-on-windows}@anchor{1db}@anchor{gnat_ugn/platform_specific_information id7}@anchor{1dc}
+@anchor{gnat_ugn/platform_specific_information using-gnat-on-windows}@anchor{1df}@anchor{gnat_ugn/platform_specific_information id9}@anchor{1e0}
@subsection Using GNAT on Windows
@end itemize
@node Using a network installation of GNAT,CONSOLE and WINDOWS subsystems,Using GNAT on Windows,Microsoft Windows Topics
-@anchor{gnat_ugn/platform_specific_information id8}@anchor{1dd}@anchor{gnat_ugn/platform_specific_information using-a-network-installation-of-gnat}@anchor{1de}
+@anchor{gnat_ugn/platform_specific_information id10}@anchor{1e1}@anchor{gnat_ugn/platform_specific_information using-a-network-installation-of-gnat}@anchor{1e2}
@subsection Using a network installation of GNAT
serious performance penalty.
@node CONSOLE and WINDOWS subsystems,Temporary Files,Using a network installation of GNAT,Microsoft Windows Topics
-@anchor{gnat_ugn/platform_specific_information console-and-windows-subsystems}@anchor{1df}@anchor{gnat_ugn/platform_specific_information id9}@anchor{1e0}
+@anchor{gnat_ugn/platform_specific_information id11}@anchor{1e3}@anchor{gnat_ugn/platform_specific_information console-and-windows-subsystems}@anchor{1e4}
@subsection CONSOLE and WINDOWS subsystems
@end quotation
@node Temporary Files,Disabling Command Line Argument Expansion,CONSOLE and WINDOWS subsystems,Microsoft Windows Topics
-@anchor{gnat_ugn/platform_specific_information id10}@anchor{1e1}@anchor{gnat_ugn/platform_specific_information temporary-files}@anchor{1e2}
+@anchor{gnat_ugn/platform_specific_information id12}@anchor{1e5}@anchor{gnat_ugn/platform_specific_information temporary-files}@anchor{1e6}
@subsection Temporary Files
directories.
@node Disabling Command Line Argument Expansion,Mixed-Language Programming on Windows,Temporary Files,Microsoft Windows Topics
-@anchor{gnat_ugn/platform_specific_information disabling-command-line-argument-expansion}@anchor{1e3}
+@anchor{gnat_ugn/platform_specific_information disabling-command-line-argument-expansion}@anchor{1e7}
@subsection Disabling Command Line Argument Expansion
@end example
@node Mixed-Language Programming on Windows,Windows Specific Add-Ons,Disabling Command Line Argument Expansion,Microsoft Windows Topics
-@anchor{gnat_ugn/platform_specific_information id11}@anchor{1e4}@anchor{gnat_ugn/platform_specific_information mixed-language-programming-on-windows}@anchor{1e5}
+@anchor{gnat_ugn/platform_specific_information id13}@anchor{1e8}@anchor{gnat_ugn/platform_specific_information mixed-language-programming-on-windows}@anchor{1e9}
@subsection Mixed-Language Programming on Windows
Encapsulate your C++ code in a DLL to be linked with your Ada
application. In this case, use the Microsoft or whatever environment to
build the DLL and use GNAT to build your executable
-(@ref{1e6,,Using DLLs with GNAT}).
+(@ref{1ea,,Using DLLs with GNAT}).
@item
Or you can encapsulate your Ada code in a DLL to be linked with the
other part of your application. In this case, use GNAT to build the DLL
-(@ref{1e7,,Building DLLs with GNAT Project files}) and use the Microsoft
+(@ref{1eb,,Building DLLs with GNAT Project files}) and use the Microsoft
or whatever environment to build your executable.
@end itemize
@end menu
@node Windows Calling Conventions,Introduction to Dynamic Link Libraries DLLs,,Mixed-Language Programming on Windows
-@anchor{gnat_ugn/platform_specific_information windows-calling-conventions}@anchor{1e8}@anchor{gnat_ugn/platform_specific_information id12}@anchor{1e9}
+@anchor{gnat_ugn/platform_specific_information windows-calling-conventions}@anchor{1ec}@anchor{gnat_ugn/platform_specific_information id14}@anchor{1ed}
@subsubsection Windows Calling Conventions
@end menu
@node C Calling Convention,Stdcall Calling Convention,,Windows Calling Conventions
-@anchor{gnat_ugn/platform_specific_information c-calling-convention}@anchor{1ea}@anchor{gnat_ugn/platform_specific_information id13}@anchor{1eb}
+@anchor{gnat_ugn/platform_specific_information c-calling-convention}@anchor{1ee}@anchor{gnat_ugn/platform_specific_information id15}@anchor{1ef}
@subsubsection @code{C} Calling Convention
When importing a variable defined in C, you should always use the @code{C}
calling convention unless the object containing the variable is part of a
DLL (in which case you should use the @code{Stdcall} calling
-convention, @ref{1ec,,Stdcall Calling Convention}).
+convention, @ref{1f0,,Stdcall Calling Convention}).
@node Stdcall Calling Convention,Win32 Calling Convention,C Calling Convention,Windows Calling Conventions
-@anchor{gnat_ugn/platform_specific_information stdcall-calling-convention}@anchor{1ec}@anchor{gnat_ugn/platform_specific_information id14}@anchor{1ed}
+@anchor{gnat_ugn/platform_specific_information stdcall-calling-convention}@anchor{1f0}@anchor{gnat_ugn/platform_specific_information id16}@anchor{1f1}
@subsubsection @code{Stdcall} Calling Convention
will be handled as a @code{C} calling convention on non-Windows platforms.
@node Win32 Calling Convention,DLL Calling Convention,Stdcall Calling Convention,Windows Calling Conventions
-@anchor{gnat_ugn/platform_specific_information win32-calling-convention}@anchor{1ee}@anchor{gnat_ugn/platform_specific_information id15}@anchor{1ef}
+@anchor{gnat_ugn/platform_specific_information win32-calling-convention}@anchor{1f2}@anchor{gnat_ugn/platform_specific_information id17}@anchor{1f3}
@subsubsection @code{Win32} Calling Convention
@code{Stdcall} calling convention described above.
@node DLL Calling Convention,,Win32 Calling Convention,Windows Calling Conventions
-@anchor{gnat_ugn/platform_specific_information dll-calling-convention}@anchor{1f0}@anchor{gnat_ugn/platform_specific_information id16}@anchor{1f1}
+@anchor{gnat_ugn/platform_specific_information id18}@anchor{1f4}@anchor{gnat_ugn/platform_specific_information dll-calling-convention}@anchor{1f5}
@subsubsection @code{DLL} Calling Convention
@code{Stdcall} calling convention described above.
@node Introduction to Dynamic Link Libraries DLLs,Using DLLs with GNAT,Windows Calling Conventions,Mixed-Language Programming on Windows
-@anchor{gnat_ugn/platform_specific_information introduction-to-dynamic-link-libraries-dlls}@anchor{1f2}@anchor{gnat_ugn/platform_specific_information id17}@anchor{1f3}
+@anchor{gnat_ugn/platform_specific_information id19}@anchor{1f6}@anchor{gnat_ugn/platform_specific_information introduction-to-dynamic-link-libraries-dlls}@anchor{1f7}
@subsubsection Introduction to Dynamic Link Libraries (DLLs)
Unix shared libraries, is the fact that on most Unix systems all public
routines are exported by default in a Unix shared library, while under
Windows it is possible (but not required) to list exported routines in
-a definition file (see @ref{1f4,,The Definition File}).
+a definition file (see @ref{1f8,,The Definition File}).
@node Using DLLs with GNAT,Building DLLs with GNAT Project files,Introduction to Dynamic Link Libraries DLLs,Mixed-Language Programming on Windows
-@anchor{gnat_ugn/platform_specific_information id18}@anchor{1f5}@anchor{gnat_ugn/platform_specific_information using-dlls-with-gnat}@anchor{1e6}
+@anchor{gnat_ugn/platform_specific_information id20}@anchor{1f9}@anchor{gnat_ugn/platform_specific_information using-dlls-with-gnat}@anchor{1ea}
@subsubsection Using DLLs with GNAT
@end menu
@node Creating an Ada Spec for the DLL Services,Creating an Import Library,,Using DLLs with GNAT
-@anchor{gnat_ugn/platform_specific_information creating-an-ada-spec-for-the-dll-services}@anchor{1f6}@anchor{gnat_ugn/platform_specific_information id19}@anchor{1f7}
+@anchor{gnat_ugn/platform_specific_information id21}@anchor{1fa}@anchor{gnat_ugn/platform_specific_information creating-an-ada-spec-for-the-dll-services}@anchor{1fb}
@subsubsection Creating an Ada Spec for the DLL Services
@end quotation
@node Creating an Import Library,,Creating an Ada Spec for the DLL Services,Using DLLs with GNAT
-@anchor{gnat_ugn/platform_specific_information id20}@anchor{1f8}@anchor{gnat_ugn/platform_specific_information creating-an-import-library}@anchor{1f9}
+@anchor{gnat_ugn/platform_specific_information id22}@anchor{1fc}@anchor{gnat_ugn/platform_specific_information creating-an-import-library}@anchor{1fd}
@subsubsection Creating an Import Library
DLL. Otherwise read on.
@geindex Definition file
-@anchor{gnat_ugn/platform_specific_information the-definition-file}@anchor{1f4}
+@anchor{gnat_ugn/platform_specific_information the-definition-file}@anchor{1f8}
@subsubheading The Definition File
@end table
Note that you must specify the correct suffix (@code{@@@emph{nn}})
-(see @ref{1e8,,Windows Calling Conventions}) for a Stdcall
+(see @ref{1ec,,Windows Calling Conventions}) for a Stdcall
calling convention function in the exported symbols list.
There can actually be other sections in a definition file, but these
sections are not relevant to the discussion at hand.
-@anchor{gnat_ugn/platform_specific_information create-def-file-automatically}@anchor{1fa}
+@anchor{gnat_ugn/platform_specific_information create-def-file-automatically}@anchor{1fe}
@subsubheading Creating a Definition File Automatically
You can automatically create the definition file @code{API.def}
-(see @ref{1f4,,The Definition File}) from a DLL.
+(see @ref{1f8,,The Definition File}) from a DLL.
For that use the @code{dlltool} program as follows:
@quotation
@end example
Note that if some routines in the DLL have the @code{Stdcall} convention
-(@ref{1e8,,Windows Calling Conventions}) with stripped @code{@@@emph{nn}}
+(@ref{1ec,,Windows Calling Conventions}) with stripped @code{@@@emph{nn}}
suffix then you'll have to edit @code{api.def} to add it, and specify
@code{-k} to @code{gnatdll} when creating the import library.
definition file and add the right suffix.
@end itemize
@end quotation
-@anchor{gnat_ugn/platform_specific_information gnat-style-import-library}@anchor{1fb}
+@anchor{gnat_ugn/platform_specific_information gnat-style-import-library}@anchor{1ff}
@subsubheading GNAT-Style Import Library
To create a static import library from @code{API.dll} with the GNAT tools
you should create the .def file, then use @code{gnatdll} tool
-(see @ref{1fc,,Using gnatdll}) as follows:
+(see @ref{200,,Using gnatdll}) as follows:
@quotation
be @code{libxyz.a}. Note that in the previous example option
@code{-e} could have been removed because the name of the definition
file (before the @code{.def} suffix) is the same as the name of the
-DLL (@ref{1fc,,Using gnatdll} for more information about @code{gnatdll}).
+DLL (@ref{200,,Using gnatdll} for more information about @code{gnatdll}).
@end quotation
-@anchor{gnat_ugn/platform_specific_information msvs-style-import-library}@anchor{1fd}
+@anchor{gnat_ugn/platform_specific_information msvs-style-import-library}@anchor{201}
@subsubheading Microsoft-Style Import Library
A Microsoft import library is needed only if you plan to make an
Ada DLL available to applications developed with Microsoft
-tools (@ref{1e5,,Mixed-Language Programming on Windows}).
+tools (@ref{1e9,,Mixed-Language Programming on Windows}).
To create a Microsoft-style import library for @code{API.dll} you
should create the .def file, then build the actual import library using
@end quotation
@node Building DLLs with GNAT Project files,Building DLLs with GNAT,Using DLLs with GNAT,Mixed-Language Programming on Windows
-@anchor{gnat_ugn/platform_specific_information id21}@anchor{1fe}@anchor{gnat_ugn/platform_specific_information building-dlls-with-gnat-project-files}@anchor{1e7}
+@anchor{gnat_ugn/platform_specific_information id23}@anchor{202}@anchor{gnat_ugn/platform_specific_information building-dlls-with-gnat-project-files}@anchor{1eb}
@subsubsection Building DLLs with GNAT Project files
of shared libraries, so it is not possible to have library level tasks in SALs.
@node Building DLLs with GNAT,Building DLLs with gnatdll,Building DLLs with GNAT Project files,Mixed-Language Programming on Windows
-@anchor{gnat_ugn/platform_specific_information building-dlls-with-gnat}@anchor{1ff}@anchor{gnat_ugn/platform_specific_information id22}@anchor{200}
+@anchor{gnat_ugn/platform_specific_information building-dlls-with-gnat}@anchor{203}@anchor{gnat_ugn/platform_specific_information id24}@anchor{204}
@subsubsection Building DLLs with GNAT
It is important to note that in this case all symbols found in the
object files are automatically exported. It is possible to restrict
the set of symbols to export by passing to @code{gcc} a definition
-file (see @ref{1f4,,The Definition File}).
+file (see @ref{1f8,,The Definition File}).
For example:
@example
@end quotation
@node Building DLLs with gnatdll,Ada DLLs and Finalization,Building DLLs with GNAT,Mixed-Language Programming on Windows
-@anchor{gnat_ugn/platform_specific_information building-dlls-with-gnatdll}@anchor{201}@anchor{gnat_ugn/platform_specific_information id23}@anchor{202}
+@anchor{gnat_ugn/platform_specific_information building-dlls-with-gnatdll}@anchor{205}@anchor{gnat_ugn/platform_specific_information id25}@anchor{206}
@subsubsection Building DLLs with gnatdll
@geindex building
Note that it is preferred to use GNAT Project files
-(@ref{1e7,,Building DLLs with GNAT Project files}) or the built-in GNAT
-DLL support (@ref{1ff,,Building DLLs with GNAT}) or to build DLLs.
+(@ref{1eb,,Building DLLs with GNAT Project files}) or the built-in GNAT
+DLL support (@ref{203,,Building DLLs with GNAT}) or to build DLLs.
This section explains how to build DLLs containing Ada code using
@code{gnatdll}. These DLLs will be referred to as Ada DLLs in the
You need to mark each Ada entity exported by the DLL with a @code{C} or
@code{Stdcall} calling convention to avoid any Ada name mangling for the
entities exported by the DLL
-(see @ref{203,,Exporting Ada Entities}). You can
+(see @ref{207,,Exporting Ada Entities}). You can
skip this step if you plan to use the Ada DLL only from Ada applications.
@item
Your Ada code must export an initialization routine which calls the routine
@code{adainit} generated by @code{gnatbind} to perform the elaboration of
-the Ada code in the DLL (@ref{204,,Ada DLLs and Elaboration}). The initialization
+the Ada code in the DLL (@ref{208,,Ada DLLs and Elaboration}). The initialization
routine exported by the Ada DLL must be invoked by the clients of the DLL
to initialize the DLL.
@item
When useful, the DLL should also export a finalization routine which calls
routine @code{adafinal} generated by @code{gnatbind} to perform the
-finalization of the Ada code in the DLL (@ref{205,,Ada DLLs and Finalization}).
+finalization of the Ada code in the DLL (@ref{209,,Ada DLLs and Finalization}).
The finalization routine exported by the Ada DLL must be invoked by the
clients of the DLL when the DLL services are no further needed.
@item
You must provide a definition file listing the exported entities
-(@ref{1f4,,The Definition File}).
+(@ref{1f8,,The Definition File}).
@item
Finally you must use @code{gnatdll} to produce the DLL and the import
-library (@ref{1fc,,Using gnatdll}).
+library (@ref{200,,Using gnatdll}).
@end itemize
Note that a relocatable DLL stripped using the @code{strip}
@end menu
@node Limitations When Using Ada DLLs from Ada,Exporting Ada Entities,,Building DLLs with gnatdll
-@anchor{gnat_ugn/platform_specific_information limitations-when-using-ada-dlls-from-ada}@anchor{206}
+@anchor{gnat_ugn/platform_specific_information limitations-when-using-ada-dlls-from-ada}@anchor{20a}
@subsubsection Limitations When Using Ada DLLs from Ada
Windows object handles, etc.
@node Exporting Ada Entities,Ada DLLs and Elaboration,Limitations When Using Ada DLLs from Ada,Building DLLs with gnatdll
-@anchor{gnat_ugn/platform_specific_information exporting-ada-entities}@anchor{203}@anchor{gnat_ugn/platform_specific_information id24}@anchor{207}
+@anchor{gnat_ugn/platform_specific_information exporting-ada-entities}@anchor{207}@anchor{gnat_ugn/platform_specific_information id26}@anchor{20b}
@subsubsection Exporting Ada Entities
Note that if you do not export the Ada entities with a @code{C} or
@code{Stdcall} convention you will have to provide the mangled Ada names
in the definition file of the Ada DLL
-(@ref{208,,Creating the Definition File}).
+(@ref{20c,,Creating the Definition File}).
@node Ada DLLs and Elaboration,,Exporting Ada Entities,Building DLLs with gnatdll
-@anchor{gnat_ugn/platform_specific_information ada-dlls-and-elaboration}@anchor{204}@anchor{gnat_ugn/platform_specific_information id25}@anchor{209}
+@anchor{gnat_ugn/platform_specific_information ada-dlls-and-elaboration}@anchor{208}@anchor{gnat_ugn/platform_specific_information id27}@anchor{20d}
@subsubsection Ada DLLs and Elaboration
(@ref{b4,,Binding with Non-Ada Main Programs}). See the body of
@code{Initialize_Api} for an example. Note that the GNAT binder is
automatically invoked during the DLL build process by the @code{gnatdll}
-tool (@ref{1fc,,Using gnatdll}).
+tool (@ref{200,,Using gnatdll}).
When a DLL is loaded, Windows systematically invokes a routine called
@code{DllMain}. It would therefore be possible to call @code{adainit}
newly created task to complete its initialization.
@node Ada DLLs and Finalization,Creating a Spec for Ada DLLs,Building DLLs with gnatdll,Mixed-Language Programming on Windows
-@anchor{gnat_ugn/platform_specific_information ada-dlls-and-finalization}@anchor{205}@anchor{gnat_ugn/platform_specific_information id26}@anchor{20a}
+@anchor{gnat_ugn/platform_specific_information id28}@anchor{20e}@anchor{gnat_ugn/platform_specific_information ada-dlls-and-finalization}@anchor{209}
@subsubsection Ada DLLs and Finalization
See the body of @code{Finalize_Api} for an
example. As already pointed out the GNAT binder is automatically invoked
during the DLL build process by the @code{gnatdll} tool
-(@ref{1fc,,Using gnatdll}).
+(@ref{200,,Using gnatdll}).
@node Creating a Spec for Ada DLLs,GNAT and Windows Resources,Ada DLLs and Finalization,Mixed-Language Programming on Windows
-@anchor{gnat_ugn/platform_specific_information id27}@anchor{20b}@anchor{gnat_ugn/platform_specific_information creating-a-spec-for-ada-dlls}@anchor{20c}
+@anchor{gnat_ugn/platform_specific_information id29}@anchor{20f}@anchor{gnat_ugn/platform_specific_information creating-a-spec-for-ada-dlls}@anchor{210}
@subsubsection Creating a Spec for Ada DLLs
@end menu
@node Creating the Definition File,Using gnatdll,,Creating a Spec for Ada DLLs
-@anchor{gnat_ugn/platform_specific_information id28}@anchor{20d}@anchor{gnat_ugn/platform_specific_information creating-the-definition-file}@anchor{208}
+@anchor{gnat_ugn/platform_specific_information creating-the-definition-file}@anchor{20c}@anchor{gnat_ugn/platform_specific_information id30}@anchor{211}
@subsubsection Creating the Definition File
@end quotation
@node Using gnatdll,,Creating the Definition File,Creating a Spec for Ada DLLs
-@anchor{gnat_ugn/platform_specific_information id29}@anchor{20e}@anchor{gnat_ugn/platform_specific_information using-gnatdll}@anchor{1fc}
+@anchor{gnat_ugn/platform_specific_information using-gnatdll}@anchor{200}@anchor{gnat_ugn/platform_specific_information id31}@anchor{212}
@subsubsection Using @code{gnatdll}
is loaded into memory.
@item
-@code{gnatdll} uses @code{dlltool} (see @ref{20f,,Using dlltool}) to build the
+@code{gnatdll} uses @code{dlltool} (see @ref{213,,Using dlltool}) to build the
export table (@code{api.exp}). The export table contains the relocation
information in a form which can be used during the final link to ensure
that the Windows loader is able to place the DLL anywhere in memory.
$ gnatlink api api.exp -o api.dll -mdll
@end example
@end itemize
-@anchor{gnat_ugn/platform_specific_information using-dlltool}@anchor{20f}
+@anchor{gnat_ugn/platform_specific_information using-dlltool}@anchor{213}
@subsubheading Using @code{dlltool}
@item @code{-k}
Kill @code{@@@emph{nn}} from exported names
-(@ref{1e8,,Windows Calling Conventions}
+(@ref{1ec,,Windows Calling Conventions}
for a discussion about @code{Stdcall}-style symbols.
@end table
@end table
@node GNAT and Windows Resources,Using GNAT DLLs from Microsoft Visual Studio Applications,Creating a Spec for Ada DLLs,Mixed-Language Programming on Windows
-@anchor{gnat_ugn/platform_specific_information gnat-and-windows-resources}@anchor{210}@anchor{gnat_ugn/platform_specific_information id30}@anchor{211}
+@anchor{gnat_ugn/platform_specific_information gnat-and-windows-resources}@anchor{214}@anchor{gnat_ugn/platform_specific_information id32}@anchor{215}
@subsubsection GNAT and Windows Resources
@end menu
@node Building Resources,Compiling Resources,,GNAT and Windows Resources
-@anchor{gnat_ugn/platform_specific_information building-resources}@anchor{212}@anchor{gnat_ugn/platform_specific_information id31}@anchor{213}
+@anchor{gnat_ugn/platform_specific_information building-resources}@anchor{216}@anchor{gnat_ugn/platform_specific_information id33}@anchor{217}
@subsubsection Building Resources
Microsoft documentation.
@node Compiling Resources,Using Resources,Building Resources,GNAT and Windows Resources
-@anchor{gnat_ugn/platform_specific_information compiling-resources}@anchor{214}@anchor{gnat_ugn/platform_specific_information id32}@anchor{215}
+@anchor{gnat_ugn/platform_specific_information compiling-resources}@anchor{218}@anchor{gnat_ugn/platform_specific_information id34}@anchor{219}
@subsubsection Compiling Resources
@end quotation
@node Using Resources,,Compiling Resources,GNAT and Windows Resources
-@anchor{gnat_ugn/platform_specific_information using-resources}@anchor{216}@anchor{gnat_ugn/platform_specific_information id33}@anchor{217}
+@anchor{gnat_ugn/platform_specific_information using-resources}@anchor{21a}@anchor{gnat_ugn/platform_specific_information id35}@anchor{21b}
@subsubsection Using Resources
@end quotation
@node Using GNAT DLLs from Microsoft Visual Studio Applications,Debugging a DLL,GNAT and Windows Resources,Mixed-Language Programming on Windows
-@anchor{gnat_ugn/platform_specific_information using-gnat-dll-from-msvs}@anchor{218}@anchor{gnat_ugn/platform_specific_information using-gnat-dlls-from-microsoft-visual-studio-applications}@anchor{219}
+@anchor{gnat_ugn/platform_specific_information using-gnat-dll-from-msvs}@anchor{21c}@anchor{gnat_ugn/platform_specific_information using-gnat-dlls-from-microsoft-visual-studio-applications}@anchor{21d}
@subsubsection Using GNAT DLLs from Microsoft Visual Studio Applications
@item
Produce a .def file for the symbols you need to interface with, either by
hand or automatically with possibly some manual adjustments
-(see @ref{1fa,,Creating Definition File Automatically}):
+(see @ref{1fe,,Creating Definition File Automatically}):
@end enumerate
@quotation
Make sure that MSVS command-line tools are accessible on the path.
@item
-Create the Microsoft-style import library (see @ref{1fd,,MSVS-Style Import Library}):
+Create the Microsoft-style import library (see @ref{201,,MSVS-Style Import Library}):
@end enumerate
@quotation
@end enumerate
@node Debugging a DLL,Setting Stack Size from gnatlink,Using GNAT DLLs from Microsoft Visual Studio Applications,Mixed-Language Programming on Windows
-@anchor{gnat_ugn/platform_specific_information id34}@anchor{21a}@anchor{gnat_ugn/platform_specific_information debugging-a-dll}@anchor{21b}
+@anchor{gnat_ugn/platform_specific_information id36}@anchor{21e}@anchor{gnat_ugn/platform_specific_information debugging-a-dll}@anchor{21f}
@subsubsection Debugging a DLL
@end menu
@node Program and DLL Both Built with GCC/GNAT,Program Built with Foreign Tools and DLL Built with GCC/GNAT,,Debugging a DLL
-@anchor{gnat_ugn/platform_specific_information program-and-dll-both-built-with-gcc-gnat}@anchor{21c}@anchor{gnat_ugn/platform_specific_information id35}@anchor{21d}
+@anchor{gnat_ugn/platform_specific_information id37}@anchor{220}@anchor{gnat_ugn/platform_specific_information program-and-dll-both-built-with-gcc-gnat}@anchor{221}
@subsubsection Program and DLL Both Built with GCC/GNAT
@code{ada_main} and that in the DLL there is an entry point named
@code{ada_dll}.
-The DLL (@ref{1f2,,Introduction to Dynamic Link Libraries (DLLs)}) and
+The DLL (@ref{1f7,,Introduction to Dynamic Link Libraries (DLLs)}) and
program must have been built with the debugging information (see GNAT -g
switch). Here are the step-by-step instructions for debugging it:
(@ref{24,,Running and Debugging Ada Programs}).
@node Program Built with Foreign Tools and DLL Built with GCC/GNAT,,Program and DLL Both Built with GCC/GNAT,Debugging a DLL
-@anchor{gnat_ugn/platform_specific_information id36}@anchor{21e}@anchor{gnat_ugn/platform_specific_information program-built-with-foreign-tools-and-dll-built-with-gcc-gnat}@anchor{21f}
+@anchor{gnat_ugn/platform_specific_information program-built-with-foreign-tools-and-dll-built-with-gcc-gnat}@anchor{222}@anchor{gnat_ugn/platform_specific_information id38}@anchor{223}
@subsubsection Program Built with Foreign Tools and DLL Built with GCC/GNAT
DLL named @code{test.dll} containing an Ada entry point named
@code{ada_dll}.
-The DLL (see @ref{1f2,,Introduction to Dynamic Link Libraries (DLLs)}) must have
+The DLL (see @ref{1f7,,Introduction to Dynamic Link Libraries (DLLs)}) must have
been built with debugging information (see the GNAT @code{-g} option).
@subsubheading Debugging the DLL Directly
@ref{24,,Running and Debugging Ada Programs}.
@node Setting Stack Size from gnatlink,Setting Heap Size from gnatlink,Debugging a DLL,Mixed-Language Programming on Windows
-@anchor{gnat_ugn/platform_specific_information id37}@anchor{220}@anchor{gnat_ugn/platform_specific_information setting-stack-size-from-gnatlink}@anchor{136}
+@anchor{gnat_ugn/platform_specific_information setting-stack-size-from-gnatlink}@anchor{136}@anchor{gnat_ugn/platform_specific_information id39}@anchor{224}
@subsubsection Setting Stack Size from @code{gnatlink}
@end itemize
@node Setting Heap Size from gnatlink,,Setting Stack Size from gnatlink,Mixed-Language Programming on Windows
-@anchor{gnat_ugn/platform_specific_information setting-heap-size-from-gnatlink}@anchor{137}@anchor{gnat_ugn/platform_specific_information id38}@anchor{221}
+@anchor{gnat_ugn/platform_specific_information setting-heap-size-from-gnatlink}@anchor{137}@anchor{gnat_ugn/platform_specific_information id40}@anchor{225}
@subsubsection Setting Heap Size from @code{gnatlink}
@end itemize
@node Windows Specific Add-Ons,,Mixed-Language Programming on Windows,Microsoft Windows Topics
-@anchor{gnat_ugn/platform_specific_information windows-specific-add-ons}@anchor{222}@anchor{gnat_ugn/platform_specific_information win32-specific-addons}@anchor{223}
+@anchor{gnat_ugn/platform_specific_information windows-specific-add-ons}@anchor{226}@anchor{gnat_ugn/platform_specific_information win32-specific-addons}@anchor{227}
@subsection Windows Specific Add-Ons
@end menu
@node Win32Ada,wPOSIX,,Windows Specific Add-Ons
-@anchor{gnat_ugn/platform_specific_information win32ada}@anchor{224}@anchor{gnat_ugn/platform_specific_information id39}@anchor{225}
+@anchor{gnat_ugn/platform_specific_information win32ada}@anchor{228}@anchor{gnat_ugn/platform_specific_information id41}@anchor{229}
@subsubsection Win32Ada
@end quotation
@node wPOSIX,,Win32Ada,Windows Specific Add-Ons
-@anchor{gnat_ugn/platform_specific_information wposix}@anchor{226}@anchor{gnat_ugn/platform_specific_information id40}@anchor{227}
+@anchor{gnat_ugn/platform_specific_information id42}@anchor{22a}@anchor{gnat_ugn/platform_specific_information wposix}@anchor{22b}
@subsubsection wPOSIX
@end quotation
@node Mac OS Topics,,Microsoft Windows Topics,Platform-Specific Information
-@anchor{gnat_ugn/platform_specific_information mac-os-topics}@anchor{2d}@anchor{gnat_ugn/platform_specific_information id41}@anchor{228}
+@anchor{gnat_ugn/platform_specific_information mac-os-topics}@anchor{2d}@anchor{gnat_ugn/platform_specific_information id43}@anchor{22c}
@section Mac OS Topics
@end menu
@node Codesigning the Debugger,,,Mac OS Topics
-@anchor{gnat_ugn/platform_specific_information codesigning-the-debugger}@anchor{229}
+@anchor{gnat_ugn/platform_specific_information codesigning-the-debugger}@anchor{22d}
@subsection Codesigning the Debugger
in the Unix group @code{_developer}.
@node Example of Binder Output File,Elaboration Order Handling in GNAT,Platform-Specific Information,Top
-@anchor{gnat_ugn/example_of_binder_output example-of-binder-output-file}@anchor{e}@anchor{gnat_ugn/example_of_binder_output doc}@anchor{22a}@anchor{gnat_ugn/example_of_binder_output id1}@anchor{22b}
+@anchor{gnat_ugn/example_of_binder_output example-of-binder-output-file}@anchor{e}@anchor{gnat_ugn/example_of_binder_output doc}@anchor{22e}@anchor{gnat_ugn/example_of_binder_output id1}@anchor{22f}
@chapter Example of Binder Output File
@c -- Example: A |withing| unit has a |with| clause, it |withs| a |withed| unit
@node Elaboration Order Handling in GNAT,Inline Assembler,Example of Binder Output File,Top
-@anchor{gnat_ugn/elaboration_order_handling_in_gnat elaboration-order-handling-in-gnat}@anchor{f}@anchor{gnat_ugn/elaboration_order_handling_in_gnat doc}@anchor{22c}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id1}@anchor{22d}
+@anchor{gnat_ugn/elaboration_order_handling_in_gnat elaboration-order-handling-in-gnat}@anchor{f}@anchor{gnat_ugn/elaboration_order_handling_in_gnat doc}@anchor{230}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id1}@anchor{231}
@chapter Elaboration Order Handling in GNAT
@end menu
@node Elaboration Code,Elaboration Order,,Elaboration Order Handling in GNAT
-@anchor{gnat_ugn/elaboration_order_handling_in_gnat elaboration-code}@anchor{22e}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id2}@anchor{22f}
+@anchor{gnat_ugn/elaboration_order_handling_in_gnat elaboration-code}@anchor{232}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id2}@anchor{233}
@section Elaboration Code
@end itemize
@node Elaboration Order,Checking the Elaboration Order,Elaboration Code,Elaboration Order Handling in GNAT
-@anchor{gnat_ugn/elaboration_order_handling_in_gnat elaboration-order}@anchor{230}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id3}@anchor{231}
+@anchor{gnat_ugn/elaboration_order_handling_in_gnat elaboration-order}@anchor{234}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id3}@anchor{235}
@section Elaboration Order
such an order due to complications with respect to control and data flow.
@node Checking the Elaboration Order,Controlling the Elaboration Order in Ada,Elaboration Order,Elaboration Order Handling in GNAT
-@anchor{gnat_ugn/elaboration_order_handling_in_gnat id4}@anchor{232}@anchor{gnat_ugn/elaboration_order_handling_in_gnat checking-the-elaboration-order}@anchor{233}
+@anchor{gnat_ugn/elaboration_order_handling_in_gnat id4}@anchor{236}@anchor{gnat_ugn/elaboration_order_handling_in_gnat checking-the-elaboration-order}@anchor{237}
@section Checking the Elaboration Order
@end itemize
@node Controlling the Elaboration Order in Ada,Controlling the Elaboration Order in GNAT,Checking the Elaboration Order,Elaboration Order Handling in GNAT
-@anchor{gnat_ugn/elaboration_order_handling_in_gnat controlling-the-elaboration-order-in-ada}@anchor{234}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id5}@anchor{235}
+@anchor{gnat_ugn/elaboration_order_handling_in_gnat controlling-the-elaboration-order-in-ada}@anchor{238}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id5}@anchor{239}
@section Controlling the Elaboration Order in Ada
orders exist) even if maintenance changes the bodies of targets.
@node Controlling the Elaboration Order in GNAT,Common Elaboration-model Traits,Controlling the Elaboration Order in Ada,Elaboration Order Handling in GNAT
-@anchor{gnat_ugn/elaboration_order_handling_in_gnat id6}@anchor{236}@anchor{gnat_ugn/elaboration_order_handling_in_gnat controlling-the-elaboration-order-in-gnat}@anchor{237}
+@anchor{gnat_ugn/elaboration_order_handling_in_gnat id6}@anchor{23a}@anchor{gnat_ugn/elaboration_order_handling_in_gnat controlling-the-elaboration-order-in-gnat}@anchor{23b}
@section Controlling the Elaboration Order in GNAT
@end itemize
@node Common Elaboration-model Traits,Dynamic Elaboration Model in GNAT,Controlling the Elaboration Order in GNAT,Elaboration Order Handling in GNAT
-@anchor{gnat_ugn/elaboration_order_handling_in_gnat common-elaboration-model-traits}@anchor{238}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id7}@anchor{239}
+@anchor{gnat_ugn/elaboration_order_handling_in_gnat common-elaboration-model-traits}@anchor{23c}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id7}@anchor{23d}
@section Common Elaboration-model Traits
@code{-gnatws}.
@node Dynamic Elaboration Model in GNAT,Static Elaboration Model in GNAT,Common Elaboration-model Traits,Elaboration Order Handling in GNAT
-@anchor{gnat_ugn/elaboration_order_handling_in_gnat dynamic-elaboration-model-in-gnat}@anchor{23a}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id8}@anchor{23b}
+@anchor{gnat_ugn/elaboration_order_handling_in_gnat dynamic-elaboration-model-in-gnat}@anchor{23e}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id8}@anchor{23f}
@section Dynamic Elaboration Model in GNAT
@end example
@node Static Elaboration Model in GNAT,SPARK Elaboration Model in GNAT,Dynamic Elaboration Model in GNAT,Elaboration Order Handling in GNAT
-@anchor{gnat_ugn/elaboration_order_handling_in_gnat static-elaboration-model-in-gnat}@anchor{23c}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id9}@anchor{23d}
+@anchor{gnat_ugn/elaboration_order_handling_in_gnat static-elaboration-model-in-gnat}@anchor{240}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id9}@anchor{241}
@section Static Elaboration Model in GNAT
@end itemize
@node SPARK Elaboration Model in GNAT,Mixing Elaboration Models,Static Elaboration Model in GNAT,Elaboration Order Handling in GNAT
-@anchor{gnat_ugn/elaboration_order_handling_in_gnat id10}@anchor{23e}@anchor{gnat_ugn/elaboration_order_handling_in_gnat spark-elaboration-model-in-gnat}@anchor{23f}
+@anchor{gnat_ugn/elaboration_order_handling_in_gnat id10}@anchor{242}@anchor{gnat_ugn/elaboration_order_handling_in_gnat spark-elaboration-model-in-gnat}@anchor{243}
@section SPARK Elaboration Model in GNAT
@end example
@node Mixing Elaboration Models,Elaboration Circularities,SPARK Elaboration Model in GNAT,Elaboration Order Handling in GNAT
-@anchor{gnat_ugn/elaboration_order_handling_in_gnat mixing-elaboration-models}@anchor{240}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id11}@anchor{241}
+@anchor{gnat_ugn/elaboration_order_handling_in_gnat mixing-elaboration-models}@anchor{244}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id11}@anchor{245}
@section Mixing Elaboration Models
The warnings can be suppressed by binder switch @code{-ws}.
@node Elaboration Circularities,Resolving Elaboration Circularities,Mixing Elaboration Models,Elaboration Order Handling in GNAT
-@anchor{gnat_ugn/elaboration_order_handling_in_gnat id12}@anchor{242}@anchor{gnat_ugn/elaboration_order_handling_in_gnat elaboration-circularities}@anchor{243}
+@anchor{gnat_ugn/elaboration_order_handling_in_gnat id12}@anchor{246}@anchor{gnat_ugn/elaboration_order_handling_in_gnat elaboration-circularities}@anchor{247}
@section Elaboration Circularities
@code{Client}, and this leads to a circularity.
@node Resolving Elaboration Circularities,Resolving Task Issues,Elaboration Circularities,Elaboration Order Handling in GNAT
-@anchor{gnat_ugn/elaboration_order_handling_in_gnat id13}@anchor{244}@anchor{gnat_ugn/elaboration_order_handling_in_gnat resolving-elaboration-circularities}@anchor{245}
+@anchor{gnat_ugn/elaboration_order_handling_in_gnat id13}@anchor{248}@anchor{gnat_ugn/elaboration_order_handling_in_gnat resolving-elaboration-circularities}@anchor{249}
@section Resolving Elaboration Circularities
@end itemize
@node Resolving Task Issues,Elaboration-related Compiler Switches,Resolving Elaboration Circularities,Elaboration Order Handling in GNAT
-@anchor{gnat_ugn/elaboration_order_handling_in_gnat id14}@anchor{246}@anchor{gnat_ugn/elaboration_order_handling_in_gnat resolving-task-issues}@anchor{247}
+@anchor{gnat_ugn/elaboration_order_handling_in_gnat id14}@anchor{24a}@anchor{gnat_ugn/elaboration_order_handling_in_gnat resolving-task-issues}@anchor{24b}
@section Resolving Task Issues
@end itemize
@node Elaboration-related Compiler Switches,Summary of Procedures for Elaboration Control,Resolving Task Issues,Elaboration Order Handling in GNAT
-@anchor{gnat_ugn/elaboration_order_handling_in_gnat elaboration-related-compiler-switches}@anchor{248}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id15}@anchor{249}
+@anchor{gnat_ugn/elaboration_order_handling_in_gnat elaboration-related-compiler-switches}@anchor{24c}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id15}@anchor{24d}
@section Elaboration-related Compiler Switches
@end table
@node Summary of Procedures for Elaboration Control,Inspecting the Chosen Elaboration Order,Elaboration-related Compiler Switches,Elaboration Order Handling in GNAT
-@anchor{gnat_ugn/elaboration_order_handling_in_gnat summary-of-procedures-for-elaboration-control}@anchor{24a}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id16}@anchor{24b}
+@anchor{gnat_ugn/elaboration_order_handling_in_gnat summary-of-procedures-for-elaboration-control}@anchor{24e}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id16}@anchor{24f}
@section Summary of Procedures for Elaboration Control
@end itemize
@node Inspecting the Chosen Elaboration Order,,Summary of Procedures for Elaboration Control,Elaboration Order Handling in GNAT
-@anchor{gnat_ugn/elaboration_order_handling_in_gnat inspecting-the-chosen-elaboration-order}@anchor{24c}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id17}@anchor{24d}
+@anchor{gnat_ugn/elaboration_order_handling_in_gnat inspecting-the-chosen-elaboration-order}@anchor{250}@anchor{gnat_ugn/elaboration_order_handling_in_gnat id17}@anchor{251}
@section Inspecting the Chosen Elaboration Order
@end example
@node Inline Assembler,GNU Free Documentation License,Elaboration Order Handling in GNAT,Top
-@anchor{gnat_ugn/inline_assembler inline-assembler}@anchor{10}@anchor{gnat_ugn/inline_assembler doc}@anchor{24e}@anchor{gnat_ugn/inline_assembler id1}@anchor{24f}
+@anchor{gnat_ugn/inline_assembler inline-assembler}@anchor{10}@anchor{gnat_ugn/inline_assembler doc}@anchor{252}@anchor{gnat_ugn/inline_assembler id1}@anchor{253}
@chapter Inline Assembler
@end menu
@node Basic Assembler Syntax,A Simple Example of Inline Assembler,,Inline Assembler
-@anchor{gnat_ugn/inline_assembler id2}@anchor{250}@anchor{gnat_ugn/inline_assembler basic-assembler-syntax}@anchor{251}
+@anchor{gnat_ugn/inline_assembler id2}@anchor{254}@anchor{gnat_ugn/inline_assembler basic-assembler-syntax}@anchor{255}
@section Basic Assembler Syntax
@node A Simple Example of Inline Assembler,Output Variables in Inline Assembler,Basic Assembler Syntax,Inline Assembler
-@anchor{gnat_ugn/inline_assembler a-simple-example-of-inline-assembler}@anchor{252}@anchor{gnat_ugn/inline_assembler id3}@anchor{253}
+@anchor{gnat_ugn/inline_assembler a-simple-example-of-inline-assembler}@anchor{256}@anchor{gnat_ugn/inline_assembler id3}@anchor{257}
@section A Simple Example of Inline Assembler
@code{nothing.out}.
@node Output Variables in Inline Assembler,Input Variables in Inline Assembler,A Simple Example of Inline Assembler,Inline Assembler
-@anchor{gnat_ugn/inline_assembler id4}@anchor{254}@anchor{gnat_ugn/inline_assembler output-variables-in-inline-assembler}@anchor{255}
+@anchor{gnat_ugn/inline_assembler id4}@anchor{258}@anchor{gnat_ugn/inline_assembler output-variables-in-inline-assembler}@anchor{259}
@section Output Variables in Inline Assembler
@end quotation
@node Input Variables in Inline Assembler,Inlining Inline Assembler Code,Output Variables in Inline Assembler,Inline Assembler
-@anchor{gnat_ugn/inline_assembler id5}@anchor{256}@anchor{gnat_ugn/inline_assembler input-variables-in-inline-assembler}@anchor{257}
+@anchor{gnat_ugn/inline_assembler id5}@anchor{25a}@anchor{gnat_ugn/inline_assembler input-variables-in-inline-assembler}@anchor{25b}
@section Input Variables in Inline Assembler
@end quotation
@node Inlining Inline Assembler Code,Other Asm Functionality,Input Variables in Inline Assembler,Inline Assembler
-@anchor{gnat_ugn/inline_assembler id6}@anchor{258}@anchor{gnat_ugn/inline_assembler inlining-inline-assembler-code}@anchor{259}
+@anchor{gnat_ugn/inline_assembler id6}@anchor{25c}@anchor{gnat_ugn/inline_assembler inlining-inline-assembler-code}@anchor{25d}
@section Inlining Inline Assembler Code
thus saving the overhead of stack frame setup and an out-of-line call.
@node Other Asm Functionality,,Inlining Inline Assembler Code,Inline Assembler
-@anchor{gnat_ugn/inline_assembler other-asm-functionality}@anchor{25a}@anchor{gnat_ugn/inline_assembler id7}@anchor{25b}
+@anchor{gnat_ugn/inline_assembler other-asm-functionality}@anchor{25e}@anchor{gnat_ugn/inline_assembler id7}@anchor{25f}
@section Other @code{Asm} Functionality
@end menu
@node The Clobber Parameter,The Volatile Parameter,,Other Asm Functionality
-@anchor{gnat_ugn/inline_assembler the-clobber-parameter}@anchor{25c}@anchor{gnat_ugn/inline_assembler id8}@anchor{25d}
+@anchor{gnat_ugn/inline_assembler the-clobber-parameter}@anchor{260}@anchor{gnat_ugn/inline_assembler id8}@anchor{261}
@subsection The @code{Clobber} Parameter
@end itemize
@node The Volatile Parameter,,The Clobber Parameter,Other Asm Functionality
-@anchor{gnat_ugn/inline_assembler the-volatile-parameter}@anchor{25e}@anchor{gnat_ugn/inline_assembler id9}@anchor{25f}
+@anchor{gnat_ugn/inline_assembler the-volatile-parameter}@anchor{262}@anchor{gnat_ugn/inline_assembler id9}@anchor{263}
@subsection The @code{Volatile} Parameter
problems.
@node GNU Free Documentation License,Index,Inline Assembler,Top
-@anchor{share/gnu_free_documentation_license gnu-fdl}@anchor{1}@anchor{share/gnu_free_documentation_license doc}@anchor{260}@anchor{share/gnu_free_documentation_license gnu-free-documentation-license}@anchor{261}
+@anchor{share/gnu_free_documentation_license gnu-fdl}@anchor{1}@anchor{share/gnu_free_documentation_license doc}@anchor{264}@anchor{share/gnu_free_documentation_license gnu-free-documentation-license}@anchor{265}
@chapter GNU Free Documentation License
with System.Task_Primitives.Operations;
with System.Tasking;
with System.Tasking.Stages; use System.Tasking.Stages;
+with System.Tasking.Utilities;
with System.OS_Interface; use System.OS_Interface;
with System.Soft_Links; use System.Soft_Links;
with Ada.Unchecked_Conversion;
Thr.all := Task_Primitives.Operations.Get_Thread_Id (To_Id (Id));
end Get_Thread;
+ ----------------------
+ -- Make_Independent --
+ ----------------------
+
+ function Make_Independent return Boolean is
+ begin
+ return System.Tasking.Utilities.Make_Independent;
+ end Make_Independent;
+
----------------
-- To_Task_Id --
----------------
-- Given a low level Id, as returned by Create_Thread, return a Task_Id,
-- so that operations in Ada.Task_Identification can be used.
+ function Make_Independent return Boolean;
+ -- If a procedure loads a shared library containing tasks, and that
+ -- procedure is considered to be a master by the compiler (because it
+ -- contains tasks or class-wide objects that might contain tasks),
+ -- then the tasks in the shared library need to call Make_Independent
+ -- because otherwise they will depend on the procedure that loaded the
+ -- shared library.
+ --
+ -- See System.Tasking.Utilities.Make_Independent in s-tasuti.ads for
+ -- further documentation.
+
end GNAT.Threads;
(T.Common.LL.Thread, To_Target_Priority (Prio));
pragma Assert (Result = 0);
- if T.Common.LL.Thread = Pthread_Self
+ if T.Common.LL.Thread = pthread_self
and then Old > Prio
then
-- When lowering the priority via a pthread_setschedprio, QNX ensures
-- of the environment task.
Self_Id := Environment_Task;
- Self_Id.Master_of_Task := Environment_Task_Level;
- Self_Id.Master_Within := Self_Id.Master_of_Task + 1;
+ Self_Id.Master_Of_Task := Environment_Task_Level;
+ Self_Id.Master_Within := Self_Id.Master_Of_Task + 1;
for L in Self_Id.Entry_Calls'Range loop
Self_Id.Entry_Calls (L).Self := Self_Id;
-- updated it itself using information from a suspended Caller, or
-- after Caller has updated it and awakened Self.
- Master_of_Task : Master_Level;
+ Master_Of_Task : Master_Level;
-- The task executing the master of this task, and the ID of this task's
-- master (unique only among masters currently active within Parent).
--
Parent.Awake_Count := Parent.Awake_Count + 1;
if Parent.Common.State = Master_Completion_Sleep
- and then Acceptor.Master_of_Task = Parent.Master_Within
+ and then Acceptor.Master_Of_Task = Parent.Master_Within
then
Parent.Common.Wait_Count :=
Parent.Common.Wait_Count + 1;
-- duplicate master ids. For example, suppose we have three nested
-- task bodies T1,T2,T3. And suppose T1 also calls P which calls Q (and
-- both P and Q are task masters). Q will have the same master id as
- -- Master_of_Task of T3. Previous versions of this would abort T3 when
+ -- Master_Of_Task of T3. Previous versions of this would abort T3 when
-- Q calls Complete_Master, which was completely wrong.
begin
P := C.Common.Parent;
if P = Self_ID then
- if C.Master_of_Task = Self_ID.Master_Within then
+ if C.Master_Of_Task = Self_ID.Master_Within then
pragma Debug
(Debug.Trace (Self_ID, "Aborting", 'X', C));
Utilities.Abort_One_Task (Self_ID, C);
P.Alive_Count := P.Alive_Count + 1;
if P.Common.State = Master_Completion_Sleep and then
- C.Master_of_Task = P.Master_Within
+ C.Master_Of_Task = P.Master_Within
then
pragma Assert (Self_ID /= P);
P.Common.Wait_Count := P.Common.Wait_Count + 1;
-- has already awaited its dependent tasks. This raises Program_Error,
-- by 4.8(10.3/2). See AI-280. Ignore this check for foreign threads.
- if Self_ID.Master_of_Task /= Foreign_Task_Level
+ if Self_ID.Master_Of_Task /= Foreign_Task_Level
and then Master > Self_ID.Master_Within
then
raise Program_Error with
P := Self_ID;
- if P.Master_of_Task <= Independent_Task_Level then
+ if P.Master_Of_Task <= Independent_Task_Level then
P := Environment_Task;
else
- while P /= null and then P.Master_of_Task >= Master loop
+ while P /= null and then P.Master_Of_Task >= Master loop
P := P.Common.Parent;
end loop;
end if;
-- a regular library level task, otherwise the run-time will get
-- confused when waiting for these tasks to terminate.
- T.Master_of_Task := Library_Task_Level;
+ T.Master_Of_Task := Library_Task_Level;
else
- T.Master_of_Task := Master;
+ T.Master_Of_Task := Master;
end if;
- T.Master_Within := T.Master_of_Task + 1;
+ T.Master_Within := T.Master_Of_Task + 1;
for L in T.Entry_Calls'Range loop
T.Entry_Calls (L).Self := T;
pragma Debug
(Debug.Trace
- (Self_ID, "Created task in " & T.Master_of_Task'Img, 'C', T));
+ (Self_ID, "Created task in " & T.Master_Of_Task'Img, 'C', T));
end Create_Task;
--------------------
Initialization.Defer_Abort_Nestable (Self_ID);
- -- Loop through the From chain, changing their Master_of_Task fields,
+ -- Loop through the From chain, changing their Master_Of_Task fields,
-- and to find the end of the chain.
loop
- C.Master_of_Task := New_Master;
+ C.Master_Of_Task := New_Master;
exit when C.Common.Activation_Link = null;
C := C.Common.Activation_Link;
end loop;
pragma Assert (Self_ID.Deferral_Level = 1);
Debug.Master_Hook
- (Self_ID, Self_ID.Common.Parent, Self_ID.Master_of_Task);
+ (Self_ID, Self_ID.Common.Parent, Self_ID.Master_Of_Task);
if Use_Alternate_Stack then
Self_ID.Common.Task_Alternate_Stack := Task_Alternate_Stack'Address;
-- environment task), because they are implementation artifacts that
-- should be invisible to Ada programs.
- elsif Self_ID.Master_of_Task /= Independent_Task_Level then
+ elsif Self_ID.Master_Of_Task /= Independent_Task_Level then
-- Look for a fall-back handler following the master relationship
-- for the task. As specified in ARM C.7.3 par. 9/2, "the fall-back
procedure Terminate_Task (Self_ID : Task_Id) is
Environment_Task : constant Task_Id := STPO.Environment_Task;
- Master_of_Task : Integer;
+ Master_Of_Task : Integer;
Deallocate : Boolean;
begin
Lock_RTS;
end if;
- Master_of_Task := Self_ID.Master_of_Task;
+ Master_Of_Task := Self_ID.Master_Of_Task;
-- Check if the current task is an independent task If so, decrement
-- the Independent_Task_Count value.
- if Master_of_Task = Independent_Task_Level then
+ if Master_Of_Task = Independent_Task_Level then
if Single_Lock then
Utilities.Independent_Task_Count :=
Utilities.Independent_Task_Count - 1;
Free_Task (Self_ID);
end if;
- if Master_of_Task > 0 then
+ if Master_Of_Task > 0 then
STPO.Exit_Task;
end if;
end Terminate_Task;
C := All_Tasks_List;
while C /= null loop
- if C.Common.Activator = Self_ID and then C.Master_of_Task = CM then
+ if C.Common.Activator = Self_ID and then C.Master_Of_Task = CM then
return False;
end if;
- if C.Common.Parent = Self_ID and then C.Master_of_Task = CM then
+ if C.Common.Parent = Self_ID and then C.Master_Of_Task = CM then
Write_Lock (C);
if C.Common.State = Unactivated then
-- Terminate unactivated (never-to-be activated) tasks
- if C.Common.Activator = Self_ID and then C.Master_of_Task = CM then
+ if C.Common.Activator = Self_ID and then C.Master_Of_Task = CM then
- -- Usually, C.Common.Activator = Self_ID implies C.Master_of_Task
+ -- Usually, C.Common.Activator = Self_ID implies C.Master_Of_Task
-- = CM. The only case where C is pending activation by this
-- task, but the master of C is not CM is in Ada 2005, when C is
-- part of a return object of a build-in-place function.
-- Count it if directly dependent on this master
- if C.Common.Parent = Self_ID and then C.Master_of_Task = CM then
+ if C.Common.Parent = Self_ID and then C.Master_Of_Task = CM then
Write_Lock (C);
if C.Awake_Count /= 0 then
C := All_Tasks_List;
while C /= null loop
- if C.Common.Parent = Self_ID and then C.Master_of_Task = CM then
+ if C.Common.Parent = Self_ID and then C.Master_Of_Task = CM then
Write_Lock (C);
pragma Assert (C.Awake_Count = 0);
-- while the task calls Free_Task itself, in Terminate_Task.
if C.Common.Parent = Self_ID
- and then C.Master_of_Task >= CM
+ and then C.Master_Of_Task >= CM
and then not C.Free_On_Termination
then
if P /= null then
if (T.Common.Parent /= null
and then T.Common.Parent.Common.Parent /= null)
- or else T.Master_of_Task > Library_Task_Level
+ or else T.Master_Of_Task > Library_Task_Level
then
Initialization.Task_Lock (Self_ID);
pragma Assert (Self_ID = Self);
pragma Assert
(Self_ID.Master_Within in
- Self_ID.Master_of_Task + 1 .. Self_ID.Master_of_Task + 3);
+ Self_ID.Master_Of_Task .. Self_ID.Master_Of_Task + 3);
pragma Assert (Self_ID.Common.Wait_Count = 0);
pragma Assert (Self_ID.Open_Accepts = null);
pragma Assert (Self_ID.ATC_Nesting_Level = 1);
Unlock_RTS;
end if;
- -- If Self_ID.Master_Within = Self_ID.Master_of_Task + 2 we may have
+ -- If Self_ID.Master_Within = Self_ID.Master_Of_Task + 2 we may have
-- dependent tasks for which we need to wait. Otherwise we just exit.
- if Self_ID.Master_Within = Self_ID.Master_of_Task + 2 then
+ if Self_ID.Master_Within = Self_ID.Master_Of_Task + 2 then
Vulnerable_Complete_Master (Self_ID);
end if;
end Vulnerable_Complete_Task;
(From, To : Activation_Chain_Access;
New_Master : Master_ID);
-- Compiler interface only. Do not call from within the RTS.
- -- Move all tasks on From list to To list, and change their Master_of_Task
+ -- Move all tasks on From list to To list, and change their Master_Of_Task
-- to be New_Master. This is used to implement build-in-place function
-- returns. Tasks that are part of the return object are initially placed
-- on an activation chain local to the return statement, and their master
pragma Assert (Parent = Environment_Task);
- Self_Id.Master_of_Task := Independent_Task_Level;
+ Self_Id.Master_Of_Task := Independent_Task_Level;
-- Update Independent_Task_Count that is needed for the GLADE
-- termination rule. See also pending update in
end loop;
if P.Common.State = Master_Phase_2_Sleep
- and then C.Master_of_Task = P.Master_Within
+ and then C.Master_Of_Task = P.Master_Within
then
pragma Assert (P.Common.Wait_Count > 0);
P.Common.Wait_Count := P.Common.Wait_Count - 1;
-- P has non-passive dependents
if P.Common.State = Master_Completion_Sleep
- and then C.Master_of_Task = P.Master_Within
+ and then C.Master_Of_Task = P.Master_Within
then
pragma Debug
(Debug.Trace
--
-- This is a dangerous operation, and should never be used on nested tasks
-- or tasks that depend on any objects that might be finalized earlier than
- -- the termination of the environment task. It is for internal use by the
- -- GNARL, to prevent such internal server tasks from preventing a partition
- -- from terminating.
+ -- the termination of the environment task. It is primarily for internal
+ -- use by the GNARL, to prevent such internal server tasks from preventing
+ -- a partition from terminating.
--
-- Also note that the run time assumes that the parent of an independent
-- task is the environment task. If this is not the case, Make_Independent
Unlock_RTS;
pragma Assert (Succeeded);
- Self_Id.Master_of_Task := 0;
- Self_Id.Master_Within := Self_Id.Master_of_Task + 1;
+ Self_Id.Master_Of_Task := 0;
+ Self_Id.Master_Within := Self_Id.Master_Of_Task + 1;
for L in Self_Id.Entry_Calls'Range loop
Self_Id.Entry_Calls (L).Self := Self_Id;
-- type of A. The quad-word operations are only implemented by one
-- Altivec primitive operation. That means that, if QW_Operation is a
-- quad-word operation, we should have:
--- QW_Operation (To_Type_of_A (B)) = QW_Operation (A)
+-- QW_Operation (To_Type_Of_A (B)) = QW_Operation (A)
-- That is true iff:
--- To_Quad_Word (To_Type_of_A (B)) = To_Quad_Word (A)
+-- To_Quad_Word (To_Type_Of_A (B)) = To_Quad_Word (A)
-- As To_Quad_Word is a bijection. we have:
--- To_Type_of_A (B) = A
+-- To_Type_Of_A (B) = A
-- resp. any combination of A, B, C:
--- To_Type_of_A (C) = A
--- To_Type_of_B (A) = B
--- To_Type_of_C (B) = C
+-- To_Type_Of_A (C) = A
+-- To_Type_Of_B (A) = B
+-- To_Type_Of_C (B) = C
-- ...
-- Making sure that the properties described above are verified by the
-- requires that "The subpool no longer belongs to any pool" BEFORE
-- calling Deallocate_Subpool. The actual dispatching call required is:
--
- -- Deallocate_Subpool(Pool_of_Subpool(Subpool).all, Subpool);
+ -- Deallocate_Subpool(Pool_Of_Subpool(Subpool).all, Subpool);
--
- -- but that can't be taken literally, because Pool_of_Subpool will
+ -- but that can't be taken literally, because Pool_Of_Subpool will
-- return null.
declare
------------------------------------------
procedure Analyze_Generic_Package_Declaration (N : Node_Id) is
- Loc : constant Source_Ptr := Sloc (N);
- Decls : constant List_Id :=
- Visible_Declarations (Specification (N));
+ Decls : constant List_Id := Visible_Declarations (Specification (N));
+ Loc : constant Source_Ptr := Sloc (N);
+
Decl : Node_Id;
Id : Entity_Id;
New_N : Node_Id;
Name =>
Make_Identifier (Loc, Chars (Defining_Entity (N))));
+ -- The declaration is inserted before other declarations, but before
+ -- pragmas that may be library-unit pragmas and must appear before other
+ -- declarations. The pragma Compile_Time_Error is not in this class, and
+ -- may contain an expression that includes such a qualified name, so the
+ -- renaming declaration must appear before it.
+
+ -- Are there other pragmas that require this special handling ???
+
if Present (Decls) then
Decl := First (Decls);
- while Present (Decl) and then Nkind (Decl) = N_Pragma loop
+ while Present (Decl)
+ and then Nkind (Decl) = N_Pragma
+ and then Get_Pragma_Id (Decl) /= Pragma_Compile_Time_Error
+ loop
Next (Decl);
end loop;
if Present (L) then
Context := Parent (L);
- -- Analyze the contracts of packages and their bodies
+ -- Certain contract annocations have forward visibility semantics and
+ -- must be analyzed after all declarative items have been processed.
+ -- This timing ensures that entities referenced by such contracts are
+ -- visible.
- if Nkind (Context) = N_Package_Specification
- and then L = Visible_Declarations (Context)
- then
- Analyze_Package_Contract (Defining_Entity (Context));
+ -- Analyze the contract of an immediately enclosing package spec or
+ -- body first because other contracts may depend on its information.
- elsif Nkind (Context) = N_Package_Body then
+ if Nkind (Context) = N_Package_Body then
Analyze_Package_Body_Contract (Defining_Entity (Context));
+
+ elsif Nkind (Context) = N_Package_Specification then
+ Analyze_Package_Contract (Defining_Entity (Context));
end if;
- -- Analyze the contracts of various constructs now due to the delayed
- -- visibility needs of their aspects and pragmas.
+ -- Analyze the contracts of various constructs in the declarative
+ -- list.
Analyze_Contracts (L);
Remove_Visible_Refinements (Corresponding_Spec (Context));
Remove_Partial_Visible_Refinements (Corresponding_Spec (Context));
- elsif Nkind (Context) = N_Package_Declaration then
+ elsif Nkind (Context) = N_Package_Specification then
-- Partial state refinements are visible up to the end of the
-- package spec declarations. Hide the partial state refinements
-- from visibility to restore the original state conditions.
- Remove_Partial_Visible_Refinements (Corresponding_Spec (Context));
+ Remove_Partial_Visible_Refinements (Defining_Entity (Context));
end if;
-- Verify that all abstract states found in any package declared in
-- Start of processing for Analyze_Subprogram_Body_Helper
begin
- -- A [generic] subprogram body "freezes" the contract of the nearest
+ -- A [generic] subprogram body freezes the contract of the nearest
-- enclosing package body and all other contracts encountered in the
-- same declarative part up to and excluding the subprogram body:
-- with Refined_Depends => (Input => Constit) ...
-- This ensures that any annotations referenced by the contract of the
- -- [generic] subprogram body are available. This form of "freezing" is
+ -- [generic] subprogram body are available. This form of freezing is
-- decoupled from the usual Freeze_xxx mechanism because it must also
-- work in the context of generics where normal freezing is disabled.
- -- Only bodies coming from source should cause this type of "freezing".
+ -- Only bodies coming from source should cause this type of freezing.
-- Expression functions that act as bodies and complete an initial
-- declaration must be included in this category, hence the use of
-- Original_Node.
if Comes_From_Source (Original_Node (N)) then
- Analyze_Previous_Contracts (N);
+ Freeze_Previous_Contracts (N);
end if;
-- Generic subprograms are handled separately. They always have a
end if;
end if;
- -- A subprogram body "freezes" its own contract. Analyze the contract
+ -- A subprogram body freezes its own contract. Analyze the contract
-- after the declarations of the body have been processed as pragmas
-- are now chained on the contract of the subprogram body.
end if;
end if;
- -- A [generic] package body "freezes" the contract of the nearest
- -- enclosing package body and all other contracts encountered in the
- -- same declarative part up to and excluding the package body:
+ -- A [generic] package body freezes the contract of the nearest
+ -- enclosing package body and all other contracts encountered in
+ -- the same declarative part up to and excluding the package body:
-- package body Nearest_Enclosing_Package
-- with Refined_State => (State => Constit)
-- This ensures that any annotations referenced by the contract of a
-- [generic] subprogram body declared within the current package body
- -- are available. This form of "freezing" is decoupled from the usual
+ -- are available. This form of freezing is decoupled from the usual
-- Freeze_xxx mechanism because it must also work in the context of
-- generics where normal freezing is disabled.
- -- Only bodies coming from source should cause this type of "freezing".
+ -- Only bodies coming from source should cause this type of freezing.
-- Instantiated generic bodies are excluded because their processing is
-- performed in a separate compilation pass which lacks enough semantic
-- information with respect to contract analysis. It is safe to suppress
- -- the "freezing" of contracts in this case because this action already
+ -- the freezing of contracts in this case because this action already
-- took place at the end of the enclosing declarative part.
if Comes_From_Source (N)
and then not Is_Generic_Instance (Spec_Id)
then
- Analyze_Previous_Contracts (N);
+ Freeze_Previous_Contracts (N);
end if;
-- A package body is Ghost when the corresponding spec is Ghost. Set
Declare_Inherited_Private_Subprograms (Spec_Id);
end if;
- -- A package body "freezes" the contract of its initial declaration.
- -- This analysis depends on attribute Corresponding_Spec being set. Only
- -- bodies coming from source shuld cause this type of "freezing".
-
if Present (Declarations (N)) then
Analyze_Declarations (Declarations (N));
Inspect_Deferred_Constant_Completion (Declarations (N));
Entry_Name : Entity_Id;
begin
- -- An entry body "freezes" the contract of the nearest enclosing package
+ -- An entry body freezes the contract of the nearest enclosing package
-- body and all other contracts encountered in the same declarative part
-- up to and excluding the entry body. This ensures that any annotations
-- referenced by the contract of an entry or subprogram body declared
-- within the current protected body are available.
- Analyze_Previous_Contracts (N);
+ Freeze_Previous_Contracts (N);
Tasking_Used := True;
-- Start of processing for Analyze_Protected_Body
begin
- -- A protected body "freezes" the contract of the nearest enclosing
+ -- A protected body freezes the contract of the nearest enclosing
-- package body and all other contracts encountered in the same
- -- declarative part up to and excluding the protected body. This ensures
- -- that any annotations referenced by the contract of an entry or
- -- subprogram body declared within the current protected body are
- -- available.
+ -- declarative part up to and excluding the protected body. This
+ -- ensures that any annotations referenced by the contract of an
+ -- entry or subprogram body declared within the current protected
+ -- body are available.
- Analyze_Previous_Contracts (N);
+ Freeze_Previous_Contracts (N);
Tasking_Used := True;
Set_Ekind (Body_Id, E_Protected_Body);
-- a single task, since Spec_Id is set to the task type).
begin
- -- A task body "freezes" the contract of the nearest enclosing package
+ -- A task body freezes the contract of the nearest enclosing package
-- body and all other contracts encountered in the same declarative part
-- up to and excluding the task body. This ensures that annotations
-- referenced by the contract of an entry or subprogram body declared
-- within the current protected body are available.
- Analyze_Previous_Contracts (N);
+ Freeze_Previous_Contracts (N);
Tasking_Used := True;
Set_Scope (Body_Id, Current_Scope);
Freeze_Id : Entity_Id);
-- Subsidiary to the analysis of pragmas Contract_Cases, Part_Of, Post, and
-- Pre. Emit a freezing-related error message where Freeze_Id is the entity
- -- of a body which caused contract "freezing" and Contract_Id denotes the
+ -- of a body which caused contract freezing and Contract_Id denotes the
-- entity of the affected contstruct.
procedure Duplication_Error (Prag : Node_Id; Prev : Node_Id);
-- Emit a clarification message when the case guard contains
-- at least one undefined reference, possibly due to contract
- -- "freezing".
+ -- freezing.
if Errors /= Serious_Errors_Detected
and then Present (Freeze_Id)
-- Emit a clarification message when the consequence contains
-- at least one undefined reference, possibly due to contract
- -- "freezing".
+ -- freezing.
if Errors /= Serious_Errors_Detected
and then Present (Freeze_Id)
end if;
-- Emit a clarification message when the encapsulator is undefined,
- -- possibly due to contract "freezing".
+ -- possibly due to contract freezing.
if Errors /= Serious_Errors_Detected
and then Present (Freeze_Id)
Preanalyze_Assert_Expression (Expr, Standard_Boolean);
-- Emit a clarification message when the expression contains at least
- -- one undefined reference, possibly due to contract "freezing".
+ -- one undefined reference, possibly due to contract freezing.
if Errors /= Serious_Errors_Detected
and then Present (Freeze_Id)
Constit_Id := Entity_Of (Constit);
-- When a constituent is declared after a subprogram body
- -- that caused "freezing" of the related contract where
+ -- that caused freezing of the related contract where
-- pragma Refined_State resides, the constituent appears
-- undefined and carries Any_Id as its entity.
procedure Check_Spaces is
begin
if N > Buflen or else Buffer (N) /= ' ' then
- pragma Annotate
- (CodePeer, False_Positive, "condition predetermined",
- "N may be less than Buflen when calling Check_Spaces");
-
FailN ("missing space for");
end if;
* *
* C Implementation File *
* *
- * Copyright (C) 2000-2016, Free Software Foundation, Inc. *
+ * Copyright (C) 2000-2017, 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- *
|| ((*((ptr) - 1) & 0xff) == 0xff) \
|| (((*(ptr) & 0xd0ff) == 0xd0ff))))
+/*----------------------------- qnx ----------------------------------*/
+
+#elif defined (__QNX__)
+
+#define USE_GCC_UNWINDER
+
+#if defined (__aarch64__)
+#define PC_ADJUST -4
+#else
+#error Unhandled QNX architecture.
+#endif
+
/*----------------------------- ia64 ---------------------------------*/
#elif defined (__ia64__) && (defined (__linux__) || defined (__hpux__))