[Ada] Crash on transient classwide limited view on RHS of short-circuit

2014-07-16 Thread Arnaud Charlet
This change fixes a compiler crash that would occur in some cases where an expression involving transient return values of a limited view of a class-wide interface type occur on the right hand side of a short circuit operator. The following compilation must be accepted quietly: $ gcc -c

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

2014-07-16 Thread Arnaud Charlet
This patch corrects the transient object machinery to treat the renamed result of a controlled function call as a finalizable transient when the context is an expression with actions. If this was a different context, the lifetime of the result would be considered extended and not finalized.

[Ada] Enfore SPARK RM rule 7.1.5(2)

2014-07-16 Thread Arnaud Charlet
This patch modifies the analysis of aspects Abstract_State, Initializes and Initial_Condition to ensure that they are inserted after pragma SPARK_Mode. The proper placement allows for SPARK_Mode to be analyzed first and dictate the mode of the related package. -- Source --

[Ada] Warning match string does not need leading/trailing asterisks

2014-07-16 Thread Arnaud Charlet
The warning message pattern given for pragma Warning_As_Error or for pragma Warnings no longer requires leading and trailing asterisks. The match can be anywhere in the string without these characters as shown in this example, compiled with -gnatwa -gnatld7 -gnatj55 Compiling: warnmatch.adb

[Ada] Catch newly illegal case of Unrestricted_Access

2014-07-16 Thread Arnaud Charlet
It is now illegal to use Unrestricted_Access to directly generate a thin pointer of an unconstrained array type which references a non- aliased object. This never worked, and we might as well catch it as illegal, since it is not hard to do so, as shown in the following example: 1. with

[Ada] Warning if record size is not a multiple of alignment

2014-07-16 Thread Arnaud Charlet
This implements a new warning (on by default, controlled by -gnatw.z/-gnatw.Z, included in -gnatwa), that warns if a record type has a specified size and alignment where the size is not a multiple of the alignment resulting in an object size greater than the specified size. The warning is

[Ada] A static predicate can be specified by a Case expression.

2014-07-16 Thread Arnaud Charlet
This patch completes the implementation of Ada 2012 static predicates, by adding support for case expressions that can be transformed into a statically evaluable expression on values of the subtype. Compiling: gcc -c -gnata test_predicate.adb must yield: test_predicate.adb:11:20:

[Ada] New node kind N_Compound_Statement

2014-07-16 Thread Arnaud Charlet
This change reorganizes expansion of object initialization statements, which need to be captured under a single node id. Previously these were represented as a (malformed) N_Expression_With_Actions with a NULL statement as its expression. This irregularity is fixed by instead introducing a

[Ada] No usage for an erroneous invocation of a gnat tool

2014-07-17 Thread Arnaud Charlet
When a gnat tool (gnatbind, gnatclean, gnatchop, gnatfind, gnatls, gnatname, gnatprep or gnatmake) is incorrectly invoked, the usage is no longer displayed. Instead, this line is displayed: type gnatxxx --help for help Tested on x86_64-pc-linux-gnu, committed on trunk 2014-07-17 Vincent

[Ada] Secondary stack leak for call returning limited discriminated object

2014-07-17 Thread Arnaud Charlet
This change fixes a defect whereby GNAT would fail to generate secondary stack cleanup code for a scope containing a local object of a limited discriminated type initialized by a (build-in-place) function call, thus causing a storage leak. The following test case must not leak memory for each

[Ada] Incomplete detection of external tag clash

2014-07-17 Thread Arnaud Charlet
This change fixes the circuitry responsible for enforcing the uniqueness of 'External_Tag attribute values. Previously uniqueness was checked at type elaboration time only for types that have an explicit External_Tag attribute definition clause. However we must also account for the fact that the

[Ada] Failure to unlock shared passive protected

2014-07-17 Thread Arnaud Charlet
This change addresses a missing unlock operation for the case of a call to a protected function appearing as the expression of a RETURN statement: the unlock was inserted after the statement containing the protected function call, which means that in the case of a RETURN statement it would never

[Ada] Missing finalization of Object.Operation class-wide interface result

2014-07-17 Thread Arnaud Charlet
This patch updates the finalization machinery to recognize a case where the result of a class-wide interface function call with multiple actual parameters that appears in Object.Operation format requires finalization actions. -- Source -- -- types.ads with

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

2014-07-17 Thread Arnaud Charlet
This patch corrects the transient object machinery to treat the renamed result of a controlled function call as a finalizable transient when the context is an expression with actions. If this was a different context, the lifetime of the result would be considered extended and not finalized.

[Ada] Analysis of delayed SPARK aspects and use of SPARK_Mode

2014-07-17 Thread Arnaud Charlet
This patch ensures that all delayed SPARK aspects are analyzed with the proper SPARK mode of their related construct. -- Source -- -- modes.ads package Modes with SPARK_Mode = On, Abstract_State = State is Var : Integer := 1; procedure Disabled_1

[Ada] Eliminate extra unwanted reads of volatile objects

2014-07-17 Thread Arnaud Charlet
This corrects a situation in which extra reads of volatile objects was being done. It was detected in the case of validity checks being done on case expressions that were volatile, where two reads were being done, one for the validity check, and one for the actual case selection. But the problem

[Ada] Analysis of delayed SPARK aspects and use of SPARK_Mode

2014-07-17 Thread Arnaud Charlet
This patch clarifies the need of saving and restoring SPARK_Mode in a stack like fashion. No change in behavior, no test needed. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-07-17 Hristian Kirtchev kirtc...@adacore.com * sem_ch6.adb (Analyze_Subprogram_Body_Contract,

[Ada] Implement new partition-wide restriction No_Long_Long_Integer

2014-07-17 Thread Arnaud Charlet
This new restriction No_Long_Long_Integer forbids any explicit reference to type Standard.Long_Long_Integer, and also forbids declaring range types whose implicit base type is Long_Long_Integer, and modular types whose size exceeds Long_Integer'Size. The following is compiled with -gnatl: 1.

[Ada] Renaming of intrinsic generic subprograms

2014-07-17 Thread Arnaud Charlet
This patch allows the renaming and subsequent instantiation of generic subprograms that are marked Intrinsic, such as the predefined units Unchecked_Conversion and Unchecked_Deallocation. The following must execute quietly: gnatmake -q -gnatws uncrename.adb uncrename --- with Mumble;

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

2014-07-17 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.

[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

[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

[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] 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

[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

[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

[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] 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 o...@adacore.com * 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

[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

[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

[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.

[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

[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] 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 kirtc...@adacore.com

[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] 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

[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 de...@adacore.com

[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 comparisons

[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

[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

[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

[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

[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 qui...@adacore.com PR ada/60652 * s-oscons-tmplt.c: For

[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

[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

[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 ebotca...@adacore.com * exp_aggr.adb (Safe_Slice_Assignment): Remove.

[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] 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 cel...@adacore.com *

[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] 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); end

[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] 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 m...@adacore.com *

[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

[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] 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__.

[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_Update

[Ada] Missing interface conversion in access type

2014-11-20 Thread Arnaud Charlet
The compiler silently skips the generation of code to perform the conversion of an access type whose designated type is a class-wide interface type, thus causing unexpected problems at runtime in dispatching calls to the target object. After this patch the following test compiles and executes

[Ada] Lift limitation of inter-unit inlining with generic packages

2014-11-20 Thread Arnaud Charlet
This change lifts the arbitrary limitation on the number of iterations that can be executed between loading of the inlined bodies and instantiation of the generic bodies of external units when inter-unit inlining is activated. It was previously limited to 1 but this may be not sufficient in some

[Ada] Fix costly call to Following_Address_Clause

2014-11-20 Thread Arnaud Charlet
This change makes is so that Following_Address_Clause is invoked only if this is really necessary from Analyze_Object_Declaration. This saves about 1% of the compilation time at low optimization levels. No functional changes. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-11-20 Eric

[Ada] Handling of function calls to predefined operators in ASIS

2014-11-20 Thread Arnaud Charlet
An operator that is called in functional notation is rewritten as an operator so that its operands can be properly resolved. ASIS needs the semantic info to be available on the original node, so in ASIS mode the resolved operands are linked back to the original call. This patch takes into account

[Ada] Improper assignment on indexing operation with implicit dereference

2014-11-20 Thread Arnaud Charlet
If the left-hand side of an assignment is an Ada 2012 generalized indexing with an implicit derenference, the compiler must verify that the type of the access discriminant that provides the implicit dereference is not an access_to_constant. Compiling ada_test.adb must yield:

[Ada] Rework win32_wait to behave more like the UNIX waitpid()

2014-11-20 Thread Arnaud Charlet
The following changes are importants: - It is possible to have multiple tasks waiting for a child process to terminate. - When a child terminates, a single wait call will receive the corresponding process id. - A call to wait will handle new incoming child processes. Tested on

[Ada] Attributes 'Old and 'Update must preserve the tag of their prefix

2014-11-20 Thread Arnaud Charlet
The patch modifies the expansion of attributes 'Old and 'Update to ensure that the tag of a tagged prefix is not modified as a result attribute evaluation. -- Source -- -- types.ads package Types is type Root is tagged record X : Integer; end record;

[Ada] Interaction between 'Loop_Entry, 'Old, 'Update and Extensions_Visible

2014-11-20 Thread Arnaud Charlet
This patch the following SPARK rule (the part about 'Loop_Entry, 'Old, 'Update) If the Extensions_Visible aspect is False for a subprogram, then certain restrictions are imposed on the use of any parameter of the subprogram which is of a specific tagged type. Such a parameter shall not

[Ada] Add missing SPARK_Mode aspects/pragmas on formal containers

2014-11-20 Thread Arnaud Charlet
While the library of formal maps/sets correctly set SPARK_Mode on spec (On) and private part / body (Off), it was not the case for lists and vectors, thus causing some errors in GNATprove when instantiating such formal containers because bodies contain non-SPARK features (e.g. access types in

[Ada] Generate VC in GNATprove instead of error for empty range check

2014-11-20 Thread Arnaud Charlet
Range checks on empty ranges typically correspond to deactivated code based on a given configuration (say, dead code inside a loop over the empty range). In GNATprove mode, instead of issuing an error message (which would stop analysis), enable the range check so that GNATprove will issue a

[Ada] Give error message if duplicate Linker_Section given

2014-11-20 Thread Arnaud Charlet
Like other similar pragmas, we should disallow duplicate pragma or aspect Linker_Section for non-overloadable entities (for the case of overloading, the pragma only applies to previous entities which do not have such a pragma). The following should compile with the given error: 1. package

[Ada] gnat1: back end switch -G nnn (PR ada/47500)

2014-11-20 Thread Arnaud Charlet
On platform where the switch is allowed, the gcc driver, when called with -Gnnn (nnn is a non negative number) invokes the compiler (gnat1) with -G nnn. This patch skips the argument nnn after -G, so that it is not taken as a source file name. Tested on x86_64-pc-linux-gnu, committed on trunk

[Ada] Spurious errors on extension aggregate for limited type

2014-11-20 Thread Arnaud Charlet
This patch fixes two errors in the handling of extension aggregates for limited types: Ancestor part of extension aggregate can itself be an extension aggregate as well as a function call that is rewritten as a reference. The following must compile quietly: gcc -c p2.adb gcc -c

[Ada] Inter-unit inlining of expression functions with -gnatn1

2014-11-20 Thread Arnaud Charlet
This enables inter-unit inlining of expression functions with -gnatn1, or more simply with -O1/-O2 -gnatn. These functions are automatically candidates for inlining, but there were actually inlined across units only with -gnatn2, or more simply -O3 -gnatn. The following program must compile

[Ada] Type conversion to String causes Constraint_Error

2014-11-20 Thread Arnaud Charlet
This patch modifies the mechanism which creates a subtype from an arbitrary expression. The mechanism now captures the bounds of all index constraints when the expression is of an array type. -- Source -- -- pack.ads with Ada.Finalization; use Ada.Finalization;

[Ada] Debugging information for inlined predefined units

2014-11-20 Thread Arnaud Charlet
The compiler suppresses debugging information on predefined units that are inlined in the code, because stepping into run-time units often complicates debugging activity. We make an exception for calls that appear in the source, when the unit is part of the Ada hierarchy, to facilitate monitoring

[Ada] Improvements to handling of unchecked union discriminants

2014-11-20 Thread Arnaud Charlet
This patch avoids issuing a warning for a missing component clause for a discriminant in an unchecked union, and also avoids printing a line for such a component in the -gnatR2 output. The following program: 1. with Interfaces; 2. procedure Test_Union is 3. type Test_Type (Flag

[Ada] Source in multi-unit source has unique object file name

2014-11-20 Thread Arnaud Charlet
Two units, one in a multi-source file and one in another source with the same base file name do not have the same object file name. No error during processing of the following project file should be reported: project Prj is package Naming is for Spec (foo_bar) use foo_bar.ads at 2;

[Ada] PR ada/63931

2014-11-20 Thread Arnaud Charlet
Fixing version number according to new GCC naming scheme. PR ada/63931 * gnatvsn.ads (Library_Version): Switch to 5. Index: gnatvsn.ads === --- gnatvsn.ads (revision 217874) +++

[Ada] New internal primitive Is_Subprogram_Or_Generic_Subprogram

2014-10-10 Thread Arnaud Charlet
This is a minor internal cleanup, to introduce a new primitive Is_Subprogram_Or_Generic_Subprogram with the obvious meaning. No external effect, no test required. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-10-10 Robert Dewar de...@adacore.com * sem_ch7.adb, einfo.adb,

[Ada] Check for attempt to bind GNATprove files

2014-10-10 Thread Arnaud Charlet
If one or more objects is compiled in GNATprove mode (either by using GNATprove directly, or by using -gnatd.F), then the ALI file is marked and gnatbind will exit with a message as shown here. Given: 1. procedure linkdf is 2. begin 3.null; 4. end; If we first compile

[Ada] Issue errors on illegal contracts unless SPARK_Mode is Off

2014-10-10 Thread Arnaud Charlet
Illegal Global/Depends contracts should be flagged by frontend in code for which SPARK_Mode is not specified, as GNATprove relies on contracts being legal in those cases. The frontend should skip these errors only when SPARK_Mode is Off. Now fixed, as shown on the following example. Command:

[Ada] Loop parameter is a constant in an iterator over a formal container.

2014-10-10 Thread Arnaud Charlet
This patch enforces the same semantics for the handling of loop parameters in element iterators over formal containers, os those over formal containers: the loop parameter cannot be assigned to in user code. Compiling formal_test.adb must yield: formal_test.adb:15:07: assignment to loop

[Ada] Operator name returned by GNAT.Source_Info.Enclosing_Entity

2014-10-10 Thread Arnaud Charlet
The string returned by GNAT.Source_Info.Enclosing_Entity did not include names of operators (e.g. **). The following program: 1. with Text_IO; use Text_IO; 2. with GNAT.Source_Info; use GNAT.Source_Info; 3. procedure BadEE is 4.type R is new Boolean; 5.RV : R :=

[Ada] Implement new pragma Prefix_Exception_Messages

2014-10-10 Thread Arnaud Charlet
This implements a new configuration pragma pragma Prefix_Exception_Messages; which causes messages set using raise x with s to be prefixed by the expanded name of the enclosing entity if s is a string literal (if s is more complex, we assume the program is calculating exactly the message it

[Ada] Spurious error on local instantiation of pure generic unit

2014-10-10 Thread Arnaud Charlet
This patch fixes an error in the legality checks of aspects that apply to library units: these aspects are legal on a local instantiation of a library-level generic unit that carries the aspect pure. The following must compile quietly: gcc -c my_buffer.adb --- package My_Buffer with

[Ada] Ada2012 freeze rules for subprogram profiles

2014-10-10 Thread Arnaud Charlet
Ada05-019 specifies that freezing a subprogram does not automatically freeze the profile, i.e. the types of the formals and the return type. In particular an attribute reference 'Access and its relatives do not freeze the profile. Compiling bd.ads must yield: bd.ads:15:34: incorrect

[Ada] Missing inheritance of pragma Default_Initial_Condition

2014-10-17 Thread Arnaud Charlet
This patch modifies the inheritance of all attributes related to pragma Default_Initial_Condition to account for a case where the full view of a private type derives from another private type. -- Source -- -- parent.ads package Parent is type Parent_Typ is private

[Ada] Ensure record type equality treated correctly for codepeer

2014-10-17 Thread Arnaud Charlet
This is an internal change that does not affect the compiler, but fixes a problem in which a record comparison was not properly expanded. The compiler back end handled this, but it blew up codepeer. No further test required. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-10-17 Robert

[Ada] Make System.Atomic_Counters available to user applications

2014-10-17 Thread Arnaud Charlet
The system unit System.Atomic_Counters which provides an atomic counter type, along with increment, decrement and test operations, available to user programs. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-10-17 Robert Dewar de...@adacore.com * gnat_rm.texi: Document

[Ada] String literal is allowed for pragma Warnings in Ada 83

2014-10-17 Thread Arnaud Charlet
Documentation change only, no further test required Tested on x86_64-pc-linux-gnu, committed on trunk 2014-10-17 Robert Dewar de...@adacore.com * gnat_rm.texi: Document that string literal can be used for pragma Warnings when operating in Ada 83 mode. Index: gnat_rm.texi

[Ada] Class-wide type invariants for type extensions in other units.

2014-10-17 Thread Arnaud Charlet
A class-wide type invariant is inherited by a type extension, and incorporated into the invariant procedure for that type. When the expression for such an invariant (typically a function call) is first analyzed, we must preserve some semantic information in it, because the type extension may be

[Ada] Fix obscure case of compiler crash on bad attribute

2014-10-17 Thread Arnaud Charlet
This fixes an error in the handling of attributes where the prefix raises an exception. This resulted from other errors in the program. No simple test case has been found, but the correction is clearly safe. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-10-17 Robert Dewar

[Ada] Better messages for missing entities in configurable runtime

2014-10-17 Thread Arnaud Charlet
A new mechanism has been implemented that allows specialization of error messages for missing entities in a configurable run-time. Instead of just outputting the (sometimes obscure) name of the entity involved, a more meaningful message can be issued. This new mechanism is used for a case of

[Ada] Short_Integer should be considered implementation defined

2014-10-17 Thread Arnaud Charlet
For the purposes of restriction No_Implementation_Identifiers, Standard.Short_Integer should be considered as being implementation defined and this was not the case. In addition, this patch fixes a compiler blow up with a compiler built with assertions in the test for implementation-defined

[Ada] Better error message for illegal iterator expression

2014-10-17 Thread Arnaud Charlet
This patch improves the error message on an iterator specification whose name is a function call that does not yield a type that implements an iterator interface. Compiling try_containers.adb must yield: try_containers.adb:17:18: expect object that implements iterator interface -- with

[Ada] Directories are no longer created for abstract projects

2014-10-17 Thread Arnaud Charlet
Directories such as object directories are no longer created for abstract projects when the builder (gnatmake or gprbuild) is called with -P or with --subdirs=..., even when there is no explicit indication in the abstract project that there are no sources in the project. Tested on

[Ada] Internal clean up (use Is_Directory_Separator)

2014-10-17 Thread Arnaud Charlet
This is an internal clean up to use an existing abstraction more extensively. No external effect, no test required. Tested on x86_64-pc-linux-gnu, committed on trunk 2014-10-17 Robert Dewar de...@adacore.com * gnatcmd.adb, make.adb, prj-part.adb, gnatlink.adb, prj-nmsc.adb,

[Ada] Spurious output on optimized default-initialized limited aggregate

2014-10-20 Thread Arnaud Charlet
When expanding a limited aggregate into individual assignments, we create a transient scope if the type of a component requires it. This must not be done if the context is an initialization procedure, because the target of the assignment must be visible outside of the block, and stack cleanup will

[Ada] Aspect specifications and incomplete views

2014-10-20 Thread Arnaud Charlet
Typically an indexing aspect is specified on the private view of a tagged type. In the unusual case where there is an incomplete view and the aspect specification appears on the full view, the aspect specification must be analyzed on the full view rather than the incomplete one, to prevent

[Ada] Lift limitation on inter-unit inlining of instantiated subprograms

2014-10-20 Thread Arnaud Charlet
This change makes it so that instantiations of generic subprograms marked as inline are considered for inter-unit inlining. This was not previously the case because of a technical limitation that was too broadly enforced (unlike the associated comment which was more accurate) and excluded

[Ada] Implement pragma/aspect No_Tagged_Streams

2014-10-20 Thread Arnaud Charlet
The No_Tagged_Streams pragma (and aspect) provides a method for selectively inhibiting the generation of stream routines for tagged types. It can be used either in a form naming a specific tagged type, or in a sequence of declarations to apply to all subsequent declarations. The following tests

[Ada] Improve error recovery for bad comma/semicolon in expression

2014-10-20 Thread Arnaud Charlet
This patch improves the error recovery for an errant comma or semicolon after one condition in an expression when more conditions follow, as shown in this example: 1. procedure BadANDTHEN (X : Integer) is 2. begin 3.if X 10 4. and then X mod 4 = 2;

[Ada] Improve recognition of misspelled aspects

2014-10-20 Thread Arnaud Charlet
As shown by this example, the recognition of misspelled aspects is improved: 1. package UnrecogAs with Prelaborate is | Prelaborate is not a valid aspect identifier possible misspelling of Preelaborate 2.type R is tagged null record;

  1   2   3   4   5   6   7   8   9   10   >