aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
AgeCommit message (Collapse)AuthorFilesLines
2022-09-26ada: Delay expansion of iterator specification in preanalysisPiotr Trojanek1-8/+3
When preanalysing spec expression (e.g. expression of an expression function), the name of iterator specification should not be expanded. This patch simplifies a complicated condition for delaying expansion within quantified expressions and iterated component associations. gcc/ada/ * sem_ch5.adb (Analyze_Iterator_Specification): Delay expansion based on Full_Analysis flag.
2022-09-26ada: Delay expansion of iterated component associationPiotr Trojanek1-4/+5
When preanalysing spec expression (e.g. expression of an expression function), the name of iterator specification within an iterated component association should not be expanded, especially in GNATprove mode. gcc/ada/ * sem_ch5.adb (Analyze_Iterator_Specification): Delay expansion of for iterated component association just like it is done within quantified expression.
2022-09-26ada: Only reject volatile ghost objects when SPARK_Mode is OnPiotr Trojanek1-1/+1
SPARK rule that forbids ghost volatile objects is only affecting proof and not generation of object code. It is now only applied where SPARK_Mode is On. This flexibility is needed to compile code automatically instrumented by GNATcoverage. gcc/ada/ * contracts.adb (Analyze_Object_Contract): Check SPARK_Mode before applying SPARK rule.
2022-09-26ada: Improve accessibility check generationJustin Squirek1-3/+13
Improve accessibility check generation by more precisely identifying cases in which an Original_Node call is needed. Instead of grabbing the Original_Node of a prefix in all cases (since this can cause issues where unanalyzed instance names get referenced) we only obtain the original node when said prefix comes as a result of expanding function calls. gcc/ada/ * sem_util.adb (Accessibility_Level): Modify indexed and selected components case by reducing the scope where Original_Node gets used.
2022-09-26ada: Remove GNATmetric's documentation from GNAT's documentationBoris Yakobowski1-1119/+1
gcc/ada/ * doc/gnat_ugn/gnat_utility_programs.rst: Remove documentation for gnatmetric.
2022-09-26ada: Remove socket definitions for ancient MinGWPiotr Trojanek2-11/+0
Modern MinGW defines _WIN32_WINNT as 0xa00, so there is no need go guard against it being lower than 0x0600 or setting it to 0x0501. gcc/ada/ * gsocket.h: Remove redefinition of _WIN32_WINNT. * mingw32.h: Remove conditional definition of _WIN32_WINNT.
2022-09-26ada: Remove definition of MAXPATHLEN for ancient MinGWPiotr Trojanek1-6/+0
Modern MinGW defines MAXPATHLEN in sys/param.h, so better to use it directly. gcc/ada/ * mingw32.h: Remove condition definition of MAXPATHLEN; the include directive for stdlib.h was most likely intended to provide the MAX_PATH.
2022-09-26ada: Deconstruct build support for ancient MinGWPiotr Trojanek6-49/+5
Remove conditional C code for building GNAT with MinGW earlier than 2.0, which was released in 2007. gcc/ada/ * adaint.c: Remove conditional #include directives for old MinGW. * cal.c: Always include winsock.h, since it is part of modern MinGW. * cstreams.c: Remove workaround for old MinGW. * expect.c: Remove conditional #include directive for old MinGW. * mingw32.h: Remove STD_MINGW and OLD_MINGW declarations. * sysdep.c: Remove conditional #include directive for old MinGW.
2022-09-26ada: Tune comment of routine for detecting junk namesPiotr Trojanek1-6/+3
Reword comment to avoid repetition between spec and body. gcc/ada/ * sem_warn.ads (Has_Junk_Name): Reword comment.
2022-09-26Small tweaks.Eric Botcazou1-6/+6
2022-09-21Daily bump.GCC Administrator1-0/+6
2022-09-20replace "the the" typosMartin Liska3-3/+3
gcc/ada/ChangeLog: * exp_ch6.adb: Replace "the the" with "the". * sem_ch6.adb: Likewise. * sem_disp.ads: Likewise. gcc/ChangeLog: * ctfc.cc (ctf_add_string): Replace "the the" with "the". * doc/md.texi: Likewise. * gimple-range-infer.cc (non_null_loadstore): Likewise. gcc/fortran/ChangeLog: * gfortran.texi: Replace "the the" with "the". gcc/testsuite/ChangeLog: * g++.dg/warn/Wclass-memaccess.C: Replace "the the" with "the". * g++.dg/warn/Wconversion-real-integer2.C: Likewise. * gcc.target/powerpc/p9-extract-1.c: Likewise. * gcc.target/s390/s390.exp: Likewise. * gcc.target/s390/zvector/vec-cmp-2.c: Likewise. * gdc.dg/torture/simd_store.d: Likewise. * gfortran.dg/actual_array_offset_1.f90: Likewise. * gfortran.dg/pdt_15.f03: Likewise. * gfortran.dg/pointer_array_8.f90: Likewise.
2022-09-16Daily bump.GCC Administrator1-0/+4
2022-09-15Move void_list_node init to common codeRichard Biener1-1/+0
All frontends replicate this, so move it. gcc/ * tree.cc (build_common_tree_nodes): Initialize void_list_node here. gcc/ada/ * gcc-interface/trans.cc (gigi): Do not initialize void_list_node. gcc/c-family/ * c-common.h (build_void_list_node): Remove. * c-common.cc (c_common_nodes_and_builtins): Do not initialize void_list_node. gcc/c/ * c-decl.cc (build_void_list_node): Remove. gcc/cp/ * decl.cc (cxx_init_decl_processing): Inline last build_void_list_node call. (build_void_list_node): Remove. gcc/d/ * d-builtins.cc (d_build_c_type_nodes): Do not initialize void_list_node. gcc/fortran/ * f95-lang.cc (gfc_init_decl_processing): Do not initialize void_list_node. gcc/go/ * go-lang.cc (go_langhook_init): Do not initialize void_list_node. gcc/jit/ * dummy-frontend.cc (jit_langhook_init): Do not initialize void_list_node. gcc/lto/ * lto-lang.cc (lto_build_c_type_nodes): Do not initialize void_list_node.
2022-09-13Daily bump.GCC Administrator1-0/+498
2022-09-12[Ada] Fix immediate assertion failure with -gnatd.1Eric Botcazou1-1/+5
The switch enables the front-end unnesting pass. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity): Relax assertion when front-end unnesting is enabled.
2022-09-12[Ada] Storage_Error raised analyzing type with call in its range constraintJustin Squirek1-2/+14
This patch corrects a problem in the compiler whereby the determination of scope levels during the generation of accessibility checks for function calls within range constraints leads to a compiler crash due to the type not being fully analyzed at the point in which its scope depth must be obtained. gcc/ada/ * sem_util.adb (Innermost_Master_Scope_Depth): Detect and handle case where scope depth is not set on an enclosing scope.
2022-09-12[Ada] Improve CUDA host-side and device-side binder supportSteve Baird1-0/+3
On the host-side, the binder now generates CUDA_Execute pragmas to invoke initialization and finalization on the device-side. The front end's expansion of these pragmas includes references to entities declared in package CUDA.Internal. Generate a with-clause so that unit will be available. gcc/ada/ * bindgen.adb: When the binder is invoked for the host, generate a "with CUDA.Internal;" with clause.
2022-09-12[Ada] Sync documentation of junk names with codePiotr Trojanek3-3/+3
The list of junk entity names for which warnings are suppressed has been recently modified, so update the documentation accordingly. gcc/ada/ * doc/gnat_rm/implementation_defined_pragmas.rst (Pragma Unreferenced): Sync description with Sem_Warn.Has_Junk_Name routine. * gnat_rm.texi: Regenerate. * gnat_ugn.texi: Regenerate.
2022-09-12[Ada] Reject 'Valid_Scalars on Unchecked_Union regardless of privacyPiotr Trojanek1-10/+10
Attribute Valid_Scalars applied to prefix with an unchecked union component causes a legitimate crash in the backend. It was already rejected in the frontend for prefixes of a public type; now it is rejected in the frontend regardless of the type privacy. gcc/ada/ * sem_attr.adb (Analyze_Attribute [Valid_Scalars]): Move check for unchecked union before checks for private and public types.
2022-09-12[Ada] Improve CUDA host-side and device-side binder supportSteve Baird4-10/+76
Use switches (one already existing, one newly added here) to indicate to the binder that CUDA support code is to be generated for either the host side or for the device side. Add an invocation of Adainit on the device side from Adainit on the host side; similarly for Adafinal. gcc/ada/ * bindgen.adb: When the binder is invoked for the host, it declares imported subprograms corresponding to the Adainit and Adafinal routines on the device. Declare string constants and expression functions for the Ada source names and the link names of these routines. Generate these subprogram declarations (and accompanying Import pragmas) in Gen_CUDA_Defs. Generate CUDA_Execute pragmas to call these subprograms from the host in Gen_Adafinal and Gen_CUDA_Init. When the binder is invoked for the device, include a CUDA_Global aspect declaration in the declarations of Adainit and Adafinal and use the aforementioned link names in the Export pragmas generated for those two routines. * debug.adb: Update comments about "d_c" and "d_d" switches. * opt.ads: Declare new Boolean variable, Enable_CUDA_Device_Expansion. This complements the existing Enable_CUDA_Expansion variable, which is used to enable host-side CUDA expansion. The new variable enables device-side CUDA expansion. It is currently never set during compilation; it is only set via a binder switch. * switch-b.adb (scan_debug_switches): Add new use of the "-d_d" binder switch. The new switch and the variable Opt.Enabled_CUDA_Device_Expansion follow the existing pattern of the "-d_c" switch and the variable Opt.Enabled_CUDA_Expansion. Flag error if both "-d_c" and "-d_d" are specified.
2022-09-12[Ada] Temporary tweak new expansion of contractsEric Botcazou3-42/+91
In the case of a function, the new expansion of contracts makes use of an extended return statement to store the result of the function in the return object while the post-conditions are evaluated. Unfortunately GNAT does not elide the copy of the return object for extended return statements for the time being, so this scheme incurs an extra copy of the return value on the primary or secondary stack, as well as an additional pair of calls to Adjust/Finalize when the return type needs finalization. This temporarily changes the expansion to use a block statement containing a renaming, which does not incur the extra copy provided that it is manually adjusted to be recognized by the existing "tail call" optimization present in the Expand_Simple_Function_Return routine. gcc/ada/ * contracts.adb (uild_Subprogram_Contract_Wrapper): Remove useless local variable. In the case of a function, replace the extended return statement by a block statement declaring a renaming of the call to the local subprogram after removing side effects manually. (Expand_Subprogram_Contract): Adjust description accordingly. * exp_ch6.adb (Expand_Ctrl_Function_Call): Rewrite obsolete comment and do not apply the transformation twice. * sem_attr.adb (Analyze_Attribute_Old_Result): Now expect a block statement instead of an extended return statement.
2022-09-12[Ada] Special-case printing of SPARK_Mode in error messagesPiotr Trojanek1-2/+28
For error messages with inserted names that include acronyms like SPARK or CPP, we want to preserve the casing. The list of special-cased named is currently the same as in gnatpp. gcc/ada/ * erroutc.adb (Set_Msg_Insertion_Name): Special-case printing with acronyms.
2022-09-12[Ada] Justify false alarm from CodePeer analysis of GNATYannick Moy1-0/+2
Branch is determined as dead following a test always False by CodePeer analysis, which is incorrect. Justify this false alarm with an appropriate pragma Annotate. gcc/ada/ * libgnat/s-imagei.adb (Image_Integer): Add justification.
2022-09-12[Ada] Cleanup routine for handling SPARK_Mode kindsPiotr Trojanek1-13/+14
Code cleanup; semantics is unaffected. gcc/ada/ * sem_prag.adb (Get_SPARK_Mode_Type): Fix header box; replace chained IF with a CASE statement.
2022-09-12[Ada] Accept explicit SPARK_Mode Auto as configuration pragmaYannick Moy2-3/+15
An explicit value of Auto is now accepted for a configuration pragma SPARK_Mode, as a way to exempt a unit from complete adherence to SPARK rules when using a global configuration pragma file where SPARK_Mode=>On is specified. gcc/ada/ * sem_prag.adb (Analyze_Pragma): Accept SPARK_Mode=>Auto as configuration pragma. (Get_SPARK_Mode): Make the value for Auto explicit. * snames.ads-tmpl (Name_Auto): Add name.
2022-09-12[Ada] Remove SPARK containers from GNAT documentationJoffrey Huguet3-662/+202
This patch removes documentation on the SPARK containers, now under the spark2014 repository. gcc/ada/ * doc/gnat_rm/the_gnat_library.rst: Remove paragraphs about SPARK containers. * gnat_rm.texi, gnat_ugn.texi: Regenerate.
2022-09-12[Ada] Reject use in SPARK of Asm intrinsics for code insertionsYannick Moy1-1/+3
SPARK does not allow code insertions. This applies also to calls to Asm intrinsics defined in System.Machine_Code. gcc/ada/ * libgnat/s-maccod.ads: Mark package as SPARK_Mode Off.
2022-09-12[Ada] Add C declaration for Opt.Unnest_Subprogram_ModeEric Botcazou1-0/+2
gcc/ada/ * fe.h (Unnest_Subprogram_Mode): Declare.
2022-09-12[Ada] Internal error compiling formal instance of generic with Initial_ConditionSteve Baird1-0/+12
Prevent the compiler from failing with an internal error in some cases involving an instance of a generic which takes as a formal parameter an instance of a second generic, where the second generic has an Initial_Condition aspect specification. gcc/ada/ * contracts.adb (Analyze_Package_Contract): Do not analyze the contract of a temporary package created just to check conformance of an actual package.
2022-09-12[Ada] Replace SPARK containers implementation by Compile_Time_ErrorJoffrey Huguet28-25943/+60
The SPARK containers are now maintained under the spark2014 repository. This change replaces the implementation of SPARK containers by a pragma Compile_Time_Error, pointing the users WITHing the libraries to their new location. gcc/ada/ * Makefile.rtl: Remove SPARK containers filenames. * impunit.adb: Remove SPARK containers packages names. * libgnat/a-cfdlli.adb, libgnat/a-cfdlli.ads: Remove content and add pragma Compile_Time_Error with suitable message. * libgnat/a-cfhama.adb, libgnat/a-cfhama.ads: Likewise. * libgnat/a-cfhase.adb, libgnat/a-cfhase.ads: Likewise. * libgnat/a-cfidll.adb, libgnat/a-cfidll.ads: Likewise. * libgnat/a-cfinse.adb, libgnat/a-cfinse.ads: Likewise. * libgnat/a-cfinve.adb, libgnat/a-cfinve.ads: Likewise. * libgnat/a-cforma.adb, libgnat/a-cforma.ads: Likewise. * libgnat/a-cforse.adb, libgnat/a-cforse.ads: Likewise. * libgnat/a-cofove.adb, libgnat/a-cofove.ads: Likewise. * libgnat/a-cofuma.adb, libgnat/a-cofuma.ads: Likewise. * libgnat/a-cofuse.adb, libgnat/a-cofuse.ads: Likewise. * libgnat/a-cofuve.adb, libgnat/a-cofuve.ads: Likewise. * libgnat/a-cofuba.adb, libgnat/a-cofuba.ads: Remove package. gcc/testsuite/ * gnat.dg/aspect2.adb: Removed. * gnat.dg/aspect2.ads: Removed. * gnat.dg/config_pragma1.adb: Removed. * gnat.dg/config_pragma1_pkg.ads: Removed. * gnat.dg/equal8.adb: Removed. * gnat.dg/equal8.ads: Removed. * gnat.dg/equal8_pkg.ads: Removed. * gnat.dg/formal_containers.adb: Removed. * gnat.dg/iter1.adb: Removed. * gnat.dg/iter1.ads: Removed.
2022-09-12[Ada] Fix validity checking on renamed Old attribute prefixPiotr Trojanek1-1/+11
Prefix of attribute Old is captured either as an object renaming or as an object declaration. This is now taken into account when applying validity checks. gcc/ada/ * exp_attr.adb (Expand_N_Attribute_Reference [Attribute_Old]): Adapt to object declaration being rewritten into object renaming.
2022-09-12[Ada] Tech debt: Expansion of contractsJustin Squirek27-1620/+900
This patch modifies the expansion of contracts such that the statements and declarations of a subprogram with post-execution checks get moved to a local internally generated subprogram which the original subprogram calls directly followed by the required post-execution checks. This differs from the current implementation which requires delicate machinary which coordinates with the finalization process to emulate the desired behavior within the "at end" procedure. gcc/ada/ * contracts.adb, contracts.ads (Analyze_Pragmas_In_Declarations): Added to aid in the new expansion model so that pragmas relating to contracts can get processed early before the rest of the subprogram containing them. (Build_Subprogram_Contract_Wrapper): Created to do the majority of expansion for postconditions. It builds a local wrapper with the statements and declarations within a given subprogram. (Is_Prologue_Renaming): Moved out from Process_Preconditions to be used generally within the contracts package. (Build_Entry_Contract_Wrapper): Moved from exp_ch7. (Expand_Subprogram_Contract): Add new local variable Decls to store expanded declarations needed for evaluation of contracts. Call new wrapper building procedure and modify comments to match new expansion model. (Get_Postcond_Enabled): Deleted. (Get_Result_Object_For_Postcond): Deleted. (Get_Return_Success_For_Postcond): Deleted. (Process_Contract_Cases): Add new parameter to store declarations. (Process_Postconditions): Add new parameter to store declarations. (Process_Preconditions): Add new parameter to store declarations. Add code to move entry-call prologue renamings * einfo.ads: Document new field Wrapped_Statements and modify comment for Postconditions_Proc. * exp_attr.adb (Analyze_Attribute): Modify expansion of the 'Old attribute to recognize new expansion model and use Wrapped_Statements instead of Postconditions_Proc. * exp_ch6.adb (Add_Return): Remove special expansion for postconditions. (Expand_Call): Modify condition checking for calls to access subprogram wrappers to handle new expansion models. (Expand_Call_Helper): Remove special expansion for postconditions. (Expand_Non_Function_Return): Remove special expansion for postconditions. (Expand_Simple_Function_Return): Remove special expansion for postconditions. * exp_ch7.adb (Build_Finalizer): Deleted, but replaced by code in Build_Finalizer_Helper (Build_Finalizer_Helper): Renamed to Build_Finalizer, and special handling of 'Old objects removed. * exp_ch9.adb (Build_Contract_Wrapper): Renamed and moved to contracts package. * exp_prag.adb (Expand_Pragma_Contract_Cases): Delay analysis of contracts since they now instead get analyzed as part of the wrapper generation instead of after analysis of their corresponding subprogram's body. (Expand_Pragma_Check): Label expanded if-statements which come from the expansion of assertion statements as Comes_From_Check_Or_Contract. * freeze.adb (Freeze_Entity): Add special case to avoid freezing when a freeze node gets generated as part of the expansion of a postcondition check. * gen_il-gen-gen_nodes.adb: Add new flag Comes_From_Check_Or_Contract. * gen_il-fields.ads: Add new field Wrapped_Statements. Add new flag Comes_From_Check_Or_Contract. * gen_il-gen-gen_entities.adb: Add new field Wrapped_Statements. * ghost.adb (Is_OK_Declaration): Replace Name_uPostconditions with Name_uWrapped_Statements. (Is_OK_Statement): Simplify condition due to the loss of Original_Node as a result of the new expansion model of contracts and use new flag Comes_From_Check_Or_Contract in its place. * inline.adb (Declare_Postconditions_Result): Replace Name_uPostconditions with Name_uWrapped_Statements. (Expand_Inlined_Call): Replace Name_uPostconditions with Name_uWrapped_Statements. * lib.adb, lib.ads (ipu): Created to aid in debugging. * lib-xref.adb (Generate_References): Remove special handling for postcondition procedures. * sem_attr.adb (Analyze_Attribute_Old_Result): Add new context in which 'Old can appear due to the changes in expansion. Replace Name_uPostconditions with Name_uWrapped_Statements. (Result): Replace Name_uPostconditions with Name_uWrapped_Statements. * sem_ch11.adb (Analyze_Handled_Statements): Remove check to exclude warnings on useless assignments within postcondition procedures since postconditions no longer get isolated into separate subprograms. * sem_ch6.adb (Analyze_Generic_Subprogram_Body): Modify expansion of generic subprogram bodies so that contracts (and their associated pragmas) get analyzed first. (Analyze_Subprogram_Body_Helper): Remove global HSS variable due to the HSS of the body potentially changing during the expansion of contracts. In cases where it was used instead directly call Handled_Statement_Sequence. Modify expansion of subprogram bodies so that contracts (and their associated pragmas) get analyzed first. (Check_Missing_Return): Create local HSS variable instead of using a global one. (Move_Pragmas): Use new pragma table instead of an explicit list. * sem_elab.adb (Is_Postconditions_Proc): Deleted since the new scheme of expansion no longer divides postcondition checks to a separate subprogram and so cannot be easily identified (similar to pre-condition checks). (Info_Call): Remove info printing for _Postconditions subprograms. (Is_Assertion_Pragma_Target): Remove check for postconditions procedure (Is_Bridge_Target): Remove check for postconditions procedure. (Get_Invocation_Attributes): Remove unneeded local variables and check for postconditions procedure. (Output_Call): Remove info printing for _Postconditions subprograms. * sem_prag.adb, sem_prag.ads: Add new Pragma table for pragmas significant to subprograms, along with tech-debt comment. (Check_Arg_Is_Local_Name): Modified to recognize the new _Wrapped_Statements internal subprogram and the new expansion model. (Relocate_Pragmas_To_Body): Replace Name_uPostconditions with Name_uWrapped_Statements. * sem_res.adb (Resolve_Entry_Call): Add conditional to detect both contract based wrappers of entries, but also wrappers generated as part of general contract expansion (e.g. local postconditions subprograms). * sem_util.adb (Accessibility_Level): Verify 'Access is not taken based on a component of a function result. (Has_Significant_Contracts): Replace Name_uPostconditions with Name_uWrapped_Statements. (Same_Or_Aliased_Subprogram): Add conditional to detect and obtain the original subprogram based on the new concept of "postcondition" wrappers. * sinfo.ads: Add documentation for new flag Comes_From_Check_Or_Contract. * snames.ads-tmpl: Remove Name_uPostconditions and add Name_uWrapped_Statements
2022-09-12[Ada] Fix oversight in implementation of unnestingEric Botcazou1-0/+2
The pass would traverse generic subprogram bodies, which are not expanded, thus stumbling on unexpected nodes. gcc/ada/ * exp_unst.adb (Unnest_Subprograms.Search_Subprograms): Skip the subprogram bodies that are not to be unnested.
2022-09-12[Ada] Syntax error in Ada 2022 array aggregate causes bug boxSteve Baird1-0/+5
Check for the case where a user writes "in" instead of "of" in an aggregate like "[for E in Some_Array when Some_Filter (E) => E]". gcc/ada/ * sem_aggr.adb (Resolve_Array_Aggregate): Generate an appropriate error message in the case where an error in the source code leads to an N_Iterated_Element_Association node in a bad context.
2022-09-12[Ada] Initialize a local variable to avoid a CodePeer warningSteve Baird1-1/+1
gcc/ada/ * sem_ch4.adb (Analyze_Selected_Component): Initialize the local variable Comp to avoid having CodePeer generate an uninitialized variable warning.
2022-09-12[Ada] bugbox referencing INOX prefixed view of primitive op of modular typeSteve Baird1-1/+10
The -gnatX switch enables naming a prefixed view of a subprogram with an untagged prefix. Compiling such a reference where the prefix is of a modular type could result in an internal compiler error. gcc/ada/ * sem_ch4.adb (Analyze_Selected_Component): Avoid initializing the local variable Comp if the variable is not going to be subsequently referenced. This is a correctness issue because the call to First_Entity can fail.
2022-09-12[Ada] Lock_Free aspect takes precedence over Ceiling_Locking locking policySteve Baird3-2/+38
Allow the Lock_Free aspect of a protected type to be True (but only by explicit specification) if Ceiling_Locking locking policy has been specified. Clarify that the Lock_Free aspect takes precedence over the Ceiling_Locking policy in that case. gcc/ada/ * sem_ch9.adb (Satisfies_Lock_Free_Requirements): If Ceiling_Locking locking policy has been specified, then either return False (if Lock_Free was not explicitly specified) or generate a warning that ceiling locking will not be implemented for this protected unit (if Lock_Free was explicitly specified). Generate an error message (in addition to returning False) if an explicit Lock_Free aspect specification is rejected because atomic primitives are not supported on the given target. * doc/gnat_rm/implementation_defined_pragmas.rst: Clarify that the Lock_Free aspect for a protected unit takes precedence over the Ceiling_Locking locking policy in the case where both apply. * gnat_rm.texi: Regenerate.
2022-09-12[Ada] Do not mark user parameters of protected subprograms as artificialEric Botcazou2-16/+29
This occurs because protected subprograms are not translated directly into object code but first rewritten as a pair of subprograms by the front-end. gcc/ada/ * exp_ch9.adb (Build_Protected_Spec): Tidy up and propagate the Comes_From_Source flag onto the new formal parameters. * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Do not check references for subprograms generated for protected subprograms.
2022-09-12[Ada] Fix issues with compiling ACATS test for user-defined literalsGary Dismukes3-29/+87
The draft ACATS test (which we developed) for the Ada 2022 feature of user-defined literals has compile-time problems that are fixed with this set of changes. Two of these involve the resolution of named numbers in the context where an implicit literal conversion can occur, and for equality when a literal or named number is an operand. Furthermore, the compiler can hang in some cases when a numeric literal is used in a context where the expected type is a type derived two levels down from a tagged type that specifies a literal aspect. gcc/ada/ * sem_res.adb (Resolve_Equality_Op): Add handling for equality ops with user-defined literal operands. * sem_util.ads (Is_User_Defined_Literal): Update spec comment to indicate inclusion of named number cases. * sem_util.adb (Corresponding_Primitive_Op): Rather than following the chain of ancestor subprograms via Alias and Overridden_Operation links, we check for matching profiles between primitive subprograms of the descendant type and the ancestor subprogram (by calling a new nested function Profile_Matches_Ancestor). This prevents the compiler from hanging due to circular linkages via those fields that can occur between inherited and overriding subprograms (which might indicate a latent bug, but one that may be rather delicate to resolve). (Profile_Matches_Ancestor): New nested subprogram to compare the profile of a primitive subprogram with the profile of a candidate ancestor subprogram. (Is_User_Defined_Literal): Also return True in cases where the node N denotes a named number (E_Name_Integer and E_Named_Real).
2022-09-12[Ada] Remove a no-longer-correct commentSteve Baird1-3/+0
Remove a comment about the former use of the -gnatd9 switch (that switch is now unused). gcc/ada/ * debug.adb: remove a comment.
2022-09-12[Ada] Fix bugs in check-related warnings.Bob Duff3-15/+18
Make sure warnings about wrong-length aggregates don't get suppressed. Such a warning (in a with-ed unit) can be the only explanation for an error about No_Elaboration_Code violations. Avoid passing a bogus "#" to Error_Msg. We really should never construct message templates by concatenating strings that can come from input data, but there are too many cases of that to clean up. The message template parameters should really be of a type other than String, to avoid these kinds of bugs, but again, that's too much work to clean up now. gcc/ada/ * checks.adb (Selected_Length_Checks): In the message for an aggregate that has too few or too many elements, add "!!" to make sure the warning gets printed in with'ed units. Note that we have to put "!!" before the "??", because Compile_Time_Constraint_Error detects warnings by comparing the last character of the message with '?' (which is bit dubious, but we're not changing that here). (Length_Mismatch_Info_Message): Use Unat for some things that can't be negative. Specify Decimal instead of Auto in calls to UI_Image. * sem_util.adb (Compile_Time_Constraint_Error): Minor. * uintp.adb (Image_Uint): It's always better to initialize objects on their declaration.
2022-09-12[Ada] Disable Support_Atomic_Primitives on x86_64 VxWorksPatrick Bernardi2-2/+2
The current configuration of the x86-64 VxWorks runtimes does not support atomic primitives. x86-64 VxWorks was missed from the previous patch. gcc/ada/ * libgnat/system-vxworks7-x86_64-kernel.ads: Set Support_Atomic_Primitives to false. * libgnat/system-vxworks7-x86_64-rtp-smp.ads: Ditto.
2022-09-12[Ada] Disable Support_Atomic_Primitives on QNX and VxWorks targetsPatrick Bernardi7-7/+7
The current configuration of the QNX and VxWorks runtimes does not support atomic primitives. gcc/ada/ * libgnat/system-qnx-arm.ads: Set Support_Atomic_Primitives to false. * libgnat/system-vxworks7-aarch64.ads: Ditto. * libgnat/system-vxworks7-aarch64-rtp-smp.ads: Ditto. * libgnat/system-vxworks7-arm.ads: Ditto. * libgnat/system-vxworks7-arm-rtp-smp.ads: Ditto. * libgnat/system-vxworks7-x86-kernel.ads: Ditto. * libgnat/system-vxworks7-x86-rtp-smp.ads: Ditto.
2022-09-12[Ada] Parser and lexer cleanupBob Duff18-770/+574
This patch makes various minor cleanup changes to the parser. No change in behavior. gcc/ada/ * par-tchk.adb, par-util.adb, prep.adb, prepcomp.adb, scng.adb: Use "in" instead of chains of "=" connected with "or else". Likewise for "not in", "/=", "and then". Misc cleanup. * par-ch10.adb, par-ch12.adb, par-ch13.adb, par-ch4.adb: Likewise. * par-ch8.adb, par-ch9.adb, par-endh.adb, par-sync.adb: Likewise. * par.adb (Pf_Rec): Remove filler, which was added August 25, 1993 to get around a compiler limitation that no longer exists. Minor cleanup. Remove useless qualfications. * par-ch3.adb: Remove redundant return statements. (Component_Scan_Loop): Remove loop name; there are no nested loops, so it's unnecessary and possibly misleading, and it causes too-long lines. * par-ch5.adb: DRY: Remove comments that repeat the comments in par.adb. (P_Sequence_Of_Statements): It is better to initialize things on the declaration. And constants are better than variables. (Test_Statement_Required): Remove unnecessary insertion of a null statement. * par-ch6.adb, par-ch7.adb: DRY: Remove comments that repeat the comments in par.adb.
2022-09-12[Ada] Revert "Enforce matching of extra formals"Javier Miranda12-1148/+438
This reverts commit 51abc0cc8691daecd7cec8372e4988e9f3f1913c.
2022-09-07Daily bump.GCC Administrator1-0/+432
2022-09-06[Ada] Mark artificial formal parameters in the debug infoEric Botcazou1-0/+1
gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_param): Set DECL_ARTIFICIAL.
2022-09-06[Ada] Fix problematic line debug info attached to call to finalizerEric Botcazou1-5/+13
The End_Label is not defined for body nodes so a small tweak is needed. gcc/ada/ * gcc-interface/trans.cc (At_End_Proc_to_gnu): Use the End_Label of the child Handled_Statement_Sequence for body nodes. (set_end_locus_from_node): Minor tweaks.
2022-09-06[Ada] Fix internal error on double renaming of private constantEric Botcazou1-25/+43
The first renaming uses the type of the full view of the constant but not the second, which introduces problematic view conversions downstream. gcc/ada/ * gcc-interface/trans.cc (Full_View_Of_Private_Constant): New function returning the Full_View of a private constant, after looking through a chain of renamings, if any. (Identifier_to_gnu): Call it on the entity. Small cleanup.