[Ada] Add internal abstraction for standard string test

2014-08-04 Thread Arnaud Charlet
This adds an internal abstraction for testing for standard string types. Internal front end cleanup, no function effect, no test required. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-08-04 Robert Dewar * einfo.ads, einfo.adb (Is_Standard_String_Type): New function.

[Ada] Spurious elaboration warning on added postcondition call

2014-08-04 Thread Arnaud Charlet
This patch removes a spurious elaboration warning on some calls to postconditions. Such a call always appears within an enclosing body, and as such is not subject to an elaboration check, but the call that is inserted after the final (inserted) return statement in a procedure body is analyzed in th

[Ada] Support for hash based message authentication codes

2014-08-04 Thread Arnaud Charlet
This change introduces a new subprogram in the GNAT secure hash framework to allow computing HMACs based on the secure hash functions. This is achieved by initializing a context with a (non-empty) key. The following example shows how to compute the first HMAC-MD5 test from RFC2104: $ gnatmake -q

[Ada] Use of discriminants in derived types for SPARK 2014

2014-08-04 Thread Arnaud Charlet
This patch implements the following rules related to the discriminants of derived types: The type of a discriminant_specification shall be discrete. A discriminant_specification shall not occur as part of a derived type declaration whose parent type is discriminated. -- Sou

[Ada] Aspect/pragma SPARK_Mode in generic

2014-08-04 Thread Arnaud Charlet
This patch allows the uses of aspect/pragma SPARK_Mode in generic units. It also implements the following rule concerning the interplay between instances and SPARK_Mode "off": However, if an instance of a generic unit is enclosed by code where SPARK_Mode is Off and if any SPARK_Mode specific

[Ada] Crash on entry call with limited view of synchronized object

2014-08-04 Thread Arnaud Charlet
The prefix of an entry call may be a limited view, in which case the expansion of the call must use the non-limited view, which is available at the point of an entry call. The following must compile quietly: gcc -c railway-train.adb --- package Railway is end Railway; --- limited with Railway

[Ada] Add documentation for aspect Invariant'Class

2014-08-04 Thread Arnaud Charlet
Documentation change only, no test required Tested on x86_64-pc-linux-gnu, committed on trunk 2014-08-04 Robert Dewar * gnat_rm.texi: Add section on aspect Invariant'Class. Index: gnat_rm.texi === --- gnat_rm.texi

[Ada] Aspect Import with a value of False

2014-08-04 Thread Arnaud Charlet
In Ada 2012, boolean aspects are True by default, but can specify explicitly a value of False. In the case of an Import aspect, this indicates that the corresponding entity must have a completion in Ada, and not in the language specified in a Convention aspect. Compiling main.adb must yield:

[Ada] Freezing subprogram that returns a limited view

2014-08-04 Thread Arnaud Charlet
This patch handles properly a function declared in package A that returns the limited view of a type declared in package B, when the function is called from a context that has with_clauses on A and B. Previous to this patch such a call would crash the compiler because of a misplaced freeze node. T

[Ada] Make sure Do_Range_Check flag is set when needed on OUT parameter

2014-08-04 Thread Arnaud Charlet
In -gnatc or GNATprove mode, there were cases in which the Do_Range_Check flag was not set on an OUT parameter, causing e.g. GNAT prove to miss the requirement for proving that an out parameter result was in range. This is now corrected, the following test, compiled in -gnatd.F (GNATprove mode) wi

[Ada] Aspect/pragma Default_Initial_Condition

2014-08-04 Thread Arnaud Charlet
This patch implements aspect/pragma Default_Initial_Condition. The construct has the following semantics and runtime behavior: The Default_Initial_Condition aspect is introduced by an aspect_specification where the aspect_mark is Default_Initial_Condition. The aspect may be specified only as part

[Ada] Type invariant procedure called on an uninitialized object

2014-08-04 Thread Arnaud Charlet
The compiler can generate a call to a type's invariant-checking procedure on an uninitialized object, such as a temporary object created for holding an aggregate. This is prevented by inhibiting the call when No_Initialization is set on the object. The following test must compile and execute quiet

[Ada] Apply special expansion in GNATprove mode also for pre-analysis

2014-08-04 Thread Arnaud Charlet
Some expression are only pre-analyzed in GNATprove mode, like default expressions and assertions. These also need to be light-expanded for formal verification. This is the second commit attempt, as the first one failed to build GNAT due to a bug. Tested on x86_64-pc-linux-gnu, committed on trunk

[Ada] New defaults for some project attributes

2014-08-04 Thread Arnaud Charlet
Some of the project attributes have new defaults that are no longer the empty string of the empty string list. These defaults are used as values of attribute references when the attribute has not been declared. Object_Dir has as default ".". Exec_Dir has as default Object_Dir, as previously specifi

[Ada] Make sure that range check flag is set on real-integer conversions

2014-08-04 Thread Arnaud Charlet
This change makes sure that the Do_Range_Check flag is set in -gnatc or GNATprove mode for type conversions from real to integer. This makes sure that SPARK2014 programs properly verify that such conversions cannot raise an exception due to an out of range value. The following test compiled with -g

[Ada] Reject illegal use of 'Old in complex postcondition.

2014-08-04 Thread Arnaud Charlet
A postcondition whose expression is a short-circuit is broken down into individual aspects in order to provide better exception reporting. This transformation is performed syntactically, before any analysis. The original short-circuit expression is rewritten as its second operand, and an occurrence

[Ada] Remove unnecessary range checks

2014-08-04 Thread Arnaud Charlet
This change removes some unnecessary range checks. The following test compiled with -gnatdt -gnatc: 1. procedure RCInteger (X : Integer) is 2.type YT is new Integer; 3.Y : constant YT := YT(X) * YT(X); 4. begin 5.null; 6. end; generates a tree file that h

[Ada] Wrong source locations in the profile of an instantiated subprogram

2014-08-04 Thread Arnaud Charlet
This patch modifies the formal subprogram instantiation machinery to preserve the source locations of all formal parameters when creating the corresponding renaming declaration. No reproducer as this requires ASIS. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-08-04 Hristian Kirtchev

[Ada] Equality and class-wide instantiations with a defaulted equality

2014-08-04 Thread Arnaud Charlet
This patch modifies the implementation of AI05-0071 to allow several special cases of equality to appear in instantiations where a formal type has unknown discriminants, a defaulted equality and the actual type is class-wide. -- Source -- -- equals_gen.ads generic t

Re: [Ada] Remove xgnatugn in doc generation

2014-08-01 Thread Arnaud Charlet
> > 2014-08-01 Arnaud Charlet > > > > * ug_words, xgnatugn.adb, gcc-interface/Make-lang.in: Remove > > xgnatugn.adb and ug_words. > > Could you check if this needs any changes to the support in > update_web_docs_svn for generating the online manuals,

[Ada] Fix breach of privacy with type derived from private discriminated

2014-08-01 Thread Arnaud Charlet
This fixes a breach of privacy for types derived from private discriminated record types whose full view has no discriminants, as well as factors out the code doing the full derivation in the various cases into a single child procedure of Build_Derived_Private_Type. As a consequence, this removes

[Ada] Crash on generic instance with class-wide actual

2014-08-01 Thread Arnaud Charlet
This patch reimplements part of the support for AI05-0071 which deals with generic/instance scenarios involving a formal type with unknown discriminants, a generic primitive operation of the formal type declared with a box and an actual class-wide type. -- Source -- --

[Ada] Minor internal cleanup

2014-08-01 Thread Arnaud Charlet
Underlying_Type now recursively goes down the chain of private derivations, including the Underlying_Full_View if any, so we call it instead of making the descent manually in Build_Initialization_Call. No functional changes. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-08-01 Eric Botc

[Ada] Access types that designate limited views of types with tasks.

2014-08-01 Thread Arnaud Charlet
This patch fixes the handling of access types whose designated types are limited views of untagged types with tasks. executing the following: gnatmake -q main.adb main must yield: Task started Task started --- with Package_Common; use Package_Common; with Package_A; use Package_A;

[Ada] Crash on entry call with preconditions and access parameters

2014-08-01 Thread Arnaud Charlet
When an entry has preconditions, the entry call is wrapped in a procedure call that incorporates the precondition checks. To prevent a double expansion, with possible duplication of extra formals, that procedure call must only be pre- nalyzed and resolved. Expansion takes place upon return to the c

[Ada] Parameterless calls to protected operations on selected components.

2014-08-01 Thread Arnaud Charlet
A multi-level selected component can designate a call to a parameterless protected operation whose target object is itself given by a selected component. When the node is rewritten as a function call, it is necessary to preserve the tree structure of the name, so that overload information and subse

[Ada] Improved handling of info messages

2014-08-01 Thread Arnaud Charlet
The count of info messages is now separated from the count of warnings and -gnatwe never turns info messages into errors. The following compiles as shown, and generates object code since no error is found when compilation options -gnatwe -gnatld7 -gnatj55 are used. Compiling: infoerr.adb 1.

[Ada] Give missing entity messages in -gnatc mode

2014-08-01 Thread Arnaud Charlet
This patch forces expansion on (but not actual code generation) for configurable run time mode or no run time mode in -gnatc mode. This means that we get error messages about unsupported features even in -gnatc mode, which was not true before. The following is compiled in -gnatc mode with a gnat.ad

Re: [Ada] Don't unconditionally define _LARGEFILE_SOURCE

2014-08-01 Thread Arnaud Charlet
> 2014-08-01 Pascal Obry > > * cstreams.c: Only enable large file support on know supported > platforms. Add missing defines/includes. > > broke Ada bootstrap on Solaris: > > /vol/gcc/src/hg/trunk/local/gcc/ada/cstreams.c:34:0: error: > "_LARGEFILE_SOURCE" redefined [-Werror]

[Ada] Conformance checking in instantiations

2014-08-01 Thread Arnaud Charlet
Within an instance, a subprogram declaration and the corresponding body may be fully conformant, but one may use in its profile a formal type while the other uses a declared subtype of that formal. The routine Same_Generic_Actual is used to recognize this case and prevent a spurious conformance err

[Ada] Spurious warning on generated with_clause for renamed unit

2014-08-01 Thread Arnaud Charlet
This patch suppresses spurious warnings that may be generated when the prefix of a with_clause for a child unit denotes the renaming of a parent unit. Such renamings generate internal with_clauses that are not marked Implicit_With because they must be properly installed as part of the context, but

[Ada] Add support for non-capturing parenthesis in GNAT.Regpat

2014-08-01 Thread Arnaud Charlet
It is now possible to use the (?:...) syntax to group elements in a regular expression without making their matched substring available in the Match_Array. The following test must output: Matched (0)= 1.. 6 Matched (1)= 5.. 5 Matched (2)= 0.. 0 with GNAT.Regpat; use GNAT.Regpat;

[Ada] Legality checks involving aspect Import

2014-08-01 Thread Arnaud Charlet
This patch adds some missing legality checks on uses of aspect Import. These checks were performed properly in the presence of pragmas, but were incomplete when using aspects. Compiling q.ads must yield: q.ads:2:28: imported entities cannot have explicit initialization (RM 8.1 (24)) q.ads:6:24: n

[Ada] Improve messages for lack of inlining in GNATprove mode

2014-08-01 Thread Arnaud Charlet
Expression functions with a separate declarations should never be inlined in GNATprove mode, hence no message should be issued for these. Correct a problem in call resolution which lead to such a message. Also change the message for lack of inlining in GNATprove mode, so that an info message is iss

[Ada] Generate Machine, Model and Rounding FP attributes in line

2014-08-01 Thread Arnaud Charlet
This change makes it so that the Machine, Model and Rounding FP attributes are generated in line by the compiler (in conjunction with a conversion to an integer type for the third) and optimized on architectures that do not make use of internal extended precision in the FPU. The following function

[Ada] Remove xgnatugn in doc generation

2014-08-01 Thread Arnaud Charlet
removes the preprocessing step needed to generate gnat_ugn.info. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-08-01 Arnaud Charlet * ug_words, xgnatugn.adb, gcc-interface/Make-lang.in: Remove xgnatugn.adb and ug_words. Index: ug_words

[Ada] More VMS clean ups

2014-08-01 Thread Arnaud Charlet
In various parts of the front-end. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-08-01 Robert Dewar * inline.adb, inline.ads, fe.h, einfo.adb, einfo.ads, sem_util.adb, sem_util.ads, exp_ch4.adb, exp_ch11.adb, exp_ch6.adb, cstand.adb, sem_mech.adb, sem_ch6.adb,

[Ada] Remove VMS handling in most tools

2014-08-01 Thread Arnaud Charlet
Continuation of VMS removal in the GNAT front-end. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-08-01 Arnaud Charlet * binde.adb, bindgen.adb, butil.adb, clean.adb, gnatbind.adb, gnatchop.adb, gnatcmd.adb, gnatls.adb, gnatname.adb, krunch.adb, make.adb

[Ada] Remove VMS specific files

2014-07-31 Thread Arnaud Charlet
This is part of the Ada front-end clean ups related to the removal of VMS support. More changes to come. Note: I've removed the boring deletions from the diff. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-07-31 Arnaud Charlet * s-auxdec-vms-ia64.adb, s-parame-vms-alph

[Ada] Remove -gnatdm flag

2014-07-31 Thread Arnaud Charlet
As a first step in removing specific support for the no-longer supported VMS port of GNAT, this patch removes the -gnatdm flag which allowed testing of VMS-specific tests on non-VMS platforms. The test suite has been adjusted appropriately, no additional test is required. Tested on x86_64-pc-linux

[Ada] Add support for files > 2Gb on 32bit platforms.

2014-07-31 Thread Arnaud Charlet
This patch set adds support for file larger than 2Gb on 32bit platforms. The main visible change is that Stream_Element_Offset is now a 64bit type on all platforms. The other changes are internal only. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-07-31 Pascal Obry * a-stream

[Ada] SPARK property "effectively volatile" and its effects

2014-07-31 Thread Arnaud Charlet
This patch implements SPARK property "effectively volatile" which states: In SPARK 2014, the terms volatile type and volatile object are defined as per Ada RM C.6(8/3). An effectively volatile type is a volatile type or an array type to which the Volatile_Components aspect has been applie

[Ada] Avoid unwanted overflow checks on unconstraint float operations

2014-07-31 Thread Arnaud Charlet
For operations on unconstrained floating-point values, we do not want overflow checks (since we expect to generate and handle IEEE INF and NaN values). This corrects a problem where such checks were being set if integer overflow was enabled. The following test when executed: 1. with Ada.Float

[Ada] Avoid random warnings treated as errors

2014-07-31 Thread Arnaud Charlet
There may be cases when warnings in the Project Manager are treated as errors, even when the switch -we is not used. There is no test, as the occurences of such errors are random (unitialized component of a record). Tested on x86_64-pc-linux-gnu, committed on trunk 2014-07-31 Vincent Celier

[Ada] Legality checks on indexing aspects

2014-07-31 Thread Arnaud Charlet
This patch implements the legality rules given in RM 4.1.6 on user-defined indexing, most importantly the rule that the aspects cannot be specified for a derived type if the parent type has such defined or inherited aspects. Several reports include this illegal usage, which appears to be an intui

[Ada] Warnings on non-static components of protected types

2014-07-31 Thread Arnaud Charlet
This patch improves the warnings on component of protected types when compiled under restriction No_Heap_allocations. The patch distinguishes betwen: a) components whose size depends on discriminants, in which case an object of the type will not violate restriction if the discriminants have stati

[Ada] Crash on illegal discrete range

2014-07-31 Thread Arnaud Charlet
With this patch the compiler rejects properly a discrete range in a loop specification that uses 'length by mistake. Compiler lab4.adb must yield: lab4.adb:13:23: expect attribute "range" --- package body lab4 is procedure createArray (myArr : in out dynArray; maxIndex : Integer) is

[Ada] Handle =>+ notation for Depends pragma/aspect

2014-07-31 Thread Arnaud Charlet
The Depends pragma/aspect uses + in a non-standard manner, which requires new handling for the -gnatyt token check, as shown by this test, compiled with -gnatl -gnatyt 1. package DependsStyle is 2.procedure P1 3. (A : in out Integer; B : Integer) 4. with Depends =

[Ada] Interplay between limited with clauses, abstract states and refinement

2014-07-31 Thread Arnaud Charlet
This patch corrects the mechanism which handles limited with clauses to semi- declare abstract states (the states are fully declared when Abstract_States is analyzed). The end result is that multiple limited with clauses now reference one unique entity which denotes the state. -- Sour

[Ada] More precise setting of Do_Overflow_Check flag for division

2014-07-31 Thread Arnaud Charlet
The Do_Overflow_Check flag was being set on division operators in many cases where it was not needed. Now the flag will be set only if there is a possibility of the (largest neg number) / (-1) case and this only if code is not being generated (-gnatc mode), since if code is generated, the check is

[Ada] Crash on complex conditional involving a packed array indexing

2014-07-31 Thread Arnaud Charlet
This patch updates the freezing of expressions to account for a case when the freezing expression is part of the Actions list of a N_Expression_With_Actions node. In this case, any freeze nodes must remain in the Actions list. -- Source -- -- use_before_decl.adb with A

[Ada] Do not fail program when runtime dir cannot be found

2014-07-31 Thread Arnaud Charlet
When a runtime specified as a relative or full path in package Builder of the main project, instead of failing the program immediately, the Project Manager raises an exception. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-07-31 Vincent Celier * prj-pars.adb, prj-conf.ads, pr

[Ada] Overflow checking is now on by default

2014-07-31 Thread Arnaud Charlet
All previous versions of GNAT have set overflow checking off by default (with -gnato switches to enable overflow checking). This update sets the default to checking on, and implements a new switch -gnato0 to turn overflow checking on. The old switch -gnato, which used to enable overflow checking ca

[Ada] Correct failure to detect Invariant'Class for untagged type

2014-07-31 Thread Arnaud Charlet
This fixes a problem with B test ND11001. There were actually three problems reported a) Bad use of Default_Component_Value, but this had already been previously fixed. b) Bad use of Invariant'Class, fixed as part of this patch c) Failure to detect bad aspect on null body. This was actually an i

[Ada] Excluded checked on unchecked unions

2014-07-31 Thread Arnaud Charlet
Checks that would read the value of a discriminant are suppressed on types that are unchecked unions. If such a record has components whose types have invariants, applying those checks would require determining the variant in which they reside, and this cannot be done on an unchecked union. THis pa

[Ada] Display correctly directory path names

2014-07-30 Thread Arnaud Charlet
When the Project Manager is indicating that a directory cannot be created and the full path name of the directory contains chacters that are teated specially to modify the error message, the full path name of the directory is not displayed correctly. This patch corrects the problem. Tested on x86_

[Ada] Notes from subunits incorrectly recorded in ALI files

2014-07-30 Thread Arnaud Charlet
This change fixes the way annotations coming from subunits are recorded in ALI files, so that their original source location (including the source file name of the subunit) is correctly preserved. The following commands must produce the shown output: $ gcc -c annot_separate.adb $ sed -n -e '/^U/s

[Ada] Internal cleanups in handling of subtype bounds

2014-07-30 Thread Arnaud Charlet
This change causes subtype bounds to be captured in special constant variables xxxL and xxxH, avoiding troublesome cases where the call to Force_Evaluation generated serialized temporaries that got referenced publicly. It also means that First/Last can be expanded out in more cases. No functional

[Ada] Internal cleanups in Cstand

2014-07-30 Thread Arnaud Charlet
The name of raise type was "any type", it is now "raise type" We now the name before setting other fields of standard entities, which avoids debugger blowups printing the entity when setting one of these fields. These are minor internal imrpovements for front-end debugging, no external effect, no

[Ada] Ability to compute range of floating-point expression for analyzers

2014-07-30 Thread Arnaud Charlet
Analyzers based on the frontend can benefit from knowing the range of possible values of a floating-point expression. For example, it might be useful to decide that a range check or an overflow check cannot fail. Implement such a procedure Determine_Range_R in checks.adb, similar to the existing De

[Ada] Reimplement Ada.Task_Attributes

2014-07-30 Thread Arnaud Charlet
e for task attributes holding in an address/pointer and whose Initial_Value is 0/null, which is more efficient and doesn't require the use of an indirection (and therefore, no extra dynamic memory allocation, and no locking). Tested on x86_64-pc-linux-gnu, committed on trunk 2014-07-30

[Ada] Fix race conditions related to independent tasks

2014-07-30 Thread Arnaud Charlet
This patch fixes several race conditions involving independent tasks. The main thing is to make sure the activating task waits for them to become independent. Otherwise (for example) the environment task can race ahead to Finalize_Global_Tasks and find things in an inconsistent state, causing progr

[Ada] Use Is_Inlined flag to mark fully inlined subp in GNATprove mode

2014-07-30 Thread Arnaud Charlet
In GNATprove mode, some subprograms may be partially inlined, due to recursion, or because some calls are in a potentially unevaluated context, which would lead to code that GNATprove would not be able to handle. In those cases, the body-to-inline has been built, and potentially already be inlined.

[Ada] Forbid the use of <> in attribute 'Update

2014-07-30 Thread Arnaud Charlet
This patch implements the following SPARK 2014 rule: 4.4.1 (1) - The box symbol, <>, may not appear in any expression appearing in an update expression. The patch also cleans up the analysis of attribute 'Update. -- Source -- -- box_update.ads package Box_Updat

[Ada] Implement compilation date and time output and functions

2014-07-30 Thread Arnaud Charlet
This patch causes the compiler to print the compilation time in -gnatv or -gnatl mode (suppressible with debug flag -gnatd7). It also provides new functions in GNAT.Source_Info to obtain the compilation date and time (in a form compatible with the use of the C macros __DATE__ and __TIME__. Finall

[Ada] SPARK 2014 aspects should not be delayed

2014-07-30 Thread Arnaud Charlet
This patch changes the categorization of SPARK 2014 aspects from delayed to non-delayed. These aspects are equivalent to source pragmas which appear after their related constructs. To deal with forward references, the generatd pragmas are stored in N_Contract nodes and later analyzed at the end of

[Ada] Front-end inlining in GNATprove mode

2014-07-30 Thread Arnaud Charlet
In GNATprove mode, all subprograms are candidates for front-end inlining, to simplify proofs. This patch extends this transformation to subprogam bodies that do not have a previous subprogram declaration. In this case the compiler builds a declaration, transfers aspects, if any, from body to decla

[Ada] Add query function to distinguish code of inlining from instances

2014-07-30 Thread Arnaud Charlet
In GNATprove, we need to distinguish code form inlined subprograms and code from generic instances, based on their source locations, to have better messages. This new query does precisely this. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-07-30 Yannick Moy * sinput.ads, sinp

[Ada] New unit GNAT.Formatted_String providing C/C++ format string support

2014-07-30 Thread Arnaud Charlet
The following code: with Ada.Text_IO; use Ada.Text_IO; with GNAT.Formatted_String; use GNAT.Formatted_String; procedure Fout is F : Formatted_String := +"%c %% %#08x"; Vc : Character := 'v'; Vi : Integer := 12; begin F := F & Vc & Vi; Put_Line (-F); e

[Ada] Illegal external aspects not detected

2014-07-30 Thread Arnaud Charlet
This patch modifies the categorization of aspects Async_Readers, Async_Writers, Effective_Reads and Effective_Writes to no longer require delayed actions. This in turn ensures that the analysis of their aspect form correctly creates their pragma counterparts. -- Source --

[Ada] Improve run time performance for large array reset

2014-07-30 Thread Arnaud Charlet
This patch makes the compiler generate faster code to reset a large array of integers to 0 by means of an aggregate with a single Others choice and, more generally, to set a large array of storage units to a single value by the same means, for example: type Arr is array (1 .. 1) of Integer;

[Ada] Inheritance of variables in extending projects

2014-07-30 Thread Arnaud Charlet
A variable V declared in a project A that is extended by a project B is now inherited in project B; it can be referenced as V in project B or as B.V in any other project that imports B. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-07-30 Vincent Celier * prj-proc.adb (Importe

[Ada] Internal cleanup for Predicate_Tests_On_Arguments

2014-07-30 Thread Arnaud Charlet
Some additional cases of internal routines are now detected and skip predicate tests on arguments. Not clear if this fixes additional problems or not, but it is certainly a desirable change. No further test required. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-07-30 Robert Dewar

[Ada] Small cleanup in array aggregate handling code

2014-07-29 Thread Arnaud Charlet
This removes a subprogram which serves no useful purpose and changes the affected case to use the common code path. No functional changes. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-07-29 Eric Botcazou * exp_aggr.adb (Safe_Slice_Assignment): Remove. (Expand_Array_

[Ada] Apply proper predicate tests to OUT and IN OUT parameters

2014-07-29 Thread Arnaud Charlet
This fix is inspired by ACATS test C324002, which tests that predicate tests for OUT and IN OUT parameters are properly applied. They were missed in some cases, and applied when they should not be to Finalize procedures. The following three tests (cutdown versions of C324002) compile and execute q

[Ada] Selectively inline subprograms in GNATprove mode

2014-07-29 Thread Arnaud Charlet
For formal verification with GNATprove, frontend inlining can be used to relieve users from the need to add contracts to local subprograms. Thus, we adopt here a simple policy for inlining in GNATprove mode, which consists in inlining all local subprograms which can be inlined, as soon as they don'

[Ada] PR ada/60652 - Wrong value for System.OS_Constants.CRTSCTS

2014-07-29 Thread Arnaud Charlet
On Linux, s-oscons-tmplt.c needs to define _BSD_SOURCE in order for CRTSCTS to be visible. Otherwise the macro is undefined, and defaulted to -1. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-07-29 Thomas Quinot PR ada/60652 * s-oscons-tmplt.c: For Linux, define _BSD_

[Ada] Out parameters of a null-excluding access type in entries.

2014-07-29 Thread Arnaud Charlet
If a procedure or entry has an formal out-parameter of a null-excluding access type, there is no check applied to the actual before the call. This patch removes a spurious access check on such parameters on entry calls. Compiling and executing p.adb must yield; Procedure version did not raise

[Ada] Implement SPARK RM C.6 rules

2014-07-29 Thread Arnaud Charlet
This patch implements the following set of rules related to shared variables: 1. A volatile representation aspect may only be applied to an object_declaration or a full_type_declaration. 2. A component of a non-volatile type declaration shall not be volatile. 3. A discriminant shall

[Ada] Fix problem with Error arg for Unevaluated_Use_Of_Old

2014-07-29 Thread Arnaud Charlet
The Error option for pragma Unevaluated_Use_Of_Old was not properly recognized, due to an internal problem with the generation of the names table for the Snames package. This is now corrected, and the following program compiles as shown with -gnatld7 -gnatj60: 1. package Uneval_Old is 2.

[Ada] New pragma Default_Scalar_Storage_Order

2014-07-29 Thread Arnaud Charlet
Normally the default scalar storage order is the native order of the target. This pragma, which can be either a configuration pragma, or appear in a package spec or declarative part, can provide a default value that overrides this normal default. If used in a package spec or declarative part, it ap

[Ada] Implement static predicates for string/real types

2014-07-29 Thread Arnaud Charlet
This implements static predicates for string and real types, as defined in the RM. There is one exception, which is that the RM allows X > "ABC" as being predicate static, but since "ABC" > "ABA" is not static, that's peculiar, so we assume that this is a mistake in the RM, and that string comparis

[Ada] Cleanup handling of discrete static predicates

2014-07-29 Thread Arnaud Charlet
This is just an internal cleanup, involving some name changes and slightly cleaned up testing of flags etc. This is part of the preparation for implementing static real predicates. No functional effect. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-07-29 Robert Dewar * sem_ag

[Ada] New pragma Unevaluated_Use_Of_Old

2014-07-29 Thread Arnaud Charlet
A new pragma Unevaluated_Use_Of_Old (Error | Warn | Allow) is implemented which controls the processing of attributes Old and Loop_Entry. If either of these attributes is used in a potentially unevaluated expression e.g. the then or else parts of an if expression), then normally this usage is cons

[Ada] Missing finalization of a transient class-wide function result

2014-07-29 Thread Arnaud Charlet
This patch corrects the transient object machinery to disregard aliasing when the associated context is a Boolean expression with actions. This is because the Boolean result is always known after the action list has been evaluated, therefore the transient objects must be finalized at that point. -

[Ada] Undefined symbols when building GPS

2014-07-29 Thread Arnaud Charlet
This patch ensures that abort-related expansion generates the same amount of internal entities when aborts are allowed or are being suppressed by pragma Restriction (No_Abort_Statements). Tested on x86_64-pc-linux-gnu, committed on trunk 2014-07-29 Hristian Kirtchev * exp_ch3.adb (Def

[Ada] Interface conversions and limited_with clauses.

2014-07-29 Thread Arnaud Charlet
In conversions of prefixed calls involving interfaces, the expression in the conversion may have a limited view of a type obtained transitively through several contexts. Use the non-limited view if available, to enable subsequent interface membership tests. The following must compile quietly:

[Ada] Error handling consistency for named associations

2014-07-29 Thread Arnaud Charlet
An error occurring in a subexpression that is part of some construct in general suppresses the reporting of further errors on the same construct, to avoid noisy cascaded messages. This patch ensures that this is also the case when named associations are present. The following test case must be rej

[Ada] Constants are non-static if they fail a predicate check

2014-07-18 Thread Arnaud Charlet
If a constant is defined with a static expression, and the expression statically fails a static predicate, then the constant is not considered as being static, as shown by this updated example (see last few lines) 1. package TestSP is 2.subtype F1 is Float with -- OK 3. Sta

[Ada] Reorganize handling of predicates

2014-07-18 Thread Arnaud Charlet
This reorganizes the handling of predicates, in preparation for proper implementation of real predicates. Several minor errors are corrected and we properly reject improper static real predicates. Static string predicates are now always rejected, in line with latest ARG thinking. The following show

[Ada] Primitive operations of incomplete types

2014-07-18 Thread Arnaud Charlet
In Ada 2012, the formals of a subprogram can be incomplete types, and the subprogram is a primitive operation of the type. If the type is subsequently derived, it inherits the operation, and it can be explicitly overridden. Executing main.adb must yield: 1 2 --- with Prim_Test; use Prim_Tes

[Ada] Allows Wide_String output on Windows console

2014-07-18 Thread Arnaud Charlet
Tested on x86_64-pc-linux-gnu, committed on trunk 2014-07-18 Pascal Obry * s-crtl.ads, i-cstrea.ads (fputwc): New routine. * a-witeio.adb (Put): On platforms where there is translation done by the OS output the raw text. (New_Line): Use Put above to properly han

[Ada] Alternate output modes for GNAT.Memory_Dump

2014-07-18 Thread Arnaud Charlet
Output lines from GNAT.Memory_Dump.Dump can now be prefixed with an offset relative to the start of the dump, or have no prefix at all, instead of showing an absolute address. Test: $ gnatmake -q dump_test $ ./dump_test 00: 4C 6F 72 65 6D 20 69 70 73 75 6D 20 64 6F 6C 6F "Lorem ipsum dolo" 10: 72

[Ada] Failure to detect illegal parens in static predicate

2014-07-18 Thread Arnaud Charlet
The rules for static predicates do not allow the type name to be parenthesized. This was not checked, but is now fixed, the following test now gives the error indicated (compiled with -gnatld7 -gnatj55) (it used to compile without errors). 1. package BadParenSP is 2.subtype r is inte

[Ada] Make sure all rep clauses are removed from tree for -gnatI

2014-07-18 Thread Arnaud Charlet
Previously all rep clauses were ignored in -gnatI mode, but in two cases (enumeration rep clauses and record rep clauses), they were not removed from the tree, causing trouble with ASIS tools. These two cases are now consistent, and ASIS tools will see none of the ignored rep clauses (e.g. gnatpp w

[Ada] Container Indexing over a derived container type

2014-07-18 Thread Arnaud Charlet
the container type is a derived type, the value of the inherited aspect is the Reference (or Constant_Reference) operation declared for the parent type. However, Reference is also a primitive operation of the new type, and the inherited operation has a different signature. It is necessary to retri

[Ada] Enforce style check for all binary operators

2014-07-18 Thread Arnaud Charlet
Add two missing style checks for token spacing for binary operators when switches -gnatyt, -gnatyy or -gnatyg is used. Preserve previous behavior with debug switch -gnatd.Q Test: $ gcc -c pkg.ads -gnatyt -gnatl -gnatd7 Compiling: pkg.ads 1. package Pkg is 2.One : constant := 1;

[Ada] Implement No_Standard_Allocators_After_Elaboration

2014-07-18 Thread Arnaud Charlet
This implements the final definition of the Ada 2012 restriction No_Standard_Allocators_After_Elaboration. There are two static cases. First appearence in task body, this one we already had before (compiled with -gnatj55 -gnatld7) 1. procedure Pmain2 is 2.type P is access all Integer

[Ada] Crash while processing illegal state refinement

2014-07-17 Thread Arnaud Charlet
This patch modifies the parser to catch a case where the argument of SPARK aspect Refined_State is not properly parenthesized. -- Source -- -- no_parens.ads package No_Parens with SPARK_Mode => On, Abstract_State => State is pragma Elaborate_Body; end No_Pa

[Ada] Add annotate aspect, add entity argument to pragma Annotate

2014-07-16 Thread Arnaud Charlet
An optional final named argument [Entity => local_NAME] is allowed for pragma Annotate to indicate that the annotation is for a particular entity, and a corresponding Annotate aspect is introduced. Given the test program: 1. package AspectAnn is 2.Y : constant Integer := 43; 3.

<    5   6   7   8   9   10   11   12   13   14   >