aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/doc
AgeCommit message (Collapse)AuthorFilesLines
2024-07-02ada: Fix crash on box-initialized component with No_Default_InitializationEric Botcazou1-2/+2
The problem is that the implementation of the No_Default_Initialization restriction assumes that no type initialization routines are needed and, therefore, builds a dummy version of them, which goes against their use for box-initialized components in aggregates. Therefore this use needs to be flagged as violating the restriction too. gcc/ada/ * doc/gnat_rm/standard_and_implementation_defined_restrictions.rst (No_Default_Initialization): Mention components alongside variables. * exp_aggr.adb (Build_Array_Aggr_Code.Gen_Assign): Check that the restriction No_Default_Initialization is not in effect for default initialized component. (Build_Record_Aggr_Code): Likewise. * gnat_rm.texi: Regenerate.
2024-06-27ada: Implement first half of Generalized FinalizationEric Botcazou1-0/+33
This implements the first half of the Generalized Finalization proposal, namely the Finalizable aspect as well as its optional relaxed semantics for the finalization operations, but the latter part is only implemented for dynamically allocated objects. In accordance with the spirit, if not the letter, of the proposal, this implements the finalizable types declared with strict semantics for the finalization operations as a direct generalization of controlled types, which in turn makes it possible to reimplement the latter types in terms of the former types and ensures full interoperability between them. The relaxed semantics for the finalization operations is also a direct generalization of the GNAT pragma No_Heap_Finalization for dynamically allocated objects, in that it extends the effects of the pragma to all access types designating the finalizable type, instead of just applying them to library-level named access types. gcc/ada/ * aspects.ads (Aspect_Id): Add Aspect_Finalizable. (Implementation_Defined_Aspect): Add True for Aspect_Finalizable. (Operational_Aspect): Add True for Aspect_Finalizable. (Aspect_Argument): Add Expression for Aspect_Finalizable. (Is_Representation_Aspect): Add False for Aspect_Finalizable. (Aspect_Names): Add Name_Finalizable for Aspect_Finalizable. (Aspect_Delay): Add Always_Delay for Aspect_Finalizable. * checks.adb: Add with and use clauses for Sem_Elab. (Install_Primitive_Elaboration_Check): Call Is_Controlled_Procedure. * einfo.ads (Has_Relaxed_Finalization): Document new flag. (Is_Controlled_Active): Update documentation. * exp_aggr.adb (Generate_Finalization_Actions): Replace Find_Prim_Op with Find_Controlled_Prim_Op for Name_Finalize. * exp_attr.adb (Expand_N_Attribute_Reference) <Finalization_Size>: Return 0 if the prefix type has relaxed finalization. * exp_ch3.adb (Build_Equivalent_Record_Aggregate): Return Empty if the type needs finalization. (Expand_Freeze_Record_Type): Call Find_Controlled_Prim_Op instead of Find_Prim_Op for Name_{Adjust,Initialize,Finalize}. Call Make_Finalize_Address_Body for all controlled types. * exp_ch4.adb (Insert_Dereference_Action): Do not generate a call to Adjust_Controlled_Dereference if the designated type has relaxed finalization. * exp_ch6.adb (Needs_BIP_Collection): Return false for an untagged type that has relaxed finalization. * exp_ch7.adb (Allows_Finalization_Collection): Return false if the designated type has relaxed finalization. (Check_Visibly_Controlled): Call Find_Controlled_Prim_Op instead of Find_Prim_Op. (Make_Adjust_Call): Likewise. (Make_Deep_Record_Body): Likewise. (Make_Final_Call): Likewise. (Make_Init_Call): Likewise. * exp_disp.adb (Set_All_DT_Position): Remove obsolete warning. * exp_util.ads: Add with and use clauses for Snames. (Find_Prim_Op): Add precondition. (Find_Controlled_Prim_Op): New function declaration. (Name_Of_Controlled_Prim_Op): Likewise. * exp_util.adb: Remove with and use clauses for Snames. (Build_Allocate_Deallocate_Proc): Do not build finalization actions if the designated type has relaxed finalization. (Find_Controlled_Prim_Op): New function. (Find_Last_Init): Call Find_Controlled_Prim_Op instead of Find_Prim_Op. (Name_Of_Controlled_Prim_Op): New function. * freeze.adb (Freeze_Entity.Freeze_Record_Type): Propagate the Has_Relaxed_Finalization flag from components. * gen_il-fields.ads (Opt_Field_Enum): Add Has_Relaxed_Finalization. * gen_il-gen-gen_entities.adb (Entity_Kind): Likewise. * sem_aux.adb (Is_By_Reference_Type): Return true for all controlled types. * sem_ch3.adb (Build_Derived_Record_Type): Do not special case types declared in Ada.Finalization. (Record_Type_Definition): Propagate the Has_Relaxed_Finalization flag from components. * sem_ch13.adb (Analyze_Aspects_At_Freeze_Point): Also process the Finalizable aspect. (Analyze_Aspect_Specifications): Likewise. Call Flag_Non_Static_Expr in more cases. (Check_Aspect_At_Freeze_Point): Likewise. (Inherit_Aspects_At_Freeze_Point): Likewise. (Resolve_Aspect_Expressions): Likewise. (Resolve_Finalizable_Argument): New procedure. (Validate_Finalizable_Aspect): Likewise. * sem_elab.ads: Add with and use clauses for Snames. (Is_Controlled_Procedure): New function declaration. * sem_elab.adb: Remove with and use clauses for Snames. (Is_Controlled_Proc): Move to... (Is_Controlled_Procedure): ...here and rename. (Check_A_Call): Call Find_Controlled_Prim_Op instead of Find_Prim_Op. (Is_Finalization_Procedure): Likewise. * sem_util.ads (Propagate_Controlled_Flags): Update documentation. * sem_util.adb (Is_Fully_Initialized_Type): Replace call to Find_Optional_Prim_Op with Find_Controlled_Prim_Op. Call Has_Null_Extension only for derived tagged types. (Propagate_Controlled_Flags): Propagate Has_Relaxed_Finalization. * snames.ads-tmpl (Name_Finalizable): New name. (Name_Relaxed_Finalization): Likewise. * libgnat/s-finroo.ads (Root_Controlled): Add Finalizable aspect. * doc/gnat_rm/gnat_language_extensions.rst: Document implementation of Generalized Finalization. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-06-20ada: Replace "All" argument to Extensions_Allowed pragma with "All_Extensions"Steve Baird2-7/+8
The argument to pragma Extensions_Allowed to enable all extensions is no longer "All", but instead "All_Extensions". gcc/ada/ * doc/gnat_rm/gnat_language_extensions.rst: Update documentation. * doc/gnat_rm/implementation_defined_pragmas.rst: Update documentation. * errout.adb (Error_Msg_GNAT_Extension): Update error message text. * par-prag.adb: Update pragma parsing. This includes changing the the name of the Check_Arg_Is_On_Or_Off formal parameter All_OK_Too to All_Extensions_OK_Too. * sem_prag.adb (Analyze_Pragma): In analyzing an Extensions_Allowed pragma, replace uses of Name_All with Name_All_Extensions; update a comment to reflect this. * snames.ads-tmpl: Add Name_All_Extensions declaration. * gnat_rm.texi: Regenerate.
2024-06-20ada: New pragma to default all interrupts to system.Doug Rupp2-0/+17
New pragma Interrupts_System_By_Default defaults all interrupts/signals to system (which will inhibit the installation of default signal handlers). Note this changes the ALI format: it optionally adds an identifier to the 'P' line (similar to pragma Unreserve_All_Interrupts). As per comment in lib-writ spec regarding new modifiers, adding modifiers to the P line is always safe. Also note this does not introduce a bootstrap problem because the compiler and binder do not set the underlying _gl global nor do they use this pragma. gcc/ada/ * ali.ads (Interrupts_Default_To_System): New boolean. (Interrupts_Default_To_System_Specified): New boolean. * ali.adb (Interrupts_Default_To_System_Specified): Initialize. (Interrupts_Default_To_System): Initialize. (Scan_ALI): Processing for "ID". * bindgen.adb: Coallesce comments on interrupt settings to ... (Gen_Adainit): Import Interrupts_Default_To_System flag and set if pragma specified. (Gen_Output_File_Ada): Generate Local_Interrupt_States according to pragma. * init.c: ... here. [vxworks] (__gnat_install_handler): Test for interrupt_state. (__gl_interrupts_default_to_system): New global flag. (__gnat_get_interrupt_State): return interrupt state according to new global flag. * lib-writ.ads: Document "ID". * lib-writ.adb: Write out "ID". * opt.ads (Interrupts_System_By_Default): New boolean, defaulted to False. * par-prag.adb (Pragma_Interrupts_System_By_Default): New. * sem_prag.adb (Pragma_Interrupts_System_By_Default): Handle it. (Pragma_Interrupts_System_By_Default): Default it. * snames.ads-tmpl (Name_Interrupts_System_By_Default): New name. (Pragma_Interrupts_System_By_Default): New * libgnarl/s-intman__posix.adb (Initialize): Ensure the Keep_Unmasked signal is sigset-able. * doc/gnat_rm/implementation_defined_pragmas.rst: Document pragma Interrupts_System_By_Default. * doc/gnat_ugn/the_gnat_compilation_model.rst (Configuration pragmas): Add Interrupts_System_By_Default. (Partition-Wide Settings): Mention pragma Interrupts_System_By_Default. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-06-20ada: Update Bit Ordering references in GNAT Reference ManualEric Botcazou2-11/+8
They are still tailored to Ada 95 while the level of recommended support for Bit Ordering was changed in Ada 2005. gcc/ada/ * doc/gnat_rm/implementation_advice.rst (Representation Clauses): Remove >> marker and add end of sentence after code-block directive. (RM 13.5.3(7-8)): Update to Ada 2005 wording. * doc/gnat_rm/implementation_defined_characteristics.rst (RM 13.5.3(5)): Likewise. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-06-20ada: Add documentation for Subprogram_Variant aspect and pragmaPiotr Trojanek2-0/+37
For completeness, the GNAT Reference Manual should document aspects and pragmas that are specific to SPARK and described in the SPARK User's Guide. gcc/ada/ * doc/gnat_rm/implementation_defined_aspects.rst (Aspect Subprogram_Variant): Refer to SPARK User's Guide. * doc/gnat_rm/implementation_defined_pragmas.rst (Pragma Subprogram_Variant): Document syntax to satisfy the convention; refer to SPARK User's Guide for semantics. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-06-20ada: Couple of minor fixes in GNAT Reference ManualEric Botcazou2-9/+8
The Storage_Model pragma no longer exists. gcc/ada/ * doc/gnat_rm/gnat_language_extensions.rst (Pragma Storage_Model): Rename to Storage Model. * doc/gnat_rm/implementation_defined_aspects.rst: Alphabetize. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-06-20ada: Change messages for -gnatw.v to warningsViljar Indus1-9/+8
Previously this switch was emitting only info messages which was both confusing in terms of the name of the switch that was used internally and externally. gcc/ada/ * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Update documentation for -gnatw.v. * sem_ch13.adb: Convert all -gnatw.v related messages to warnings. * gnat_ugn.texi: Regenerate.
2024-06-20ada: Convert -gnatw.n messages to warningsViljar Indus1-5/+7
Previously the messages produced by this warning switch were info messages that were suppressed with the same methods as regular warnings. Since info messages are now separated as a completely different class of messages then these messages should be converted back to warnings in order for the previous pragma based suppression methods to work. gcc/ada/ * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Update documentation for -gnatw.n switch. * exp_util.adb: Convert info messages into warnings. * gnat_ugn.texi: Regenerate.
2024-06-20ada: Add switch for suppressing info messagesViljar Indus1-0/+15
Add a separate switch -gnatis to suppress info messages separately from warning messages that are controlled by -gnatws. gcc/ada/ * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Add entry for -gnatis. * errout.adb (Error_Msg_Internal): Stop printing info messages if -gnatis was used. * opt.ads: Add Info_Suppressed flag to track whether info messages should be suppressed. * switch-c.adb: Add parsing for -gnatis. * gnat_ugn.texi: Regenerate.
2024-06-20ada: Update documentation for 'SuperJustin Squirek2-24/+27
This patch moves the documentation for 'Super from gnat language extensions to experimental language extensions. gcc/ada/ * doc/gnat_rm/gnat_language_extensions.rst: Add entry for 'Super. * doc/gnat_rm/implementation_defined_attributes.rst: Remove entry for 'Super. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-06-14ada: Add prototype for mutably tagged typesJustin Squirek1-0/+38
This patch implements mutably tagged types via the new Size'Class aspect. gcc/ada/ * doc/gnat_rm/gnat_language_extensions.rst: Add documentation for mutably tagged type feature. * aspects.ads: Add registration for 'Size'Class. * einfo.ads: Add documentation for new components Class_Wide_Equivalent_Type and Is_Mutably_Tagged_Type. * exp_aggr.adb (Gen_Assign): Assume associated mutably tagged type when class-wide equivalent type is encountered. (Contains_Mutably_Tagged_Type): New subprogram. (Convert_To_Positional): Assume associated mutably tagged type when class-wide equivalent type is encountered. (Is_Static_Element): Assume associated mutably tagged type when class-wide equivalent type is encountered. (Expand_Array_Aggregate): Assume associated mutably tagged type when class-wide equivalent type is encountered. (Expand_Record_Aggregate): Force mutably tagged records to be expanded into assignments. * exp_ch3.adb (Build_Array_Init_Proc): Assume associated mutably tagged type when class-wide equivalent type is encountered. (Simple_Initialization_OK): Disallow simple initialization for class-wide equivalent types. (Build_Init_Statements): Assume associated mutably tagged type when class-wide equivalent type is encountered. (Expand_Freeze_Array_Type): Ignore building of record init procs for mutably tagged types. (Expand_N_Full_Type_Declaration): Replace mutably tagged type declarations with their associated class-wide equivalent types. (Default_Initialize_Object): Add special handling for mutably tagged types. * exp_ch4.adb (Expand_N_Allocator): Add initialization for mutably tagged types. (Expand_Record_Equality): Generate mutably tagged unchecked conversions. * exp_ch5.adb (Expand_N_Assignment_Statement): Generate a special assignment case for class-wide equivalent types which does tag assignments and ignores certain checks. * exp_ch6.adb (Expand_Call_Helper): Propagate constrained extra formal actuals for mutably tagged types. * exp_ch7.adb (Make_Init_Call): Handle mutably tagged type initialization. * exp_util.adb (Make_CW_Equivalent_Type): Modify to handle mutably tagged objects which contain no initialization expression. (Make_Subtype_From_Expr): Modify call to Make_CW_Equivalent_Type. * exp_util.ads (Make_CW_Equivalent_Type): Move declaration from body to spec. * freeze.adb (Size_Known): No longer return false automatically when a class-wide type is encountered. (Freeze_Entity): Ignore error messages about size not being known for mutably tagged types. * gen_il-fields.ads: Register new fields Class_Wide_Equivalent_Type and Is_Mutably_Tagged_Type. * gen_il-gen-gen_entities.adb: Register new fields Class_Wide_Equivalent_Type and Is_Mutably_Tagged_Type for type entities. * mutably_tagged.adb, mutably_tagged.ads (Corresponding_Mutably_Tagged_Type): New subprogram. (Depends_On_Mutably_Tagged_Ext_Comp): New subprogram. (Get_Corresponding_Mutably_Tagged_Type_If_Present): New subprogram. (Get_Corresponding_Tagged_Type_If_Present): New subprogram. (Is_Mutably_Tagged_Conversion): New subprogram. (Is_Mutably_Tagged_CW_Equivalent_Type): New subprogram. (Make_Mutably_Tagged_Conversion): New subprogram. (Make_CW_Size_Compile_Check): New subprogram. (Make_Mutably_Tagged_CW_Check): New subprogram. * sem_aggr.adb (Resolve_Array_Aggregate): Skip tag checks for class-wide equivalent types. (Resolve_Aggr_Expr): Assume associated mutably tagged type when class-wide equivalent type is encountered. * sem_attr.adb (Analyze_Attribute): Allow 'Tag on mutably tagged types. (Resolve_Attribute): Detect errors for dependence of mutably tagged extension type component. * sem_ch12.adb (Instantiate_Object): Detect errors for dependence of mutably tagged extension type component. * sem_ch13.adb (Analyze_One_Aspect): Propagate 'Size'Class to class-wide type. (Analyze_Attribute_Definition_Clause): Add handling of 'Size'Class by generating class-wide equivalent types and checking for illegal uses. * sem_ch2.adb (Analyze_Identifier): Generate unchecked conversion for class-wide equivalent types. * sem_ch3.adb (Analyze_Component_Declaration): Avoid unconstrained errors on mutably tagged types. (Analyze_Object_Declaration): Rewrite declarations of mutably tagged types to use class-wide equivalent types. (Array_Type_Declaration): Modify arrays of mutably tagged types to use their corresponding class-wide equivalent types. (Derived_Type_Declaration): Add various checks for mutably tagged derived types. * sem_ch4.adb (Analyze_Allocator): Replace reference to mutably tagged type with cooresponding tagged type. (Process_Indexed_Component): Generate unchecked conversion for class-wide equivalent type. (Analyze_One_Call): Generate unchecked conversion for class-wide equivalent types. (Analyze_Selected_Component): Assume reference to class-wide equivalent type is associated mutably tagged type. (Analyze_Type_Conversion): Generate unchecked conversion for class-wide equivalent type. * sem_ch5.adb (Analyze_Assignment): Assume associated mutably tagged type when class-wide equivalent type is encountered. (Analyze_Iterator_Specification): Detect errors for dependence of mutably tagged extension type component. * sem_ch6.adb (Create_Extra_Formals): Add code to generate extra formal for mutably tagged types to signal if they are constrained. * sem_ch8.adb (Analyze_Object_Renaming): Detect error on renaming of mutably tagged extension type component. (Analyze_Renaming_Primitive_Operation): Detect error on renaming of mutably tagged extension type component. * sem_res.adb (Resolve_Actuals): Allow class-wide arguments on class-wide equivalent types. (Valid_Conversion): Assume associated mutably tagged type when class-wide equivalent type is encountered. * sem_util.adb (Is_Fully_Initialized_Type): Flag mutably tagged types as fully initialized. (Needs_Simple_Initalization): Flag class-wide equivalent types as needing initialization. * gnat_rm.texi: Regenerate. * gcc-interface/Make-lang.in: Add entry for mutably_tagged.o.
2024-06-13ada: Remove Iterable from list of GNAT-specific attributesEric Botcazou1-6/+0
The attribute is rejected except in attribute definition clauses, where it is silently ignored (it's a by-product of the processing of the aspect). gcc/ada/ * doc/gnat_rm/implementation_defined_attributes.rst (Iterable): Delete entry. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-06-13ada: Fix Super attribute documentationSteve Baird1-1/+1
The GNAT-defined Super attribute was formerly disallowed for an object of a derived tagged type having an abstract parent type. This rule has been relaxed; an abstract parent type is now permitted as long as it is not an interface type. Update the GNAT RM accordingly. gcc/ada/ * doc/gnat_rm/implementation_defined_attributes.rst: Update Super attribute documentation. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-06-10ada: Adjust comments and doc about the new use of restriction No_StreamsPiotr Trojanek2-6/+6
Extend code comment; move recently added documentation from pragma No_Tagged_Streams to restriction No_Streams. gcc/ada/ * doc/gnat_rm/implementation_defined_pragmas.rst (No_Tagged_Streams): Move documentation. * doc/gnat_rm/standard_and_implementation_defined_restrictions.rst (No_Streams): Likewise. * exp_disp.adb (Make_DT): Extend comment. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-05-21ada: Fix formatting in list of implemented Ada 2012 featuresPiotr Trojanek1-3/+3
Fix formatting; meaning is unaffected. gcc/ada/ * doc/gnat_rm/implementation_of_ada_2012_features.rst: Fix formatting. * gnat_rm.texi: Regenerate.
2024-05-21ada: Sort list of implemented Ada 2012 featuresPiotr Trojanek1-812/+812
The list of implemented Ada 2012 features is now ordered by the AI numbers. It has been sorted mechanically using the csplit command with a bit of shell scripting. gcc/ada/ * doc/gnat_rm/implementation_of_ada_2012_features.rst: Order list by AI number. * gnat_rm.texi: Regenerate.
2024-05-21ada: Fix index entry for an implemented AI featurePiotr Trojanek1-1/+1
Fix inconsistent reference with "05" in the name of AI. gcc/ada/ * doc/gnat_rm/implementation_of_ada_2012_features.rst (AI-0216): Fix index reference. * gnat_rm.texi: Regenerate.
2024-05-21ada: Update documentation of warning messagesViljar Indus1-7/+7
Update the documentation of warning messages that only emit info messages to clearly reflect that they only emit info messages and not warning messages. gcc/ada/ * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Update the documentation of -gnatw.n and -gnatw.l * gnat_ugn.texi: Regenerate.
2024-05-21ada: Do not leak tagged type names when Discard_Names is enabledPiotr Trojanek1-0/+6
When both pragmas Discard_Names and No_Tagged_Streams apply to a tagged type, the intended behavior is to prevent type names from leaking into object code, as documented in GNAT RM. However, while Discard_Names can be used as a configuration pragma, No_Tagged_Streams must be applied to each type separately. This patch enables the use of restriction No_Streams, which can be activated globally, instead of No_Tagged_Streams on individual types. When no tagged stream object can be created and allocated, then routines that make use of the External_Tag won't be used. gcc/ada/ * doc/gnat_rm/implementation_defined_pragmas.rst (No_Tagged_Streams): Document how to avoid exposing entity names for the entire partition. * exp_disp.adb (Make_DT): Make use of restriction No_Streams. * exp_put_image.adb (Build_Record_Put_Image_Procedure): Respect Discard_Names in the generated Put_Image procedure. * gnat_rm.texi: Regenerate.
2024-05-21ada: Add new Mingw task priority mappingJustin Squirek1-51/+66
This patch adds a new mapping (Non_FIFO_Underlying_Priorities) for dynamically setting task priorities in Windows when pragma Task_Dispatching_Policy (FIFO_Within_Priorities) is not present. Additionally, it documents the requirement to specify the pragma in order to use Set_Priority in the general case. gcc/ada/ * doc/gnat_ugn/platform_specific_information.rst: Add note about different priority level granularities under different policies in Windows and move POSIX related info into new section. * libgnarl/s-taprop.ads: Add note about Task_Dispatching_Policy. * libgnarl/s-taprop__mingw.adb: (Set_Priority): Add use of Non_FIFO_Underlying_Priorities. * libgnat/system-mingw.ads: Add documentation for modifying priority mappings and add alternative mapping Non_FIFO_Underlying_Priorities. * gnat_ugn.texi: Regenerate.
2024-05-20ada: Implement representation aspect Max_Entry_Queue_LengthJose Ruiz1-1/+1
Enforce Max_Entry_Queue_Length (and its synonym Max_Entry_Queue_Depth) when applied to individual protected entries. gcc/ada/ * exp_ch9.adb (Expand_N_Protected_Type_Declaration): Clarify comments. * sem_prag.adb (Analyze_Pragma): Check for duplicates Max_Entry_Queue_Length, Max_Entry_Queue_Depth and Max_Queue_Length for the same protected entry. * sem_util.adb (Get_Max_Queue_Length): Take into account all three representation aspects that can be used to set this restriction. (Has_Max_Queue_Length): Likewise. * doc/gnat_rm/implementation_defined_pragmas.rst: (pragma Max_Queue_Length): Fix pragma in example. * gnat_rm.texi: Regenerate.
2024-05-20ada: Rework and augment documentation on strict aliasingEric Botcazou2-132/+171
The documentation was originally centered around pragma No_Strict_Aliasing and pragma Universal_Aliasing was mentioned only as an afterthought. It also contained a warning about the usage of overlays implemented by means of address clauses that has been obsolete for long. gcc/ada/ * doc/gnat_rm/implementation_defined_pragmas.rst (Universal_Aliasing): Remove reference to No_Strict_Aliasing. * doc/gnat_ugn/gnat_and_program_execution.rst (Optimization and Strict Aliasinng): Simplify first example and make it more consistent with the second. Add description of the effects of pragma Universal_Aliasing and document new warning issued for unchecked conversions. Remove obsolete stuff. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-05-17ada: Fix probable copy/paste errorMarc Poulhiès1-4/+3
gcc/ada/ * doc/gnat_rm/implementation_defined_attributes.rst: Fix copy/paste. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-05-16ada: Implement new experimental attribute 'SuperJustin Squirek1-0/+24
This patch implements (under -gnatX0) the 'Super attribute which can be applied to tagged objects in order to get a view conversion to their immediate parent. gcc/ada/ * doc/gnat_rm/implementation_defined_attributes.rst: Add entry for Super attribute. * accessibility.adb (Accessibility_Level): Add handling for Super. * exp_attr.adb (Expand_N_Attribute_Reference): Add entry for Super. * sem_attr.adb (Analyze_Attribute): Create a case to handle the semantic checking and expansion for Super. (Eval_Attribute): Add entry for Super. * sem_attr.ads: Add entry for Super. * sem_util.adb (Is_Aliased_View, Is_Variable): Add case to handle references to 'Super. * snames.ads-tmpl: Register Name_Super and Attribute_Super. * gnat_rm.texi: Regenerate.
2024-05-16ada: Fix docs and comments about pragmas for Boolean-valued aspectsPiotr Trojanek1-25/+32
Fix various inconsistencies in documentation and comments of Boolean-valued aspects. gcc/ada/ * doc/gnat_rm/implementation_defined_pragmas.rst: Fix documentation. * sem_prag.adb: Fix comments. * gnat_rm.texi: Regenerate.
2024-05-13ada: Remove deprecated VxWorks interrupt connection APIAshley Gay1-17/+0
The VxWorks 7 API to use hardware interrupts is the VxBus subsystem. GNAT API still provides bindings for the deprecated (VxWorks 6) routines. A direct consequence of this change is that Attach_Handler cannot be used anymore (the VxBus subsystem should be used instead). This patch removes all the functions that are not supported by VxWorks 7 anymore. To warn for the usage of Attach_Handler, it adds the 'Obsolescent' pragma to to this routine so the comiler will advise the user if this function is called directly or through a pragma. gcc/ada/ * Makefile.rtl: remove i-vxinco.* from the build * doc/gnat_rm/the_gnat_library.rst: Remove i-vxinco.ads from the units documentation. * impunit.adb: Remove i-vxinco from the list of available units in GNATstudio. * libgnarl/i-vxinco.adb: Remove. * libgnarl/i-vxinco.ads: Ditto. * libgnarl/s-interr__vxworks.adb: enrich comment * libgnarl/s-vxwext__kernel.ads: fix comment * libgnat/i-vxwork.ads: Remove deprecated interrupt connections API, as well as an example. * libgnat/i-vxwork__x86.ads: Ditto and add the paragma Obscolescent to Attach_Handler * gnat_rm.texi: Regenerate.
2024-05-13ada: Enable casing on composite via -X0 instead of -XSteve Baird1-118/+118
Move case statement pattern matching out of the curated language extension set and into the extended set. gcc/ada/ * sem_case.adb: Replace all tests of Core_Extensions_Allowed with corresponding tests of All_Extensions_Allowed. * sem_ch5.adb: Likewise. * doc/gnat_rm/gnat_language_extensions.rst: update documentation. * gnat_rm.texi: Regenerate.
2024-05-06ada: Extend Round attribute to ordinary fixed point typesEric Botcazou1-0/+8
The attribute is only defined by the language for decimal fixed point types (RM 3.5.10(12)) but it could be useful to have it for ordinary fixed point types too because conversions from floating point truncate in both cases. gcc/ada/ * sem_attr.adb (Analyze_Attribute) <Attribute_Round>: Also accept it for ordinary fixed point types. * doc/gnat_rm/implementation_defined_attributes.rst (Round): New. * gnat_rm.texi: Regenerate.
2024-04-15ada: Add documentation for Exceptional_CasesPiotr Trojanek2-0/+30
Add minimal description for pragma and aspect Exceptional_Cases, based on a similarly minimal descriptions for other SPARK contracts. gcc/ada/ * doc/gnat_rm/implementation_defined_aspects.rst (Exceptional_Cases): Add description for aspect. * doc/gnat_rm/implementation_defined_pragmas.rst (Exceptional_Cases): Add description for pragma. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2024-01-09ada: Document new SPARK aspect and pragma Always_TerminatesPiotr Trojanek2-0/+20
Add description of a recently added SPARK contract. gcc/ada/ * doc/gnat_rm/implementation_defined_aspects.rst, doc/gnat_rm/implementation_defined_pragmas.rst: Add sections for Always_Terminates. * gnat-style.texi: Regenerate. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2023-12-19ada: Do not issue SPARK legality error if SPARK_Mode ignoredYannick Moy1-1/+3
When pragma Ignore_Pragma(SPARK_Mode) is used, do not issue error messages related to SPARK legality checking. This facilitates the instrumentation of code by GNATcoverage. gcc/ada/ * doc/gnat_rm/implementation_defined_pragmas.rst: Fix doc for pragma Ignore_Pragma, in the case where it follows another configuration pragma that it names, which causes the preceding pragma to be ignored after parsing. * errout.adb (Should_Ignore_Pragma_SPARK_Mode): New query. (SPARK_Msg_N): Do nothing if SPARK_Mode is ignored. (SPARK_Msg_NE): Same. * gnat-style.texi: Regenerate. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2023-11-28ada: Fix incorrect quoting in documentationEric Botcazou1-3/+2
gcc/ada/ * doc/gnat_rm/the_implementation_of_standard_i_o.rst: Fix a couple occurrences of incorrect quoting. * gnat_rm.texi: Regenerate.
2023-11-21ada: Fix misplaced index directive in documentationMarc Poulhiès1-6/+5
The index directive must be located before the indexed element, at least for the generated texinfo to be correct. See: https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-index This was reported along with changes done in https://inbox.sourceware.org/gcc-patches/20230223102714.3606058-3-arsen@aarsen.me/ gcc/ada/ * doc/gnat_ugn/the_gnat_compilation_model.rst: Move index directives. * gnat_ugn.texi: Regenerate.
2023-11-07ada: Update the logo in the gnat docJulien Bortolussi1-3/+6
Update the logo and the background color in the top right corner of the GNAT User’s Guide for Native Platforms gcc/ada/ * doc/share/conf.py: Changed the background color and the logo.
2023-11-07ada: Fix documentation of -gnatwcRonan Desplanques1-2/+2
-gnatwc has been correctly emitting warnings for expressions outside of tests for a while, but its documentation in the user's guide had never been updated to reflect that. Also, the documentation used "conditional expressions" to designate boolean expressions, but "conditional expressions" has been defined by Ada 2012 to designate if expressions and case expressions. This patch fixes those issues. gcc/ada/ * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Fix -gnatwc documentation. * gnat_ugn.texi: Regenerate.
2023-11-07ada: New Local_Restrictions and User_Aspect aspects.Steve Baird3-0/+94
A GNAT-defined aspect, Local_Restrictions, is defined. This provides a way of enforcing a given restriction for an individual subprogram (and its call-closure) without requiring that the entire program satisfy the restriction. A GNAT-defined aspect, User_Aspect, is defined. This (along with the new User_Aspect_Definition configuration pragma) provides a way of naming a set of aspect specifications which can then be applied to multiple declarations without textual repetition of the set. gcc/ada/ * local_restrict.ads: A new package. Declares Local_Restriction enumeration type and provides operations to check for local restriction violations. * local_restrict.adb: Corresponding package body. Replace "not Present (X)" calls with "No (X)" calls. * aspects.ads: Add a new enumeration elements, Aspect_Local_Restrictions and Aspect_User_Aspect, to the Aspect_Id enumeration type. Update Aspect_Id-indexed aggregates. Add nested package User_Aspect_Support to manage two pieces of state. One is a map from identifiers to User_Aspect_Definition pragmas (updated when such a pragma is encountered). The other is an access-to-subprogram variable that is introduced in order to keep the bulk of semantics out of the closure of package Aspects while allowing a call from aspects.adb to the sem_ch13 procedure that analyzes a User_Aspect aspect specification. * aspects.adb (Find_Aspect): Cope with a case of a block statement with an empty parent. It is not clear whether this is papering over a compiler bug. Add indirect call through the aforementioned access-to-subprogram variable when Find_Aspect enounters an unanalyzed User_Aspect aspect specification. If Find_Aspect is called looking for aspect Foo, then a User_Aspect specification might generate (during analysis) a Foo aspect specification. So the Find_Aspect call needs to trigger that analysis if it has not already taken place. Provide a body for package User_Aspect_Support. Replace "not Present (X)" call with "No (X)" call. * freeze.adb (Freeze_Subprogram): Check local restriction compatibility when a dispatching operation is overridden. * par-prag.adb: Add support for parsing a User_Aspect_Definition pragma. * restrict.ads: We'd like to have the body of package Restrict include a call to a procedure declared in package Local_Restrict. Doing that in the obvious way pulls most of semantics into the closure of package Restrict, and that turns out to cause problems. So we introduce a level of indirection and instead call through an access-to-subprogram value. In this unit, we declare the access-to-subprogram type and object. * restrict.adb (Check Restriction): When a construct is encountered that could violate a global restriction (depending on whether the given restriction is in effect), Check_Restriction is called. At this point, we also check for a violation of any corresponding local restriction that is in effect. For reasons described above, this check is performed via an indirect call. * sem_ch13.ads (Parse_Aspect_Local_Restrictions): A new function, similar to the existing Parse_Aspect_Xxx subprograms. * sem_ch13.adb: Perform semantic analysis of Local_Restrictions and User_Aspect aspect specifications. Declare and call new Validate_Aspect_Local_Restrictions and Analyze_User_Aspect_Aspect_Specification procedures (a reference to the latter is registered during package elaboration). In Analyze_Aspect_Specifications, do not set the Analyzed flag of a User_Aspect aspect specification. Replace "not Present (X)" call with "No (X)" call. Replace 'Image with 'Img in a case where the prefix of the attribute reference is an object; this is done to accomodate older compilers. * sem_ch6.adb (Check_Subtype_Conformant): Include in subtype conformance check a check for overriding-related compatibility of local restrictions. * sem_ch8.adb (Analyze_Subprogram_Renaming): In the case of an instance of a generic that takes a formal subprogram, check that formal and actual are compatible with respect to local restrictions. * sem_prag.adb: Add support for User_Aspect_Definition pragma. * sem_res.adb (Resolve_Call): Check caller/callee compatibility with respect to local restrictions. * snames.ads-tmpl: Add Name_Local_Restrictions, Name_User_Aspect, and Name_User_Aspect_Definition constants. * doc/gnat_rm/implementation_defined_aspects.rst: Document new aspects. * doc/gnat_rm/implementation_defined_pragmas.rst: Document new pragma. * doc/gnat_ugn/the_gnat_compilation_model.rst: Add User_Aspect_Definition to list of GNAT pragmas. * gcc-interface/Make-lang.in: Add local_restrict.o. * gnat-style.texi: Regenerate. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2023-10-19ada: Support new SPARK aspect Side_EffectsYannick Moy2-0/+20
SPARK RM 6.1.11 introduces a new aspect Side_Effects to denote those functions which may have output parameters, write global variables, raise exceptions and not terminate. This adds support for this aspect and the corresponding pragma in the frontend. Handling of this aspect in the frontend is very similar to the handling of aspect Extensions_Visible: both are Boolean aspects whose expression should be static, they can be specified on the same entities, with the same rule of inheritance from overridden to overriding primitives for tagged types. There is no impact on code generation. gcc/ada/ * aspects.ads: Add aspect Side_Effects. * contracts.adb (Add_Pre_Post_Condition) (Inherit_Subprogram_Contract): Add support for new contract. * contracts.ads: Update comments. * einfo-utils.adb (Get_Pragma): Add support. * einfo-utils.ads (Prag): Update comment. * errout.ads: Add explain codes. * par-prag.adb (Prag): Add support. * sem_ch13.adb (Analyze_Aspect_Specifications) (Check_Aspect_At_Freeze_Point): Add support. * sem_ch6.adb (Analyze_Subprogram_Body_Helper) (Analyze_Subprogram_Declaration): Call new analysis procedure to check SPARK legality rules. (Analyze_SPARK_Subprogram_Specification): New procedure to check SPARK legality rules. Use an explain code for the error. (Analyze_Subprogram_Specification): Move checks to new subprogram. This code was effectively dead, as the kind for parameters was set to E_Void at this point to detect early references. * sem_ch6.ads (Analyze_Subprogram_Specification): Add new procedure. * sem_prag.adb (Analyze_Depends_In_Decl_Part) (Analyze_Global_In_Decl_Part): Adapt legality check to apply only to functions without side-effects. (Analyze_If_Present): Extract functionality in new procedure Analyze_If_Present_Internal. (Analyze_If_Present_Internal): New procedure to analyze given pragma kind. (Analyze_Pragmas_If_Present): New procedure to analyze given pragma kind associated with a declaration. (Analyze_Pragma): Adapt support for Always_Terminates and Exceptional_Cases. Add support for Side_Effects. Make sure to call Analyze_If_Present to ensure pragma Side_Effects is analyzed prior to analyzing pragmas Global and Depends. Use explain codes for the errors. * sem_prag.ads (Analyze_Pragmas_If_Present): Add new procedure. * sem_util.adb (Is_Function_With_Side_Effects): New query function to determine if a function is a function with side-effects. * sem_util.ads (Is_Function_With_Side_Effects): Same. * snames.ads-tmpl: Declare new names for pragma and aspect. * doc/gnat_rm/implementation_defined_aspects.rst: Document new aspect. * doc/gnat_rm/implementation_defined_pragmas.rst: Document new pragma. * gnat_rm.texi: Regenerate.
2023-10-19ada: Document gnatbind -Q switchPatrick Bernardi1-6/+23
Add documentation for the -Q gnatbind switch in GNAT User's Guide and improve gnatbind's help output for the switch to emphasize that it adds the requested number of stacks to the secondary stack pool generated by the binder. gcc/ada/ * bindusg.adb (Display): Make it clear -Q adds to the number of secondary stacks generated by the binder. * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Document the -Q gnatbind switch and fix references to old runtimes. * gnat-style.texi: Regenerate. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2023-09-26ada: Dimensional analysis when used with elementary functionsDerek Schacht1-0/+12
gcc/ada/ * doc/gnat_ugn/gnat_and_program_execution.rst: Add more details on using Generic Elementary Functions with dimensional analysis. * gnat_ugn.texi: Regenerate.
2023-09-15ada: Remove GNAT Pro details regarding moldKévin Le Gouguec1-22/+0
gcc/ada/ * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Remove extended discussion regarding mold run-time dependencies; packaging changes in GNAT Pro have made them obsolete.
2023-09-05ada: building_executable_programs_with_gnat.rst: fix -gnatw.x indexGhjuvan Lacambre1-1/+1
The index for this paragraph was wrong. gcc/ada/ * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Fix index. * gnat_ugn.texi: Regenerate.
2023-07-18ada: Expose expected_throw attributeAlexandre Oliva1-1/+3
Mark exception-raising subprograms with expected_throw attribute. Document the use of the attribute in Control Flow Redundancy. Enable marking subprograms as expected_throw with Machine_Attribute pragmas. gcc/ada/ * libgnat/a-except.ads (Raise_Exception): Mark expected_throw. (Reraise_Occurrence): Likewise. (Raise_Exception_Always): Likewise. (Raise_From_Controlled_Operation): Likewise. (Reraise_Occurrence_Always): Likewise. (Reraise_Occurrence_No_Defer): Likewise. * libgnat/a-except.adb (Exception_Propagation.Propagate_Exception): Likewise. (Complete_And_Propagate_Occurrence): Likewise. (Raise_Exception_No_Defer): Likewise. (Raise_From_Signal_Handler): Likewise. (Raise_With_Msg): Likewise. (Raise_With_Location_And_Msg): Likewise. (Raise_Constraint_Error): Likewise. (Raise_Constraint_Error_Msg): Likewise. (Raise_Program_Error): Likewise. (Raise_Program_Error_Msg): Likewise. (Raise_Storage_Error): Likewise. (Raise_Storage_Error_Msg): Likewise. (Reraise, Rcheck_*): Likewise. * doc/gnat_rm/security_hardening_features.rst (Control Flow Hardening): Note the influence of expected_throw. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate. * gcc-interface/utils.cc (handle_expected_throw_attribute): New. (gnat_internal_attribute_table): Add expected_throw.
2023-07-10ada: Documentation for mixed declarations and statementsBob Duff1-0/+21
This patch documents the new feature that allows declarations mixed with statements, primarily by referring to the RFC. gcc/ada/ * doc/gnat_rm/gnat_language_extensions.rst (Local Declarations Without Block): Document the feature very briefly, and refer the reader to the RFC for details and examples. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2023-07-10ada: hardcfr: optionally disable in leaf functionsAlexandre Oliva1-0/+5
Document -fhardcfr-skip-leaf. gcc/ada/ * doc/gnat_rm/security_hardening_features.rst (Control Flow Hardening): Document -fhardcfr-skip-leaf. * gnat_rm.texi: Regenerate.
2023-07-10ada: hardcfr: mark throw-expected functionsAlexandre Oliva1-8/+9
Adjust documentation to reflect the introduction of -fhardcfr-check-noreturn-calls=no-xthrow. gcc/ada/ * doc/gnat_rm/security_hardening_features.rst (Control Flow Redundancy): Add -fhardcfr-check-noreturn-calls=no-xthrow. * gnat_rm.texi: Regenerate.
2023-07-10ada: Add leafy mode for zero-call-used-regsAlexandre Oliva1-0/+6
Document leafy mode. gcc/ada/ * doc/gnat_rm/security_hardening_features.rst (Register Scrubbing): Document leafy mode. * gnat_rm.texi: Regenerate.
2023-07-06ada: Refer to non-Ada binding limitations in user guideViljar Indus1-0/+3
The limitation of resetting the FPU mode for non 80-bit precision was not referenced from "Creating a Stand-alone Library to be used in a non-Ada context". Reference it the same way it is already referenced from "Interfacing to C". gcc/ada/ * doc/gnat_ugn/the_gnat_compilation_model.rst: Reference "Binding with Non-Ada Main Programs" from "Creating a Stand-alone Library to be used in a non-Ada context". * gnat_ugn.texi: Regenerate.
2023-07-04ada: Add No_Use_Of_Attribute & No_Use_Of_Pragma to gnat_rmViljar Indus1-0/+14
gcc/ada/ * doc/gnat_rm/standard_and_implementation_defined_restrictions.rst: add No_Use_Of_Attribute & No_Use_Of_Pragma restrictions. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2023-06-20ada: Fix couple of issues in documentation of overflow checkingEric Botcazou1-20/+3
There is still a mention of the defunct CHECKED mode and the Default Settings paragraph is confusing with regard to the -gnato switch. gcc/ada/ * doc/gnat_ugn/gnat_and_program_execution.rst (Overflows in GNAT) <Default Settings>: Remove obsolete paragraph about -gnato. <Implementation Notes>: Replace CHECKED with STRICT. * gnat_ugn.texi: Regenerate.