Commit Graph

77305 Commits

Author SHA1 Message Date
Ed Schonberg
3b75bcab98 sem_ch7.adb (Check_Anonymous_Access_Types): New procedure...
2006-10-31  Ed Schonberg  <schonberg@adacore.com>
	    Javier Miranda  <miranda@adacore.com>

	* sem_ch7.adb (Check_Anonymous_Access_Types): New procedure, subsidiary
	of Analyze_Package_Body, to create Itype references for anonymous
	access types created in the package declaration, whose designated types
	may have only a limited view.
	(Analyze_Package_Specification): For the private part of a nested
	package, install private_with_clauses of enclosing compilation unit if
	we are in its visible part.
	(Declare_Inherited_Private_Subprograms): Complete barrier
	to ensure that the primitive operation has an alias to some parent
	primitive. This is now required because, after the changes done for the
	implementation of abstract interfaces, the contents of the list of
	primitives has entities whose alias attribute references entities of
	such list of primitives.
	(Analyze_Package_Specification): Simplify code that handles parent units
	of instances and formal packages.
	(Uninstall_Declarations): Check the convention consistency among
	primitive overriding operations of a tagged record type.

From-SVN: r118305
2006-10-31 19:08:12 +01:00
Ed Schonberg
ec4867fab9 sem_ch6.ads, [...] (Analyze_Subprogram_Declaration): A null procedure cannot be a protected operation (it is a basic_declaration...
2006-10-31  Ed Schonberg  <schonberg@adacore.com>
	    Hristian Kirtchev  <kirtchev@adacore.com>
	    Bob Duff  <duff@adacore.com>
        
	* sem_ch6.ads, sem_ch6.adb (Analyze_Subprogram_Declaration): A null
	procedure cannot be a protected operation (it is a basic_declaration,
	not a subprogram_declaration).
	(Check_Overriding_Indicator): Rename formal Does_Override to Overridden_
	Subp. Add logic for entry processing.
	(Check_Synchronized_Overriding): New procedure in New_Overloaded_Entity.
	Determine whether an entry or subprogram of a protected or task type
	override an inherited primitive of an implemented interface.
	(New_Overloaded_Entity): Add calls to Check_Synchronized_Overriding.
	Update the actual used in calls to Check_Overriding_Indicator.
	(Analyze_Generic_Subprogram_Body): If the subprogram is a child unit,
	generate the proper reference to the parent unit, for cross-reference.
	(Analyze_Subprogram_Declaration): Protect Is_Controlling_Formal with
	Is_Formal.
	Add -gnatd.l --Use Ada 95 semantics for limited function returns,
	(Add_Extra_Formal): Revise procedure to allow passing in associated
	entity, scope, and name suffix, and handle setting of the new
	Extra_Formals field.
	(Create_Extra_Formals): Change existing calls to Add_Extra_Formal to
	pass new parameters. Add support for adding the new extra access formal
	for functions whose calls are treated as build-in-place.
	(Analyze_A_Return_Statement): Correct casing in error message.
	Move Pop_Scope to after Analyze_Function_Return, because an extended
	return statement really is a full-fledged scope. Otherwise, visibility
	doesn't work right. Correct use of "\" for continuation messages.
	(Analyze_Function_Return): Call Analyze on the Obj_Decl, rather than
	evilly trying to call Analyze_Object_Declaration directly. Otherwise,
	the node doesn't get properly marked as analyzed.
	(Analyze_Subprogram_Body): If subprogram is a function that returns
	an anonymous access type that denotes a task, build a Master Entity
	for it.
	(Analyze_Return_Type): Add call to Null_Exclusion_Static_Checks. Verify
	proper usage of null exclusion in a result definition.
	(Process_Formals): Code cleanup and new error message.
	(Process_Formals): Detect incorrect application of null exclusion to
	non-access types.
	(Conforming_Types): Handle conformance between [sub]types and itypes
	 generated for entities that have null exclusions applied to them.
	(Maybe_Primitive_Operation): Add an additional type retrieval when the
	 base type is an access subtype. This case arrises with null exclusions.
	(New_Overloaded_Entity): Do not remove the overriden entity from the
	homonym chain if it corresponds with an abstract interface primitive.
	(Process_Formals): Replace membership test agains Incomplete_Kind with a
	call to the synthesized predicate Is_Incomplete_Type.
	(Analyze_Subprogram_Body): Check wrong placement of abstract interface
	primitives.
	(Analyze_Subprogram_Declaration): Check that abstract interface
	primitives are abstract or null.
	(Analyze_Subprogram_Specification): Remove previous check for abstract
	interfaces because it was not complete.
	(Has_Interface_Formals): Removed.

From-SVN: r118304
2006-10-31 19:07:52 +01:00
Robert Dewar
2a806772b8 sem_ch5.ads, [...] (Analyze_Loop_Statement): Add circuit to warn on infinite loops.
2006-10-31  Robert Dewar  <dewar@adacore.com>
	    Ed Schonberg  <schonberg@adacore.com>
	    Gary Dismukes  <dismukes@adacore.com>

	* sem_ch5.ads, sem_ch5.adb (Analyze_Loop_Statement): Add circuit to
	warn on infinite loops.
	Add \\ to some continuation messages
	(Analyze_Assignment_Statement): Call Warn_On_Useless_Assignment
	(Process_Bounds): If the bounds are integer literals that result from
	constant-folding, and they carry a user-defined type, preserve that type
	rather than treating this as an integer range.
	(Analyze_Exit_Statement): Test for E_Return_Statement in legality check.
	(Analyze_Goto_Statement): Test for E_Return_Stateemnt in legality check.
	(Analyze_Assignment_Statement): Add call to Check_Elab_Assign for
	left hand side of assignment.
	(Analyze_Assignment): Add suport to manage assigments to the attribute
	priority of a protected object.
	(Check_Possible_Current_Value_Condition): Allow fully qualified names
	not just identifiers.
	(Check_Possible_Current_Value_Condition): Acquire left operand of AND
	or AND THEN for possible tracking.
	(Analyze_Iteration_Scheme): Check for setting Current_Value for the
	case of while loops so we can track values in the loop body.

From-SVN: r118303
2006-10-31 19:07:33 +01:00
Ed Schonberg
b67a385c62 sem_ch4.adb (Try_Primitive_Operation): Code cleanup to ensure that we generate the same errors compiling under -gnatc.
2006-10-31  Ed Schonberg  <schonberg@adacore.com>
	    Javier Miranda  <miranda@adacore.com>
	    Robert Dewar  <dewar@adacore.com>

	* sem_ch4.adb (Try_Primitive_Operation): Code cleanup to ensure that we
	generate the same errors compiling under -gnatc.
	(Try_Object_Operation): If no candidate interpretation succeeds, but
	there is at least one primitive operation with the right name, report
	error in call rather than on a malformed selected component.
	(Analyze_Selected_Component): If the prefix is an incomplete type from
	a limited view, and the full view is available, use the full view to
	determine whether this is a prefixed call to a primitive operation.
	(Operator_Check): Verify that a candidate interpretation is a binary
	operation before checking the type of its second formal.
	(Analyze_Call): Add additional warnings for function call contexts not
	yet supported.
	(Analyze_Allocator): Move the check for "initialization not allowed for
	limited types" after analyzing the expression. This is necessary,
	because OK_For_Limited_Init looks at the structure of the expression.
	Before analysis, we don't necessarily know what sort of expression it
	is. For example, we don't know whether F(X) is a function call or an
	indexed component; the former is legal in Ada 2005; the latter is not.
	(Analyze_Allocator): Correct code for AI-287 -- extension aggregates
	were missing. We also didn't handle qualified expressions. Now also
	allow function calls. Use new common routine OK_For_Limited_Init.
	(Analyze_Type_Conversion): Do not perform some legality checks in an
	instance, because the error message will be redundant or spurious.
	(Analyze_Overloaded_Selected_Component): Do not do style check when
	setting an entity, since we do not know it is the right entity yet.
	(Analyze_Selected_Component): Move Generate_Reference call to Sem_Res
	(Analyze_Overloaded_Selected_Component): Same change
	(Analyze_Selected_Component): Remove unnecessary prefix type retrieval
	since regular incomplete subtypes are transformed into corresponding
	subtypes of their full views.
	(Complete_Object_Operation): Treat name of transformed subprogram call
	as coming from source, for browsing purposes.
	(Try_Primitive_Operation): If formal is an access parameter, compare
	with base type of object to determine whether it is a primitive
	operation.
	(Operator_Check): If no interpretation of the operator matches, check
	whether a use clause on any candidate might make the operation legal.
	(Try_Class_Wide_Operation): Check whether the first parameter is an
	access type whose designated type is class-wide.

From-SVN: r118302
2006-10-31 19:07:13 +01:00
Robert Dewar
affbee12f4 sem_ch13.adb: Storage pool cannot be given for access to subprogram type.
2006-10-31  Robert Dewar  <dewar@adacore.com>
	    Thomas Quinot  <quinot@adacore.com>

	* sem_ch13.adb: Storage pool cannot be given for access to subprogram
	type.
	(New_Stream_Subprogram): When processing an attribute definition clause
	for a stream-oriented subprogram, record an entity node occurring at
	the point of clause to use for checking the visibility of the clause,
	as defined by 8.3(23) as amended by AI-195.
	(New_Stream_Subprogram): New procedure, factoring behaviour from both
	 New_Stream_Function and New_Stream_Procedure.
	(New_Stream_Function, New_Stream_Procedure): Removed.
	(Analyze_Attribute_Definition_Clause, case Address): Check new
	Alignment_Check check

From-SVN: r118301
2006-10-31 19:06:54 +01:00
Ed Schonberg
097fdf65a0 sem_ch12.ads, [...] (Save_References): If node is an operator that has been constant-folded...
2006-10-31  Ed Schonberg  <schonberg@adacore.com>
	    Hristian Kirtchev  <kirtchev@adacore.com>
        
        * sem_ch12.ads, sem_ch12.adb (Save_References): If node is an operator
	that has been constant-folded, preserve information of original tree,
	for ASIS uses.
	(Analyze_Formal_Derived_Type): Set the limited present flag of the newly
	generated private extension declaration if the formal derived type is
	synchronized. Carry synchronized present over to the generated private
	extension.
	(Validate_Derived_Type_Instance): Ensure that the actual of a
	synchronized formal derived type is a synchronized tagged type.
	(Instantiate_Formal_Package): When creating the instantiation used to
	validate the actual package of a formal declared without a box, check
	whether the formal itself depends on a prior actual.
	(Instantiate_Formal_Subprogram): Create new entities for the defining
	identifiers of the formals in the renaming declaration, for ASIS use.
	(Instantiate_Formal_Subprogram, Instantiate_Formal_Type): When creating
	a renaming declaration or a subtype declaration for an actual in an
	instance, capture location information of declaration in generic, for
	ASIS use.
	(Instantiate_Formal_Package): Add comments on needed additional tests.
	AI-317 (partial parametrization) is fully implemented.
	(Validate_Private_Type_Instance): Add check for actual which
	must have preelaborable initialization
	Use new // insertion for some continuation messages
	(Analyze_Formal_Object_Declaration): Change usage of Expression to
	Default_Expression. Add type retrieval when the declaration has an
	access definition. Update premature usage of incomplete type check.
	(Check_Access_Definition): New subsidiary routine. Check whether the
	current compilation version is Ada 05 and the supplied node has an
	access definition.
	(Instantiate object): Alphabetize local variables. Handle the creation
	of new renaming declarations with respect to the kind of definition
	used - either an access definition or a subtype mark. Guard against
	unnecessary error message in the context of anonymous access types after
	they have been resolved. Add check for required null exclusion in a
	formal object declaration.
	(Switch_View): A private subtype of a non-private type needs to be
	switched (the base type can have been switched without its private
	dependents because of the last branch of Check_Private_View.
	(Check_Private_View): Do not recompute Base_Type (T), instead use cached
	value from BT.
	(Instantiate_Type): Emit an error message whenever a class-wide type of
	a tagged incomplete type is used as a generic actual.
	(Find_Actual_Type): Extend routine to handle a component type in a child
	unit that is imported from a formal package in a parent.
	(Validate_Derived_Type_Instance): Check that analyzed formal and actual
	agree on constrainedness, rather than checking against ultimate ancestor
	(Instantiate_Subprogram_Body): Create a cross-reference link to the
	generic body, for navigation purposes.

From-SVN: r118300
2006-10-31 19:06:39 +01:00
Robert Dewar
6109adeb7d sem_ch11.adb (Analyze_Handled_Statements): Move final test for useless assignments here and conditionalize it on absence...
2006-10-31  Robert Dewar  <dewar@adacore.com>

	* sem_ch11.adb (Analyze_Handled_Statements): Move final test for
	useless assignments here and conditionalize it on absence of exception
	handlers.
	(Analyze_Exception_Handlers): Small code reorganization of error
	detection code, for new handling of formal packages.

From-SVN: r118299
2006-10-31 19:06:22 +01:00
Ed Schonberg
468c6c8af6 sem_attr.ads, [...] (Analyze_Access_Attribute): Diagnose properly an attempt to apply Unchecked_Access to a protected operation.
2006-10-31  Ed Schonberg  <schonberg@adacore.com>
	    Thomas Quinot  <quinot@adacore.com>
	    Javier Miranda  <miranda@adacore.com>
	    Gary Dismukes  <dismukes@adacore.com>

	* sem_attr.ads, sem_attr.adb (Analyze_Access_Attribute): Diagnose
	properly an attempt to apply Unchecked_Access to a protected operation.
	(OK_Self_Reference): New subprogram to check the legality of an access
	attribute whose prefix is the type of an enclosing aggregate.
	Generalizes previous mechanism to handle attribute references nested
	arbitrarily deep within the aggregate.
	(Analyze_Access_Attribute): An access attribute whose prefix is a type
	can appear in an aggregate if this is a default-initialized aggregate
	for a self-referential type.
	(Resolve_Attribute, case Access): Ditto.
	Add support for new implementation defined attribute Stub_Type.
	(Eval_Attribute, case Attribute_Stub_Type): New case.
	(Analyze_Attribute, case Attribute_Stub_Type): New case.
	(Stream_Attribute_Available): Implement using new subprogram from
	sem_cat, Has_Stream_Attribute_Definition, instead of incorrect
	Has_Specified_Stream_Attribute flag.
	Disallow Storage_Size and Storage_Pool for access to subprogram
	(Resolve_Attribute, case 'Access et al): Take into account anonymous
	access types of return subtypes in extended return statements. Remove
	accessibility checks on anonymous access types when Unchecked_Access is
	used.
	(Analyze_Attribute): Add support for the use of 'Class to convert
	a class-wide interface to a tagged type.
	Add support for the attribute Priority.
	(Resolve_Attribute, case Attribute_Access): For Ada_05, add test for
	whether the designated type is discriminated with a constrained partial
	view and require static matching in that case.
	Add local variable Des_Btyp. The Designated_Type
	of an access to incomplete subtype is either its non-limited view if
	coming from a limited with or its etype if regular incomplete subtype.

	* sem_cat.ads, sem_cat.adb (Validate_Remote_Access_To_Class_Wide_Type):
	Fix predicate to identify and allow cases of (expander-generated)
	references to tag of designated object of a RACW.
	(Validate_Static_Object_Name): In Ada 2005, a formal object is
	non-static, and therefore cannot appear as a primary in a preelaborable
	package.
	(Has_Stream_Attribute_Definition): New subprogram, abstracted from
	Has_Read_Write_Attributes.
	(Has_Read_Write_Attributes): Reimplement in termes of
	Has_Stream_Attribute_Definition.
	(Missing_Read_Write_Attributes): When checking component types in a
	record, unconditionally call Missing_Read_Write_Attributes recursively
	(remove guard checking for Is_Record_Type / Is_Access_Type).

From-SVN: r118298
2006-10-31 19:06:06 +01:00
Robert Dewar
daca8389ef scng.adb (Scan, [...]): Better msg for identifier starting with a digit.
2006-10-31  Robert Dewar  <dewar@adacore.com>

	* scng.adb (Scan, case of numeric literal): Better msg for identifier
	starting with a digit.

From-SVN: r118297
2006-10-31 19:05:47 +01:00
Arnaud Charlet
1fa4cb204c rtsfind.adb: Remove s-polint from comment as it exists no more.
* rtsfind.adb: Remove s-polint from comment as it exists no more.

        * rtsfind.ads: 
        Move entity RE_Get_Active_Partition_Id to package System.DSA_Services.
        Move all the entities in obsolete package System.PolyORB_Interface to
        System.Partition_Interface.
	(RE_Storage_Size): New function in System.Tasking.
	(RE_Get_Ceiling): New entity.
	(RE_Set_Ceiling): New entity.
	(RO_PE_Get_Ceiling): New entity.
	(RO_RE_Set_Ceiling): New entity.
	(Inherit_CPP_DT): New entity

From-SVN: r118296
2006-10-31 19:05:34 +01:00
Arnaud Charlet
de397a3d0a restrict.ads, [...] (Restriction_Active): Now returns False if only a restriction warning is active for the given restriction.
2006-10-31  Arnaud Charlet  <charlet@adacore.com>
	    Robert Dewar  <dewar@adacore.com>

	* restrict.ads, restrict.adb (Restriction_Active): Now returns False if
	only a restriction warning is active for the given restriction. This is
	desirable because we do not want to modify code in the case where only
	a warning is set.
	(Set_Profile_Restrictions): Make sure that a Profile_Warnings never
	causes overriding of real restrictions.
	Take advantage of new No_Restrictions constant.

	* raise.h: (__gnat_set_globals): Change profile.

From-SVN: r118295
2006-10-31 19:05:19 +01:00
Robert Dewar
d3879a5ac8 repinfo.adb (List_Entities): Don't list entities from renaming declarations.
2006-10-31  Robert Dewar  <dewar@adacore.com>

	* repinfo.adb (List_Entities): Don't list entities from renaming
	declarations.

From-SVN: r118294
2006-10-31 19:04:59 +01:00
Vincent Celier
ddd6e5ae32 prj-nmsc.adb (Check_Ada_Name): For children of package A...
2006-10-31  Vincent Celier  <celier@adacore.com>

	* prj-nmsc.adb (Check_Ada_Name): For children of package A, G, I and S
	on VMS, change "__" to '.' before checking the name.
	(Record_Ada_Source): Always add the source file name in the list of
	of sources, even if it is not the first time, as it is for another
	source index.
	(Get_Unit): Replace both '_' (after 'a', 'g', 'i' or 's') with a single
	dot, instead of replacing only the first '_'.

	* prj-part.adb (Parse): Convert project file path to canonical form

	* prj-proc.adb (Recursive_Process): Make sure that, when a project is
	extended, the project id of the project extending it is recorded in its
	data, even when it has already been processed as an imported project.

From-SVN: r118293
2006-10-31 19:04:45 +01:00
Vincent Celier
3356ee073b prj-makr.adb (Packages_To_Check_By_Gnatname): New global constant
2006-10-31  Vincent Celier  <celier@adacore.com>

	* prj-makr.adb (Packages_To_Check_By_Gnatname): New global constant
	(Make): Call Parse with Packages_To_Check_By_Gnatname for parameter
	Packages_To_Check.

From-SVN: r118292
2006-10-31 19:04:28 +01:00
Vincent Celier
aa1c3df226 prj-dect.adb (Parse_Attribute_Declaration): Do not issue warning for unknown attribute in unknown package or in package...
2006-10-31  Vincent Celier  <celier@adacore.com>

	* prj-dect.adb (Parse_Attribute_Declaration): Do not issue warning for
	unknown attribute in unknown package or in package that does not need
	to be checked.
	(Parse_Package_Declaration): Do not issue warning for unknown package in
	quiet output.

From-SVN: r118291
2006-10-31 19:04:10 +01:00
Robert Dewar
529c27463f par-ch3.adb (P_Range_Or_Subtype_Mark): Check for bad parentheses
2006-10-31  Robert Dewar  <dewar@adacore.com>
	    Javier Miranda  <miranda@adacore.com>
        
	* par-ch3.adb (P_Range_Or_Subtype_Mark): Check for bad parentheses
	(P_Type_Declaration): Remove barrier against the reserved word "limited"
	after "abstract" to give support to the new syntax of AARM 3.4 (2/2).
	(P_Type_Declaration): Minor code cleanup. Add support for synchronized
	private extensions.
	(P_Type_Declaration): Add the new actual Abstract_Present to every call
	to P_Interface_Type_Definition.
	(P_Interface_Type_Definition): Addition of one formal to report an error
	if the reserved word abstract has been previously found.
	(P_Identifier_Declarations): Update grammar rules. Handle parsing of an
	object renaming declaration with an access definition or subtype mark
	with a possible null exclusion.

	* par-ch9.adb: Minor error msg fix

	* par-load.adb: Add missing continuation mark to error msg

	* par-tchk.adb: (Wrong_Token): Code cleanup, use concatenation

From-SVN: r118290
2006-10-31 19:03:53 +01:00
Hristian Kirtchev
fd6342ec0e par-ch12.adb: Grammar update and cleanup.
2006-10-31  Hristian Kirtchev  <kirtchev@adacore.com>
	    Javier Miranda  <miranda@adacore.com>

	* par-ch12.adb: Grammar update and cleanup.
	(P_Formal_Type_Definition, P_Formal_Derived_Type_Definition): Add
	support for synchronized derived type definitions.
	Add the new actual Abstract_Present to every call to
	P_Interface_Type_Definition.
	(P_Formal_Object_Declarations): Update grammar rules. Handle parsing of
	a formal object declaration with an access definition or a subtype mark
	with a null exclusion.
	(P_Generic_Association): Handle association with box, and others_choice
	with box, to support Ada 2005 partially parametrized formal packages.

From-SVN: r118289
2006-10-31 19:03:23 +01:00
Robert Dewar
aae02e6a54 par-ch10.adb (P_Context_Clause): Minor error message fix
2006-10-31  Robert Dewar  <dewar@adacore.com>

	* par-ch10.adb (P_Context_Clause): Minor error message fix

From-SVN: r118288
2006-10-31 19:03:00 +01:00
Ed Schonberg
743c8beb16 sem_ch10.ads, [...] (Check_Redundant_Withs, [...]): If the context of a body includes a use clause for P.Q then a with_clause for P...
2006-10-31  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch10.ads, sem_ch10.adb (Check_Redundant_Withs,
	Process_Body_Clauses): If the context of a body includes a use clause
	for P.Q then a with_clause for P in the same body is not redundant,
	even if the spec also has a with_clause on P.
	Add missing continuation mark to error msg
	(Build_Limited_Views): A limited view of a type is tagged if its
	declaration includes a record extension.
	(Analyze_Proper_Body): Set Corresponding_Stub field in N_Subunit
	node, even if the subunit has errors. This avoids malfunction by
	Lib.Check_Same_Extended_Unit in the presence of syntax errors.
	(Analyze_Compilation_Unit): Add circuit to make sure we get proper
	generation of obsolescent messages for with statements (cannot do
	this too early, or we cannot implement avoiding the messages in the
	case of obsolescent units withing obsolescent units).
	(Install_Siblings): If the with_clause is on a remote descendant of
	an ancestor of the current compilation unit, find whether there is
	a sibling child unit that is immediately visible.
	(Remove_Private_With_Clauses): New procedure, invoked after completing
	the analysis of the private part of a nested package, to remove from
	visibility the private with_clauses of the enclosing package
	declaration.
	(Analyze_With_Clause): Remove Check_Obsolescent call, this checking is
	now centralized in Generate_Reference.
	(Install_Limited_Context_Clauses): Remove superfluous error
	message associated with unlimited view visible through use
	and renamings. In addition, at the point in which the error
	is reported, we add the backslash to the text of the error
	to ensure that it is reported as a single error message.
	Use new // insertion for some continuation messages
	(Expand_Limited_With_Clause): Use copy of name rather than name itself,
	to create implicit with_clause for parent unit mentioned in original
	limited_with_clause.
	(Install_Limited_With_Unit): Set entity of parent identifiers if the
	unit is a child unit. For ASIS queries.
	(Analyze_Subunit): If the subunit appears within a child unit, make all
	ancestor child units directly visible again.

From-SVN: r118287
2006-10-31 19:02:40 +01:00
Vincent Celier
f6cf2af4c7 mlib-utl.adb (Initialized): Remove, no longer used
2006-10-31  Vincent Celier  <celier@adacore.com>

	* mlib-utl.adb (Initialized): Remove, no longer used
	(Initialize): Remove, no longer used
	(Ar): If Ar_Exec is null, get the location of the archive builder and,
	if there is one, the archive indexer. Fail if the archive builder cannot
	be found.
	(Gcc): If the driver path is unknown, get it. Fail if the driver cannot
	be found.

From-SVN: r118286
2006-10-31 19:02:17 +01:00
Thomas Quinot
b8783398c1 Makefile.in: Set EH mechanism to ZCX for FreeBSD.
2006-10-31  Thomas Quinot  <quinot@adacore.com>
	    Eric Botcazou  <ebotcazou@adacore.com>
	    Arnaud Charlet  <charlet@adacore.com>

	* Makefile.in: Set EH mechanism to ZCX for FreeBSD.
	(NO_REORDER_ADAFLAGS): New var defined to -fno-toplevel-reorder if
	possible.
	(a-except.o): Pass it to the compiler.
	(gnatlib-shared-vms): Removed -nostartfiles switch in link step.
	(LIBGNAT_TARGET_PAIRS for Windows): Avoid the use of the specific
	a-calend-mingw.adb version.

        * Makefile.rtl: Added s-dsaser.
	Add object entries for Ada.Calendar.[Arithmetic/Formatting/Time_Zones]
	(GNATRTL_TASKING_OBJS): Add Ada.Dispatching and
	Ada.Dispatching.Round_Robin.
	Added new unit Ada.Containers.Restricted_Bounded_Doubly_Linked_Lists

	* Make-lang.in: Remove all references to gt-ada-decl.h.
	Add concatenation (s-strops/s-sopco3/s-sopco4/s-sopco5) to compiler
	sources.
	Add dependency on ada/s-restri.o for GNAT1 and GNATBIND objects.
	Update dependencies.

	* system-freebsd-x86.ads: Make ZCX the default EH mechanism for FreeBSD

From-SVN: r118285
2006-10-31 19:02:00 +01:00
Vincent Celier
53973dcf9d lib-load.adb (Load_Unit): Skip the test for a unit not found when its file has already been loaded...
2006-10-31  Vincent Celier  <celier@adacore.com>

	* lib-load.adb (Load_Unit): Skip the test for a unit not found when
	its file has already been loaded, according to the unit being loaded,
	not to the current value of Multiple_Unit_Index.

From-SVN: r118284
2006-10-31 19:01:41 +01:00
Robert Dewar
cac01ae32b layout.adb (Layout_Record_Type): Deal with non-static subtypes of variant records
2006-10-31  Robert Dewar  <dewar@adacore.com>

        * layout.adb (Layout_Record_Type): Deal with non-static subtypes of
        variant records
        (Layout_Variant_Record): Retrieve the discriminants from the entity
	rather than from the type definition, because in the case of a full
	type for a private type we need to take the discriminants from the
	partial view.
        (Layout_Component_List): When applying the Max operator to variants with
        a nonstatic size, check whether either operand is static and scale that
        operand from bits to storage units before applying Max.
	(Layout_Type): In VMS, if a C-convention access type has no explicit
	size clause (and does not inherit one in the case of a derived type),
	then the size is reset to 32 from 64.

From-SVN: r118283
2006-10-31 19:01:28 +01:00
Robert Dewar
2d6a1685fa g-spipat.adb (S_To_PE): Remove incorrect use of 0 instead of Str'First
2006-10-31  Robert Dewar  <dewar@adacore.com>

	* g-spipat.adb (S_To_PE): Remove incorrect use of 0 instead of Str'First

From-SVN: r118282
2006-10-31 19:01:11 +01:00
Robert Dewar
30f41abaec g-speche.ads, [...]: Add special case to recognize misspelling initial letter o as a zero.
2006-10-31  Robert Dewar  <dewar@adacore.com>

	* g-speche.ads, g-speche.adb: Add special case to recognize misspelling
	initial letter o as a zero.

From-SVN: r118281
2006-10-31 19:00:56 +01:00
Thomas Quinot
ad98c85e5b g-socket.ads, [...] (Close_Selector): Once the signalling sockets are closed...
2006-10-31  Thomas Quinot  <quinot@adacore.com>

	* g-socket.ads, g-socket.adb (Close_Selector): Once the signalling
	sockets are closed, reset the R_Sig_Socket and W_Sig_Socket components
	to No_Socket.
	(Selector_Type): Add default value of No_Socket for R_Sig_Socket and
	W_Sig_Socket.

From-SVN: r118280
2006-10-31 19:00:42 +01:00
Vincent Celier
8967c38f74 g-os_lib.ads, [...] (Locate_Exec_On_Path): Always return an absolute path name.
2006-10-31  Vincent Celier  <celier@adacore.com>

	* g-os_lib.ads, g-os_lib.adb (Locate_Exec_On_Path): Always return an
	absolute path name.
	(Locate_Regular_File): Ditto
	(Change_Dir): Remove, no longer used
	(Normalize_Pathname): Do not use Change_Dir to get the drive letter
	on Windows. Get it calling Get_Current_Dir.
	(OpenVMS): Remove imported boolean, no longer needed.
	(Normalize_Pathname)[VMS]: Do not resolve directory names.
	(Pid_To_Integer): New function to convert a Process_Id to  Integer

From-SVN: r118279
2006-10-31 19:00:29 +01:00
Vincent Celier
ac36caab6b gnatls.adb: Take into account GPR_PROJECT_PATH...
2006-10-31  Vincent Celier  <celier@adacore.com>
        
	* gnatls.adb: Take into account GPR_PROJECT_PATH, when it is defined,
	instead of ADA_PROJECT_PATH, for the project path.
	(Gnatls): When displaying the project path directories, use host dir
	specs.

	* prj-ext.adb (Prj.Ext elaboration): On VMS, only expand relative path
	names in the project path, as absolute paths may correspond to
	multi-valued VMS logical names.

From-SVN: r118278
2006-10-31 19:00:14 +01:00
Vincent Celier
ef6ea465e3 gnatlink.adb (Gnatlink): If gcc is not called with -shared-libgcc...
2006-10-31  Vincent Celier  <celier@adacore.com>

	* gnatlink.adb (Gnatlink): If gcc is not called with -shared-libgcc,
	call it with -static-libgcc, as there are some platforms, such as
	Darwin, where one of these two switches is compulsory to link.

From-SVN: r118277
2006-10-31 18:59:58 +01:00
Arnaud Charlet
64c69860aa gnatcmd.adb (Process_Link): Use Osint.Executable_Name instead of handling executable extension manually and...
2006-10-31  Arnaud Charlet  <charlet@adacore.com>
	    Robert Dewar  <dewar@adacore.com>

	* gnatcmd.adb (Process_Link): Use Osint.Executable_Name instead of
	handling executable extension manually and duplicating code.

	* make.adb: Implement new -S switch
	(Gnatmake): Use new function Osint.Executable_Name instead
	of handling executable extension manually.

	* prj-util.adb (Executable_Of): Make sure that if an Executable_Suffix
	is specified, the executable name ends with this suffix.
	Take advantage of Osint.Executable_Name instead of duplicating code.

	* switch-m.adb: Recognize new gnatmake -S switch

	* targparm.ads, targparm.adb (Executable_Extension_On_Target): New
	variable.
	(Get_Target_Parameters): Set Executable_Extension_On_Target if
	available.

	* makeusg.adb: Add line for gnatmake -S switch

From-SVN: r118276
2006-10-31 18:59:45 +01:00
Vincent Celier
5b8b905744 g-debpoo.adb (Is_Valid): Correctly compute Offset using Integer_Address arithmetic, as in Set_Valid.
2006-10-31  Vincent Celier  <celier@adacore.com>

	* g-debpoo.adb (Is_Valid): Correctly compute Offset using
	Integer_Address arithmetic, as in Set_Valid.

From-SVN: r118275
2006-10-31 18:59:28 +01:00
Hristian Kirtchev
87009d43ae g-catiio.ads, [...] (Value): New function.
2006-10-31  Hristian Kirtchev  <kirtchev@adacore.com>

	* g-catiio.ads, g-catiio.adb (Value): New function.
	Given an input String, try and parse a valid Time value.

From-SVN: r118274
2006-10-31 18:59:12 +01:00
Bob Duff
88b32fc3a7 g-awk.adb (Default_Session, [...]): Compile this file in Ada 95 mode, because it violates the new rules for AI-318.
2006-10-31  Bob Duff  <duff@adacore.com>
	    Robert Dewar  <dewar@adacore.com>
	    Ed Schonberg  <schonberg@adacore.com>

	* g-awk.adb (Default_Session, Current_Session): Compile this file in
	Ada 95 mode, because it violates the new rules for AI-318.

	* g-awk.ads: Use overloaded subprograms in every case where we used to
	have a default of Current_Session. This makes the code closer to be
	correct for both Ada 95 and 2005.

	* g-moreex.adb (Occurrence): Turn off warnings for illegal-in-Ada-2005
	code, relying on the fact that the compiler generates a warning
	instead of an error in -gnatg mode.

	* lib-xref.ads (Xref_Entity_Letters): Add entry for new
	E_Return_Statement entity kind.
	Add an entry for E_Incomplete_Subtype in Xref_Entity_Letters.

	* par.adb (P_Interface_Type_Definition): Addition of one formal to
	report an error if the reserved word abstract has been previously found.
	(SS_End_Type): Add E_Return for new extended_return_statement syntax.
        
        * par-ch4.adb (P_Aggregate_Or_Paren_Expr): Improve message for
	parenthesized range attribute usage
	(P_Expression_No_Right_Paren): Add missing comment about error recovery.

	* par-ch6.adb (P_Return_Object_Declaration): AI-318: Allow "constant"
	in the syntax for extended_return_statement. This is not in the latest
	RM, but the ARG is expected to issue an AI allowing this.
	(P_Return_Subtype_Indication,P_Return_Subtype_Indication): Remove
	N_Return_Object_Declaration. We now use N_Object_Declaration instead.
	(P_Return_Object_Declaration, P_Return_Subtype_Indication,
	P_Return_Statement): Parse the new syntax for extended_return_statement.

	* par-endh.adb (Check_End, Output_End_Deleted, Output_End_Expected,
	Output_End_Missing): Add error-recovery code for the new
	extended_return_statement syntax; that is, the new E_Return entry on
	the scope stack.

	* s-auxdec-vms_64.ads, s-auxdec.ads (AST_Handler): Change type from
	limited to nonlimited, because otherwise we violate the new Ada 2005
	rules about returning limited types in function Create_AST_Handler in
	s-asthan.adb.

	* sem.adb (Analyze): Add cases for new node kinds
	N_Extended_Return_Statement and N_Return_Object_Declaration.

	* sem_aggr.adb (Aggregate_Constraint_Checks): Verify that component
	type is in the same category as type of context before applying check,
	to prevent anomalies in instantiations.
	(Resolve_Aggregate): Remove test for limited components in aggregates.
	It's unnecessary in Ada 95, because if it has limited components, then
	it must be limited. It's wrong in Ada 2005, because limited aggregates
	are now allowed.
	(Resolve_Record_Aggregate): Move check for limited types later, because
	OK_For_Limited_Init requires its argument to have been resolved.
	(Get_Value): When copying the component default expression for a
	defaulted association in an aggregate, use the sloc of the aggregate
	and not that of the original expression, to prevent spurious
	elaboration errors, when the expression includes function calls.
	(Check_Non_Limited_Type): Correct code for AI-287, extension aggregates
	were missing. We also didn't handle qualified expressions. Now also
	allow function calls. Use new common routine OK_For_Limited_Init.
	(Resolve_Extension_Aggregate): Minor fix to bad error message (started
	with space can upper case letter).

        * sem_ch3.ads, sem_ch3.adb (Create_Constrained_Components): Set
	Has_Static_Discriminants flag
        (Record_Type_Declaration): Diagnose an attempt to declare an interface
        type with discriminants.
        (Process_Range_Expr_In_Decl): Do validity checks on range
	(Build_Discriminant_Constraints): Use updated form of
	Denotes_Discriminant.
	(Process_Subtype): If the subtype is a private subtype whose full view
	is a concurrent subtype, introduce an itype reference to prevent scope
	anomalies in gigi.
	(Build_Derived_Record_Type, Collect_Interface_Primitives,
	Record_Type_Declaration):  The functionality of the subprograms
	Collect_Abstract_Interfaces and Collect_All_Abstract_Interfaces
	is now performed by a single routine.
	(Build_Derived_Record_Type): If the type definition includes an explicit
	indication of limitedness, then the type must be marked as limited here
	to ensure that any access discriminants will not be treated as having
	a local anonymous access type.
	(Check_Abstract_Overriding): Issue a detailed error message when an
	abstract subprogram was not overridden due to incorrect mode of its
	first parameter.
	(Analyze_Private_Extension_Declaration): Add support for the analysis of
	synchronized private extension declarations. Verify that the ancestor is
	a limited or synchronized interface or in the generic case, the ancestor
	is a tagged limited type or synchronized interface and all progenitors
	are either limited or synchronized interfaces.
	Derived_Type_Declaration): Check for presence of private extension when
	dealing with synchronized formal derived types.
	Process_Full_View): Enchance the check done on the usage of "limited" by
	testing whether the private view is synchronized.
	Verify that a synchronized private view is completed by a protected or
	task type.
	(OK_For_Limited_Init_In_05): New function.
	(Analyze_Object_Declaration): Move check for limited types later,
	because OK_For_Limited_Init requires its argument to have been resolved.
	Add -gnatd.l --Use Ada 95 semantics for limited function returns,
	in order to alleviate the upward compatibility introduced by AI-318.
	(Constrain_Corresponding_Record): If the constraint is for a component
	subtype, mark the itype as frozen, to avoid out-of-scope references to
	discriminants in the back-end.
	(Collect_Implemented_Interfaces): Protect the recursive algorithm of
	this subprogram against wrong sources.
	(Get_Discr_Value, Is_Discriminant): Handle properly references to a
	discriminant of limited type completed with a protected type, when the
	discriminant is used to constrain a private component of the type, and
	expansion is disabled.
	(Find_Type_Of_Object): Do not treat a return subtype that is an
	anonymous subtype as a local_anonymous_type, because its accessibility
	level is the return type of the enclosing function.
	(Check_Initialization): In -gnatg mode, turn the error "cannot
	initialize entities of limited type" into a warning.
	(OK_For_Limited_Init): Return true for generated nodes, since it
	sometimes violates the legality rules.
	(Make_Incomplete_Declaration): If the type for which an incomplete
	declaration is created happens to be the currently visible entity,
	preserve the homonym chain when removing it from visibility.
	(Check_Conventions): Add support for Ada 2005 (AI-430): Conventions of
	inherited subprograms.
	(Access_Definition): If this is an access to function that is the return
	type of an access_to_function definition, context is a type declaration
	and the scope of the anonymous type is the current one.
	(Analyze_Subtype_Declaration): Add the defining identifier of a regular
	incomplete subtype to the set of private dependents of the original
	incomplete type.
	(Constrain_Discriminated_Type): Emit an error message whenever an
	incomplete subtype is being constrained.
	(Process_Incomplete_Dependents): Transform an incomplete subtype into a
	corresponding subtype of the full view of the original incomplete type.
	(Check_Incomplete): Properly detect invalid usage of incomplete types
	and subtypes.

From-SVN: r118273
2006-10-31 18:58:48 +01:00
Olivier Hainque
bae7876b4d g-alleve.adb (lvx, stvx): Ceil-Round the Effective Address to the closest multiple of VECTOR_ALIGNMENT...
2006-10-31  Olivier Hainque  <hainque@adacore.com>

	* g-alleve.adb (lvx, stvx): Ceil-Round the Effective Address to the
	closest multiple of VECTOR_ALIGNMENT and not the closest multiple of 16.

From-SVN: r118272
2006-10-31 18:58:30 +01:00
Robert Dewar
3f1ede06fc freeze.adb: Add handling of Last_Assignment field
2006-10-31  Robert Dewar  <dewar@adacore.com>
	    Ed Schonberg  <schonberg@adacore.com>

	* freeze.adb: Add handling of Last_Assignment field
	(Warn_Overlay): Supply missing continuation marks in error msgs
	(Freeze_Entity): Add check for Preelaborable_Initialization

	* g-comlin.adb: Add Warnings (Off) to prevent new warning

	* g-expect.adb: Add Warnings (Off) to prevent new warning

	* lib-xref.adb: Add handling of Last_Assignment field
	(Generate_Reference): Centralize handling of pragma Obsolescent here
	(Generate_Reference): Accept an implicit reference generated for a
	default in an instance.
	(Generate_Reference): Accept a reference for a node that is not in the
	main unit, if it is the generic body corresponding to an subprogram
	instantiation.

	* xref_lib.adb: Add pragma Warnings (Off) to avoid new warnings

        * sem_warn.ads, sem_warn.adb (Set_Warning_Switch): Add processing for
	-gnatwq/Q.
	(Warn_On_Useless_Assignment): Suppress warning if enclosing inner
	exception handler.
	(Output_Obsolescent_Entity_Warnings): Rewrite to avoid any messages on
	use clauses, to avoid messages on packages used to qualify, and also
	to avoid messages from obsolescent units.
	(Warn_On_Useless_Assignments): Don't generate messages for imported
	and exported variables.
	(Warn_On_Useless_Assignments): New procedure
	(Output_Obsolescent_Entity_Warnings): New procedure
	(Check_Code_Statement): New procedure

        * einfo.ads, einfo.adb (Has_Static_Discriminants): New flag
	Change name Is_Ada_2005 to Is_Ada_2005_Only
	(Last_Assignment): New field for useless assignment warning

From-SVN: r118271
2006-10-31 18:58:16 +01:00
Vincent Celier
ac3b962ec3 krunch.ads, krunch.adb (Krunch): New Boolean parameter VMS_On_Target.
2006-10-31  Vincent Celier  <celier@adacore.com>

	* krunch.ads, krunch.adb (Krunch): New Boolean parameter VMS_On_Target.
	When True, apply VMS treatment to children of packages A, G, I and S.
	For F320-016

	* fname-uf.adb (Get_File_Name): Call Krunch with OpenVMS_On_Target

From-SVN: r118270
2006-10-31 18:57:54 +01:00
Bob Duff
05350ac648 exp_ch7.adb (Build_Array_Deep_Procs, [...]): Rename Is_Return_By_Reference_Type to be Is_Inherently_Limited_Type...
2006-10-31  Bob Duff  <duff@adacore.com>
	    Ed Schonberg  <schonberg@adacore.com>
	    Robert Dewar  <dewar@adacore.com>

	* exp_ch7.adb (Build_Array_Deep_Procs, Build_Record_Deep_Procs,
	Make_Deep_Record_Body): Rename Is_Return_By_Reference_Type to be
	Is_Inherently_Limited_Type, because return-by-reference has no meaning
	in Ada 2005.
	(Find_Node_To_Be_Wrapped): Use new method of determining the result
	type of the function containing a return statement, because the
	Return_Type field was removed. We now use the Return_Applies_To field.

        * exp_util.ads, exp_util.adb: Use new subtype N_Membership_Test
	(Build_Task_Image_Decl): If procedure is not called from an
	initialization procedure, indicate that function that builds task name
	uses the sec. stack. Otherwise the enclosing initialization procedure
	will carry the indication.
	(Insert_Actions): Remove N_Return_Object_Declaration. We now use
	N_Object_Declaration instead.
	(Kill_Dead_Code): New interface to implement -gnatwt warning for
	conditional dead code killed, and change implementation accordingly.
	(Insert_Actions): Add N_Return_Object_Declaration case.
	Correct comment to mention N_Extension_Aggregate node.
	(Set_Current_Value_Condition): Call Safe_To_Capture_Value to avoid bad
	attempts to save information for global variables which cannot be
	safely tracked.
	(Get_Current_Value_Condition): Handle conditions the other way round
	(constant on left). Also handle right operand of AND and AND THEN
	(Set_Current_Value_Condition): Corresponding changes
	(Append_Freeze_Action): Remove unnecessary initialization of Fnode.
	(Get_Current_Value_Condition): Handle simple boolean operands
	(Get_Current_Value_Condition): Handle left operand of AND or AND THEN
	(Get_Current_Value_Condition): If the variable reference is within an
	if-statement, does not appear in the list of then_statments, and does
	not come from source, treat it as being at unknown location.
	(Get_Current_Value_Condition): Enhance to allow while statements to be
	processed as well as if statements.
	(New_Class_Wide_Subtype): The entity for a class-wide subtype does not
	come from source.
	(OK_To_Do_Constant_Replacement): Allow constant replacement within body
	of loop. This is safe now that we fixed Kill_Current_Values.
	(OK_To_Do_Constant_Replacement): Check whether current scope is
	Standard, before examining outer scopes.

From-SVN: r118269
2006-10-31 18:57:36 +01:00
Robert Dewar
ac9e991846 exp_prag.adb (Expand_Pragma_Common_Object): Use a single Machine_Attribute pragma internally to implement the user pragma.
2006-10-31  Robert Dewar  <dewar@adacore.com>

	* exp_prag.adb (Expand_Pragma_Common_Object): Use a single
	Machine_Attribute pragma internally to implement the user pragma.
	Add processing for pragma Interface so that it is now completely
	equivalent to pragma Import.

	* sem_prag.adb (Analyze_Pragma, case Obsolescent): Extend this pragma
	so that it can be applied to all entities, including record components
	and enumeration literals.
	(Analyze_Pragma, case Priority_Specific_Dispatching): Check whether
	priority ranges are correct, verify compatibility against task
	dispatching and locking policies, and if everything is correct an entry
	is added to the table containing priority specific dispatching entries
	for this compilation unit.
	(Delay_Config_Pragma_Analyze): Delay processing
	Priority_Specific_Dispatching pragmas because when processing the
	pragma we need to access run-time data, such as the range of
	System.Any_Priority.
	(Sig_Flags): Add Pragma_Priority_Specific_Dispatching.
	Allow pragma Unreferenced as a context item
	Add pragma Preelaborable_Initialization
	(Analyze_Pragma, case Interface): Interface is extended so that it is
	now syntactically and semantically equivalent to Import.
	(Analyze_Pragma, case Compile_Time_Warning): Fix error of blowups on
	insertion characters.
	Add handling for Pragma_Wide_Character_Encoding
	(Process_Restrictions_Restriction_Warnings): Ensure that a warning
	never supercedes a real restriction, and that a real restriction
	always supercedes a warning.
	(Analyze_Pragma, case Assert): Set Low_Bound_Known if assert is of
	appropriate form.

From-SVN: r118268
2006-10-31 18:57:10 +01:00
Javier Miranda
53cc4a7aa1 exp_intr.adb (Expand_Dispatching_Constructor_Call): Add missing run-time membership test to ensure that the constructed object...
2006-10-31  Javier Miranda  <miranda@adacore.com>
        
	* exp_intr.adb (Expand_Dispatching_Constructor_Call): Add missing
	run-time membership test to ensure that the constructed object
	implements the target abstract interface.

From-SVN: r118267
2006-10-31 18:56:43 +01:00
Robert Dewar
c99e6969f2 exp_imgv.adb (Expand_Image_Attribute): For Wide_[Wide_]Character cases...
2006-10-31  Robert Dewar  <dewar@adacore.com>

	* exp_imgv.adb (Expand_Image_Attribute): For Wide_[Wide_]Character
	cases, pass the encoding method, since it is now required by the run
	time.

	* s-valwch.ads, s-valwch.adb (Value_Wide_Wide_Character): Avoid
	assumption that Str'First = 1.
	(Value_Wide_Character): Takes EM (encoding method) parameter and passes
	it on to the Value_Wide_Wide_Character call.
	(Value_Wide_Wide_Character): Takes EM (encoding method) parameter and
	properly handles a string of the form quote-encoded_wide_char-quote.

	* s-wchcnv.adb: Minor reformatting

From-SVN: r118266
2006-10-31 18:56:24 +01:00
Ed Schonberg
20f96ac918 exp_fixd.adb (Rounded_Result_Set): For multiplication and division of fixed-point operations in an integer context...
2006-10-31  Ed Schonberg  <schonberg@adacore.com>

	* exp_fixd.adb (Rounded_Result_Set): For multiplication and division of
	fixed-point operations in an integer context, i.e. as operands of a
	conversion to an integer type, indicate that result must be rounded.

From-SVN: r118265
2006-10-31 18:56:09 +01:00
Thomas Quinot
92869a7b6b exp_dist.adb (Get_Subprogram_Ids): This function will no more assign subprogram Ids, even if they are not yet assigned.
2006-10-31  Thomas Quinot  <quinot@adacore.com>
	    Pablo Oliveira  <oliveira@adacore.com>
        
        * exp_dist.adb (Get_Subprogram_Ids): This function will no more assign
	subprogram Ids, even if they are not yet assigned.
	(Build_Subprogram_Id): It is now this function that will take care of
	calling Assign_Subprogram_Ids if necessary.
	(Add_Receiving_Stubs_To_Declarations): Checking the subprograms ids
	should be done only once they are assigned.
	(Build_From_Any_Function, case of tagged types): Add missing call to
	Allocate_Buffer.
	(Corresponding_Stub_Type): New subprogram. Returns the associated stub
	type for an RACW type.
	(Add_RACW_Features): When processing an RACW declaration for which the
	designated type is already frozen, enforce E.2.2(14) rules immediately.
	(GARLIC_Support.Build_Subprogram_Receiving_Stubs): Do not perform any
	special reordering of controlling formals.

	* exp_dist.ads (Corresponding_Stub_Type): New subprogram. Returns the
	associated stub type for an RACW type.

From-SVN: r118264
2006-10-31 18:55:55 +01:00
Robert Dewar
108e13eb74 exp_dbug.ads, [...] (Get_External_Name): Add missing initialization of Homonym_Len.
2006-10-31  Robert Dewar  <dewar@adacore.com>

	* exp_dbug.ads, exp_dbug.adb (Get_External_Name): Add missing
	initialization of Homonym_Len.
	(Fully_Qualify_Name): Remove kludge to eliminate anonymous block
	names from fully qualified name. Fixes problem of duplicate
	external names differing only in the presence of such a block name.

From-SVN: r118263
2006-10-31 18:55:39 +01:00
Ed Schonberg
ae5dd59d04 exp_ch9.adb (Update_Prival_Types): Simplify code for entity references that are private components of the...
2006-10-31  Ed Schonberg  <schonberg@adacore.com>             

        * exp_ch9.adb (Update_Prival_Types): Simplify code for entity
	references that are private components of the protected object.
	(Build_Barrier_Function): Set flag Is_Entry_Barrier_Function
	(Update_Prival_Subtypes): Add explicit Process argument to Traverse_Proc
	instantiation to deal with warnings.
	(Initialize_Protection): If expression for priority is non-static, use
	System_Priority as its expected type, in case the expression has not
	been analyzed yet.

From-SVN: r118261
2006-10-31 18:55:21 +01:00
Robert Dewar
02822a92a4 exp_ch6.ads, [...]: Use new Validity_Check suppression capability.
2006-10-31  Robert Dewar  <dewar@adacore.com>
	    Ed Schonberg  <schonberg@adacore.com>
	    Bob Duff  <duff@adacore.com>
	    Gary Dismukes  <dismukes@adacore.com>

	* exp_ch6.ads, exp_ch6.adb: Use new Validity_Check suppression
	capability.
	(Expand_Inlined_Call): Tagged types are by-reference types, and
	therefore should be replaced by a renaming declaration in the expanded
	body, as is done for limited types.
	(Expand_Call): If this is a call to a function with dispatching access
	result, propagate tag from context.
	(Freeze_Subprogram): Enable full ABI compatibility for interfacing with
	CPP by default.
	(Make_Build_In_Place_Call_In_Assignment): New procedure to do
	build-in-place when the right-hand side of an assignment is a
	build-in-place function call.
	(Make_Build_In_Place_Call_In_Allocator): Apply an unchecked conversion
	of the explicit dereference of the allocator to the result subtype of
	the build-in-place function. This is needed to satisfy type checking
	in cases where the caller's return object is created by an allocator for
	a class-wide access type and the type named in the allocator is a
	specific type.
	(Make_Build_In_Place_Call_In_Object_Declaration): Apply an unchecked
	conversion of the reference to the declared object to the result subtype
	of the build-in-place function. This is needed to satisfy type checking
	in cases where the declared object has a class-wide type. Also, in the
	class-wide case, change the type of the object entity to the specific
	result subtype of the function, to avoid passing a class-wide object
	without explicit initialization to the back end.
	(Register_Interface_DT_Entry): Moved outside the body of
	Freeze_Subprogram because this routine is now public; it is called from
	Check_Dispatching_Overriding to handle late overriding of abstract
	interface primitives.
	(Add_Access_Actual_To_Build_In_Place_Call): New utility procedure for
	adding an implicit access actual on a call to a build-in-place function.
	(Expand_Actuals): Test for an actual parameter that is a call to a
	build-in-place function and apply
	Make_Build_In_Place_Call_In_Anonymous_Context to the call.
	(Is_Build_In_Place_Function): New function to determine whether an
	entity is a function whose calls should be handled as build-in-place.
	(Is_Build_In_Place_Function_Call): New function to determine whether an
	expression is a function call that should handled as build-in-place.
	(Make_Build_In_Place_Call_In_Allocator): New procedure for handling
	calls to build-in-place functions as the initialization of an allocator.
	(Make_Build_In_Place_Call_In_Anonymous_Context): New procedure for
	handling calls to build-in-place functions in contexts that do not
	involve init of a separate object (for example, actuals of subprogram
	calls).
	(Make_Build_In_Place_Call_In_Object_Declaration): New procedure for
	handling calls to build-in-place functions as the initialization of an
	object declaration.
	(Detect_Infinite_Recursion): Add explicit parameter Process to
	instantiation of Traverse_Body to avoid unreferenced warning.
	(Check_Overriding_Inherited_Interfaces): Removed.
	(Register_Interface_DT_Entry): Code cleanup.
	(Register_Predefined_DT_Entry): Code cleanup.
	(Expand_Inlined_Call.Rewrite_Procedure_Call): Do not omit block around
	inlined statements if within a transient scope.
	(Expand_Inlined_Call.Process_Formals): When replacing occurrences of
	formal parameters with occurrences of actuals in inlined body, establish
	visibility on the proper view of the actual's subtype for the body's
	context.
	(Freeze_Subprogram): Do nothing if we are compiling under full ABI
	compatibility mode and we have an imported CPP subprogram because
	for now we assume that imported CPP primitives correspond with
	objects whose constructor is in the CPP side (and therefore we
	don't need to generate code to register them in the dispatch table).
	(Expand_Actuals): Introduce copy of actual, only if it might be a bit-
	aligned selected component.
	(Add_Call_By_Copy_Node): Add missing code to handle the case in which
	the actual of an in-mode parameter is a type conversion.
	(Expand_Actuals): If the call does not come from source and the actual
	is potentially misaligned, let gigi handle it rather than rejecting the
	(Expand_N_Subprogram_Body, Freeze_Subprogram): set subprograms returning
	Class Wide types as returning by reference independantly of their
	controlled status since with HIE runtimes class wide types are not
	potentially controlled anymore.

From-SVN: r118260
2006-10-31 18:55:05 +01:00
Eric Botcazou
efd6ef80ca re PR target/24071 (__gthread_active_p vs __gthread_once)
PR target/24071
	* gthr-posix.h (__gthread_active_p): New implementation on Solaris.
	* gthr-posix95.h (__gthread_active_p): Likewise.

From-SVN: r118259
2006-10-31 17:54:58 +00:00
Bob Duff
9e5ac75fe2 exp_ch5.ads (Expand_N_Extended_Return_Statement): New procedure.
2006-10-31  Bob Duff  <duff@adacore.com>
	    Robert Dewar  <dewar@adacore.com>
	    Gary Dismukes  <dismukes@adacore.com>
	    Ed Schonberg  <schonberg@adacore.com>

	* exp_ch5.ads (Expand_N_Extended_Return_Statement): New procedure.

        * exp_ch5.adb (Expand_N_Loop_Statement): Do validity checks on range
	(Expand_N_Assignment_Statement): Call
	Make_Build_In_Place_Call_In_Assignment if the right-hand side is a
	build-in-place function call. Currently, this can happen only for
	assignments that come from aggregates.
	Add -gnatd.l --Use Ada 95 semantics for limited function returns,
	in order to alleviate the upward compatibility introduced by AI-318.
	(Expand_N_Extended_Return_Statement): Add support for handling the
	return object as a build-in-place result.
	(Expand_Non_Function_Return): Implement simple return statements nested
	within an extended return.
	(Enable_New_Return_Processing): Turn on the new processing of return
	statements.
	(Expand_Non_Function_Return): For a return within an extended return,
	don't raise Program_Error, because Sem_Ch6 now gives a warning.
	(Expand_N_Extended_Return_Statement): Implement AI-318
	(Expand_Simple_Function_Return): Ditto.
	(Expand_N_If_Statement): Handle new -gnatwt warning
	(Expand_N_Case_Statement): Handle new -gnatwt warning
	(Expand_N_Assignment): Handle assignment to the Priority attribute of
	a protected object.
	(Expand_N_Assignment_Statement): Implement -gnatVe/E to control
	validity checking of assignments to elementary record components.
	(Expand_N_Return_Statement): return Class Wide types on the secondary
	stack independantly of their controlled status since with HIE runtimes,
	class wide types are not potentially controlled anymore.

	* expander.adb (Expand): Add case for new N_Extended_Return_Statement
	node kind.

	* exp_ch11.adb (Expand_N_Handled_Sequence_Of_Statements): Avoid
	Expand_Cleanup_Actions in case of N_Extended_Return_Statement, because
	it expects a block, procedure, or task. The return statement will get
	turned into a block, and Expand_Cleanup_Actions will happen then.

From-SVN: r118258
2006-10-31 18:54:50 +01:00
Javier Miranda
20b5d666e7 exp_ch4.adb (Expand_N_Type_Conversion): Handle missing interface type conversion.
2006-10-31  Javier Miranda  <miranda@adacore.com>
	    Ed Schonberg  <schonberg@adacore.com>
	    Bob Duff  <duff@adacore.com>
	    Gary Dismukes  <dismukes@adacore.com>
	    Robert Dewar  <dewar@adacore.com>
        
        * exp_ch4.adb (Expand_N_Type_Conversion): Handle missing interface type
	conversion.
        (Expand_N_In): Do validity checks on range
	(Expand_Selected_Component): Use updated for of Denotes_Discriminant.
	(Expand_N_Allocator): For "new T", if the object is constrained by
	discriminant defaults, allocate the right amount of memory, rather than
	the maximum for type T.
	(Expand_Allocator_Expression): Suppress the call to Remove_Side_Effects
	when the allocator is initialized by a build-in-place call, since the
	allocator is already rewritten as a reference to the function result,
	and this prevents an unwanted duplication of the function call.
	Add with and use of Exp_Ch6.
	(Expand_Allocator_Expresssion): Check for an allocator whose expression
	is a call to build-in-place function and apply
	Make_Build_In_Place_Call_In_Allocator to the call (for both tagged and
	untagged designated types).
	(Expand_N_Unchecked_Type_Conversion): Do not do integer literal
	optimization if source or target is biased.
	(Expand_N_Allocator): Add comments for case of an allocator within a
	function that returns an anonymous access type designating tasks.
	(Expand_N_Allocator): apply discriminant checks for access
	discriminants of anonymous access types (AI-402, AI-416)

From-SVN: r118257
2006-10-31 18:54:34 +01:00
Javier Miranda
3476f94908 exp_ch3.ads, [...] (Expand_N_Object_Declaration): Do not register in the final list objects containing class-wide interfaces...
2006-10-31  Javier Miranda  <miranda@adacore.com>
	    Robert Dewar  <dewar@adacore.com>
	    Ed Schonberg  <schonberg@adacore.com>
	    Gary Dismukes  <dismukes@adacore.com>

        * exp_ch3.ads, exp_ch3.adb (Expand_N_Object_Declaration): Do not
	register in the final list objects containing class-wide interfaces;
	otherwise we incorrectly register the tag of the interface in the final
	list.
        (Make_Controlling_Function_Wrappers): Add missing barrier to do not
        generate the wrapper if the parent primitive is abstract. This is
        required to report the correct error message.
        (Expand_N_Subtype_Indication): Do validity checks on range
	(Clean_Task_Names): If an initialization procedure includes a call to
	initialize a task (sub)component, indicate that the procedure will use
	the secondary stack.
	(Build_Init_Procedure, Init_Secondary_Tags): Enable full ABI
	compatibility for interfacing with CPP by default.
	(Expand_N_Object_Declaration): Only build an Adjust call when the
	object's type is a nonlimited controlled type.
	* exp_ch3.adb: Add with and use of Exp_Ch6.
	(Expand_N_Object_Declaration): Check for object initialization that is a
	call to build-in-place function and apply Make_Build_In_Place_Call_In_
	Object_Declaration to the call.
	(Freeze_Type): When the designated type of an RACW was not frozen at the
	point where the RACW was declared, validate the primitive operations
	with respect to E.2.2(14) when it finally is frozen.
	(Build_Initialization_Call,Expand_Record_Controller): Rename
	Is_Return_By_Reference_Type to be Is_Inherently_Limited_Type, because
	return-by-reference has no meaning in Ada 2005.
	(Init_Secondary_Tags): Add missing call to Set_Offset_To_Top
	to register tag of the immediate ancestor interfaces in the
	run-time structure.
	(Init_Secondary_Tags): Moved to the specification to allow the
	initialization of extension aggregates with abstract interfaces.
	(Build_Master_Renaming): Make public, for use by function declarations
	whose return type is an anonymous access type.
	(Freeze_Record_Type): Replace call to Insert_List_Before by call to
	Insert_List_Before_And_Analyze after the generation of the specs
	associated with null procedures.
	(Expand_Tagged_Root): Update documentation in its specification.
	(Init_Secondary_Tags): Update documentation.
	(Build_Init_Procedure): If we are compiling under CPP full ABI compa-
	tibility mode and the immediate ancestor is a CPP_Pragma tagged type
	then generate code to inherit the contents of the dispatch table
	directly from the ancestor.
	(Expand_Record_Controller): Insert controller component after tags of
	implemented interfaces.
	(Freeze_Record_Type): Call new procedure Make_Null_Procedure_Specs to
	create null procedure overridings when null procedures are inherited
	from interfaces.
	(Make_Null_Procedure_Specs): New procedure to generate null procedure
	declarations for overriding null primitives inherited from interfaces.
	(Is_Null_Interface_Procedure): New function in
	Make_Null_Procedure_Specs.
	(Make_Predefined_Primitive_Specs/Predefined_Primitive_Bodies): If the
	immediate ancestor of a tagged type is an abstract interface type we
	must generate the specification of the predefined primitives associated
	with controlled types (because the dispatch table of the ancestor is
	null and hence these entries cannot be inherited). This is required to
	elaborate well the dispatch table.

From-SVN: r118256
2006-10-31 18:54:22 +01:00
Robert Dewar
d705ba7827 exp_ch2.adb: Change Is_Lvalue to May_Be_Lvalue
2006-10-31  Robert Dewar  <dewar@adacore.com>

	* exp_ch2.adb: Change Is_Lvalue to May_Be_Lvalue
	(Expand_Entity_Reference): Correct error of not handling subprogram
	formals in current_value processing.

From-SVN: r118255
2006-10-31 18:54:05 +01:00