aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
AgeCommit message (Collapse)AuthorFilesLines
2019-07-18Makefile.rtl, [...]: Introduce a "STANDALONE" mode where C runtime files do ↵Arnaud Charlet24-179/+125
not have any dependency... * Makefile.rtl, expect.c, env.c, aux-io.c, mkdir.c, initialize.c, cstreams.c, raise.c, tracebak.c, adadecode.c, init.c, raise-gcc.c, argv.c, adaint.c, adaint.h, ctrl_c.c, sysdep.c, rtinit.c, cio.c, seh_init.c, exit.c, targext.c: Introduce a "STANDALONE" mode where C runtime files do not have any dependency on GCC include files. Remove unnecessary includes. Remove remaining references to VMS in runtime C file. * runtime.h: new File. From-SVN: r273576
2019-07-13* Makefile.rtl: Use g-sercom__linux.adb for all linuxes.Andreas Schwab2-1/+4
From-SVN: r273467
2019-07-11[Ada] Use high-level wrappers for Lib.Units.TablePiotr Trojanek2-3/+9
2019-07-11 Piotr Trojanek <trojanek@adacore.com> gcc/ada/ * lib-writ.adb (Ensure_System_Dependency, Up_To_Date_ALI_File_Exists, Write_ALI): Replace low-level access to table with a high-level query. From-SVN: r273407
2019-07-11[Ada] Minor refactoringPiotr Trojanek4-2/+12
2019-07-11 Piotr Trojanek <trojanek@adacore.com> gcc/ada/ * checks.adb: Fix typo in comment. * sem.adb (Semantics): Avoid repeated calls to In_Extended_Main_Source_Unit by reusing an already-cached result. * sem_util.adb (First_Global): Fix style. From-SVN: r273406
2019-07-11[Ada] Avoid spurious errors on dimensionality checking in GNATproveYannick Moy2-1/+8
In the special GNATprove mode of the frontend, automatic inlining is performed, which may lead to spurious errors on dimensionality checking. Avoid performing this checking on inlined code, which has already been checked for dimensionality errors. There is no impact on compilation. 2019-07-11 Yannick Moy <moy@adacore.com> gcc/ada/ * sem_res.adb (Resolve_Call): Do not perform dimensionality checking on inlined bodies. From-SVN: r273405
2019-07-11[Ada] Flip the meaning of debug switch -gnatdFYannick Moy2-4/+9
2019-07-11 Yannick Moy <moy@adacore.com> gcc/ada/ * debug.adb: Flip meaning of debug switch -gnatdF. From-SVN: r273404
2019-07-11[Ada] Avoid spurious warning on assertions with Loop_EntryYannick Moy2-10/+44
When the Loop_Entry attribute is used inside a loop invariant or another assertion where it is allowed, it may lead to spurious warnings on conditions that are detected to be always valid. Now fixed. 2019-07-11 Yannick Moy <moy@adacore.com> gcc/ada/ * sem_eval.adb (Is_Same_Value): Add special case for rewritten Loop_Entry attribute. gcc/testsuite/ * gnat.dg/loop_entry1.adb: New testcase. From-SVN: r273403
2019-07-11[Ada] Refactor ownership pointer checking in SPARK as a genericClaire Dross4-149/+329
Ownership checking as done in SPARK should be applied only to SPARK code, which requires GNATprove knowledge of the SPARK_Mode boundary. Transform the checking unit into a generic to allow passing in the knowledge from GNATprove to that unit in GNAT sources. Keeping the code in GNAT sources makes it possible in the future to adapt it further (or simply instantiate it differently) to be used on Ada code, independently of GNATprove. There is no impact on compilation. 2019-07-11 Claire Dross <dross@adacore.com> gcc/ada/ * gnat1drv.adb: SPARK checking rules for pointer aliasing are moved to GNATprove backend. * sem_spark.ads, sem_spark.adb (Sem_SPARK): Is now a generic unit. Takes as parameters: - Retysp which is used to query the most underlying type visible in SPARK. We do not introduce aliasing checks for types which are not visibly deep. - Component_Is_Visible_In_SPARK is used to avoid doing pointer aliasing checks on components which are not visible in SPARK. - Emit_Messages returns True in the second phase of SPARK analysis. Error messages for failed aliasing checks are only output in this case. Additionally, errors on constructs not supported in SPARK are removed as duplicates of marking errors. Components are stored in the permission map using their original component to avoid inconsistencies between components of different views of the same type. (Check_Expression): Handle delta constraints. (Is_Deep): Exported so that we can check for SPARK restrictions on deep types inside SPARK semantic checkings. (Is_Traversal_Function): Exported so that we can check for SPARK restrictions on traversal functions inside SPARK semantic checkings. (Check_Call_Statement, Read_Indexes): Check wether we are dealing with a subprogram pointer type before querying called entity. (Is_Subpath_Expression): Image attribute can appear inside a path. (Check_Loop_Statement): Correct order of statements in the loop. (Check_Node): Ignore raise nodes. (Check_Statement): Use Last_Non_Pragma to get the object declaration in an extended return statement. From-SVN: r273402
2019-07-11[Ada] Minimal binderPatrick Bernardi7-17/+86
The new minimal binder option ("-minimal") suppresses the generation of binder objects that are not strictly required for program operation. This option is suitable for space constrained applications and comes with the restriction that programs can no longer be debugged using GDB. 2019-07-11 Patrick Bernardi <bernardi@adacore.com> gcc/ada/ * bindgen.adb (Gen_Main): Do not generate a reference to Ada_Main_Program_Name when the Minimal_Binder flag is set. (Gen_Output_File_Ada): Do not output GNAT_Version and Ada_Main_Program_Name info if Minimal_Binder flag is set. * bindusg.adb: Add documentation for new -minimal switch. * gnatbind.adb (Scan_Bind_Arg): Scan -minimal switch. * opt.ads: Add new global flag Minimal_Binder to indicate if the binder should not produce global variables. * doc/gnat_ugn/building_executable_programs_with_gnat.rst: Update documentation with new binder -minimal switch. * gnat_ugn.texi: Regenerate. From-SVN: r273401
2019-07-11[Ada] Makefile.rtl: add a warning about compilation flagsEric Botcazou2-9/+20
2019-07-11 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * Makefile.rtl: Add warning note about compilation flags and capitalize. From-SVN: r273400
2019-07-11[Ada] Crash on protected type with self-referential componentEd Schonberg2-1/+69
This patch fixes a compiler abort on a declarastion for a protected type PT when one of its private component is of type access PT. 2019-07-11 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * exp_ch9.adb (Expand_N_Protected_Type_Declaaration): New subsidiary routine Replace_Access_Definition, to handle properly a protected type PT one of whose private components is of type access PT. gcc/testsuite/ * gnat.dg/prot8.adb, gnat.dg/prot8.ads: New testcase. From-SVN: r273399
2019-07-11[Ada] GNAT.Sockets: support ICMP, IGMP and RAW IP protocol levelsDmitriy Anisimkov4-2/+122
2019-07-11 Dmitriy Anisimkov <anisimko@adacore.com> gcc/ada/ * libgnat/g-socket.ads (Level_Type): Add enumerators for IP_Protocol_For_ICMP, IP_Protocol_For_IGMP, IP_Protocol_For_RAW_Level. * libgnat/g-socket.adb (Levels): Handle them. * s-oscons-tmplt.c: Import socket protocols defined in netinet/in.h. From-SVN: r273398
2019-07-11[Ada] Memory corruption when using formal hashed sets or mapsClaire Dross3-4/+15
Add a check to avoid causing a buffer overflow when the map is empty 2019-07-11 Claire Dross <dross@adacore.com> gcc/ada/ * libgnat/a-cfhama.adb, libgnat/a-cfhase.adb (Free): Do not reset the Has_Element flag if no element is freed. From-SVN: r273397
2019-07-11[Ada] errno.c: remove obsolete support for MaRTE OSArnaud Charlet2-13/+6
2019-07-11 Arnaud Charlet <charlet@adacore.com> gcc/ada/ * errno.c: Remove obsolete support for MaRTE OS. From-SVN: r273396
2019-07-11[Ada] Remove redundant predicate checksEd Schonberg4-18/+51
This patch removes redundant dynamic predicate checks generated by type conversions in various contexts. The patch also recognizes additional such checks that can be evaluated statically when applied to constant values. No simple test available. 2019-07-11 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * exp_ch4.adb (Expand_N_Type_Conversion): If a predicate check is generated, analyze it with range check suppressed, because that check has been previously applied. * exp_ch5.adb (Expand_N_Assignment_Statement): If the RHS is a type conversion to the type of the LHS, do not apply a predicate check to the RHS because it will have been generated already during its expansion. * exp_ch6.adb (Can_Fold_Predicate_Call): Extend processing to handle a predicate check on a constant entity whose value is static. From-SVN: r273395
2019-07-11[Ada] Elaboration order v4.0 and output of dependenciesHristian Kirtchev5-5/+37
This patch adds a missing case to the mechanism that outputs the elaboration order dependencies of units. ------------ -- Source -- ------------ -- pack.ads package Pack is procedure Force_Body; end Pack; -- pack.adb package body Pack is procedure Force_Body is null; end Pack; -- main.adb with Pack; procedure Main is begin null; end Main; ---------------------------- -- Compilation and output -- ---------------------------- $ gnatmake -q main.adb -bargs -e ELABORATION ORDER DEPENDENCIES unit "pack (spec)" must be elaborated before unit "main (body)" reason: unit "main (body)" has with clause for unit "pack (spec)" unit "pack (spec)" must be elaborated before unit "pack (body)" reason: spec must be elaborated before body 2019-07-11 Hristian Kirtchev <kirtchev@adacore.com> gcc/ada/ * bindo.adb: Remove the documentation of switch -d_N because it is no longer in use. * bindo-graphs.ads, bindo-graphs.adb (Is_Spec_Before_Body_Edge): New routine. * bindo-writers.adb (Write_Dependency_Edge): Add the missing case of a spec-before-body edge. From-SVN: r273394
2019-07-11[Ada] GNAT.Sockets: add support for RAW socketsDmitriy Anisimkov3-5/+12
2019-07-11 Dmitriy Anisimkov <anisimko@adacore.com> gcc/ada/ * libgnat/g-socket.ads (Mode_Type): Add a Socket_Raw enumerator. * libgnat/g-socket.adb (Modes): Handle Socket_Raw. From-SVN: r273393
2019-07-11[Ada] Pragma Unreferenced triggers undefined referenceJustin Squirek2-1/+16
This patch corrects the generation of protected body declarations so that instances of pragma Unreferenced applied to formals don't falsly trigger undefined references. 2019-07-11 Justin Squirek <squirek@adacore.com> gcc/ada/ * exp_ch9.adb (Build_Private_Protected_Declaration): Add exception for the moving of pragmas to internally generated specs for pragma Unreferenced. gcc/testsuite/ * gnat.dg/unreferenced2.adb: New testcase. From-SVN: r273392
2019-07-11[Ada] Fix inconsistent documentation for gnatmetricBob Duff3-48/+50
One part said all metrics are enabled by default (which is now true), and another part said the coupling metrics are disabled by default (which is no longer true). 2019-07-11 Bob Duff <duff@adacore.com> gcc/ada/ * doc/gnat_ugn/gnat_utility_programs.rst: Fix inconsistent documentation for gnatmetric. * gnat_ugn.texi: Regenerate. From-SVN: r273391
2019-07-11[Ada] Document gnatpp's --spaces-only switchBob Duff2-0/+11
2019-07-11 Bob Duff <duff@adacore.com> gcc/ada/ * doc/gnat_ugn/gnat_utility_programs.rst: Document gnatpp's --spaces-only switch. From-SVN: r273390
2019-07-11[Ada] Infinite loop on illegal declarationHristian Kirtchev2-1/+12
This patch updates predicate Null_Status to prevent an infinite recursion when the argument is an illegal object declaration of an access type. 2019-07-11 Hristian Kirtchev <kirtchev@adacore.com> gcc/ada/ * sem_util.adb (Null_Status): Assume that an erroneous construct has an undefined null status. gcc/testsuite/ * gnat.dg/self_ref1.adb: New testcase. From-SVN: r273389
2019-07-11[Ada] Minor reformattingHristian Kirtchev8-33/+49
2019-07-11 Hristian Kirtchev <kirtchev@adacore.com> gcc/ada/ * checks.adb, exp_ch6.adb, gnat1drv.adb, sem_aux.adb, sem_ch2.adb, sem_ch8.adb, sem_res.adb: Minor reformatting. From-SVN: r273388
2019-07-11[Ada] Internal crash on illegal renamingHristian Kirtchev2-10/+40
This patch updates the retrieval of the renamed object name of an object renaming declaration to handle various name forms. No need for a test because one already exists, and reproducing requires a compiler built with assertions. 2019-07-11 Hristian Kirtchev <kirtchev@adacore.com> gcc/ada/ * sem_ch8.adb (Analyze_Object_Renaming): Obtain the object being renamed using routine Get_Object_Name which takes care of various name forms. (Get_Object_Name): New routine. From-SVN: r273387
2019-07-11[Ada] Compile-time evaluation of predicate checksEd Schonberg2-0/+107
This patch recognizes case of dynamic predicates on integer subtypes that are simple enough to be evaluated statically when the argument is itself a literal. Even though in many cases such predicate checks will be removed by the back-end with any level of optimization, it is preferable to perform this constant folding in the front-end, wich also cleans up the output of CCG, as well as producing explicit warnings when the test will fail. 2019-07-11 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * exp_ch6.adb (Can_Fold_Predicate_Call): New function, subsidiary of Expand_Call_Helper, to compute statically a predicate check when the argument is a static integer. gcc/testsuite/ * gnat.dg/predicate11.adb: New testcase. From-SVN: r273386
2019-07-11[Ada] Link error due to negated intrinsic comparisonHristian Kirtchev2-2/+12
This patch corrects the resolution of operator "not" when the expression being negated is an equality operator to prevent the transformation of an intrinsic equality operator into a function call. 2019-07-11 Hristian Kirtchev <kirtchev@adacore.com> gcc/ada/ * sem_res.adb (Resolve_Op_Not): Do not rewrite an equality operator into a function call when the operator is intrinsic. gcc/testsuite/ * gnat.dg/equal9.adb: New testcase. From-SVN: r273385
2019-07-11[Ada] Fix crash on dynamic predicate when generating SCOsThomas Quinot2-2/+12
A pragma Check for Dynamic_Predicate does not correspond to any source construct that has a provisionally-disabled SCO. 2019-07-11 Thomas Quinot <quinot@adacore.com> gcc/ada/ * sem_prag.adb (Analyze_Pragma, case pragma Check): Do not call Set_SCO_Pragma_Enabled for the dynamic predicate case. gcc/testsuite/ * gnat.dg/scos1.adb: New testcase. From-SVN: r273384
2019-07-11[Ada] Missing finalization of private protected typeHristian Kirtchev6-117/+129
This patch updates the analysis of protected types to properly mark the type as having controlled components when it contains at least one such component. This in turn marks a potential partial view as requiring finalization actions. ------------ -- Source -- ------------ -- types.ads with Ada.Finalization; use Ada.Finalization; package Types is type Ctrl_Typ is new Controlled with null record; procedure Finalize (Obj : in out Ctrl_Typ); type Prot_Typ is limited private; private protected type Prot_Typ is private Comp : Ctrl_Typ; end Prot_Typ; end Types; -- types.adb with Ada.Text_IO; use Ada.Text_IO; package body Types is procedure Finalize (Obj : in out Ctrl_Typ) is begin Put_Line ("finalize"); end Finalize; protected body Prot_Typ is end Prot_Typ; end Types; -- main.adb with Types; use Types; procedure Main is Obj : Prot_Typ; begin null; end Main; 2019-07-11 Hristian Kirtchev <kirtchev@adacore.com> gcc/ada/ * exp_util.ads, exp_util.adb (Needs_Finalization): Move to Sem_Util. * sem_ch9.adb (Analyze_Protected_Definition): Code cleanup. Mark the protected type as having controlled components when it contains at least one such component. * sem_util.ads, sem_util.adb (Needs_Finalization): New function. From-SVN: r273383
2019-07-11[Ada] New Repinfo.Input unit to read back JSON representation info.Eric Botcazou8-2/+1503
For some time the Repinfo unit has been able to output the representation information in the JSON data interchange format in addition to the usual text and binary formats. The new Repinfo.Input unit makes it possible to read back this information under this format and make it available to clients, the main one being ASIS. The big advantage of using this approach over manipulating a binary blob is that the writer and the reader of the JSON representation need not be binary compatible, i.e. in practice need not be the same version of the compiler or ASIS for the same target. The patch also adds a -gnatd_j switch to read back the information in the compiler itself, which makes it easy to keep the writer and the reader in sync using only one tool, namely the compiler. The typical usage is: gcc -c p.ads -gnatR4js gcc -c p.ads -gnatd_j to exercise respectively the writer and the reader from the compiler. 2019-07-11 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * alloc.ads (Rep_JSON_Table_Initial): New constant. (Rep_JSON_Table_Increment): Likewise. * debug.adb: Document -gnatd_j switch. * gcc-interface/Make-lang.in (GNAT_ADA_OBJS): Add repinfo-input.o. * gnat1drv.adb: Add with clause for Repinfo.Input. Add with and use clauses for Sinput. (Read_JSON_Files_For_Repinfo): New procedure. (Gnat1drv1): Deal with -gnatd_j switch. * repinfo-input.ad[sb]: New unit. * snames.ads-tmpl (Name_Discriminant): New constant. (Name_Operands): Likewise. From-SVN: r273382
2019-07-11[Ada] No warning for guaranteed accessibility check failuresJustin Squirek2-5/+25
This patch corrects the generation of dynamic accessibility checks which are guaranteed to trigger errors during run time so as to give the user proper warning during unit compiliation. 2019-07-11 Justin Squirek <squirek@adacore.com> gcc/ada/ * checks.adb (Apply_Accessibility_Check): Add check for constant folded conditions on accessibility checks. gcc/testsuite/ * gnat.dg/access7.adb: New testcase. From-SVN: r273381
2019-07-11[Ada] GNAT.Threads: Add a Get_Thread overload taking a Task_IdArnaud Charlet3-3/+15
2019-07-11 Arnaud Charlet <charlet@adacore.com> gcc/ada/ * libgnarl/g-thread.ads, libgnarl/g-thread.adb (Get_Thread): Update comments. Add new version taking a Task_Id. From-SVN: r273380
2019-07-11[Ada] Elaboration order v4.0 and infinite loopsHristian Kirtchev13-6/+246
This patch introduces binder switch -d_S which prompts the various phases of the elaboration order mechanism to output a short message concerning their commencement and completion. The output is useful when trying to determine whether a phase is stuck in an infinite loop. ------------ -- Source -- ------------ -- main.adb procedure Main is begin null; end Main; ---------------------------- -- Compilation and output -- ---------------------------- $ gnatmake -q main.adb -bargs -d_S -d_V elaborating units... collecting units... units collected. constructing library graph... validating library graph... library graph validated. library graph constructed. constructing invocation graph... validating invocation graph... invocation graph validated. invocation graph constructed. augmenting library graph... library graph augmented. discovering components... components discovered. validating elaboration order... elaboration order validated. units elaborated. 2019-07-11 Hristian Kirtchev <kirtchev@adacore.com> gcc/ada/ * bindo.adb: Update the section of switches and debugging elaboration issues. * bindo.ads: Add type Elaboration_Phase. * bindo-augmentors.adb: Add use clause for Bindo.Writers.Phase_Writers. (Augment_Library_Graph): Signal the start and end of the aubmentation phase. * bindo-builders.adb: Add with and use clause for Bindo.Writers. Add use clause for Bindo.Writers.Phase_Writers. (Build_Invocation_Graph): Signal the start and end of the invocation graph construction phase. (Build_Library_Graph): Signal the start and end of the library graph construction phase. * bindo-diagnostics.adb: Add use clause for Bindo.Writers.Phase_Writers. (Diagnose_Cycle): Signal the start and end of the cycle diagnostic phase. * bindo-elaborators.adb: Add use clause for Bindo.Writers.Phase_Writers. (Elaborate_Units): Signal the start and end of the unit elaboration phase. * bindo-graphs.adb: Add use clause for Bindo.Writers.Phase_Writers. (Find_Components): Signal the start and end of the component discovery phase. (Find_Cycles): Signal the start and end of the cycle discovery phase. * bindo-units.adb: Add with and use clause for Bindo.Writers. Add use clause for Bindo.Writers.Phase_Writers. (Collect_Elaborable_Units): Signal the start and end of the unit collection phase. * bindo-validators.adb: Add with and use clause for Bindo.Writers. Add use clause for Bindo.Writers.Phase_Writers. (Validate_Cycles, Validate_Elaboration_Order, Validate_Invocation_Graph, Validate_Library_Graph): Signal the start and end of the libray graph validation phase. * bindo-writers.ads, bindo-writers.adb: Add new nested package Phase_Writers. * debug.adb: Update the documentation of switch d_S. From-SVN: r273379
2019-07-11[Ada] Avoid spurious warning on wrong order of operator call argumentsYannick Moy2-1/+11
GNAT issues a warning under -gnatwa when actuals for a call are named like the formals, but in a different order. This is inappropriate for calls to operators in infix form, when e.g. Right <= Left is in general the intended order. Special case calls to operators to avoid that spurious warning. 2019-07-11 Yannick Moy <moy@adacore.com> gcc/ada/ * sem_res.adb (Check_Argument_Order): Special case calls to operators. gcc/testsuite/ * gnat.dg/warn21.adb, gnat.dg/warn21.ads: New testcase. From-SVN: r273378
2019-07-10[Ada] System.Strings.Stream_Ops: do not depend on Stream_IODmitriy Anisimkov2-1/+6
Dependence was only from Ada.Streams.Stream_IO.End_Error exception which is renaming of the Ada.IO_Exceptions.End_Error. Use Ada.IO_Exceptions.End_Error directly. 2019-07-10 Dmitriy Anisimkov <anisimko@adacore.com> gcc/ada/ * libgnat/s-ststop.adb: Remove System.Strings.Stream_Ops dependence on System.Streams.Stream_IO. From-SVN: r273353
2019-07-10[Ada] Spurious run-time error with 64-bit modular typesEd Schonberg2-1/+26
As a lexical element an integer literal has type Universal_Integer, i.e is compatible with any integer type. This is semantically consistent and simplifies type checking and subsequent constant folding when applicable. An exception is caused by 64-bit modular types, whose upper bound is not representable in a non-static context that will use 64-bit integers at run-time. For such cases we need to preserve the information that the analyzed literal has that modular type. For simplicity we preseve the information for all integer literals that result from a modular operation. This happens after prior analysis (or construction) of the literal, and after type checking and resolution. 2019-07-10 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * sem_ch2.adb (Analyze_Integer_Literal): Preserve the type of the literal if prior analysis determined that its type is a modular integer type. gcc/testsuite/ * gnat.dg/modular5.adb: New testcase. From-SVN: r273352
2019-07-10[Ada] Do not attempt to re-arm guard page on x86_64-vx7(r2)Doug Rupp2-1/+5
A change in the API prohibits accessing Tcb fields directly. The bug in VxWorks7 (failure to re-arm the guard page) now appears to be fixed, so this is no long necessary. 2019-07-10 Doug Rupp <rupp@adacore.com> gcc/ada/ * init.c: Do not attempt to re-arm guard page on x86_64-vx7(r2). From-SVN: r273351
2019-07-10[Ada] Crash on aggregate for limited type in extended returnEd Schonberg2-4/+16
This patch fixes a compiler abort on an extended return statement whose expression is an aggregate (to be built in place) for a discriminated record with a limited component. The build-in-place mechanism creates an access type and a renaming declaration through which individual components are assigned. The renamed object is constrained because it is limited, and the renaming declaration does not need to create a local subtype indication for it, which may lead to type mismatches in the back-end, and is in any case redundant. This patch extends this optimization to the case of records that are limited only because of a limitied component, and not because they are explicit declared limited. 2019-07-10 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * sem_ch8.adb (Check_Constrained_Object): A record that is limited because of the presence of a limited component is constrained, and no subtype indiciation needs to be created for it, just as is the case for declared limited records. gcc/testsuite/ * gnat.dg/limited3.adb, gnat.dg/limited3_pkg.adb, gnat.dg/limited3_pkg.ads: New testcase. From-SVN: r273350
2019-07-10[Ada] Fix spurious messages on global variables for SPARK pointer supportYannick Moy4-2/+76
Pointer support in GNATprove leads to spurious messages about global variables, with local variables declared in local packages and protected components. Now fixed. There is no impact on compilation. 2019-07-10 Yannick Moy <moy@adacore.com> gcc/ada/ * sem_aux.adb, sem_aux.ads (Is_Protected_Operation): New function to determine if a subprogram is protected. * sem_spark.adb (Setup_Protected_Components): New procedure to add protected components to the environment. (Check_Callable_Body): Call the new Setup_Protected_Components. (Check_Package_Spec): Merge local environment with enclosing one when done. From-SVN: r273349
2019-07-10[Ada] Fix possible crashes in GNATprove analysis of pointersClaire Dross2-20/+124
The new analysis of SPARK pointer rules could crash on some constructs. Now fixed. There is no impact on compilation. 2019-07-10 Claire Dross <dross@adacore.com> gcc/ada/ * sem_spark.adb (Check_Expression): Allow digits constraints as input. (Illegal_Global_Usage): Pass in the entity. (Is_Subpath_Expression): New function to allow different nodes as inner parts of a path expression. (Read_Indexes): Allow concatenation and aggregates with box expressions. Allow attributes Update and Loop_Entry. (Check_Expression): Allow richer membership test. (Check_Node): Ignore bodies of generics. (Get_Root_Object): Allow concatenation and attributes. From-SVN: r273348
2019-07-10[Ada] Spurious error on discriminant of incomplete typeHristian Kirtchev2-1/+6
This patch corrects the conformance verification of discriminants to provide symmetry between the analysis of incomplete and full view discriminants. As a result, types of discriminants always resolve to the proper view. 2019-07-10 Hristian Kirtchev <kirtchev@adacore.com> gcc/ada/ * sem_ch6.adb (Check_Discriminant_Conformance): Use Find_Type to discover the type of a full view discriminant. gcc/testsuite/ * gnat.dg/incomplete7.adb, gnat.dg/incomplete7.ads: New testcase. From-SVN: r273347
2019-07-10[Ada] Improve gnatmem's doc for the depth switchArnaud Charlet2-8/+14
2019-07-10 Arnaud Charlet <charlet@adacore.com> gcc/ada * doc/gnat_ugn/gnat_and_program_execution.rst: Improve gnatmem's doc for the depth switch. From-SVN: r273346
2019-07-10[Ada] GNATpp: document the --source-line-breaks switchBob Duff2-0/+13
2019-07-10 Bob Duff <duff@adacore.com> gcc/ada/ * doc/gnat_ugn/gnat_utility_programs.rst: Document gnatpp's --source-line-breaks switch. From-SVN: r273345
2019-07-10[Ada] Documentation of Img attribute out of dateJustin Squirek6-18/+31
2019-07-10 Justin Squirek <squirek@adacore.com> gcc/ada/ * doc/gnat_rm/implementation_defined_attributes.rst: Add mention of 'Image attribute with 'Img's entry to mention additional added 2012 usage of Obj'Image. * doc/gnat_rm/implementation_defined_pragmas.rst: Correct mispelling of Async_Writers. * gnat_rm.texi: Regenerate. * sem_prag.adb (Analyze_Pragma): Correct mispelling of Async_Writers. * sem_util.adb (State_Has_Enabled_Property): Correct mispelling of Async_Writers. From-SVN: r273344
2019-07-10[Ada] Entity names are not uniqueSimon Buist3-0/+12
This patch updates the Unique_Name procedure in order to prefix the string "ada___" to child units that have a nested subprogram or package, so that they do not clash with a parent package of the same name. This is for GNATprove only and does not affect regular compilation. 2019-07-10 Simon Buist <buist@adacore.com> gcc/ada/ * sem_util.ads (Child_Prefix): New constant. * sem_util.adb (Unique_Name): Add a special prefix to child units that have a nested subprogram or package. From-SVN: r273343
2019-07-10[Ada] Add an annotation for static analysisArnaud Charlet2-0/+5
2019-07-10 Arnaud Charlet <charlet@adacore.com> gcc/ada/ * sfn_scan.adb (Scan_SFN_Pragmas): Add pragma Assert. From-SVN: r273342
2019-07-10[Ada] Spelling mistakes in error messagesHristian Kirtchev2-17/+24
This patch updates certain error messages to eliminate spelling mistakes. No need for a test as this is a minor cosmetic fix. 2019-07-10 Hristian Kirtchev <kirtchev@adacore.com> gcc/ada/ * sem_ch3.adb (Check_Nonoverridable_Aspects): Correct the spelling in certain error messages. (Check_Pragma_Implemented): Correct the spelling in certain error messages. From-SVN: r273341
2019-07-10[Ada] Improve support for tuning branch probability heuristicsEric Botcazou5-160/+260
This adds a new GNAT.Branch_Prediction package to make it possible to tune the branch probability heuristics more finely. This package contains the equivalent of __builtin_expect in C/C++ plus a couple of specializations. The following program gives a summary of the usage: package Q is I : Integer; pragma Volatile (I); end Q; with GNAT.Branch_Prediction; use GNAT.Branch_Prediction; with Text_IO; use Text_IO; with Q; use Q; procedure P is begin if Unlikely (I = 0) then Put_Line ("Zero was passed"); return; end if; if Likely (I > 0) then Put_Line ("A positive number was passed"); else Put_Line ("A negative number was passed"); end if; if Expect ((I rem 2) = 0, False) then Put_Line ("An even number was passed"); else Put_Line ("An odd number was passed"); end if; end; 2019-07-10 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * Makefile.rtl (GNATRTL_NONTASKING_OBJS): Add g-brapre. * libgnat/g-brapre.ads: New package specification. * doc/gnat_rm/the_gnat_library.rst: Document it. * gnat_rm.texi: Regenerate. From-SVN: r273340
2019-07-10[Ada] Allow multiple units per file in GNATproveYannick Moy2-15/+20
For analysis tools that rely on information generated in ALI files, but do not generate object files, the frontend did not generate the special extension names like file~2.ali for unit 2 in the file. This is needed to be able to analyze files with multiple units. Now fixed. There is no impact on compilation. 2019-07-10 Yannick Moy <moy@adacore.com> gcc/ada/ * osint-c.adb (Set_File_Name): Always add extension for multiple units per file mode. From-SVN: r273339
2019-07-10[Ada] sysdep.c: correct include directives orderingCorentin Gay2-1/+6
Some VxWorks headers are relying on types that are defined in `vxWorks.h` but do not include it themselves, we move the include directive for `vxWorks.h` at the top of the include directives. 2019-07-10 Corentin Gay <gay@adacore.com> gcc/ada/ * sysdep.c: Put include directive for 'vxWorks.h' before any other VxWorks headers. From-SVN: r273338
2019-07-10[Ada] GNAT RM: add note about debuggers for Scalar_Storage_OrderEric Botcazou3-16/+28
2019-07-10 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * doc/gnat_rm/implementation_defined_attributes.rst (Scalar_Storage_Order): Minor tweaks. Add note about debuggers. * gnat_rm.texi: Regenerate. From-SVN: r273337
2019-07-10[Ada] Spurious error on case expression with limited resultHristian Kirtchev2-3/+14
This patch modifies the expansion of case expressions to prevent a spurious error caused by the use of assignment statements to capture the result of the case expression when the associated type is limited. 2019-07-10 Hristian Kirtchev <kirtchev@adacore.com> gcc/ada/ * exp_ch4.adb (Expand_N_Case_Expression): Mark the generated assignments to the temporary result as being OK because the expansion of case expressions is correct by construction. (Is_Copy_Type): Update the predicate to match the comment within. gcc/testsuite/ * gnat.dg/limited2.adb, gnat.dg/limited2_pack_1.adb, gnat.dg/limited2_pack_1.ads, gnat.dg/limited2_pack_2.adb, gnat.dg/limited2_pack_2.ads: New testcase. From-SVN: r273336