diff options
author | Ronan Desplanques <desplanques@adacore.com> | 2024-09-02 15:38:21 +0200 |
---|---|---|
committer | Marc Poulhiès <dkm@gcc.gnu.org> | 2024-10-08 10:37:11 +0200 |
commit | 7e09f16ef980883598268b2044b9b370ec3a9611 (patch) | |
tree | 236cd26c5cc9b0f85994488a873a1fe59f2b9240 /gcc/ada/fe.h | |
parent | 23017cea9c8438865e557782c6c46eb996cf2132 (diff) | |
download | gcc-7e09f16ef980883598268b2044b9b370ec3a9611.zip gcc-7e09f16ef980883598268b2044b9b370ec3a9611.tar.gz gcc-7e09f16ef980883598268b2044b9b370ec3a9611.tar.bz2 |
ada: Add External_Initialization extension
This patch introduces a GNAT extension that adds a new aspect,
External_Initialization. A section is added to the reference
manual with a description of what the aspect does.
The implementation reuses existing mechanisms, in particular
Sinput.L.Load_Source_File and Sem_Res.Set_String_Literal_Subtype.
A new node kind is added, and nodes of that type are present in what
is passed to the back ends. That makes it necessary to update the back
ends to handle the new node type. The C interface is extended to make
that possible.
gcc/ada/ChangeLog:
* aspects.ads: Add entities for External_Initialization.
* checks.adb (Selected_Length_Checks): Add support for
N_External_Initializer nodes.
* doc/gnat_rm/gnat_language_extensions.rst: Add section for the added
extension.
* exp_util.adb (Insert_Actions): Add support for N_External_Initializer
nodes.
* fe.h (C_Source_Buffer): New function.
* gen_il-fields.ads: Add new field.
* gen_il-gen-gen_nodes.adb: Add N_External_Initializer node kind.
* gen_il-gen.adb: Add new field type.
* gen_il-types.ads: Add new node kind and new field type.
* pprint.adb (Expr_Name): Handle new node kind.
* sem.adb (Analyze): Add support for N_External_Initializer nodes.
* sem_ch13.adb (Analyze_Aspect_Specifications, Check_Aspect_At_Freeze_Point):
Add support for External_Initialization aspect.
* sem_ch3.adb (Apply_External_Initialization): New subprogram.
(Analyze_Object_Declaration): Add support for External_Initialization aspect.
* sem_res.adb (Resolve_External_Initializer): New procedure.
(Resolve): Add support for N_External_Initializer nodes.
(Set_String_Literal_Subtype): Extend to handle N_External_Initializer nodes.
* sinfo-utils.adb (Is_In_Union_Id): Adapt to new field addition.
* sinfo.ads: Add documentation for new node kind and new field.
* sinput.adb, sinput.ads (C_Source_Buffer): Add new C interface function.
* snames.ads-tmpl: Add new aspect identifier.
* sprint.adb (Sprint_Node_Actual): Add nop handling of N_External_Initializer
nodes.
* types.ads: Modify type to allow for new C interface.
* gcc-interface/trans.cc (gnat_to_gnu): Handle new GNAT node type.
* gcc-interface/Make-lang.in: Update list of stage1 run-time library units.
* gnat-style.texi: Regenerate.
* gnat_rm.texi: Regenerate.
* gnat_ugn.texi: Regenerate.
Diffstat (limited to 'gcc/ada/fe.h')
-rw-r--r-- | gcc/ada/fe.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/ada/fe.h b/gcc/ada/fe.h index b4c1aea5..9d3606c 100644 --- a/gcc/ada/fe.h +++ b/gcc/ada/fe.h @@ -345,11 +345,18 @@ extern void Set_Present_Expr (Node_Id, Uint); /* sinput: */ +struct c_array { + char *pointer; + int length; +}; + +#define C_Source_Buffer sinput__c_source_buffer #define Debug_Source_Name sinput__debug_source_name #define Get_Column_Number sinput__get_column_number #define Get_Logical_Line_Number sinput__get_logical_line_number #define Get_Source_File_Index sinput__get_source_file_index +extern struct c_array C_Source_Buffer (Source_File_Index); extern File_Name_Type Debug_Source_Name (Source_File_Index); extern Column_Number_Type Get_Column_Number (Source_Ptr); extern Line_Number_Type Get_Logical_Line_Number (Source_Ptr); |