aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
AgeCommit message (Collapse)AuthorFilesLines
2018-10-22trans.c (Pragma_to_gnu): Use a simple memory constraint in all cases.Eric Botcazou3-20/+13
* gcc-interface/trans.c (Pragma_to_gnu) <Pragma_Inspection_Point>: Use a simple memory constraint in all cases. * gcc-interface/lang-specs.h: Bump copyright year. From-SVN: r265378
2018-10-18Fix missing entry to gcc/ada/ChangeLog for r265240David Malcolm1-0/+4
From-SVN: r265272
2018-10-17Run selftests for C++ as well as CDavid Malcolm1-0/+3
gcc/ChangeLog: * Makefile.in (SELFTEST_TARGETS): New. (selftest) Change from s-selftest-c to $(SELFTEST_TARGETS). (C_SELFTEST_FLAGS, C_SELFTEST_DEPS, s-selftest-c, selftest-c-gdb) (selftest-gdb, selftest-c-valgrind, selftest-valgrind): Move to c/Make-lang.in. (CPP_SELFTEST_FLAGS, CPP_SELFTEST_DEPS, s-selftest-c++) (selftest-c++-gdb, selftest-c++-valgrind): Move to cp/Make-lang.in. * configure: Regenerate. * configure.ac (selftest_languages): New. gcc/brig/ChangeLog: * Make-lang.in (selftest-brig): New. gcc/c/ChangeLog: * Make-lang.in (selftest-c): New. (C_SELFTEST_FLAGS, C_SELFTEST_DEPS, s-selftest-c, selftest-c-gdb) (selftest-gdb, selftest-c-valgrind, selftest-valgrind): Move here from gcc/Makefile.in. gcc/cp/ChangeLog: * Make-lang.in (selftest-c++): New. (CPP_SELFTEST_FLAGS, CPP_SELFTEST_DEPS, s-selftest-c++) (selftest-c++-gdb, selftest-c++-valgrind): Move here from gcc/Makefile.in. gcc/fortran/ChangeLog: * Make-lang.in (selftest-fortran): New. gcc/go/ChangeLog: * Make-lang.in (selftest-go): New. gcc/jit/ChangeLog: * Make-lang.in (selftest-jit): New. gcc/lto/ChangeLog: * Make-lang.in (selftest-lto): New. gcc/objc/ChangeLog: * Make-lang.in (selftest-objc): New. gcc/objcp/ChangeLog: * Make-lang.in (selftest-obj-c++): New. From-SVN: r265240
2018-10-09[Ada] Fix spurious -Wuninitialized warnings for small recordsEric Botcazou4-28/+99
This change is aimed at getting rid of spurious -Wuninitialized warnings issued for small records passed by copy and containing default values for some of their components. The source of the problem is that the _Init parameter of the initialization routine is declared as an in/out parameter, so the uninitialized object is passed by copy to it and this can be flagged by -Wuninitialized. That's why the mode of the parameter is changed to out, except for the cases where information really needs to be passed in: unconstrained array types, protected and task types. For the following record type Rec! type Rec is record B : Boolean := True; end record; the initialization routine must now be: procedure r__recIP (_init : out r__rec1) is begin _init.b := true; return; end r__recIP; 2018-10-09 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * exp_ch3.adb (Is_Null_Statement_List): New predicate. (Build_Array_Init_Proc): Use it to find out whether the initialization procedure Is_Null_Init_Proc; if so, set Warnings_Off on the parameter. (Build_Init_Procedure): Likewise. (Init_Formals): Use an in/out first parameter only for unconstrained arrays and for records either containing or built for proteced types or task types; use an out parameter in all the other cases. * fe.h (Is_Init_Proc): Declare. * gcc-interface/decl.c (type_requires_init_of_formal): Do not return true for a discriminant in an unchecked union. (gnat_to_gnu_param): Do not create a PARM_DECL for the Out parameter of an initialization procedure. From-SVN: r264984
2018-10-09[Ada] Fix incorrect computation of Component_Size in ASIS modeEric Botcazou3-4/+12
2018-10-09 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Constant>: If this is not a definition, retrieve the expression in all cases even if we are just annotating types. * gcc-interface/trans.c (gnat_to_gnu): Also translate Size attribute for constrained types in this mode. From-SVN: r264983
2018-10-09[Ada] Minor tweaks to suppress warningsEric Botcazou4-9/+27
2018-10-09 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * adaint.c (__gnat_get_executable_suffix_ptr): Add new line. (__gnat_locate_exec): Check that HOST_EXECUTABLE_SUFFIX is not empty before doing a string search for it. * socket.c (ATTRIBUTE_UNUSED): Define. (__gnat_disable_sigpipe): Add ATTRIBUTE_UNUSED on parameter. * terminals.c (ATTRIBUTE_UNUSED): Move around. (__gnat_setup_child_communication): Add ATTRIBUTE_UNUSED on parameter. (__gnat_send_header): Add ATTRIBUTE_UNUSED on parameters. From-SVN: r264982
2018-10-09[Ada] Ignore pragmas Compile_Time_Error/Warning in GNATprove modeYannick Moy2-0/+16
GNATprove does not have sometimes the precise information of the compiler about size of types and objects, so that it cannot evaluate the expressions in pragma Compile_Time_Error/Warning the same way the compiler does. Thus, these pragmas should be ignored in GNATprove mode, as it can neither verify them nor assume them (if the expression cannot be evaluated at compile time, then the semantics for GNAT is to ignore them). 2018-10-09 Yannick Moy <moy@adacore.com> gcc/ada/ * sem_prag.adb (Process_Compile_Time_Warning_Or_Error): Rewrite pragmas as null statements in GNATprove mode. From-SVN: r264981
2018-10-09[Ada] Fix spurious error on derived record passed as Out parameterEric Botcazou2-0/+11
This fixlet gets rid of a spurious error issued in the specific case of a call to a subprogram taking an Out parameter of a discriminated record type without default discriminants, if the actual parameter is the result of the conversion to the record type of a variable whose type is derived from the record and has a representation clause. The compiler was failing to initialize the temporary made around the call because of the representation clause, but this is required for a type with discriminants because discriminants may be read by the called subprogram. 2018-10-09 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * exp_ch6.adb (Add_Call_By_Copy_Code): Initialize the temporary made for an Out parameter if the formal type has discriminants. gcc/testsuite/ * gnat.dg/derived_type5.adb, gnat.dg/derived_type5_pkg.ads: New testcase. From-SVN: r264980
2018-10-09[Ada] SPARK: fix bug related to non access object permissionsMaroua Maalej2-18/+7
2018-10-09 Maroua Maalej <maalej@adacore.com> gcc/ada/ * sem_spark.adb (Check_Declaration): fix bug related to non access object permissions. From-SVN: r264979
2018-10-09[Ada] Minor copyright header fixDoug Rupp2-1/+5
2018-10-09 Doug Rupp <rupp@adacore.com> gcc/ada/ * libgnat/a-ncelfu.ads: Fix name in header to match package. From-SVN: r264978
2018-10-09[Ada] Fix strange warning when using Ada.Iterator_InterfaceEric Botcazou2-2/+11
The back-end was recently changed to issue more -Wuninitialized warnings on Out parameters and this has caught a case related to Ada.Iterator_Interface.: This patchlet simply kills this uninteresting warning. 2018-10-09 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * exp_disp.adb (Make_Disp_Asynchronous_Select_Spec): Set Warnings_Off on the B out parameter. gcc/testsuite/ * gnat.dg/warn17.adb: New testcase. From-SVN: r264977
2018-10-09[Ada] Einfo: minor comment fixEric Botcazou2-1/+5
2018-10-09 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * einfo.ads: Small comment fix. From-SVN: r264976
2018-10-09[Ada] Internal error on inlined renaming of subprogram instanceEric Botcazou2-2/+16
This fixes a recent regression introduced in the compiler for the inlined renaming of a subprogram instantiated in a package body. It was wrongly clearing the Is_Public flag on the entity associated with the body. 2018-10-09 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * sem_ch7.adb (Has_Referencer): Add comment for the N_Freeze_Entity case. Do not rely on Has_Referencer_Of_Non_Subprograms to clear the Is_Public flag on subprogram entities. gcc/testsuite/ * gnat.dg/inline14.adb, gnat.dg/inline14_pkg.adb, gnat.dg/inline14_pkg.ads: New testcase. From-SVN: r264975
2018-10-09[Ada] Unnesting: fix handling of private types that are synchronizedEd Schonberg2-0/+14
2018-10-09 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * exp_unst.adb (In_Synchronized_Call): Handle properly private types whose full views are synchronized types, in order to recognize generated subprograms whose bodies must be considered reachable even if no direct calls to them are visible in the source. From-SVN: r264974
2018-10-09[Ada] Fix expansion of operations on nonbinary modular typesEd Schonberg2-2/+21
2018-10-09 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * exp_ch4.adb (Expand_Modular_Op): When expanding an operation on nonbinary modular types, convert the opersnds to an integer type that is large enough to hold the modulus of the type, which may be larger than Integer'Last. From-SVN: r264973
2018-10-09[Ada] Unnesting: fix handling of uplevel refs to unconstrained formalsEd Schonberg2-6/+42
2018-10-09 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * exp_unst.adb (Unnest_Subprogram): When an uplevel reference is to an unconstrained formal, the 'Access reference that is created to initialize the corresponding component of the activation record must be wrapped in an unchecked conversion to the generated type of the component. Otherwise, spurious suvtype conformance errors will be generated when the code is within an instantiation and the type of the formal is a formal type of the enclosing generic. Note that during unnesting there is no simple way to determine that the code appears within an instance because ther is no scope stack. From-SVN: r264972
2018-10-09[Ada] Remove spurious -Wuninitialized warning for small array at -O2Eric Botcazou2-27/+51
2018-10-09 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * gcc-interface/decl.c (type_requires_init_of_formal): New predicate. (gnat_to_gnu_param): Use it to determine whether a PARM_DECL must be created for an Out parameter passed by copy. From-SVN: r264971
2018-10-09[Ada] Bounded_Holders: fix a typoArnaud Charlet2-1/+5
2018-10-09 Arnaud Charlet <charlet@adacore.com> gcc/ada/ * libgnat/a-coboho.ads (Storage_Element): Fix a typo. From-SVN: r264970
2018-10-09[Ada] Functional_Vectors: remove default value for max sizeClaire Dross2-2/+6
2018-10-09 Claire Dross <dross@adacore.com> gcc/ada/ * libgnat/a-cfinve.ads: Remove default value for Max_Size_In_Storage_Elements as it was not supported in SPARK. From-SVN: r264969
2018-10-09[Ada] Reset Is_True_Constant on entites used as OUT/IN OUT actualsEd Schonberg2-0/+10
2018-10-09 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * exp_ch6.adb (Add_Call_By_Copy_Node, Add_Simple_Call_By_Copy_Node, Expand_Call_Helper): Reset Is_True_Constant on entities used as Out or In_Out parameters in calls. From-SVN: r264968
2018-10-09[Ada] Unnesting: avoid unnecessary loads of SystemEd Schonberg2-10/+23
2018-10-09 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * exp_unst.adb (Unnest_Subprogram): Do not load System to obtain the Address entity unless an activation record is being built. Removes useless with_clauses for System when nested subprograms do not have uplevel references, and therefore do not need activation records. From-SVN: r264967
2018-10-09[Ada] Spurious error message on visibiliy change in aspect expressionEd Schonberg2-1/+18
This patch removes an improper error message on a visibility change in an aspect expression between the freeze point and the end of the declaration list, when the expression involves a call to a instance of Unchecked_Conversion and the enclosing package declaration has a package body with multiple subprogram bodies. The following must compile quietly: ---- package body Par.Rep is procedure Nothing is begin null; end; procedure Rien is begin null; end; end; ---- with Par.Loc; package Par.Rep is type Rec is record X, Y : Integer; end record with Volatile; Thing2 : Unsigned_32 := 15; Thing3 : Rec with Volatile, Address => To_Address (Par.Loc.Flash_Base); procedure Nothing; end; ---- pragma Restrictions (No_Elaboration_Code); with interfaces; use interfaces; pragma unreferenced (interfaces); with Tp; use Tp; pragma unreferenced (Tp); package Par is end Par; ---- with Ada.Unchecked_Conversion; with System; with Interfaces; use Interfaces; package Tp is subtype system_address is unsigned_32; function to_address is new ada.unchecked_conversion (system_address, system.address); function To_32 is new ada.unchecked_conversion (System.Address, System_Address); end; ---- with TP; use TP; package Par.Loc is FLASH_BASE : constant system_address := 16#0800_0000#; end; 2018-10-09 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * sem_ch6.adb (Fully_Conformant_Expressions): Handle properly the conformance check on an aspect expression that includes a call to an instance of Unchecked_Conversion, or more generally a call to an intrinsic operation. From-SVN: r264966
2018-10-09[Ada] Repinfo: list the mechanism of functions onlyEric Botcazou2-2/+6
2018-10-09 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * repinfo.adb: Remove with/use clause for Stand. (List_Mechanisms): List the mechanism of functions only. From-SVN: r264965
2018-10-09[Ada] Various User Manual updates for GNATppBob Duff2-8/+35
2018-10-09 Bob Duff <duff@adacore.com> gcc/ada/ * doc/gnat_ugn/gnat_utility_programs.rst: Correct spelling of --eol switch. Document the language-version switches. Update description for --no-exception. From-SVN: r264964
2018-10-09[Ada] System.Os_Lib.Normalize_Pathname: fix incorrect commentVasiliy Fofanov2-2/+7
2018-10-09 Vasiliy Fofanov <fofanov@adacore.com> gcc/ada/ * libgnat/s-os_lib.ads (Normalize_Pathname): Fix incorrect comment. From-SVN: r264963
2018-10-09[Ada] Remove CodePeer annotationArnaud Charlet2-4/+4
2018-10-09 Arnaud Charlet <charlet@adacore.com> gcc/ada/ * vxlink.adb: Remove pragma Annotate, no longer needed. From-SVN: r264962
2018-10-09[Ada] Preserve Do_Range_Check flags in SPARK modeEd Schonberg2-3/+8
2018-10-09 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * checks.adb (Apply_Type_Conversion_Checks): Use GNATprove_Mode rather than SPARK_mode in order to preserve the Do_Range_Check flag for verification purposes. From-SVN: r264961
2018-10-09[Ada] Spurious warning on uninitialized entity during code generationEd Schonberg2-0/+9
This patch suppresses a spurious warning coming from the GCC backend, on an aggregate that cannot be built in place and for which a temporary variable must be created. If the type of the aggregate is a packed boolean array, the generated code may appear to use an uninitialized value for a component of the array, when in fact the code simply sets a single bit of that array. 2018-10-09 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * exp_aggr.adb (Expand_Array_Aggregate): If it is not possible to build in place an aggregate with component associations, set the Warnings_Off flag on the generated temporary, to prevent spurious warnings from the backend when compiling with the -Wuninitialized gcc flag. gcc/testsuite/ * gnat.dg/warn18.adb: New testcase. From-SVN: r264960
2018-10-01[Ada] use -gnatd_A to disable .ali on -fcompare-debug recompileAlexandre Oliva4-12/+13
for gcc/ada/ChangeLog * gcc-interface/lang-specs.h (default_compilers): When given fcompare-debug-second, adjust auxbase like cc1, and pass gnatd_A. * gcc-interface/misc.c (flag_compare_debug): Remove variable. (gnat_post_options): Do not set it. * lib-writ.adb (flag_compare_debug): Remove import. (Write_ALI): Do not test it. From-SVN: r264732
2018-09-28calls.c (expand_call): Try to do a tail call for thunks at -O0 too.Eric Botcazou4-6/+262
* calls.c (expand_call): Try to do a tail call for thunks at -O0 too. * cgraph.h (struct cgraph_thunk_info): Add indirect_offset. (cgraph_node::create_thunk): Add indirect_offset parameter. (thunk_adjust): Likewise. * cgraph.c (cgraph_node::create_thunk): Add indirect_offset parameter and initialize the corresponding field with it. (cgraph_node::dump): Dump indirect_offset field. * cgraphclones.c (duplicate_thunk_for_node): Deal with indirect_offset. * cgraphunit.c (cgraph_node::analyze): Be prepared for external thunks. (thunk_adjust): Add indirect_offset parameter and deal with it. (cgraph_node::expand_thunk): Deal with the indirect_offset field and pass it to thunk_adjust. Do not call the target hook if it's non-zero or if the thunk is external or local. Fix formatting. Do not chain the RESULT_DECL to BLOCK_VARS. Pass the static chain to the target, if any, in the GIMPLE representation. * ipa-icf.c (sem_function::equals_wpa): Deal with indirect_offset. * lto-cgraph.c (lto_output_node): Write indirect_offset field. (input_node): Read indirect_offset field. * tree-inline.c (expand_call_inline): Pass indirect_offset field in the call to thunk_adjust. * tree-nested.c (struct nesting_info): Add thunk_p field. (create_nesting_tree): Set it. (convert_all_function_calls): Copy static chain from targets to thunks. (finalize_nesting_tree_1): Return early for thunks. (unnest_nesting_tree_1): Do not finalize thunks. (gimplify_all_functions): Do not gimplify thunks. cp/ * method.c (use_thunk): Adjust call to cgraph_node::create_thunk. ada/ * gcc-interface/decl.c (is_cplusplus_method): Do not require C++ convention on Interfaces. * gcc-interface/trans.c (Subprogram_Body_to_gnu): Try to create a bona-fide thunk and hand it over to the middle-end. (get_controlling_type): New function. (use_alias_for_thunk_p): Likewise. (thunk_labelno): New static variable. (make_covariant_thunk): New function. (maybe_make_gnu_thunk): Likewise. * gcc-interface/utils.c (finish_subprog_decl): Set DECL_CONTEXT of the result DECL here instead of... (end_subprog_body): ...here. Co-Authored-By: Pierre-Marie de Rodat <derodat@adacore.com> From-SVN: r264701
2018-09-27tree.h (tree_to_shwi): Add attribute nonnull and pure.Martin Sebor2-7/+15
gcc/ChangeLog: * tree.h (tree_to_shwi): Add attribute nonnull and pure. (tree_to_poly_int64, tree_to_uhwi, tree_to_poly_uint64): Same. (int_fits_type_p): Same. gcc/ada/ChangeLog: * gcc-interface/utils.c (make_packable_type): Introduce a temporary to avoid -Wnonnull. (unchecked_convert): Same. From-SVN: r264680
2018-09-26[Ada] SPARK: minor error message enhancementElisa Barboni2-1/+9
2018-09-26 Elisa Barboni <barboni@adacore.com> gcc/ada/ * sem_prag.adb (Check_Refined_Global_Item): Improve error message. From-SVN: r264637
2018-09-26[Ada] Fix inheritance of representation items defined as aspectsThomas Quinot2-2/+28
When a representation item is defined by a pragma or attribute definition clause, the entity it applies to is that of the Name of the representation item. But when it is defined by an aspect definition, the entity is directly denoted by the Entity attribute of the represenation item. The circuitry that inherits representation items for derived types or subtypes must account for these two possible cases. 2018-09-26 Thomas Quinot <quinot@adacore.com> gcc/ada/ * sem_ch13.adb (Inherit_Aspects_At_Freeze_Point): For a representation item that is an N_Aspect_Definition, retrieve the entity it applies to using the Entity attribute. gcc/testsuite/ * gnat.dg/sso13.adb: New testcase. From-SVN: r264636
2018-09-26[Ada] Spurious ineffective use_clause warningJustin Squirek2-1/+15
This patch fixes an issue whereby user-defined subprograms used as generic actuals with corresponding formals containing other formal types led to spurious ineffective use_clause warnings. 2018-09-26 Justin Squirek <squirek@adacore.com> gcc/ada/ * sem_ch8.adb (Analyze_Subprogram_Renaming): Add extra condition to check for unmarked subprogram references coming from renamings. gcc/testsuite/ * gnat.dg/warn16.adb: New testcase. From-SVN: r264635
2018-09-26[Ada] Store -G xxx switchesArnaud Charlet2-7/+22
2018-09-26 Arnaud Charlet <charlet@adacore.com> gcc/ada/ * back_end.adb (Scan_Compiler_Arguments): Store -G xxx switches. From-SVN: r264634
2018-09-26[Ada] Issue info message on inlined subprograms in GNATprove modeYannick Moy4-4/+20
Issue a positive message that inlining was performed in GNATprove mode, when corresponding debug switch -gnatd_f is set. 2018-09-26 Yannick Moy <moy@adacore.com> gcc/ada/ * errout.ads: Update comment for insertion character '?'. * inline.adb: Use simple insertion character '?' for GNATprove info messages. * sem_res.adb (Resolve_Call): Issue an info message on inlining in GNATprove mode. From-SVN: r264633
2018-09-26[Ada] Missing front-end code for constraint checks on fixed point exprsEd Schonberg3-2/+31
This patch ensures that the front-end generates constraint checks for some operations that previously depended on gigi for the corresponding check. The patch also resets the Do_Range_Check flag so that it never appears in the tree presented to gigi. 2018-09-26 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * checks.adb (Apply_Type_Conversion_Checks): Do not generate a range check on the expression of the conversion if it involves a fixed-point type, as such conversions are handled specially during expansion. * exp_ch4.adb (Expand_N_Type_Conversion): In a conversion from Fixed to Integer, use the base type of the expression to ensure that the caller will generate the proper constraint check when needed. From-SVN: r264632
2018-09-26[Ada] SPARK: fix a bug related to loop exit environmentMaroua Maalej2-23/+58
2018-09-26 Maroua Maalej <maalej@adacore.com> gcc/ada/ * sem_spark.adb (Check_Loop_Statement): Fix a bug related to loop exit environment. (Check_Statement): fixing a bug when comparing the source and target in an assignment statement. From-SVN: r264631
2018-09-26[Ada] Spurious elaboration issue due to inliningHristian Kirtchev2-54/+86
This patch ensures that the full compilation context is captured prior to package or subprogram instantiation/inlining and restored after the action takes place. 2018-09-26 Hristian Kirtchev <kirtchev@adacore.com> gcc/ada/ * sem_ch12.adb (Instantiate_Package_Body): Capture and restore the full compilation context. (Instantiate_Subprogram_Body): Capture and restore the full compilation context. gcc/testsuite/ * gnat.dg/elab7.adb, gnat.dg/elab7_pkg1.adb, gnat.dg/elab7_pkg1.ads, gnat.dg/elab7_pkg2.adb, gnat.dg/elab7_pkg2.ads: New testcase. From-SVN: r264630
2018-09-26[Ada] Do not issue by default info messages for inlining in GNATproveYannick Moy3-8/+27
Info messages about lack of inlining for analysis in GNATprove may be confusing to users. They are now only issued when GNATprove is called with switch --info, which it passes on to gnat2why with switch -gnatd_f. There is no effect on compilation. 2018-09-26 Yannick Moy <moy@adacore.com> gcc/ada/ * debug.adb: Add use for -gnatd_f switch. * inline.adb (Cannot_Inline): Only issue info message for failure to inline in GNATprove mode when switch -gnatd_f is used. From-SVN: r264629
2018-09-26[Ada] Spurious error on interface conversion under ZFPJavier Miranda3-1/+41
The frontend reports an error under ZFP when performing the type conversion of a tagged object to one of its covered interface types. 2018-09-26 Javier Miranda <miranda@adacore.com> gcc/ada/ * exp_disp.adb (Expand_Interface_Conversion): No displacement of the pointer needed when the type of the operand is an interface type that maches the target type and we are compiling under configurable runtime. Adding also documentation explaining why this cannot be done when compiling with the full runtime. * exp_intr.adb: Update comment. gcc/testsuite/ * gnat.dg/interface8.adb, gnat.dg/interface8.ads: New testcase. From-SVN: r264628
2018-09-26[Ada] Add a No_Return annotation to ease static analysisHristian Kirtchev2-1/+6
2018-09-26 Hristian Kirtchev <kirtchev@adacore.com> gcc/ada/ * sem_ch5.adb (Wrap_Loop_Statement): Annotate as No_Return. From-SVN: r264627
2018-09-26[Ada] Spurious error on private extension with predicateEd Schonberg2-2/+10
This patch fixes a spurious error involving a private extension whose full view includes a dynamic predicate, when the parent type is itself private at the point of the predicate check. The conversion is known to be legal so no extra conversion checks are required. 2018-09-26 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * exp_util.adb (Make_Predicate_Call): Use OK_Convert_To when applying a predicate check to prevent spurious errors when private ancestors are involved. gcc/testsuite/ * gnat.dg/predicate2-containers.ads, gnat.dg/predicate2-project-name_values.ads, gnat.dg/predicate2-project-registry-attribute.ads, gnat.dg/predicate2-project-registry.ads, gnat.dg/predicate2-project-typ-set.ads, gnat.dg/predicate2-project-typ.ads, gnat.dg/predicate2-project.ads, gnat.dg/predicate2-source_reference.ads, gnat.dg/predicate2.ads, gnat.dg/predicate2_main.adb: New testcase. From-SVN: r264626
2018-09-26[Ada] Spurious dependency on secondary stackHristian Kirtchev4-195/+362
This patch reimplements the handling of the secondary stack when the iteration scheme of a loop statement requires this support. Prior to this modification, an iterator loop over a container was assumed to require unconditional secondary stack management. This is however not always true because of user-defined iterator types, where routines First and Next return an iterator that does require the secondary stack. ------------ -- Source -- ------------ -- gnat.adc pragma Restrictions (No_Secondary_Stack); -- test.ads package Test is type Test_Type is private with Default_Initial_Condition, Iterable => (First => First_Element, Next => Next_Element, Has_Element => Has_Element, Element => Element); type Cursor_Type is private; function First_Element (T : Test_Type) return Cursor_Type; function Next_Element (T : Test_Type; C : Cursor_Type) return Cursor_Type; function Has_Element (T : Test_Type; C : Cursor_Type) return Boolean; function Element (T : Test_Type; C : Cursor_Type) return Natural; private type Cursor_Type is new Natural; type Test_Type is record null; end record; function First_Element (T : Test_Type) return Cursor_Type is (0); function Next_Element (T : Test_Type; C : Cursor_Type) return Cursor_Type is (0); function Has_Element (T : Test_Type; C : Cursor_Type) return Boolean is (False); function Element (T : Test_Type; C : Cursor_Type) return Natural is (0); end Test; -- main.adb with Test; use Test; procedure Main is F : Boolean; M : Test_Type; begin for Elem of M loop null; end loop; F := (for all C of M => C = 1); F := (for all C in M => True); end Main; ----------------- -- Compilation -- ----------------- $ gnatmake -q --RTS=zfp -nostdlib main.adb 2018-09-26 Hristian Kirtchev <kirtchev@adacore.com> gcc/ada/ * exp_ch4.adb (Expand_N_Allocator): Ensure that the use of the secondary stack does not clash with restriction No_Secondary_Stack. * exp_ch6.adb (Expand_N_Extended_Return_Statement): Ensure that the use of the secondary stack does not clash with restriction No_Secondary_Stack. * sem_ch5.adb (Analyze_Loop_Statement): Wrap the loop in a block prior to analysis in order to either provide a local scope for an iterator, or ensure that the secondary stack is properly managed. (Check_Call): Account for the case where the tree may be unanalyzed or contain prior errors. (Has_Call_Using_Secondary_Stack): Renamed to Has_Sec_Stack_Call. Update all uses of the subprogram. (Prepare_Loop_Statement): New routine. From-SVN: r264625
2018-09-26[Ada] Mimic the C++ ABI when passing class-wide conversion actualsJavier Miranda2-0/+9
This patch does not affect the behavior of Ada-only code but improves consistency with the code generated by the C++ compiler. 2018-09-26 Javier Miranda <miranda@adacore.com> gcc/ada/ * sem_res.adb (Resolve_Actuals): If the formal is a class-wide type conversion then do not skip resolving and expanding the conversion; required to displace the pointer to the object and reference the dispatch table associated with the target interface type. From-SVN: r264624
2018-09-26[Ada] Pair miscount in Dynamic_HTable.PutHristian Kirtchev2-2/+14
This patch corrects the logic of GNAT.Dynamic_HTables.Dynamic_HTable.Put to update the number of key-value pairs in the hash table only when the put is adding a new pair, rather than updating the value of an existing pair. 2018-09-26 Hristian Kirtchev <kirtchev@adacore.com> gcc/ada/ * libgnat/g-dynhta.adb (Prepend_Or_Replace): Update the number of key-value pairs in the hash table only when adding a brand new pair. gcc/testsuite/ * gnat.dg/dynhash1.adb: New testcase. From-SVN: r264623
2018-09-26[Ada] Add notes about processing of aggregate projectsSergey Rybin2-2/+9
2018-09-26 Sergey Rybin <rybin@adacore.com> gcc/ada/ * doc/gnat_ugn/gnat_utility_programs.rst: Add note about processing of aggregate projects in gnatmetric and gnatstub. From-SVN: r264622
2018-09-26[Ada] Minor reformattingsHristian Kirtchev12-202/+318
2018-09-26 Hristian Kirtchev <kirtchev@adacore.com> gcc/ada/ * contracts.adb, exp_unst.adb, exp_util.adb, gnat1drv.adb, opt.ads, par-prag.adb, sem_ch3.adb, sem_ch5.adb, sem_prag.adb, sinfo.ads, snames.ads-tmpl: Minor reformatting. From-SVN: r264621
2018-09-26[Ada] New unit GNAT.SetsHristian Kirtchev11-113/+439
This patch implements unit GNAT.Sets which currently offers a general purpose membership set. The patch also streamlines GNAT.Dynamic_HTables and GNAT.Lists to use parts of the same API, types, and exceptions as those used by GNAT.Sets. 2018-09-26 Hristian Kirtchev <kirtchev@adacore.com> gcc/ada/ * gcc-interface/Make-lang.in: Add unit GNAT.Sets to the list of front end sources. * impunit.adb: Add unit GNAT.Sets to the list of predefined units. * Makefile.rtl: Add unit GNAT.Sets to the list of non-tasking units. * libgnat/g-sets.adb: New unit. * libgnat/g-sets.ads: New unit. * libgnat/g-dynhta.adb (Minimum_Size): Decrease to 8 in order to allow for small sets. Update all occurrences of Table_Locked to Iterated. (Ensure_Unlocked): Query the number of iterators. (Find_Node): Use the supplied equality. (Is_Empty): New routine. (Lock): Update the number of iterators. (Prepend_Or_Replace): Use the supplied equality. (Size): Update the return type. (Unlock): Update the number of iterators. * libgnat/g-dynhta.ads: Update all occurrences of Table_Locked to Iterated. Rename formal subprogram Equivalent_Keys to "=". (Bucket_Range_Type, Pair_Count_Type): Remove types. (Not_Created, Table_Locked, Iterator_Exhausted): Remove exceptions. (Hash_Table): Update to store the number of iterators rather than locks. (Is_Empty): New routine. (Size): Update the return type. * libgnat/g-lists.adb: Update all occurrences of List_Locked to Iterated. (Ensure_Unlocked): Query the number of iterators. (Length): Remove. (Lock): Update the number of iterators. (Size): New routine. (Unlock): Update the number of iterators. * libgnat/g-lists.ads: Update all occurrences of List_Locked to Iterated. (Element_Count_Type): Remove type. (Not_Created, Table_Locked, Iterator_Exhausted): Remove exceptions. (Linked_List): Update type to store the number of iterators rather than locks. (Length): Remove. (Size): New routine. * libgnat/gnat.ads (Bucket_Range_Type): New type. (Iterated, Iterator_Exhausted, and Not_Created): New exceptions. gcc/testsuite/ * gnat.dg/sets1.adb: New testcase. * gnat.dg/dynhash.adb, gnat.dg/linkedlist.adb: Update testcases to new API. From-SVN: r264620
2018-09-26[Ada] ICE on mix of tagged and limited interfacesJavier Miranda2-0/+13
2018-09-26 Javier Miranda <miranda@adacore.com> gcc/ada/ * checks.adb (Install_Null_Excluding_Check): Do not add null-excluding checks when the tree may not be fully decorated. This patch cascade errors. From-SVN: r264619