Commit Graph

6242 Commits

Author SHA1 Message Date
Ed Schonberg 7c14db4032 ghost.adb (Prune_Node): A freeze node for an ignored ghost entity must be pruned as well.
2016-07-04  Ed Schonberg  <schonberg@adacore.com>

	* ghost.adb (Prune_Node): A freeze node for an ignored ghost
	entity must be pruned as well.

From-SVN: r237967
2016-07-04 12:29:02 +02:00
Gary Dismukes 607114db6a sem_type.adb, [...]: Minor reformatting and typo fix.
2016-07-04  Gary Dismukes  <dismukes@adacore.com>

	* sem_type.adb, einfo.ads, freeze.adb, exp_ch6.adb: Minor reformatting
	and typo fix.

From-SVN: r237966
2016-07-04 12:25:35 +02:00
Hristian Kirtchev c308e7620e sem_ch3.adb, [...]: Minor reformatting.
2016-07-04  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_ch3.adb, sem_type.adb, sem_ch12.adb, xref_lib.adb,
	freeze.adb, sinput-l.adb, sinput-l.ads, sem_ch4.adb, sem_ch8.adb:
	Minor reformatting.

From-SVN: r237965
2016-07-04 12:19:10 +02:00
Arnaud Charlet f50f7e2c00 [multiple changes]
2016-07-04  Justin Squirek  <squirek@adacore.com>

	* sem_prag.adb (Analyze_Unmodified_Or_Unused and
	Analyze_Unreferenced_Or_Unused): Change warning message to be
	more clear about pragma duplicates.

2016-07-04  Yannick Moy  <moy@adacore.com>

	* sinput-l.adb (Create_Instantiation_Source): Set component
	Inlined_Call for inherited pragma case.
	* sinput.adb, sinput.ads (Instantiation): Return component
	Inlined_Call for inherited pragma case.

2016-07-04  Bob Duff  <duff@adacore.com>

	* sem_type.adb (Remove_Conversions): Protect
	the call to Left_Opnd by checking for Nkind in N_Unary_Op --
	unary operators do not have a left operand.

2016-07-04  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch3.adb (Analyze_Object_Declaration): A declaration of a
	constant in a protected operation may be a homonym of a private
	component of the enclosing protected type. This declaration hides
	the component renaming constructed within the protected operation.

From-SVN: r237964
2016-07-04 12:17:30 +02:00
Arnaud Charlet 96df3ff4bd [multiple changes]
2016-07-04  Bob Duff  <duff@adacore.com>

	* xref_lib.adb (Parse_X_Filename, Parse_Identifier_Info): Ignore
	unknown files. Check that File_Nr is in the range of files we
	know about. The previous code was checking the lower bound,
	but not the upper bound.

2016-07-04  Arnaud Charlet  <charlet@adacore.com>

	* tracebak.c: Minor reformatting.

2016-07-04  Yannick Moy  <moy@adacore.com>

	* sem_ch12.adb, sem_ch12.ads Update calls to
	Create_Instantiation_Source to use default argument.
	(Adjust_Inherited_Pragma_Sloc): New function to adjust sloc
	of inherited pragma.
	(Set_Copied_Sloc_For_Inherited_Pragma):
	New function that wraps call to Create_Instantiation_Source for
	copying an inherited pragma.
	(Set_Copied_Sloc_For_Inlined_Body): Update call to
	Create_Instantiation_Source with new arguments.
	* sem_prag.adb (Build_Pragma_Check_Equivalent): In the case
	of inherited pragmas, use the generic machinery to get chained
	locations for the pragma and its sub-expressions.
	* sinput-c.adb: Adapt to new type Source_File_Record.
	* sinput-l.adb, sinput-l.ads (Create_Instantiation_Source):
	Add parameter Inherited_Pragma and make parameter Inlined_Body
	optional.
	* sinput.adb, sinput.ads (Comes_From_Inherited_Pragma): New
	function to return when a location comes from an inherited pragma.
	(Inherited_Pragma): New function to detect when a location comes
	from an inherited pragma.
	(Source_File_Record): New component Inherited_Pragma.

2016-07-04  Yannick Moy  <moy@adacore.com>

	* sem_elab.adb: Register existence of quickfix for error message.

2016-07-04  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch4.adb (Resolve_One_Call): In the context of a predicate
	function the formal and the actual in a call may have different
	views of the same type, because of the delayed analysis of
	predicates aspects. Extend the patch that handles this potential
	discrepancy to handle private and full views as well.
	* sem_ch8.adb (Find_Selected_Component): Refine predicate that
	produces additional error when an illegal selected component
	looks like a prefixed call whose first formal is untagged.

From-SVN: r237963
2016-07-04 12:09:04 +02:00
Justin Squirek 9d1d00ca24 einfo.adb (Has_Pragma_Unused): Create this function as a setter for a new flag294 (Set_Has_Pragma_Unused):...
2016-07-04  Justin Squirek  <squirek@adacore.com>

	* einfo.adb (Has_Pragma_Unused): Create this function as a setter
	for a new flag294 (Set_Has_Pragma_Unused): Create this procedure
	as a getter for flag294 (Write_Entity_Flags): Register the new
	flag with an alias
	* einfo.ads Add comment documenting Has_Pragma_Unused (flag294)
	and subsequent getter and setter declarations.
	* lib-xref.adb (Generate_Reference): Recognize Has_Pragma_Unused
	flag to print appropriate warning messages.
	* par-prag.adb (Prag): Classify Pragma_Unused into "All Other
	Pragmas."
	* snames.ads-tmpl Add a new name to the name constants and a
	new pramga to Pragma_Id for pramga Unused.
	* sem_prag.adb (Analyze_Pragma): Create case for Pragma_Unused
	and move the block for Pragma_Unmodified and Pragma_Unreferenced
	out and into local subprograms.
	(Analyze_Unmodified, Analyze_Unreferenced): From the old pragma blocks
	that have been separated in to local subprograms add a parameter to
	indicate the if they are being called in the context of Pragma_Unused
	and handle it accordingly.
	(Is_Non_Significant_Pragma_Reference): Add an entry for Pragma_Unused
	and correct the position of Pragma_Unevaluated_Use_Of_Old.
	* sem_util.adb (Note_Possible_Modification): Recognize
	Has_Pragma_Unused flag to print appropriate warning messages.

From-SVN: r237961
2016-07-04 12:05:53 +02:00
Ed Schonberg 002e3d16cb freeze.adb (Check_Inherited_Conditions): Perform two passes over the primitive operations of the type...
2016-07-04  Ed Schonberg  <schonberg@adacore.com>

	* freeze.adb (Check_Inherited_Conditions): Perform two passes over
	the primitive operations of the type: one over source overridings
	to build the primitives mapping, and one over inherited operations
	to check for the need to create wrappers, and to check legality
	of inherited condition in SPARK.
	* sem_prag.ads (Update_Primitive_Mapping): Make public, for use
	in freeze actions.
	* sem_prag.adb (Build_Pragma_Check_Equivalent): Refine error
	message in the case of an inherited condition in SPARK that
	includes a call to some other overriding primitive.

From-SVN: r237960
2016-07-04 12:03:34 +02:00
Arnaud Charlet 10edebe7b4 [multiple changes]
2016-07-04  Hristian Kirtchev  <kirtchev@adacore.com>

	* exp_aggr.adb (Ctrl_Init_Expression): New routine.
	(Gen_Assign): Code cleanup. Perform in-place side effect removal when
	the expression denotes a controlled function call.
	* exp_util.adb (Remove_Side_Effects): Do not remove side effects
	on a function call which has this behavior suppressed.
	* sem_aggr.adb Code cleanup.
	* sinfo.adb (No_Side_Effect_Removal): New routine.
	(Set_Side_Effect_Removal): New routine.
	* sinfo.ads New attribute No_Side_Effect_Removal along with
	occurences in nodes.
	(No_Side_Effect_Removal): New routine along with pragma Inline.
	(Set_Side_Effect_Removal): New routine along with pragma Inline.

2016-07-04  Arnaud Charlet  <charlet@adacore.com>

	* opt.ads, sem_prag.adb (Universal_Addressing_On_AAMP): Removed.
	Remove support for pragma No_Run_Time. Update comments.

2016-07-04  Pascal Obry  <obry@adacore.com>

	* g-forstr.ads: More documentation for the Formatted_String
	support.

2016-07-04  Ed Schonberg  <schonberg@adacore.com>

	* exp_ch13.adb (Expand_N_Attribute_Definition_Clause, case
	'Address): If the address comes from an aspect specification
	and not a source attribute definition clause, do not remove
	side effects from the expression, because the expression must
	be elaborated at the freeze point of the object and not at the
	object declaration, because of the delayed analysis of aspect
	specifications.

From-SVN: r237959
2016-07-04 12:00:57 +02:00
Eric Botcazou 9182f71840 re PR ada/48835 (porting GNAT to m68k-linux)
PR ada/48835
	PR ada/61954
	* gcc-interface/gigi.h (enum standard_datatypes): Add ADT_realloc_decl
	(realloc_decl): New macro.
	* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Use local
	variable for the entity type and translate it as void pointer if the
	entity has convention C.
	(gnat_to_gnu_entity) <E_Function>: If this is not a definition and the
	external name matches that of malloc_decl or realloc_decl, return the
	correspoding node directly.
	(gnat_to_gnu_subprog_type): Likewise for parameter and return types.
	* gcc-interface/trans.c (gigi): Initialize void_list_node here, not...
	Initialize realloc_decl.
	* gcc-interface/utils.c (install_builtin_elementary_types): ...here.
	(build_void_list_node): Delete.
	* gcc-interface/utils2.c (known_alignment) <CALL_EXPR>: Return the
	alignment of the system allocator for malloc_decl and realloc_decl.
	Do not take alignment from void pointer types either.

From-SVN: r237850
2016-06-29 13:03:22 +00:00
Eric Botcazou abb67622cf misc.c (LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL): Reorder.
* gcc-interface/misc.c (LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL): Reorder.
	(LANG_HOOKS_INIT_TS): Likewise.

From-SVN: r237848
2016-06-29 12:32:57 +00:00
Arnaud Charlet d13ecc2dc7 sem_prag.adb: Revert unwanted change in previous commit, only keep message fix.
2016-06-22  Arnaud Charlet  <charlet@adacore.com>

	* sem_prag.adb: Revert unwanted change in previous commit,
	only keep message fix.

From-SVN: r237699
2016-06-22 12:51:37 +02:00
Ed Schonberg 017d237ede sem_prag.ads (Build_Classwide_Expression): new procedure to build the expression for an inherited classwide condition...
2016-06-22  Ed Schonberg  <schonberg@adacore.com>

	* sem_prag.ads (Build_Classwide_Expression): new procedure to
	build the expression for an inherited classwide condition, and
	to validate such expressions when they apply to an inherited
	operation that is not overridden.
	* sem_prag.adb (Primitives_Mapping): new data structure to
	handle the mapping between operations of a root type and the
	corresponding overriding operations of a type extension. Used
	to construct the expression for an inherited classwide condition.
	(Update_Primitives_Mapping): add to Primitives_Mapping the links
	between primitive operations of a root type and those of a given
	type extension.
	(Build_Pragma_Check_Equivalent): use Primitives_Mapping.
	* sem_ch6.adb (New_Overloaded_Entity): Remove call to
	Collect_Iherited_Class_Wide_Conditions in GNATprove_Mode. This
	needs to be done at freeze point of the type.
	* freeze.adb (Check_Inherited_Conditions): new procedure to
	verify the legality of inherited classwide conditions. In normal
	compilation mode the procedure determines whether an inherited
	operation needs a wrapper to handle an inherited condition that
	differs from the condition of the root type.  In SPARK mode
	the routine invokes Collect_Inherited_Class_Wide_Conditions to
	produce the SPARK version of these inherited conditions.
	(Freeze_Record_Type): For a type extension, call
	Check_Inherited_Conditions.

From-SVN: r237698
2016-06-22 12:49:48 +02:00
Arnaud Charlet 497a660d21 [multiple changes]
2016-06-22  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_ch3.adb, sem_type.adb, sem.adb, freeze.adb, sem_util.adb,
	s-htable.adb, exp_ch11.adb, s-secsta.adb, restrict.adb, exp_disp.adb,
	sem_ch8.adb, s-tpobop.adb, exp_aggr.ads, sem_ch13.adb: Minor
	reformatting.

2016-06-22  Yannick Moy  <moy@adacore.com>

	* lib-xref-spark_specific.adb (Collect_SPARK_Xrefs): Inverse order of
	treatments so that files without compilation unit are simply skipped
	before more elaborate treatments.

2016-06-22  Bob Duff  <duff@adacore.com>

	* s-memory.ads: Minor typo fixes in comments.
	* s-memory.adb: Code cleanup.

From-SVN: r237697
2016-06-22 12:48:33 +02:00
Olivier Hainque 35484fc8b0 * vxworks-crtbe-link.spec: Removed, no longer used.
From-SVN: r237696
2016-06-22 12:46:14 +02:00
Justin Squirek 194d6f3fc9 sem_ch8.adb (Push_Scope): Add a check for when the scope table is empty to assign the global variable...
2016-06-22  Justin Squirek  <squirek@adacore.com>

	* sem_ch8.adb (Push_Scope): Add a check for when the
	scope table is empty to assign the global variable
	Configuration_Component_Alignment.
	* sem.adb (Do_Analyze): Add Configuration_Component_Alignment
	to be assigned when the environment is cleaned instead of the
	default.
	* sem.ads Add a global variable Configuration_Component_Alignment
	to store the value given by pragma Component_Alignment in the
	context of a configuration file.
	* sem_prag.adb (Analyze_Pragma): Correct the case for
	Component_Alignment so that the pragma is verified and add
	comments to explain how it is applied to the scope stack.

2016-06-22  Justin Squirek  <squirek@adacore.com>

	* sprint.adb (Sprint_Node_Actual): Add check in
	the case of an N_Object_Declaration when evaluating an expression
	to properly ignore errors.

From-SVN: r237694
2016-06-22 12:42:46 +02:00
Arnaud Charlet d1aea5ddc5 [multiple changes]
2016-06-22  Bob Duff  <duff@adacore.com>

	* g-comlin.ads (Parameter_Type): Change subtype of Last to
	Natural.
	* g-comlin.adb (Set_Parameter): Change subtype of Last to
	Natural.
	(Getopt): Check for Arg = "", and Switches /= "".
	(Internal_Initialize_Option_Scan): Check for Argument (Parser,
	Index) /= "".

2016-06-22  Gary Dismukes  <dismukes@adacore.com>

	* sem_prag.adb, sem_ch8.adb: Minor reformatting.

From-SVN: r237693
2016-06-22 12:39:31 +02:00
Arnaud Charlet 405b907c8f [multiple changes]
2016-06-22  Ed Schonberg  <schonberg@adacore.com>

	* einfo.ads, einfo.adb (Is_Actual_Subtype): New flag, defined
	on subtypes that are created within subprogram bodies to handle
	unconstrained composite formals.
	* checks.adb (Apply_Predicate_Check): Do not generate a check on
	an object whose type is an actual subtype.
	* sem_ch6.adb (Set_Actual_Subtypes): Do not generate an
	actual subtype for a formal whose base type is private.
	Set Is_Actual_Subtype on corresponding entity after analyzing
	its declaration.

2016-06-22  Justin Squirek  <squirek@adacore.com>

	* sem_prag.adb (Check_Expr_Is_OK_Static_Expression): Fix ordering
	of if-block and add in a condition to test for errors during
	resolution.
	* sem_res.adb (Resolution_Failed): Add comment to explain why
	the type of a node which failed to resolve is set to the desired
	type instead of Any_Type.
	* sem_ch8.adb (Analyze_Object_Renaming): Add a check for Any_Type
	to prevent crashes on Is_Access_Constant.

From-SVN: r237692
2016-06-22 12:37:08 +02:00
Arnaud Charlet 80007176a5 [multiple changes]
2016-06-22  Hristian Kirtchev  <kirtchev@adacore.com>

	* lib-xref-spark_specific.adb, checks.adb, sem_ch13.adb: Minor
	reformatting.
	* exp_ch7.adb: Minor typo fix.
	* lib.ads (Get_Top_Level_Code_Unit): Add comment.

2016-06-22  Bob Duff  <duff@adacore.com>

	* s-tassta.adb (Task_Wrapper): Fix handling of Fall_Back_Handler
	wrt independent tasks.

2016-06-22  Ed Schonberg  <schonberg@adacore.com>

	* sem_dim.adb (Analyze_Dimension): Propagate dimension for
	explicit_dereference nodes when they do not come from source,
	to handle correctly dimensional analysis on iterators over
	containers whose elements have declared dimensions.

From-SVN: r237691
2016-06-22 12:35:28 +02:00
Arnaud Charlet 7ffbef9966 spark_xrefs.ads (Scope_Num): type refined to positive integers.
2016-06-22  Arnaud Charlet  <charlet@adacore.com>

	* spark_xrefs.ads (Scope_Num): type refined to positive integers.
	* lib-xref-spark_specific.adb (Detect_And_Add_SPARK_Scope):
	moved into scope of Collect_SPARK_Xrefs.
	(Add_SPARK_Scope): moved into scope of Collect_SPARK_Xrefs;
	now uses Dspec and Scope_Id from Collect_SPARK_Xrefs.
	(Collect_SPARK_Xrefs): refactored to avoid retraversing the list
	of scopes.
	(Traverse_Compilation_Unit): refactored as a generic procedure.
	* types.ads (Unit_Number_Type): range refined.

From-SVN: r237690
2016-06-22 12:31:47 +02:00
Arnaud Charlet f26a3587a6 [multiple changes]
2016-06-22  Hristian Kirtchev  <kirtchev@adacore.com>

	* lib-xref-spark_specific.adb, a-cuprqu.ads, sem_ch6.adb: Minor
	reformatting.

2016-06-22  Eric Botcazou  <ebotcazou@adacore.com>

	* sem_util.ads (Address_Value): Declare new function.
	* sem_util.adb (Address_Value): New function extracted
	unmodified from Apply_Address_Clause_Check, which returns the
	underlying value of the expression of an address clause.
	* checks.adb (Compile_Time_Bad_Alignment): Delete.
	(Apply_Address_Clause_Check): Call Address_Value on
	the expression.  Do not issue the main warning here and
	issue the secondary warning only when the value of the
	expression is not known at compile time.
	* sem_ch13.adb (Address_Clause_Check_Record): Add A component and
	adjust the description.
	(Analyze_Attribute_Definition_Clause): In the case
	of an address, move up the code creating an entry in the table of
	address clauses.  Also create an entry for an absolute address.
	(Validate_Address_Clauses): Issue the warning for absolute
	addresses here too.  Tweak condition associated with overlays
	for consistency.

From-SVN: r237688
2016-06-22 12:05:04 +02:00
Arnaud Charlet f24ea9120d [multiple changes]
2016-06-22  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch13.adb (Is_Predicate_Static): An inherited predicate
	can be static only if it applies to a scalar type.

2016-06-22  Ed Schonberg  <schonberg@adacore.com>

	* exp_util.adb (Adjust_Result_Type): Convert operand to base
	type to prevent spurious constraint checks on subtypes of Boolean.

2016-06-22  Bob Duff  <duff@adacore.com>

	* debug.adb: Document debug switch -gnatd.o.
	* sem_elab.adb (Check_Internal_Call): Debug switch -gnatd.o
	now causes a more conservative treatment of indirect calls,
	treating P'Access as a call to P in more cases. We Can't make
	this the default, because it breaks common idioms, for example
	the soft links.
	* sem_util.adb: Add an Assert.

2016-06-22  Bob Duff  <duff@adacore.com>

	* a-cuprqu.ads, a-cuprqu.adb: Completely rewrite this package. Use
	red-black trees, which gives O(lg N) worst-case performance on
	Enqueue and Dequeue. The previous version had O(N) Enqueue in
	the worst case.

2016-06-22  Arnaud Charlet  <charlet@adacore.com>

	* sem_warn.adb: minor style fix in comment.
	* spark_xrefs.ads (Scope_Num): type refined to positive integers.
	* lib-xref-spark_specific.adb (Detect_And_Add_SPARK_Scope):
	moved into scope of Collect_SPARK_Xrefs.
	(Add_SPARK_Scope): moved into scope of Collect_SPARK_Xrefs;
	now uses Dspec and Scope_Id from Collect_SPARK_Xrefs.
	(Collect_SPARK_Xrefs): refactored to avoid retraversing the list
	of scopes.
	* sem_ch3.adb (Build_Discriminal): Set Parent of the discriminal.

From-SVN: r237687
2016-06-22 12:00:24 +02:00
Arnaud Charlet b48a45e33c lib-xref-spark_specific.adb (Generate_Dereference): Assignment to not commented local variables replaced with direct uses of their...
2016-06-22  Arnaud Charlet  <charlet@adacore.com>

	* lib-xref-spark_specific.adb (Generate_Dereference): Assignment to not
	commented local variables replaced with direct uses of their values.

From-SVN: r237685
2016-06-22 11:55:42 +02:00
Arnaud Charlet 22da877084 [multiple changes]
2016-06-22  Hristian Kirtchev  <kirtchev@adacore.com>

	* exp_ch7.adb (Add_Invariant): Replace the
	current type instance with the _object parameter even in ASIS mode.
	(Build_Invariant_Procedure_Body): Do not insert the
	invariant procedure body into the tree for ASIS and GNATprove.
	(Build_Invariant_Procedure_Declaration): Do not insert the
	invariant procedure declaration into the tree for ASIS and
	GNATprove.
	* lib-xref-spark_specific.adb (Add_SPARK_Scope): Update comment.

2016-06-22  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch6.adb (Set_Actual_Subtypes): If the type of the actual
	has predicates, the actual subtype must be frozen properly
	because of the generated tests that may follow.  The predicate
	may be specified by an explicit aspect, or may be inherited in
	a derivation.

From-SVN: r237684
2016-06-22 11:51:47 +02:00
Ed Schonberg 444656ce62 exp_ch4.adb (In_Range_Chec)): New predicate, subsidiary of Expand_N_In...
2016-06-22  Ed Schonberg  <schonberg@adacore.com>

	* exp_ch4.adb (In_Range_Chec)): New predicate, subsidiary of
	Expand_N_In: within an expanded range check that might raise
	Constraint_Error do not generate a predicate check as well. It
	is redundant because the context will add an explicit predicate
	check, and it will raise the wrong exception if it fails.
	* lib-xref-spark_specific.adb (Add_SPARK_File): Remove useless checks
	since dependency units always have an associated compilation unit.

From-SVN: r237683
2016-06-22 11:48:49 +02:00
Arnaud Charlet 3bb91f983b lib.ads: Code cleanup.
2016-06-22  Arnaud Charlet  <charlet@adacore.com>

	* lib.ads: Code cleanup.
	* inline.adb: Type refinement for a counter variable.
	* lib-xref-spark_specific.adb (Add_SPARK_File): removal of no-op code.
	Code cleanup.

From-SVN: r237682
2016-06-22 11:47:02 +02:00
Eric Botcazou d42b755992 tree.c (verify_type_variant): Skip TYPE_SIZE and TYPE_SIZE_UNIT if they are both PLACEHOLDER_EXPRs.
* tree.c (verify_type_variant): Skip TYPE_SIZE and TYPE_SIZE_UNIT if
	they are both PLACEHOLDER_EXPRs.
ada/
	* gcc-interface/decl.c (set_nonaliased_component_on_array_type): New
	function.
	(set_reverse_storage_order_on_array_type): Likewise.
	(gnat_to_gnu_entity) <E_Array_Type>: Call them to set the flags.
	<E_Array_Subtype>: Likewise.
	<E_String_Literal_Subtype>: Likewise.
	(substitute_in_type) <ARRAY_TYPE>: Likewise.
	* gcc-interface/utils.c (gnat_pushdecl): Always create a variant for
	the DECL_ORIGINAL_TYPE of a type.

From-SVN: r237658
2016-06-21 21:34:12 +00:00
Arnaud Charlet 20250fb87c [multiple changes]
2016-06-20  Hristian Kirtchev  <kirtchev@adacore.com>

	* make.adb, gnatbind.adb, g-socket.adb, sem_ch13.adb: Minor
	reformatting.
	* lib.ads, sem_util.adb: Minor typo in comment.

2016-06-20  Yannick Moy  <moy@adacore.com>

	* sem_prag.adb, sem_prag.ads (Build_Pragma_Check_Equivalent):
	Add parameter Keep_Pragma_Id to optionally keep
	the identifier of the pragma instead of converting
	to pragma Check. Also set type of new function call
	appropriately.	(Collect_Inherited_Class_Wide_Conditions):
	Call Build_Pragma_Check_Equivalent with the new parameter
	Keep_Pragma_Id set to True to keep the identifier of the copied
	pragma.
	* sinfo.ads: Add comment.

2016-06-20  Hristian Kirtchev  <kirtchev@adacore.com>

	* exp_ch7.adb (Build_Invariant_Procedure_Body):
	Always install the scope of the invariant procedure
	in order to produce better error messages. Do not
	insert the body when the context is a generic unit.
	(Build_Invariant_Procedure_Declaration): Perform minimal
	decoration of the invariant procedure and its formal parameter
	in case they are not analyzed.	Do not insert the declaration
	when the context is a generic unit.

From-SVN: r237600
2016-06-20 14:31:47 +02:00
Ed Schonberg 9e3be36e46 sem_ch13.adb (Visible_Component): New procedure...
2016-06-20  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch13.adb (Visible_Component): New procedure, subsidiary
	of Replace_Type_References_ Generic, to determine whether an
	identifier in a predicate or invariant expression is a visible
	component of the type to which the predicate or invariant
	applies. Implements the visibility rule stated in RM 13.1.1
	(12/3).

From-SVN: r237599
2016-06-20 14:27:05 +02:00
Arnaud Charlet 2f8d7dfe21 [multiple changes]
2016-06-20  Hristian Kirtchev  <kirtchev@adacore.com>

	* s-regpat.adb, sem_prag.adb, pprint.adb, sem_ch13.adb: Minor
	reformatting.

2016-06-20  Tristan Gingold  <gingold@adacore.com>

	* make.adb (Check_Standard_Library): Consider system.ads
	if s-stalib.adb is not available.
	* gnatbind.adb (Add_Artificial_ALI_File): New procedure extracted from
	gnatbind.

2016-06-20  Thomas Quinot  <quinot@adacore.com>

	* g-socket.adb (Is_IP_Address): A string consisting in digits only is
	not a dotted quad.

2016-06-20  Arnaud Charlet  <charlet@adacore.com>

	* exp_ch7.adb (Build_Invariant_Procedure_Body):
	decorate invariant procedure body with typical properties of
	procedure entityes.

2016-06-20  Arnaud Charlet  <charlet@adacore.com>

	* a-exetim-darwin.adb: New file.

From-SVN: r237598
2016-06-20 14:25:44 +02:00
Arnaud Charlet 3ddfabe34f [multiple changes]
2016-06-16  Hristian Kirtchev  <kirtchev@adacore.com>

	* atree.ads, atree.adb (Elist29): New routine.
	(Set_Elist29): New routine.
	* atree.h New definition for Elist29.
	* einfo.adb Subprograms_For_Type is now an Elist rather than
	a node. Has_Invariants is now a synthesized attribute
	and does not require a flag. Has_Own_Invariants
	is now Flag232. Has_Inherited_Invariants is
	Flag291. Is_Partial_Invariant_Procedure is Flag292.
	(Default_Init_Cond_Procedure): Reimplemented.
	(Has_Inherited_Invariants): New routine.
	(Has_Invariants): Reimplemented.
	(Has_Own_Invariants): New routine.
	(Invariant_Procedure): Reimplemented.
	(Is_Partial_Invariant_Procedure): New routine.
	(Partial_Invariant_Procedure): Reimplemented.
	(Predicate_Function): Reimplemented.
	(Predicate_Function_M): Reimplemented.
	(Set_Default_Init_Cond_Procedure): Reimplemented.
	(Set_Has_Inherited_Invariants): New routine.
	(Set_Has_Invariants): Removed.
	(Set_Has_Own_Invariants): New routine.
	(Set_Invariant_Procedure): Reimplemented.
	(Set_Is_Partial_Invariant_Procedure): New routine.
	(Set_Partial_Invariant_Procedure): Reimplemented.
	(Set_Predicate_Function): Reimplemented.
	(Set_Predicate_Function_M): Reimplemented.
	(Set_Subprograms_For_Type): Reimplemented.
	(Subprograms_For_Type): Reimplemented.
	(Write_Entity_Flags): Output Flag232 and Flag291.
	* einfo.ads Add new attributes Has_Inherited_Invariants
	Has_Own_Invariants Is_Partial_Invariant_Procedure
	Partial_Invariant_Procedure Change the documentation
	of attributes Has_Inheritable_Invariants Has_Invariants
	Invariant_Procedure Is_Invariant_Procedure Subprograms_For_Type
	(Has_Inherited_Invariants): New routine along with pragma Inline.
	(Has_Own_Invariants): New routine along with pragma Inline.
	(Is_Partial_Invariant_Procedure): New routine along with pragma Inline.
	(Partial_Invariant_Procedure): New routine.
	(Set_Has_Inherited_Invariants): New routine along with pragma Inline.
	(Set_Has_Invariants): Removed along with pragma Inline.
	(Set_Has_Own_Invariants): New routine along with pragma Inline.
	(Set_Is_Partial_Invariant_Procedure): New routine
	along with pragma Inline.
	(Set_Partial_Invariant_Procedure): New routine.
	(Set_Subprograms_For_Type): Update the signature.
	(Subprograms_For_Type): Update the signature.
	* exp_ch3.adb Remove with and use clauses for Sem_Ch13.
	(Build_Array_Invariant_Proc): Removed.
	(Build_Record_Invariant_Proc): Removed.
	(Freeze_Type): Build the body of the invariant procedure.
	(Insert_Component_Invariant_Checks): Removed.
	* exp_ch7.adb Add with and use clauses for Sem_Ch6, Sem_Ch13,
	and Stringt.
	(Build_Invariant_Procedure_Body): New routine.
	(Build_Invariant_Procedure_Declaration): New routine.
	* exp_ch7.ads (Build_Invariant_Procedure_Body): New routine.
	(Build_Invariant_Procedure_Declaration): New routine.
	* exp_ch9.adb (Build_Corresponding_Record): Do not propagate
	attributes related to invariants to the corresponding record
	when building the corresponding record. This is done by
	Build_Invariant_Procedure_Declaration.
	* exp_util.adb (Make_Invariant_Call): Reimplemented.
	* freeze.adb (Freeze_Array_Type): An array type requires an
	invariant procedure when its component type has invariants.
	(Freeze_Record_Type): A record type requires an invariant
	procedure when at least one of its components has an invariant.
	* sem_ch3.adb (Analyze_Private_Extension_Declaration): Inherit
	invariant-related attributes.
	(Analyze_Subtype_Declaration):
	Inherit invariant-related attributes.
	(Build_Derived_Record_Type): Inherit invariant-related attributes.
	(Check_Duplicate_Aspects): Reimplemented.
	(Get_Partial_View_Aspect): New routine.
	(Process_Full_View): Inherit invariant-related attributes. Reimplement
	the check on hidden inheritance of class-wide invariants.
	(Remove_Default_Init_Cond_Procedure): Reimplemented.
	* sem_ch6.adb (Analyze_Subprogram_Specification): Do not modify
	the controlling type for an invariant procedure declaration
	or body.
	(Is_Invariant_Procedure_Or_Body): New routine.
	* sem_ch7.adb (Analyze_Package_Specification): Build the partial
	invariant body in order to preanalyze and resolve all invariants
	of a private type at the end of the visible declarations. Build
	the full invariant body in order to preanalyze and resolve
	all invariants of a private type's full view at the end of
	the private declarations.
	(Preserve_Full_Attributes): Inherit invariant-related attributes.
	* sem_ch9.adb (Analyze_Protected_Type_Declaration): Ensure that
	aspects are analyzed with the proper view when the protected type
	is a completion of a private type. Inherit invariant-related attributes.
	(Analyze_Task_Type_Declaration): Ensure that
	aspects are analyzed with the proper view when the task type
	is a completion of a private type. Inherit invariant-related
	attributes.
	* sem_ch13.adb Remove with and use clauses for Stringt.
	(Build_Invariant_Procedure_Declaration): Removed.
	(Build_Invariant_Procedure): Removed.
	(Freeze_Entity_Checks): Do not build the body of the invariant
	procedure here.
	The body is built when the type is frozen in Freeze_Type.
	(Inherit_Aspects_At_Freeze_Point): Do not inherit any attributes
	related to invariants here because this leads to erroneous
	inheritance.
	(Replace_Node): Rename to Replace_Type_Ref.
	* sem_ch13.ads (Build_Invariant_Procedure_Declaration): Removed.
	(Build_Invariant_Procedure): Removed.
	* sem_prag.adb Add with and use clauses for Exp_Ch7.
	(Analyze_Pragma): Reimplement the analysis of pragma Invariant.
	* sem_res.adb (Resolve_Actuals): Emit a specialized error when
	the context is an invariant.
	* sem_util.adb (Get_Views): New routine.
	(Incomplete_Or_Partial_View): Consider generic packages when
	examining declarations.
	(Inspect_Decls): Consider full type
	declarations because they may denote a derivation from a
	private type.
	(Propagate_Invariant_Attributes): New routine.
	* sem_util.ads (Get_Views): New routine.
	(Propagate_Invariant_Attributes): New routine.

2016-06-16  Arnaud Charlet  <charlet@adacore.com>

	* pprint.adb (Expression_Image): Add better handling of UCs,
	we don't want to strip them all for clarity.

From-SVN: r237596
2016-06-20 14:22:09 +02:00
Kyrylo Tkachov ff7b374b78 [typo] alignement -> alignment
2016-06-20  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

    * params.def (PARAM_ALIGN_LOOP_ITERATIONS): Use "alignment" instead of
    "alignement".
    * tree.h (TYPE_ALIGN): Likewise.

2016-06-20  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

    * exp_util.adb (Safe_Unchecked_Type_Conversion): Use "alignment"
    instead of "alignement".

2016-06-20  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

    * gfortran.dg/common_align_2.f90: Use "alignment" instead of
    "alignement".

From-SVN: r237590
2016-06-20 11:12:07 +00:00
Arnaud Charlet 73170f9e46 [multiple changes]
2016-06-16  Gary Dismukes  <dismukes@adacore.com>

	* sem_util.adb: Minor typo fix.

2016-06-16  Emmanuel Briot  <briot@adacore.com>

	* s-regpat.adb: Further fix for invalid index in GNAT.Regexp.

2016-06-16  Eric Botcazou  <ebotcazou@adacore.com>

	* sem_ch13.adb (Validate_Address_Clauses): Use the same logic to
	issue the warning on the offset for the size as for the alignment
	and tweak the wording for the sake of consistency.

2016-06-16  Ed Schonberg  <schonberg@adacore.com>

	* sem_prag.adb (Check_Class_Wide_COndition): New procedure,
	subsidiary of Analyze_Pre_Post_ Condition_In_Decl_Part, to
	check legality rules that follow from the revised semantics of
	class-wide pre/postconditions described in AI12-0113.
	(Build_Pragma_Check_Equivalent): Abstract subprogram declarations
	must be included in list of overriding primitives of a derived
	type.

From-SVN: r237521
2016-06-16 12:39:14 +02:00
Arnaud Charlet 4bfb35fdce [multiple changes]
2016-06-16  Ed Schonberg  <schonberg@adacore.com>

	* sem_util.adb (May_Be_Lvalue): An actual in an unexpanded
	attribute reference 'Read is an assignment and must be considered
	a modification of the object.

2016-06-16  Gary Dismukes  <dismukes@adacore.com>

	* einfo.adb: Minor editorial.

From-SVN: r237517
2016-06-16 12:29:00 +02:00
Arnaud Charlet d1b83e6253 [multiple changes]
2016-06-16  Ed Schonberg  <schonberg@adacore.com>

	* sem_prag.adb (Overridden_Ancestor): Clean up code to use
	controlling type of desired primitive rather than its scope,
	because the primitive that inherits the classwide condition may
	comes from several derivation steps.

2016-06-16  Javier Miranda  <miranda@adacore.com>

	* einfo.adb (Set_Default_Init_Cond_Procedure): Allow calls setting
	this attribute to Empty (only if the attribute has not been set).
	* sem_util.adb (Build_Default_Init_Cond_Procedure_Body):
	No action needed if the spec was not built.
	(Build_Default_Init_Cond_Procedure_Declaration): The spec is
	not built if DIC is set to NULL or no condition was specified.
	* exp_ch3.adb (Expand_N_Object_Declaration): Check availability
	of the Init_Cond procedure before generating code to call it.

2016-06-16  Emmanuel Briot  <briot@adacore.com>

	* s-regpat.adb: Fix invalid index check when matching end-of-line
	on substrings.

2016-06-16  Arnaud Charlet  <charlet@adacore.com>

	* gnat1drv.adb: Minor reformatting.

From-SVN: r237516
2016-06-16 12:27:34 +02:00
Arnaud Charlet 3386e3ae5d [multiple changes]
2016-06-16  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch3.adb (Check_Entry_Contracts): New procedure, subsidiary
	of Analyze_Declarations, that performs pre-analysis of
	pre/postconditions on entry declarations before full analysis
	is performed after entries have been converted into procedures.
	Done solely to capture semantic errors.
	* sem_attr.adb (Analyze_Attribute, case 'Result): Add guard to
	call to Denote_Same_Function.

2016-06-16  Emmanuel Briot  <briot@adacore.com>

	* g-comlin.adb: Fix minor memory leak in GNAT.Command_Line.

2016-06-16  Hristian Kirtchev  <kirtchev@adacore.com>

	* exp_ch7.adb (Find_Last_Init): Remove obsolete code. The
	logic is now performed by Process_Object_Declaration.
	(Process_Declarations): Recognize a controlled deferred
	constant which is in fact initialized by means of a
	build-in-place function call as needing finalization actions.
	(Process_Object_Declaration): Insert the counter after the
	build-in-place initialization call for a controlled object. This
	was previously done in Find_Last_Init.
	* exp_util.adb (Requires_Cleanup_Actions): Recognize a controlled
	deferred constant which is in fact initialized by means of a
	build-in-place function call as needing finalization actions.

2016-06-16  Justin Squirek  <squirek@adacore.com>

	* exp_aggr.adb (Expand_Array_Aggregate): Minor comment changes and
	additional style fixes.
	* exp_ch7.adb: Minor typo fixes and reformatting.

From-SVN: r237515
2016-06-16 12:25:47 +02:00
Arnaud Charlet 5ed4ba1574 [multiple changes]
2016-06-16  Justin Squirek  <squirek@adacore.com>

	* sem_ch3.adb (Analyze_Object_Declaration): Add a missing check
	for optimized aggregate arrays with qualified expressions.
	* exp_aggr.adb (Expand_Array_Aggregate): Fix block and
	conditional statement in charge of deciding whether to perform
	in-place expansion. Specifically, use Parent_Node to jump over
	the qualified expression to the object declaration node. Also,
	a check has been inserted to skip the optimization if SPARK 2005
	is being used in strict adherence to RM 4.3(5).

2016-06-16  Tristan Gingold  <gingold@adacore.com>

	* sem_prag.adb (Analyze_Pragma): Simplify code
	for Pragma_Priority.

From-SVN: r237514
2016-06-16 12:23:06 +02:00
Eric Botcazou 36d3d5d3db sem_util.ads (Indexed_Component_Bit_Offset): Declare.
2016-06-16  Eric Botcazou  <ebotcazou@adacore.com>

	* sem_util.ads (Indexed_Component_Bit_Offset): Declare.
	* sem_util.adb (Indexed_Component_Bit_Offset): New
	function returning the offset of an indexed component.
	(Has_Compatible_Alignment_Internal): Call it.
	* sem_ch13.adb (Offset_Value): New function returning the offset of an
	Address attribute reference from the underlying entity.
	(Validate_Address_Clauses): Call it and take the offset into
	account for the size warning.

From-SVN: r237511
2016-06-16 12:19:51 +02:00
Hristian Kirtchev 3455747810 bindgen.adb, [...]: Minor reformatting.
2016-06-16  Hristian Kirtchev  <kirtchev@adacore.com>

	* bindgen.adb, exp_util.adb, sem_ch9.adb, sem_util.adb: Minor
	reformatting.

From-SVN: r237510
2016-06-16 12:12:26 +02:00
Gary Dismukes 3ab53b0db9 sem_ch9.adb, [...]: Minor reformatting and typo fixes.
2016-06-16  Gary Dismukes  <dismukes@adacore.com>

	* sem_ch9.adb, sem_util.ads, sem_res.adb: Minor reformatting and typo
	fixes.

From-SVN: r237509
2016-06-16 12:11:23 +02:00
Arnaud Charlet a8a42b933c [multiple changes]
2016-06-16  Javier Miranda  <miranda@adacore.com>

	* sem_res.adb (Resolve): Under relaxed RM semantics silently
	replace occurrences of null by System.Null_Address.
	* sem_ch4.adb (Analyze_One_Call, Operator_Check): Under
	relaxed RM semantics silently replace occurrences of null by
	System.Null_Address.
	* sem_util.ad[sb] (Null_To_Null_Address_Convert_OK): New subprogram.
	(Replace_Null_By_Null_Address): New subprogram.

2016-06-16  Bob Duff  <duff@adacore.com>

	* exp_util.adb (Is_Controlled_Function_Call):
	This was missing the case where the call is in prefix format,
	with named notation, as in Obj.Func (Formal => Actual).

From-SVN: r237508
2016-06-16 11:52:17 +02:00
Arnaud Charlet fb757f7da4 [multiple changes]
2016-06-16  Hristian Kirtchev  <kirtchev@adacore.com>

	* exp_attr.adb, inline.adb, sem_attr.adb, sem_elab.adb: Minor
	reformatting.

2016-06-16  Bob Duff  <duff@adacore.com>

	* sem_util.adb (Collect): Avoid Empty Full_T. Otherwise Etype
	(Full_T) crashes when assertions are on.
	* sem_ch12.adb (Matching_Actual): Correctly handle the case where
	"others => <>" appears in a generic formal package, other than
	by itself.

2016-06-16  Arnaud Charlet  <charlet@adacore.com>

	* usage.adb: Remove confusing comment in usage line.
	* bindgen.adb: Fix binder generated file in codepeer mode wrt
	recent additions.

2016-06-16  Javier Miranda  <miranda@adacore.com>

	* restrict.adb (Check_Restriction_No_Use_Of_Entity): Avoid
	never-ending loop, code cleanup; adding also support for Text_IO.
	* sem_ch8.adb (Find_Expanded_Name): Invoke
	Check_Restriction_No_Use_Entity.

2016-06-16  Tristan Gingold  <gingold@adacore.com>

	* exp_ch9.adb: Minor comment fix.
	* einfo.ads (Has_Protected): Clarify comment.
	* sem_ch9.adb (Analyze_Protected_Type_Declaration): Do not
	consider private protected types declared in the runtime for
	the No_Local_Protected_Types restriction.

From-SVN: r237507
2016-06-16 11:44:04 +02:00
Arnaud Charlet 124bed2985 [multiple changes]
2016-06-14  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch6.adb (Set_Actual_Subtypes): Do not generate actual
	subtypes for unconstrained formals when analyzing the generated
	body of an expression function, because it may lead to premature
	and misplaced freezing of the types of formals.

2016-06-14  Gary Dismukes  <dismukes@adacore.com>

	* sem_elab.adb, sem_ch4.adb: Minor reformatting and typo fix.

2016-06-14  Tristan Gingold  <gingold@adacore.com>

	* einfo.adb (Set_Has_Timing_Event): Add assertion.
	* sem_util.ads, sem_util.adb (Propagate_Concurrent_Flags): New
	name for Propagate_Type_Has_Flags.
	* exp_ch3.adb, sem_ch3.adb, sem_ch7.adb, sem_ch9.adb: Adjust after
	renaming.

From-SVN: r237439
2016-06-14 14:41:03 +02:00
Arnaud Charlet 519e9fdfba [multiple changes]
2016-06-14  Bob Duff  <duff@adacore.com>

	* sem_elab.adb (Check_A_Call): Do nothing if the callee is
	(or is in) an instance, and the caller is outside.  Misc cleanup.

2016-06-14  Javier Miranda  <miranda@adacore.com>

	* sem_ch4.adb (Analyze_Quantified_Expression):
	Generating C code avoid spurious warning on loop variable of
	inlinined postconditions.

From-SVN: r237438
2016-06-14 14:39:11 +02:00
Javier Miranda 64f5d139b9 sem_attr.adb (Analyze_Attribute_Old_Result): Adding assertion.
2016-06-14  Javier Miranda  <miranda@adacore.com>

	* sem_attr.adb (Analyze_Attribute_Old_Result): Adding assertion.
	(Analyze_Attribute [Attribute_Old]): Generating C handle
	analysis of 'old in inlined postconditions.
	(Analyze_Attribute [Attribute_Result]): Generating C handle analysis
	of 'result in inlined postconditions.
	* exp_attr.adb (Expand_N_Attribute_Reference [Attribute_Old]):
	Generating C handle expansion of 'old in inlined postconditions.
	* inline.adb (Declare_Postconditions_Result): New subprogram.
	* sem_ch12.adb (Copy_Generic_Node): Copy pragmas generated from
	aspects when generating C code since pre/post conditions are
	inlined and the frontend inlining relies on this routine to
	perform inlining.
	* exp_ch6.adb (Inlined_Subprogram): Replace Generate_C_Code
	by Modify_Tree_For_C.
	* exp_unst.adb (Visit_Node): Searching for up-level references
	skip entities defined in inlined subprograms.

From-SVN: r237437
2016-06-14 14:37:54 +02:00
Arnaud Charlet 5a52795215 [multiple changes]
2016-06-14  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_ch7.adb, sem_ch12.adb, freeze.adb, lib-xref.ads, exp_ch3.adb:
	Minor reformatting.

2016-06-14  Bob Duff  <duff@adacore.com>

	* sem_elab.adb: Do nothing if the callee is intrinsic.
	* sinfo.ads, einfo.ads: Minor comment fixes.

From-SVN: r237436
2016-06-14 14:36:01 +02:00
Arnaud Charlet 7782ff6771 [multiple changes]
2016-06-14  Ed Schonberg  <schonberg@adacore.com>

	* contracts.adb (Has_Null_Body): Move to sem_util, for general
	availability.
	* sem_util.ads, sem_util.adb (Has_Null_Body): Predicate to
	determine when an internal procedure created for some assertion
	checking (e.g. type invariant) is a null procedure. Used to
	eliminate redundant calls to such procedures when they apply to
	components of composite types.
	* exp_ch3.adb (Build_Component_Invariant_Call): Do not add call
	if invariant procedure has a null body.

2016-06-14  Thomas Quinot  <quinot@adacore.com>

	* g-socket.ads (Check_Selector): Clarify effect on IN OUT socket
	set parameters.

2016-06-14  Hristian Kirtchev  <kirtchev@adacore.com>

	* exp_ch4.adb (Process_Action): Pass the action
	list to Process_Transient_Object.
	(Process_If_Case_Statements): Pass the action list to
	Process_Transient_Object.
	(Process_Transient_Object): Add new parameter Stmts and update the
	comment on usage. When the context is a Boolean evaluation, insert
	any finalization calls after the last statement of the construct.

From-SVN: r237435
2016-06-14 14:33:56 +02:00
Arnaud Charlet 4969efdf7d [multiple changes]
2016-06-14  Tristan Gingold  <gingold@adacore.com>

	* einfo.adb, einfo.ads (Has_Timing_Event,
	Set_Has_Timing_Event): Add Has_Timing_Event flag.
	(Write_Entity_Flags): Display * sem_util.ads, sem_util.adb:
	(Propagate_Type_Has_Flags): New procedure to factorize code.
	* exp_ch3.adb (Expand_Freeze_Array_Type,
	Expand_Freeze_Record_Type): Call Propagate_Type_Has_Flags.
	* sem_ch3.adb (Access_Type_Decalaration): Initialize
	Has_Timing_Event flag.	(Analyze_Object_Declaration):
	Move code that check No_Local_Timing_Events near
	the code that check No_Local_Protected_Objects.
	(Analyze_Private_Extension_Declaration, Array_Type_Declaration)
	(Build_Derived_Type, Copy_Array_Base_Type_Attributes,
	Process_Full_View) (Record_Type_Definition): Call
	Propagate_Type_Has_Flags.
	* sem_ch4.adb (Analyze_Allocator): Check No_Local_Timing_Events.
	* sem_ch7.adb (New_Private_Type): Set Has_Timing_Event on the
	Timing_Event type.
	(Uninstall_Declaration): Call Propagate_Type_Has_Flags.
	* sem_ch9.adb (Analyze_Protected_Definition): Call
	Propagate_Type_Has_Flags.

2016-06-14  Arnaud Charlet  <charlet@adacore.com>

	* sem.ads: Minor style fix.

From-SVN: r237434
2016-06-14 14:23:34 +02:00
Arnaud Charlet 44900051ac [multiple changes]
2016-06-14  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch12.adb (Analyze_Associations): An actual parameter
	with a box must be included in the count of actuals, to detect
	possible superfluous named actuals that do not match any of the
	formals of the generic unit in a formal package declaration.

2016-06-14  Justin Squirek  <squirek@adacore.com>

	* sem_ch3.adb (Analyze_Object_Declaration): Fix formatting
	of error output related to SPARK RM 6.1.7(3) and pragma
	Extensions_Visible.
	* sem_ch4.adb (Analyze_Type_Conversion): Fix formatting of error
	output related to SPARK RM 6.1.7(3) and pragma Extensions_Visible.
	* sem_prag.adb (Analyze_Pragma): Fix formatting of error output
	related to SPARK RM 7.1.2(15) and pragma Volatile_Function
	so that the values True and False are no longer surrounded by
	double quotes.
	* sem_res.adb (Resolve_Actuals): Fix formatting of error output
	related to SPARK RM 6.1.7(3) and pragma Extensions_Visible.

2016-06-14  Arnaud Charlet  <charlet@adacore.com>

	* gnat1drv.adb (Adjust_Global_Switches): Enable access checks
	in codepeer mode.
	* freeze.adb: Minor grammar fix in comment.

From-SVN: r237433
2016-06-14 14:20:01 +02:00
Arnaud Charlet 0da343bce0 [multiple changes]
2016-06-14  Hristian Kirtchev  <kirtchev@adacore.com>

	* lib.adb: Minor reformatting.
	* sem_util.adb (Is_OK_Volatile_Context): Do
	include Address in the supported attributes.

2016-06-14  Hristian Kirtchev  <kirtchev@adacore.com>

	* exp_ch4.adb (Expand_N_Case_Expression):
	Code cleanup. Finalize any transient controlled
	objects on exit from a case expression alternative.
	(Expand_N_If_Expression): Code cleanup.
	(Process_Actions): Removed.
	(Process_If_Case_Statements): New routine.
	(Process_Transient_Object): Change the name of formal Rel_Node to
	N and update all occurrences. Update the comment on usage. When
	the type of the context is Boolean, the proper insertion point
	for the finalization call is after the last declaration.

2016-06-14  Ed Schonberg  <schonberg@adacore.com>

	* lib-xref.ads, lib-xref.adb (Has_Deferred_Reference): new
	predicate to determine whether an entity appears in a context
	for which a Deferred_Reference was created, because it is not
	possible to determine when reference is analyzed whether it
	appears in a context in which the entity is modified.
	* sem_ch5.adb (Analyze_Statement): Do not emit a useless warning
	on assignment for an entity that has a deferred_reference.

2016-06-14  Javier Miranda  <miranda@adacore.com>

	* sem_res.adb (Resolve_Actuals): Generate a reference to actuals that
	come from source. Previously the reference was generated only if the
	call comes from source but the call may be rewritten by the expander
	thus causing the notification of spurious warnings.

2016-06-14  Arnaud Charlet  <charlet@adacore.com>

	* gnat1drv.adb: Remove further references to AAMP.
	* checks.adb (Apply_Scalar_Range_Check): Take
	Check_Float_Overflow info account.
	* live.ads, live.adb Added subprogram headers and
	start-of-processing-for comments.
	* sem_ch12.adb (Instantiate_Package_Body): Do not suppress
	checks when instantiating runtime units in CodePeer mode.

From-SVN: r237432
2016-06-14 14:17:48 +02:00
Arnaud Charlet a5150cb18f [multiple changes]
2016-06-14  Arnaud Charlet  <charlet@adacore.com>

	* exp_ch3.adb (Expand_N_Object_Declaration): Only consider
	nodes from sources.

2016-06-14  Arnaud Charlet  <charlet@adacore.com>

	* switch-c.adb, gnat1drv.adb (Adjust_Global_Switches): Only disable
	simple value propagation in CodePeer mode when warnings are disabled.
	(Scan_Front_End_Switches): Enable relevant front-end switches
	when using -gnateC.

2016-06-14  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_util.adb (Is_OK_Volatile_Context): A
	reference to a volatile object is considered OK if appears as
	the prefix of attributes Address, Alignment, Component_Size,
	First_Bit, Last_Bit, Position, Size, Storage_Size.

2016-06-14  Yannick Moy  <moy@adacore.com>

	* lib-xref-spark_specific.adb (Add_SPARK_File): Do not traverse
	subunits directly, as they are already traversed as part of the
	top-level unit to which they belong.
	(Add_SPARK_Xrefs): Add assertions to ensure correct sorting.
	(Generate_Dereference): Use unique definition place for special
	variable __HEAP, to ensure correct sorting of references.
	* lib-xref.adb (Generate_Reference): Use top-level unit in case
	of subunits.
	* lib.adb, lib.ads (Get_Top_Level_Code_Unit): New functions that
	compute the top-level code unit for a source location of AST node,
	that go past subunits.

From-SVN: r237431
2016-06-14 14:12:42 +02:00
Eric Botcazou 7cdb687133 decl.c (gnat_to_gnu_subprog_type): Build only a minimal PARM_DECL when the parameter type is dummy.
* gcc-interface/decl.c (gnat_to_gnu_subprog_type): Build only a minimal
	PARM_DECL when the parameter type is dummy.
	* gcc-interface/trans.c (Call_to_gnu): Translate formal types before
	formal objects.

From-SVN: r237362
2016-06-13 08:17:07 +00:00
Eric Botcazou 42e77cbc7d decl.c (gnat_to_gnu_entity): Deal with PLUS_EXPR in the expression of a renaming.
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Deal with
	PLUS_EXPR in the expression of a renaming.

From-SVN: r237360
2016-06-13 08:00:17 +00:00
Eric Botcazou 0317e5a24c utils2.c (known_alignment): Deal specially with calls to malloc.
* gcc-interface/utils2.c (known_alignment) <CALL_EXPR>: Deal specially
	with calls to malloc.

From-SVN: r237356
2016-06-13 07:40:47 +00:00
Eric Botcazou aa18f65ad4 trans.c (build_binary_op_trapv): If no operand is a constant, use the generic implementation of the middle-end...
* gcc-interface/trans.c (build_binary_op_trapv): If no operand is a
	constant, use the generic implementation of the middle-end; otherwise
	turn the dynamic conditions into static conditions and simplify.

From-SVN: r237328
2016-06-11 12:07:54 +00:00
Eric Botcazou a31d78c6a0 * gcc-interface/trans.c (Case_Statement_to_gnu): Deal with characters.
From-SVN: r237326
2016-06-11 11:53:11 +00:00
Pierre-Marie de Rodat 773392af39 decl.c (gnat_to_gnu_entity): Do not clobber gnat_entity_name with temporary names for XUP and XUT types.
* gcc-interface/decl.c (gnat_to_gnu_entity): Do not clobber
	gnat_entity_name with temporary names for XUP and XUT types.

From-SVN: r237324
2016-06-11 11:23:54 +00:00
Martin Sebor 4d926e3493 PR c/71392 - SEGV calling integer overflow built-ins with a null pointer
gcc/ChangeLog:
2016-06-10  Martin Sebor  <msebor@redhat.com>

	PR c/71392
	* builtin-attrs.def (ATTR_NOTHROW_NONNULL_LEAF_LIST): New macro.
	(ATTR_NOTHROW_NONNULL_TYPEGENERIC_LEAF): Same.
	* builtins.def (BUILT_IN_SADD_OVERFLOW, BUILT_IN_SADDL_OVERFLOW): Use
	them.
	(BUILT_IN_SADDLL_OVERFLOW, BUILT_IN_SSUB_OVERFLOW): Same.
	(BUILT_IN_SSUBL_OVERFLOW, BUILT_IN_SSUBLL_OVERFLOW): Same.
	(BUILT_IN_SMUL_OVERFLOW, BUILT_IN_SMULL_OVERFLOW): Same.
	(BUILT_IN_SMULLL_OVERFLOW, BUILT_IN_UADD_OVERFLOW): Same.
	(BUILT_IN_UADDL_OVERFLOW, BUILT_IN_UADDLL_OVERFLOW): Same.
	(BUILT_IN_USUB_OVERFLOW, BUILT_IN_USUBL_OVERFLOW): Same.
	(BUILT_IN_USUBLL_OVERFLOW, BUILT_IN_UMUL_OVERFLOW): Same.
	(BUILT_IN_UMULL_OVERFLOW, BUILT_IN_UMULLL_OVERFLOW):

gcc/ada/ChangeLog:
2016-06-10  Martin Sebor  <msebor@redhat.com>

	PR c/71392
	* gcc/ada/gcc-interface/utils.c (handle_nonnull_attribute): Accept
	the nonnull attribute in type-generic builtins.

gcc/c-family/ChangeLog:
2016-06-10  Martin Sebor  <msebor@redhat.com>

	PR c/71392
	* gcc/c-family/c-common.c (handle_nonnull_attribute): Accept
	the nonnull attribute in type-generic builtins.

gcc/lto/ChangeLog:
2016-06-10  Martin Sebor  <msebor@redhat.com>

	PR c/71392
	* gcc/lto/lto-lang.c (handle_nonnull_attribute): Accept the nonnull
	attribute in type-generic builtins.

gcc/testsuite/ChangeLog:
2016-06-10  Martin Sebor  <msebor@redhat.com>

	PR c/71392
	* c-c++-common/builtin-arith-overflow-1.c: Add test cases.

From-SVN: r237314
2016-06-10 11:38:19 -06:00
Eric Botcazou 42a5e4106a decl.c (Gigi_Equivalent_Type): Make sure equivalent types are present before returning them.
* gcc-interface/decl.c (Gigi_Equivalent_Type): Make sure equivalent
	types are present before returning them.  Remove final assertion.
	(gnat_to_gnu_entity) <E_Access_Protected_Subprogram_Type>: Adjust to
	above change.
	<E_Protected_Type>: Likewise.

From-SVN: r237130
2016-06-06 10:03:14 +00:00
Eric Botcazou f8a9b81f10 trans.c (elaborate_all_entities_for_package): Also do not elaborate Itypes.
* gcc-interface/trans.c (elaborate_all_entities_for_package): Also do
	not elaborate Itypes.

From-SVN: r237129
2016-06-06 09:55:44 +00:00
Eric Botcazou 1f0b1322e0 utils.c (gnat_internal_attribute_table): Add support for noinline and noclone attributes.
* gcc-interface/utils.c (gnat_internal_attribute_table): Add support
	for noinline and noclone attributes.
	(handle_noinline_attribute): New handler.
	(handle_noclone_attribute): Likewise.

From-SVN: r237127
2016-06-06 09:51:33 +00:00
Eric Botcazou 5a4916beb8 * gcc-interface/trans.c (process_type): Beef up comment.
From-SVN: r237126
2016-06-06 09:47:17 +00:00
Eric Botcazou 62801a777a utils2.c (build_call_alloc_dealloc): Do not substitute placeholder expressions here but...
* gcc-interface/utils2.c (build_call_alloc_dealloc): Do not substitute
	placeholder expressions here but...
	* gcc-interface/trans.c (gnat_to_gnu) <N_Free_Statement>: ...here.
	Make an exception to the protection of a CALL_EXPR result with an
	unconstrained type only in the same cases as Call_to_gnu.

From-SVN: r237125
2016-06-06 09:44:11 +00:00
Eric Botcazou f1ff07ec09 trans.c (gnat_to_gnu): Rework special code dealing with boolean rvalues and set the location directly.
* gcc-interface/trans.c (gnat_to_gnu): Rework special code dealing
	with boolean rvalues and set the location directly.  Do not set the
	location in the other cases for a simple name.
	(gnat_to_gnu_external): Clear the location on the expression.

From-SVN: r237123
2016-06-06 09:31:13 +00:00
Eric Botcazou d5ebeb8c1b decl.c (gnat_to_gnu_entity): Remove useless 'else' statements and tidy up.
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Component>: Remove
	useless 'else' statements and tidy up.
	<E_Array_Subtype>: Fully deal with the declaration here.
	<E_Incomplete_Type>: Use properly-typed constant.
	Assert that we don't apply the special type treatment to dummy types.
	Separate this treatment from the final back-annotation and simplify
	the condition for the RM size.
	(gnat_to_gnu_param): Add GNU_PARAM_TYPE parameter and adjust.
	(gnat_to_gnu_subprog_type): Ajust call to gnat_to_gnu_param.
	* gcc-interface/trans.c (gnat_to_gnu) <N_Subprogram_Declaration>: Add
	comment.
	(process_freeze_entity): Remove obsolete code.
	(process_type): Minor tweaks.

From-SVN: r237122
2016-06-06 09:26:07 +00:00
Eric Botcazou 4d9446f9c0 einfo.ads (Returns_Limited_View): Remove.
* einfo.ads (Returns_Limited_View): Remove.
	(Set_Returns_Limited_View ): Likewise.
	* einfo.adb (Returns_Limited_View): Likewise.
	(Set_Returns_Limited_View ): Likewise.
	* freeze.adb (Late_Freeze_Subprogram): Remove.
	(Freeze_Entity): Do not defer the freezing of functions returning an
	incomplete type coming from a limited context.

From-SVN: r237121
2016-06-06 09:18:41 +00:00
Eric Botcazou 7414a3c340 gigi.h (finish_subprog_decl): Add ASM_NAME parameter.
* gcc-interface/gigi.h (finish_subprog_decl): Add ASM_NAME parameter.
	* gcc-interface/decl.c (gnu_ext_name_for_subprog): New function.
	(gnat_to_gnu_entity) <E_Subprogram_Type>: Do not check compatibility
	of profiles for builtins here...  Call gnu_ext_name_for_subprog.
	Also update profiles if pointers to limited_with'ed types are
	updated.
	(gnat_to_gnu_param): Restore the correct source location information
	for vector ABI warnings.
	(associate_subprog_with_dummy_type): Add comment about AI05-019.
	Set TYPE_DUMMY_IN_PROFILE_P flag unconditionally.
	(update_profile): Deal with builtin declarations.
	Call gnu_ext_name_for_subprog.  Adjust call to finish_subprog_decl.
	(update_profiles_with): Add comment.
	(gnat_to_gnu_subprog_type): Reuse the return type if it is complete.
	Likewise for parameter declarations in most cases.  Do not change
	the return type for the CICO mechanism if the profile is incomplete.
	...but here instead.  Always reset the slot for the parameters.
	* gcc-interface/utils.c (create_subprog_decl): Call
	gnu_ext_name_for_subprog.  Do not set the assembler name here but...
	(finish_subprog_decl): ...but here instead.  Add ASM_NAME parameter.

From-SVN: r237119
2016-06-06 09:08:56 +00:00
Eric Botcazou 128a98eace exp_ch9.adb (Expand_N_Protected_Type_Declaration): Insert the declaration of the corresponding record type before that of the...
* exp_ch9.adb (Expand_N_Protected_Type_Declaration): Insert the
	declaration of the corresponding record type before that of the
	unprotected version of the subprograms that operate on it.
	(Expand_Access_Protected_Subprogram_Type): Declare the Equivalent_Type
	just before the original type.
	* sem_ch3.adb (Handle_Late_Controlled_Primitive): Point the current
	declaration to the newly created declaration for the primitive.
	(Analyze_Subtype_Declaration): Remove obsolete code forcing the
	freezing of the subtype before its declaration.
	(Replace_Anonymous_Access_To_Protected_Subprogram): Insert the new
	declaration in the nearest enclosing scope for formal parameters too.
	(Build_Derived_Access_Type): Restore the status of the created Itype
	after it is erased by Copy_Node.
	* sem_ch6.adb (Exchange_Limited_Views): Remove guard on entry.
	(Analyze_Subprogram_Body_Helper): Call Exchange_Limited_Views only if
	the specification is present.
	Move around the code changing the designated view of the return type
	and save the original view.  Restore it on exit.
	* sem_ch13.adb (Build_Predicate_Function_Declaration): Always insert
	the declaration right after that of the type.

From-SVN: r237118
2016-06-06 08:46:33 +00:00
Simon Wright e4b631a5a8 re PR ada/71358 (GNAT.Command_Line.Getopt fails if there are no switches)
PR ada/71358
	* g-comlin.adb (Display_Section_Help): Do not dereference
	Config.Switches if it's null.
	(Getopt): Likewise.

From-SVN: r236975
2016-06-01 07:43:57 +00:00
Eric Botcazou 3dc553dd32 re PR ada/71317 (Compiling gnat for rtems fails at s-taprop.adb)
* s-osinte-kfreebsd-gnu.ads (clock_getres): Define.
	(Get_Page_Size): Remove duplicate and return int.

	PR ada/71317
	* s-osinte-rtems.ads (clock_getres): Define.
	(Get_Page_Size): Remove duplicate and return int.

From-SVN: r236938
2016-05-31 18:59:36 +00:00
Eric Botcazou 55c8849f5d tree-vrp.c (compare_values_warnv): Simplify handling of symbolic ranges by calling get_single_symbol and tidy up.
* tree-vrp.c (compare_values_warnv): Simplify handling of symbolic
	ranges by calling get_single_symbol and tidy up.  Look more closely
	into NAME + CST1 vs CST2 comparisons if type overflow is undefined.
ada/
	* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Signed_Integer_Subtype>:
	Make same-sized subtypes of signed base types signed.
	* gcc-interface/utils.c (make_type_from_size): Adjust to above change.
	(unchecked_convert): Likewise.

From-SVN: r236548
2016-05-20 21:46:58 +00:00
Eric Botcazou d972bae09c decl.c (gnat_to_gnu_entity): Do not build a specific type for the object if it is deemed a constant.
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Do not build
	a specific type for the object if it is deemed a constant.

From-SVN: r236283
2016-05-16 11:33:01 +00:00
Eric Botcazou f91caacb45 freeze.adb (Freeze_Record_Type): Extend pragma Implicit_Packing to components of any elementary types and of...
* freeze.adb (Freeze_Record_Type): Extend pragma Implicit_Packing to
	components of any elementary types and of composite types.

From-SVN: r236282
2016-05-16 11:20:45 +00:00
Eric Botcazou 3d626f94a5 freeze.adb (Freeze_Array_Type): Call Addressable predicate instead of testing for individual sizes.
* freeze.adb (Freeze_Array_Type): Call Addressable predicate instead
	of testing for individual sizes.
	(Freeze_Entity): Rework implementation of pragma Implicit_Packing for
	array types, in particular test for suitable sizes upfront and do not
	mimic the processing that will be redone later in Freeze_Array_Type.

From-SVN: r236281
2016-05-16 11:16:42 +00:00
Eric Botcazou cce309d7ed trans.c (elaborate_all_entities_for_package): Also skip formal objects.
* gcc-interface/trans.c (elaborate_all_entities_for_package): Also skip
	formal objects.

From-SVN: r236280
2016-05-16 11:11:47 +00:00
Eric Botcazou b3f7567260 * doc/gnat_rm/implementation_defined_attributes.rst
(Scalar_Storage_Order): Adjust restriction for packed array types.
	* einfo.ads (Is_Bit_Packed_Array): Adjust description.
	(Is_Packed): Likewise.
	(Is_Packed_Array_Impl_Type): Likewise.
	(Packed_Array_Impl_Type): Likewise.
	* exp_ch4.adb (Expand_N_Indexed_Component): Do not do anything special
	if the prefix is not a packed array implemented specially.
	* exp_ch6.adb (Expand_Actuals): Expand indexed components only for
	bit-packed array types.
	* exp_pakd.adb (Install_PAT): Set Is_Packed_Array_Impl_Type flag on
	the PAT before analyzing its declaration.
	(Create_Packed_Array_Impl_Type): Remove redundant statements.
	* freeze.adb (Check_Component_Storage_Order): Reject packed array
	components only if they are bit packed.
	(Freeze_Array_Type): Fix logic detecting bit packing and do not bit
	pack for composite types whose size is multiple of a byte.
	Create the implementation type for packed array types only when it is
	needed, i.e. bit packing or packing because of holes in index types.
	Make sure the Has_Non_Standard_Rep and Is_Packed flags agree.
	* gcc-interface/gigi.h (make_packable_type): Add MAX_ALIGN parameter.
	* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Signed_Integer_Subtype>:
	Call maybe_pad_type instead of building the padding type manually.
	(gnat_to_gnu_entity) <E_Array_Subtype>: Do not assert that
	Packed_Array_Impl_Type is present for packed arrays.
	(gnat_to_gnu_component_type): Also handle known alignment for packed
	types by passing it to make_packable_type.
	* gcc-interface/utils.c (make_packable_type): Add MAX_ALIGN parameter
	and deal with it in the array case.  Adjust recursive call.  Simplify
	computation of new size and cap the alignment to BIGGEST_ALIGNMENT.

From-SVN: r236279
2016-05-16 11:08:53 +00:00
Thomas Quinot 6232acb724 freeze.adb (Check_Component_Storage_Order): Also get full view of enclosing type.
* freeze.adb (Check_Component_Storage_Order): Also get full view of
	enclosing type.

From-SVN: r236277
2016-05-16 10:58:20 +00:00
Eric Botcazou 34da9c9840 exp_util.adb (Remove_Side_Effects): Also make a constant if we need to capture the value for a small not...
* exp_util.adb (Remove_Side_Effects): Also make a constant if we need
	to capture the value for a small not by-reference record type.
	* freeze.ads (Check_Compile_Time_Size): Adjust comment.
	* freeze.adb (Set_Small_Size): Likewise.  Accept a size in the range
	of 33 .. 64 bits.
	(Check_Compile_Time_Size): Merge scalar and access type cases. Change
	variable name in array type case.  For the computation of the packed
	size, deal with record components and remove redundant test.
	(Freeze_Array_Type): Also adjust packing status when the size of the
	component type is in the range 33 .. 64 bits.
	* doc/gnat_rm/representation_clauses_and_pragmas.rst: Turn primitive
	into elementary type throughout.  Minor tweaks.
	(Alignment Clauses): Document actual alignment of packed array types.
	(Pragma Pack for Arrays): List only the 3 main cases and adjust.  Add
	"simple" to the record case.  Document effect on non packable types.
	(Pragma Pack for Records): Likewise.  Add record case and adjust.

From-SVN: r236275
2016-05-16 10:14:19 +00:00
Eric Botcazou 47e62307a7 configure.ac: Add ACX_NONCANONICAL_HOST.
gnattools/
	* configure.ac: Add ACX_NONCANONICAL_HOST.
	* configure: Regenerate.
	* Makefile.in: Replace host_alias with host_noncanonical.
	(gnattools-cross): Do not rename the tools.
gcc/
	* configure.ac: Add ACX_NONCANONICAL_HOST.
	* configure: Regenerate.
	* Makefile.in: Set host_noncanonical.
gcc/ada
	* gcc-interface/Make-lang.in (GNATMAKE_FOR_HOST): In the canadian
	cross case, use host_noncanonical instead of host as prefix.
	(GNATBIND_FOR_HOST): Likewise.
	(GNATLINK_FOR_HOST): Likewise.
	(GNATLS_FOR_HOST): Likewise.

From-SVN: r236267
2016-05-16 08:55:12 +00:00
Eric Botcazou 498988ad6a re PR ada/70969 (bootstrap failure: s-unstyp.ads:40:15: violation of No_Elaboration_Code_All at line 42)
PR ada/70969
	* system-darwin-ppc64.ads: Add pragma No_Elaboration_Code_All.
	* system-linux-armeb.ads: Likewise.
	* system-linux-mips64el.ads: Likewise.
	* system-linux-mips.ads: Likewise.
	* system-linux-mipsel.ads: Likewise.
	* system-linux-ppc64.ads: Likewise.
	* system-linux-sparcv9.ads: Likewise.
	* system-rtems.ads: Likewise.

From-SVN: r235946
2016-05-06 09:11:38 +00:00
Samuel Thibault 2a746f231d s-osinte-gnu.ads (Get_Page_Size): Return int and use getpagesize instead of __getpagesize.
* s-osinte-gnu.ads (Get_Page_Size): Return int and use getpagesize
	instead of __getpagesize.

From-SVN: r235896
2016-05-04 19:14:05 +00:00
Rainer Orth 87cdf04b1a Fix make install-gcc-specs with empty GCC_SPEC_FILES
* gcc-interface/Makefile.in (install-gcc-specs): Use foreach.
	Honor DESTDIR.

From-SVN: r235754
2016-05-02 13:08:59 +00:00
Arnaud Charlet a56886e9df [multiple changes]
2016-05-02  Tristan Gingold  <gingold@adacore.com>

	* fname.adb (Is_Predefined_File_Name): Also consider non-krunched
	i-* names.

2016-05-02  Ed Schonberg  <schonberg@adacore.com>

	* sem_util.adb (Aggregate_Constraint_Checks): Separate
	accessibility checks and non-null checks for aggregate components,
	to prevent spurious accessibility errors.

2016-05-02  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch3.adb (OK_For_Limited_Init): A type conversion is not
	always legal in the in-place initialization of a limited entity
	(e.g. an allocator).
	* sem_res.adb (Resolve_Allocator): Improve error message with RM
	reference  when allocator expression is illegal.

From-SVN: r235746
2016-05-02 12:36:45 +02:00
Arnaud Charlet fc3819c9b4 [multiple changes]
2016-05-02  Ed Schonberg  <schonberg@adacore.com>

	* exp_ch6.adb (Expand_Call): When inlining a call to a function
	declared in a package instance, locate the instance node of the
	package after the actual package declaration. skipping over
	pragmas that may have been introduced when the generic unit
	carries aspects that are transformed into pragmas.

2016-05-02  Bob Duff  <duff@adacore.com>

	* s-memory.adb (Alloc, Realloc): Move checks
	for Size = 0 or size_t'Last into the Result = System.Null_Address
	path for efficiency. Improve comments (based on actual C language
	requirements for malloc).
	* exp_util.adb (Build_Allocate_Deallocate_Proc): Optimize the
	case where we are using the default Global_Pool_Object, and we
	don't need the heavy finalization machinery.

From-SVN: r235745
2016-05-02 12:34:16 +02:00
Gary Dismukes 14c3ae9af8 exp_util.ads, [...]: Minor reformatting.
2016-05-02  Gary Dismukes  <dismukes@adacore.com>

	* exp_util.ads, sem_ch12.adb: Minor reformatting.

From-SVN: r235743
2016-05-02 12:31:25 +02:00
Arnaud Charlet 89d3b1a133 [multiple changes]
2016-05-02  Javier Miranda  <miranda@adacore.com>

	* exp_util.ads, exp_util.adb (Force_Evaluation): Adding new formal.
	(Remove_Side_Effects): Adding a new formal.
	* exp_ch6.adb (Expand_Simple_Function_Return): Generating the
	call to the _Postconditions procedure ensure that side-effects
	are unconditionally removed.

2016-05-02  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch12.adb (Check_Formal_Package_Instance, Check_Mismatch):
	Use original node to determine whether the declaration is for
	a formal type declaration, to take into account that formwl
	private types are rewritten as private extension declarations
	to simplify semantic analysis.

From-SVN: r235742
2016-05-02 12:30:23 +02:00
Gary Dismukes ca90b9623d exp_ch9.adb, [...]: Minor reformatting and typo fixes.
2016-05-02  Gary Dismukes  <dismukes@adacore.com>

	* exp_ch9.adb, sem_ch6.adb, sem_ch6.ads: Minor reformatting and typo
	fixes.

From-SVN: r235741
2016-05-02 12:29:12 +02:00
Arnaud Charlet bac5ba153d [multiple changes]
2016-05-02  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_ch3.adb, exp_ch9.adb, einfo.adb, sem_ch4.adb, sem_ch6.adb: Minor
	reformatting.

2016-05-02  Ed Schonberg  <schonberg@adacore.com>

	* exp_ch4.adb (Expand_N_Allocator): If the designated type
	is a private derived type with no discriminants, examine its
	underlying_full_view to determine whether the full view has
	defaulted discriminants, so their defaults can be used in the
	call to the initialization procedure for the designated object.

From-SVN: r235740
2016-05-02 12:27:18 +02:00
Arnaud Charlet 42f11e4c26 [multiple changes]
2016-05-02  Hristian Kirtchev  <kirtchev@adacore.com>

	* exp_prag.adb, comperr.adb: Minor reformatting.

2016-05-02  Ed Schonberg  <schonberg@adacore.com>

	* exp_pakd.adb (Rj_Unchecked_Convert_To): Do not perform an
	unchecked conversion if the source size is 0 (indicating that
	its RM size is unknown). This will happen with packed arrays of
	non-discrete types, in which case the component type is known
	to match.

2016-05-02  Arnaud Charlet  <charlet@adacore.com>

	* debug.adb: Reserve -gnatd.V.

2016-05-02  Javier Miranda  <miranda@adacore.com>

	* sem_ch3.adb (Process_Full_View): Remove from visibility
	wrappers of synchronized types to avoid spurious errors with
	their wrapped entity.
	* exp_ch9.adb (Build_Wrapper_Spec): Do not generate the wrapper
	if no interface primitive is covered by the subprogram and this is
	not a primitive declared between two views; see Process_Full_View.
	(Build_Protected_Sub_Specification): Link the dispatching
	subprogram with its original non-dispatching protected subprogram
	since their names differ.
	(Expand_N_Protected_Type_Declaration):
	If a protected subprogram overrides an interface primitive then
	do not build a wrapper if it was already built.
	* einfo.ads, einfo.adb (Original_Protected_Subprogram): New attribute.
	* sem_ch4.adb (Names_Match): New subprogram.
	* sem_ch6.adb (Check_Synchronized_Overriding): Moved
	to library level and defined in the public part of the
	package to invoke it from Exp_Ch9.Build_Wrapper_Spec
	(Has_Matching_Entry_Or_Subprogram): New subprogram.
	(Report_Conflict): New subprogram.

From-SVN: r235739
2016-05-02 12:18:12 +02:00
Arnaud Charlet 331e50151c [multiple changes]
2016-05-02  Jerome Lambourg  <lambourg@adacore.com>

	* s-unstyp.ads: Code cleanups.

2016-05-02  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_ch13.adb (Size_Too_Small_Error): Fix the error message format.

2016-05-02  Ed Schonberg  <schonberg@adacore.com>

	* exp_prag.adb (Expand_attributes_In_Consequence,
	Expand_Attributes): If the prefix of'Old is an unconstrained type,
	for example an unconstrained formal of the enclosing subprogram,
	create an object declaration with an expression to obtain the
	actual subtype of the temporary.

2016-05-02  Arnaud Charlet  <charlet@adacore.com>

	* comperr.adb (Delete_SCIL_Files): Add missing handling of
	N_Subprogram_Declaration.

From-SVN: r235738
2016-05-02 12:14:23 +02:00
Arnaud Charlet 2cc2e9642b [multiple changes]
2016-05-02  Gary Dismukes  <dismukes@adacore.com>

	* exp_ch5.adb, exp_ch7.adb, exp_ch7.ads, checks.adb, sem_attr.adb,
	gnat1drv.adb, sem_ch4.adb, sem_ch13.adb: Minor reformatting and typo
	fixes.
	* sem_prag.adb, sem_ch12.adb: Minor typo fixes.

2016-05-02  Ed Schonberg  <schonberg@adacore.com>

	* exp_ch6.adb (Make_Build_In_Place_Call_In_Allocator): The
	function call may be wrapped in an explicit type conversion.

2016-05-02  Jerome Lambourg  <lambourg@adacore.com>

	* interfac.ads: use pragma No_Elaboration_Code_All.
	* s-unstyp.ads: s-unstyp.ads: use pragma No_Elaboration_Code_All.

2016-05-02  Ed Schonberg  <schonberg@adacore.com>

	* sem.adb (Analyze: If node is an error node previously created
	by the parser, disable expansion to prevent subsequent glitches
	in error recovery.

From-SVN: r235736
2016-05-02 12:10:01 +02:00
Hristian Kirtchev 51122913ce sem_ch13.adb (Alignment_Error): Removed.
2016-05-02  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_ch13.adb (Alignment_Error): Removed.
	(Get_Alignment_Value): Code cleanup.

From-SVN: r235733
2016-05-02 12:06:45 +02:00
Arnaud Charlet 32b794c81a [multiple changes]
2016-05-02  Tristan Gingold  <gingold@adacore.com>

	* sem_ch3.adb (Analyze_Object_Declaration): Use Has_Protected
	to check for the no local protected objects restriction.

2016-05-02  Hristian Kirtchev  <kirtchev@adacore.com>

	* einfo.adb Anonymous_Master now uses Node35.
	(Anonymous_Master): Update the assertion and node reference.
	(Set_Anonymous_Master): Update the assertion and node reference.
	(Write_Field35_Name): Add output for Anonymous_Master.
	(Write_Field36_Name): The output is now undefined.
	* einfo.ads Update the node and description of attribute
	Anonymous_Master. Remove prior occurrences in entities as this
	is now a type attribute.
	* exp_ch3.adb (Expand_Freeze_Array_Type): Remove local variable
	Ins_Node. Anonymous access- to-controlled component types no
	longer need finalization masters. The master is now built when
	a related allocator is expanded.
	(Expand_Freeze_Record_Type): Remove local variable Has_AACC. Do not
	detect whether the record type has at least one component of anonymous
	access-to- controlled type. These types no longer need finalization
	masters. The master is now built when a related allocator is expanded.
	* exp_ch4.adb Remove with and use clauses for Lib and Sem_Ch8.
	(Current_Anonymous_Master): Removed.
	(Expand_N_Allocator): Call Build_Anonymous_Master to create a
	finalization master for an anonymous access-to-controlled type.
	* exp_ch6.adb (Add_Finalization_Master_Actual_To_Build_In_Place_Call):
	Call routine Build_Anonymous_Master to create a finalization master
	for an anonymous access-to-controlled type.
	* exp_ch7.adb (Allows_Finalization_Master): New routine.
	(Build_Anonymous_Master): New routine.
	(Build_Finalization_Master): Remove formal parameter
	For_Anonymous. Use Allows_Finalization_Master to determine whether
	circumstances warrant a finalization master. This routine no
	longer creates masters for anonymous access-to-controlled types.
	(In_Deallocation_Instance): Removed.
	* exp_ch7.ads (Build_Anonymous_Master): New routine.
	(Build_Finalization_Master): Remove formal parameter For_Anonymous
	and update the comment on usage.
	* sem_util.adb (Get_Qualified_Name): New routines.
	(Output_Name): Reimplemented.
	(Output_Scope): Removed.
	* sem_util.ads (Get_Qualified_Name): New routines.

2016-05-02  Hristian Kirtchev  <kirtchev@adacore.com>

	* debug.adb: Document the use of switch -gnatd.H.
	* gnat1drv.adb (Adjust_Global_Switches): Set ASIS_GNSA mode when
	-gnatd.H is present.
	(Gnat1drv): Suppress the call to gigi when ASIS_GNSA mode is active.
	* opt.ads: Add new option ASIS_GNSA_Mode.
	* sem_ch13.adb (Alignment_Error): New routine.
	(Analyze_Attribute_Definition_Clause): Suppress certain errors in
	ASIS mode for attribute clause Alignment, Machine_Radix, Size, and
	Stream_Size.
	(Check_Size): Use routine Size_Too_Small_Error to
	suppress certain errors in ASIS mode.
	(Get_Alignment_Value): Use routine Alignment_Error to suppress certain
	errors in ASIS mode.
	(Size_Too_Small_Error): New routine.

From-SVN: r235732
2016-05-02 12:05:03 +02:00
Arnaud Charlet 4871a41df9 2016-05-02 Arnaud Charlet <charlet@adacore.com>
* spark_xrefs.ads Description of the spark cross-references
	clarified; small style fixes.
	* lib-xref-spark_specific.adb (Add_SPARK_Scope,
	Detect_And_Add_SPARK_Scope): consider protected types and bodies
	as yet another scopes.
	(Enclosing_Subprogram_Or_Library_Package): refactored using
	Hristian's suggestions; added support for scopes of protected
	types and bodies; fix for entries to return the scope of the
	enclosing concurrent type, which is consistent with what is
	returned for protected subprograms.
	* sem_intr.adb: Minor style fix in comment.

From-SVN: r235731
2016-05-02 12:00:00 +02:00
Arnaud Charlet 8d4611f7b0 [multiple changes]
2016-05-02  Hristian Kirtchev  <kirtchev@adacore.com>

	* lib-xref.ads, lib-xref-spark_specific.adb, get_spark_xrefs.adb,
	put_spark_xrefs.adb: Minor reformatting.

2016-05-02  Doug Rupp  <rupp@adacore.com>

	* g-traceb.ads: Document traceback for ARM.

2016-05-02  Javier Miranda  <miranda@adacore.com>

	* exp_disp.adb (Make_Tags): Do not generate the
	external name of interface tags adding the suffix counter since
	it causes problems at link time when the IP routines are inlined
	across units with optimization.

2016-05-02  Ed Schonberg  <schonberg@adacore.com>

	* einfo.ads, einfo.adb (Predicates_Ignared): new flag to indicate
	that predicate checking is disabled for predicated subtypes in
	the context of an Assertion_Policy pragma.
	* checks.adb (Apply_Predicate_Check): Do nothing if
	Predicates_Ignored is true.
	* exp_ch3.adb (Expand_Freeze_Enumeration_Type): If
	Predicates_Ignores is true, the function Rep_To_Pos does raise
	an exception for invalid data.
	* exp_ch4.adb (Expand_N_Type_Conversion): IF target is a predicated
	type do not apply check if Predicates_Ignored is true.
	* exp_ch5.adb (Expand_N_Case_Statement): If Predicates_Ignored
	is true, sem_prag.adb:
	* sem_ch3.adb (Analyze_Object_Declaration): If Predicates_Ignored
	is true do not emit predicate check on initializing expression.

From-SVN: r235730
2016-05-02 11:57:54 +02:00
Arnaud Charlet bcb0389ef3 get_spark_xrefs.adb (Get_Nat, Get_Name): Initialize variables when they are declared...
2016-05-02  Arnaud Charlet  <charlet@adacore.com>

	* get_spark_xrefs.adb (Get_Nat, Get_Name): Initialize variables when
	they are declared; refine type of a counter from Integer to Natural.
	* sem_ch5.adb, gnatcmd.adb, s-intman-posix.adb, eval_fat.adb,
	prj.adb, sem_util.adb, s-intman-android.adb, prj-nmsc.adb, sem_ch8.adb,
	exp_ch3.adb: Minor editing.

From-SVN: r235729
2016-05-02 11:53:16 +02:00
Yannick Moy ef25192bee a-tigeli.adb (Get_Line): Always set Last prior to returning.
2016-05-02  Yannick Moy  <moy@adacore.com>

	* a-tigeli.adb (Get_Line): Always set Last prior to returning.

2016-05-02  Yannick Moy  <moy@adacore.com>

	* lib-xref.adb: Minor style fix in whitespace of declarations.
	* put_spark_xrefs.adb (Put_SPARK_Xrefs): printing of strings
	refactored without loops.
	* put_spark_xrefs.ads (Write_Info_Str): new formal argument of
	generic procedure.
	* spark_xrefs.adb (Write_Info_Str): new actual in instantiation
	of generic procedure.

From-SVN: r235728
2016-05-02 11:50:45 +02:00
Arnaud Charlet eff69022b3 lib-xref-spark_specific.adb (Add_SPARK_Scope): add task type scope.
2016-05-02  Arnaud Charlet  <charlet@adacore.com>

	* lib-xref-spark_specific.adb (Add_SPARK_Scope): add task type scope.
	(Detect_And_Add_SPARK_Scope): detect and add task type scope.
	(Enclosing_Subprogram_Or_Package): Respect boundaries of task
	and entry declarations.
	* spark_xrefs.ads: minor typo in comment.

From-SVN: r235726
2016-05-02 11:48:55 +02:00
Arnaud Charlet fb8d37efa6 make.adb: Minor...
2016-05-02  Arnaud Charlet  <charlet@adacore.com>

	* make.adb: Minor: avoid an exception when calling gnatmake with
	no argument and gnatmake is built with checks on.
	* lib-xref-spark_specific.adb: Minor code cleanup.

From-SVN: r235725
2016-05-02 11:47:42 +02:00
Ed Schonberg c4405dfe1d sem_util.adb (Normalize_Actuals): Take into account extra actuals that may have been introduced previously.
2016-05-02  Ed Schonberg  <schonberg@adacore.com>

	* sem_util.adb (Normalize_Actuals): Take into account extra
	actuals that may have been introduced previously. Normally extra
	actuals are introduced when a call is expanded, but a validity
	check may copy and reanalyze a call that carries an extra actual
	(e.g. an accessibility parameter) before the call itself is
	marked Analzyed, and the analysis of the copy has to be able to
	cope with the added actual.

From-SVN: r235723
2016-05-02 11:44:54 +02:00
Arnaud Charlet 07eb872e34 [multiple changes]
2016-05-02  Bob Duff  <duff@adacore.com>

	* sem_ch10.adb (Analyze_Compilation_Unit): Preserve
	treeishness. Previous version had Context_Items shared between
	the spec and body.

2016-05-02  Ed Schonberg  <schonberg@adacore.com>

	* sem_aggr.adb (Resolve_Aggr_Expression): For both array and
	record cases, apply predicate check on component for expression
	only if expression has been analyzed already. For expressions
	that need to be duplicated when they cover multiple components,
	resolution and predicate checking take place later.

2016-05-02  Olivier Hainque  <hainque@adacore.com>

	* a-direct.adb (Delete_Tree): Use full names to designate subdirs
	and files therein, instead of local names after a change of
	current directory.

From-SVN: r235717
2016-05-02 11:30:59 +02:00
Thomas Quinot a25ad01cfb freeze.adb (Check_Component_Storage_Order): Get full view of component type.
2016-05-02  Thomas Quinot  <quinot@adacore.com>

	* freeze.adb (Check_Component_Storage_Order): Get full view of
	component type.

From-SVN: r235716
2016-05-02 11:29:09 +02:00
Hristian Kirtchev 558fbeb042 checks.adb, [...]: Minor reformatting.
2016-05-02  Hristian Kirtchev  <kirtchev@adacore.com>

	* checks.adb, freeze.adb, sem_res.adb, s-stposu.adb, repinfo.adb:
	Minor reformatting.

From-SVN: r235714
2016-05-02 11:27:18 +02:00
Arnaud Charlet 1e60643a12 [multiple changes]
2016-05-02  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_ch4.adb (Find_Indexing_Operations): Use the underlying type
	of the container base type in case the container is a subtype.
	* sem_ch5.adb (Analyze_Iterator_Specification): Ensure that
	the selector has an entity when checking for a component of a
	mutable object.

2016-05-02  Arnaud Charlet  <charlet@adacore.com>

	Remove dead code.
	* opt.ads (Latest_Ada_Only): New flag.
	* sem_prag.adb, par-prag.adb: Ignore pragma Ada_xx under this flag.
	* usage.adb, switch-c.adb: Disable support for -gnatxx under this flag.
	* einfo.ads (Has_Predicates, Predicate_Function):
	Clarify that Has_Predicates does not imply that Predicate_Function
	will return a non-empty entity.

2016-05-02  Ed Schonberg  <schonberg@adacore.com>

	* sem_res.adb (Resolve_Qualified_Expression): Generate a predicate
	check if type requires it.
	* checks.adb (Apply_Predicate_Check): Disable checks in the
	object declaration created for an expression with side-effects
	that requires a predicate check to prevent infinite recursion
	during expansion.

2016-05-02  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch6.adb (Process_Formals): Check properly the type of a
	formal to determine whether a given convention applies to it.

2016-05-02  Doug Rupp  <rupp@adacore.com>

	* tracebak.c: Add incantations for arm-vxworks[67] traceback.

2016-05-02  Thomas Quinot  <quinot@adacore.com>

	* freeze.adb (Check_Component_Storage_Order): Make it a warning, not an
	error, to have a component with implicit SSO within a composite type
	that has explicit SSO.

2016-05-02  Bob Duff  <duff@adacore.com>

	* s-stposu.adb (Allocate_Any_Controlled): Don't lock/unlock twice.

2016-05-02  Ed Schonberg  <schonberg@adacore.com>

	* repinfo.adb (List_Entities): Make procedure recursive, to
	provide representation information for subprograms declared
	within subprogram bodies.

From-SVN: r235713
2016-05-02 11:23:49 +02:00
Arnaud Charlet f96fd197d2 [multiple changes]
2016-05-02  Arnaud Charlet  <charlet@adacore.com>

	* exp_ch5.adb, layout.adb, gnatcmd.adb exp_attr.adb, make.adb,
	bindgen.adb, debug.adb, exp_pakd.adb, freeze.adb, sem_util.adb,
	gnatlink.adb, switch-m.adb, exp_ch4.adb, repinfo.adb, adabkend.adb,
	osint.adb: Remove dead code.

2016-05-02  Yannick Moy  <moy@adacore.com>

	* a-tigeli.adb (Get_Line): Fix bound for test to
	decide when to compensate for character 0 added by call to fgets.

From-SVN: r235710
2016-05-02 11:11:03 +02:00
Arnaud Charlet 3ba1a9eb6e [multiple changes]
2016-05-02  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch4.adb (Analyze_Allocator): If the expression does not
	have a subtype indication and the type is an unconstrained tagged
	type with defaulted discriminants, create an explicit constraint
	for it during analysis to prevent out-of-order freezing actions
	on generated classwide types.

2016-05-02  Javier Miranda  <miranda@adacore.com>

	* exp_ch5.adb (Expand_N_Assignment_Statement):
	In the runtime check that ensures that the tags of source an
	target match, add missing displacement of the pointer to the
	objects if they cover interface types.

2016-05-02  Ed Schonberg  <schonberg@adacore.com>

	* sem_attr.adb (Analyze_Attribute, case 'Old): Do not use
	base type for attribute when type is discrete: transformation
	is not needed for such types, and leads to spurious errors if
	the context is a case construct.

From-SVN: r235709
2016-05-02 11:08:44 +02:00
Eric Botcazou 552cc5904c decl.c (elaborate_reference_1): Do not bother about operand #2 for COMPONENT_REF.
* gcc-interface/decl.c (elaborate_reference_1): Do not bother about
	operand #2 for COMPONENT_REF.
	* gcc-interface/utils2.c (gnat_save_expr): Likewise.
	(gnat_protect_expr): Likewise.
	(gnat_stabilize_reference_1): Likewise.
	(gnat_rewrite_reference): Do not bother about operand #3 for ARRAY_REF.
	(get_inner_constant_reference): Likewise.
	(gnat_invariant_expr): Likewise.
	* gcc-interface/trans.c (fold_constant_decl_in_expr): Likewise.

From-SVN: r235701
2016-05-02 07:46:05 +00:00
Eric Botcazou 3eaec28592 trans.c (Range_to_gnu): New static function.
* gcc-interface/trans.c (Range_to_gnu): New static function.
	(Raise_Error_to_gnu) <N_In>: Call it to translate the range.
	(gnat_to_gnu) <N_In>: Likewise.

From-SVN: r235699
2016-05-02 07:38:37 +00:00
Eric Botcazou f73036c179 Make-lang.in (ACATSCMD): New variable.
ada/
	* gcc-interface/Make-lang.in (ACATSCMD): New variable.
	(check-acats): Use it.
	(check_acats_targets): Likewise.
testsuite/
	* ada/acats/run_acats: Rename into...
	* ada/acats/run_acats.sh: ...this.  Only export BASE variable.
	* ada/acats/run_all.sh: Remove redundant test.
	(target_run): Move around.
	(target_gnatchop): Use newly built executable.
	(target_gnatmake): Likewise.
	Check that the compilation of impbit succeeds.

From-SVN: r235678
2016-04-30 10:42:14 +00:00
Eric Botcazou 24efbb3e41 re PR ada/70786 (Missing "not" breaks Ada.Text_IO.Get_Immediate(File, Item, Available))
PR ada/70786
	* a-textio.adb (Get_Immediate): Add missing 'not' in expression.

From-SVN: r235554
2016-04-28 10:58:38 +00:00
Eric Botcazou 1e55d29a0c sem_aux.adb (Is_By_Reference_Type): Also return true for a tagged incomplete type without full view.
* sem_aux.adb (Is_By_Reference_Type): Also return true for a tagged
	incomplete type without full view.
	* sem_ch6.adb (Exchange_Limited_Views): Change into a function and
	return the list of changes.
	(Restore_Limited_Views): New procedure to undo the transformation made
	by Exchange_Limited_Views.
	(Analyze_Subprogram_Body_Helper): Adjust call to Exchange_Limited_Views
	and call Restore_Limited_Views at the end, if need be.
	(Possible_Freeze): Do not delay freezing because of incomplete types.
	(Process_Formals): Remove kludges for class-wide types.
	* types.h (By_Copy_Return): Delete.
	* gcc-interface/ada-tree.h (TYPE_MAX_ALIGN): Move around.
	(TYPE_DUMMY_IN_PROFILE_P): New macro.
	* gcc-interface/gigi.h (update_profiles_with): Declare.
	(finish_subprog_decl): Likewise.
	(get_minimal_subprog_decl): Delete.
	(create_subprog_type): Likewise.
	(create_param_decl): Adjust prototype.
	(create_subprog_decl): Likewise.
	* gcc-interface/decl.c (defer_limited_with): Rename into...
	(defer_limited_with_list): ...this.
	(gnat_to_gnu_entity): Adjust to above renaming.
	(finalize_from_limited_with): Likewise.
	(tree_entity_vec_map): New structure.
	(gt_pch_nx): New helpers.
	(dummy_to_subprog_map): New hash table.
	(gnat_to_gnu_param): Set the SLOC here.  Remove MECH parameter and
	add FIRST parameter.  Deal with the mechanism here instead of...
	Do not make read-only variant of types.  Simplify expressions.
	In the by-ref case, test the mechanism before must_pass_by_ref
	and also TYPE_IS_BY_REFERENCE_P before building the reference type.
	(gnat_to_gnu_subprog_type): New static function extracted from...
	Do not special-case the type_annotate_only mode.  Call
	gnat_to_gnu_profile_type instead of gnat_to_gnu_type on return type.
	Deal with dummy return types.  Likewise for parameter types.  Deal
	with by-reference types explicitly and add a kludge for null procedures
	with untagged incomplete types.  Remove assertion on the types and be
	prepared for multiple elaboration of the declarations.  Skip the whole
	CICO processing if the profile is incomplete.  Handle the completion of
	a previously incomplete profile.
	(gnat_to_gnu_entity) <E_Variable>: Rename local variable.
	Adjust couple of calls to create_param_decl.
	<E_Access_Subprogram_Type, E_Anonymous_Access_Subprogram_Type>:
	Remove specific deferring code.
	<E_Access_Type>: Also deal with E_Subprogram_Type designated type.
	Simplify handling of dummy types and remove obsolete comment.
	Constify a couple of variables.  Do not set TYPE_UNIVERSAL_ALIASING_P
	on dummy types.
	<E_Access_Subtype>: Tweak comment and simplify condition.
	<E_Subprogram_Type>: ...here.  Call it and clean up handling.  Remove
	obsolete comment and adjust call to gnat_to_gnu_param.  Adjust call to
	create_subprog_decl.
	<E_Incomplete_Type>: Add a couple of 'const' qualifiers and get rid of
	inner break statements.  Tidy up condition guarding direct use of the
	full view.
	(get_minimal_subprog_decl): Delete.
	(finalize_from_limited_with): Call update_profiles_with on dummy types
	with TYPE_DUMMY_IN_PROFILE_P set.
	(is_from_limited_with_of_main): Delete.
	(associate_subprog_with_dummy_type): New function.
	(update_profile): Likewise.
	(update_profiles_with): Likewise.
	(gnat_to_gnu_profile_type): Likewise.
	(init_gnat_decl): Initialize dummy_to_subprog_map.
	(destroy_gnat_decl): Destroy dummy_to_subprog_map.
	* gcc-interface/misc.c (gnat_get_alias_set): Add guard for accessing
	TYPE_UNIVERSAL_ALIASING_P.
	(gnat_get_array_descr_info): Minor tweak.
	* gcc-interface/trans.c (gigi): Adjust calls to create_subprog_decl.
	(build_raise_check): Likewise.
	(Compilation_Unit_to_gnu): Likewise.
	(Identifier_to_gnu): Accept mismatches coming from a limited context.
	(Attribute_to_gnu): Remove kludge for dispatch table entities.
	(process_freeze_entity): Do not retrieve old definition if there is an
	address clause on the entity.  Call update_profiles_with on dummy types
	with TYPE_DUMMY_IN_PROFILE_P set.
	* gcc-interface/utils.c (build_dummy_unc_pointer_types): Also set
	TYPE_REFERENCE_TO to the fat pointer type.
	(create_subprog_type): Delete.
	(create_param_decl): Remove READONLY parameter.
	(finish_subprog_decl): New function extracted from...
	(create_subprog_decl): ...here.  Call it.  Remove CONST_FLAG and
	VOLATILE_FLAG parameters and adjust.
	(update_pointer_to): Also clear TYPE_REFERENCE_TO in the unconstrained
	case.

From-SVN: r235521
2016-04-27 18:08:39 +00:00
Arnaud Charlet 437244c773 [multiple changes]
2016-04-27  Arnaud Charlet  <charlet@adacore.com>

	* aa_util.adb, aa_util.ads: Removed, no longer used.

2016-04-27  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_prag.adb (Analyze_Pragma): An object
	renaming declaration resulting from the expansion of an object
	declaration is a suitable context for pragma Ghost.

2016-04-27  Doug Rupp  <rupp@adacore.com>

	* init.c: Refine last checkin so the only requirement is the
	signaling compilation unit is compiled with the same mode as
	the compilation unit containing the initial landing pad.

2016-04-27  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch13.adb (Valid_Default_Iterator): Better filter of illegal
	specifications for Default_Iterator, including overloaded cases
	where no interpretations are legal, and return types that are
	not iterator types.

2016-04-27  Hristian Kirtchev  <kirtchev@adacore.com>

	* exp_ch5.adb (Expand_N_Assignment_Statement): Do not install
	an accessibility check when the left hand side of the assignment
	denotes a container cursor.
	* exp_util.ads, exp_util.adb (Find_Primitive_Operations): Removed.
	* sem_ch4.adb (Find_Indexing_Operations): New routine.
	(Try_Container_Indexing): Code cleanup.

From-SVN: r235505
2016-04-27 15:28:30 +02:00
Arnaud Charlet 57323d5bd3 [multiple changes]
2016-04-27  Arnaud Charlet  <charlet@adacore.com>

	* sem_ch10.adb, sem_case.adb: Mark messages udner -gnatwr when needed.

2016-04-27  Hristian Kirtchev  <kirtchev@adacore.com>

	* errout.adb, errutil.adb: Minor reformatting.

2016-04-27  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch13.adb (Analyze_Aspect_Specifications, case Pre/Post):
	Check that the classwide version is illegal when the prefix is
	an operation of an untagged synchronized type.

From-SVN: r235504
2016-04-27 15:25:54 +02:00
Arnaud Charlet ac566cbe4b [multiple changes]
2016-04-27  Arnaud Charlet  <charleT@adacore.com>

	* sinput-l.ads, sem_ch13.adb: Minor editing.

2016-04-27  Doug Rupp  <rupp@adacore.com>

	* init.c (__gnat_adjust_context_for_raise) [arm-linux thumb]:
	Bump the pc so the lower order bit is set.

2016-04-27  Ed Schonberg  <schonberg@adacore.com>

	* sem_case.adb, sem_case.ads (NO_Op): If appropriate warning is
	enabled, report an empty range in a case construct.

From-SVN: r235503
2016-04-27 15:22:48 +02:00
Arnaud Charlet 6616e39069 sinput.ads, [...]: Minor editing.
2016-04-27  Arnaud Charlet  <charlet@adacore.com>

	* sinput.ads, a-cfdlli.adb, a-crbtgo.adb, a-chtgop.adb, a-cbhama.adb,
	a-rbtgbo.adb, a-crdlli.adb, a-chtgbo.adb: Minor editing.

From-SVN: r235502
2016-04-27 15:15:25 +02:00
Arnaud Charlet 6d0d18dcb1 [multiple changes]
2016-04-27  Bob Duff  <duff@adacore.com>

	* a-chtgop.adb (Adjust): Zero the tampering counts on assignment,
	as is done for the other containers.

2016-04-27  Hristian Kirtchev  <kirtchev@adacore.com>

	* ghost.adb (In_Subprogram_Body_Profile): New routine.
	(Is_OK_Declaration): Treat an unanalyzed expression
	function as an OK context.  Treat a reference to a Ghost entity
	as OK when it appears within the profile of a subprogram body.

2016-04-27  Bob Duff  <duff@adacore.com>

	* errout.ads: Document the fact that informational messages
	don't have to be warnings.
	* errout.adb (Error_Msg_Internal): In statistics counts, deal
	correctly with informational messages that are not warnings.
	(Error_Msg_NEL): Remove useless 'if' aroung Set_Posted, because
	Set_Posted already checks for errors and ignores others.
	* erroutc.adb (Prescan_Message): Set Is_Serious_Error to False
	if Is_Info_Msg; the previous code was assuming that Is_Info_Msg
	implies Is_Warning_Msg.
	* errutil.adb (Error_Msg): In statistics counts, deal correctly
	with informational messages that are not warnings.

From-SVN: r235500
2016-04-27 15:09:13 +02:00
Arnaud Charlet 680d5f6190 [multiple changes]
2016-04-27  Ed Schonberg  <schonberg@adacore.com>

	* sem_util.ads, sem_util.adb (Is_Null_Record_Type): New predicate
	to determine whether a record type is a null record.
	* sem_ch3.adb (Analyze_Object_Declaration): If the type is a
	null record and there is no expression in the declaration,
	no predicate check applies to the object.

2016-04-27  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_ch7.adb (Analyze_Package_Body_Helper): The body of an
	instantiated package should not cause freezing of previous contracts.

2016-04-27  Ed Schonberg  <schonberg@adacore.com>

	* sem_dim.adb (Analyze_Dimension): Handle subtype declarations
	that do not come from source.
	(Analyze_Dimension_Subtype_Declaration): Allow confirming
	dimensions on subtype entity, either inherited from base type
	or provided by aspect specification.

2016-04-27  Ed Schonberg  <schonberg@adacore.com>

	* s-gearop.ads (Matrix_Vector_Solution, Matrix_Matrix_Solution):
	Add scalar formal object Zero, to allow detection and report
	when the matrix is singular.
	* s-gearop.adb (Matrix_Vector_Solution, Matrix_Matrix_Solution):
	Raise Constraint_Error if the Forward_Eliminate pass has
	determined that determinant is Zero.o
	* s-ngrear.adb (Solve): Add actual for Zero in corresponding
	instantiations.
	* s-ngcoar.adb (Solve): Ditto.

From-SVN: r235499
2016-04-27 15:05:41 +02:00
Arnaud Charlet 14f3895c40 [multiple changes]
2016-04-27  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_ch3.adb: Minor reformatting.

2016-04-27  Ed Schonberg  <schonberg@adacore.com>

	* sem_dim.adb (Analyze_Dimension, case N_Identifier): Check
	that identifier has a usable type before analysis, to handle
	properly identifiers introduced after some lexical/syntactic
	recovery that created new identifiers.

From-SVN: r235498
2016-04-27 14:56:41 +02:00
Arnaud Charlet db99c46e1d [multiple changes]
2016-04-27  Bob Duff  <duff@adacore.com>

	* a-coinve.adb, a-comutr.adb, a-conhel.adb, a-convec.adb,
	exp_util.adb: Remove assertions that can fail in obscure cases when
	assertions are turned on but tampering checks are turned off.

2016-04-27  Javier Miranda  <miranda@adacore.com>

	* exp_ch6.adb (Add_Call_By_Copy_Code,
	Add_Simple_Call_By_Copy_Code, Expand_Actuals): Handle formals
	whose type comes from the limited view.

2016-04-27  Yannick Moy  <moy@adacore.com>

	* a-textio.adb: Complete previous patch.

2016-04-27  Yannick Moy  <moy@adacore.com>

	* inline.adb (Expand_Inlined_Call): Use Cannot_Inline instead of
	Error_Msg_N to issue message about impossibility to inline call,
	with slight change of message.

2016-04-27  Hristian Kirtchev  <kirtchev@adacore.com>

	* exp_spark.adb (Expand_Potential_Renaming): Removed.
	(Expand_SPARK): Update the call to expand a potential renaming.
	(Expand_SPARK_Potential_Renaming): New routine.
	* exp_spark.ads (Expand_SPARK_Potential_Renaming): New routine.
	* sem.adb Add with and use clauses for Exp_SPARK.
	(Analyze): Expand a non-overloaded potential renaming for SPARK.

2016-04-27  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch3.adb (Constrain_Discriminated_Type): In an instance,
	check full view for the presence of defaulted discriminants,
	even when the partial view of a private type has no visible and
	no unknown discriminants.

From-SVN: r235497
2016-04-27 14:55:18 +02:00
Arnaud Charlet c6c8d05942 [multiple changes]
2016-04-27  Hristian Kirtchev  <kirtchev@adacore.com>

	* lib-xref.adb, exp_ch3.adb: Minor reformatting.

2016-04-27  Nicolas Roche  <roche@adacore.com>

	* rtinit.c: Add weak symbol __gnat_do_argv_expansion.

From-SVN: r235496
2016-04-27 14:52:02 +02:00
Arnaud Charlet caa64a44ac [multiple changes]
2016-04-27  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_prag.adb (Process_Atomic_Independent_Shared_Volatile): Code
	cleanup. Check the original node when trying to determine the node kind
	of pragma Volatile's argument to account for untagged derivations
	where the type is transformed into a constrained subtype.

2016-04-27  Olivier Hainque  <hainque@adacore.com>

	* mkdir.c (__gnat_mkdir): Rework the vxworks section to use a
	consistent posix interface on the caller side.

2016-04-27  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch10.adb (Build_Limited_View, Decorate_Type): If this
	is a limited view of a type, initialize the Limited_Dependents
	field to catch misuses of the type in a client unit.

2016-04-27  Thomas Quinot  <quinot@adacore.com>

	* a-strunb-shared.adb (Finalize): add missing Reference call.
	* s-strhas.adb: minor grammar fix and extension of comment
	* sem_ch8.adb: minor whitespace fixes

2016-04-27  Ed Schonberg  <schonberg@adacore.com>

	* lib-xref.adb (Get_Type_Reference): Handle properly the case
	of an object declaration whose type definition is a class-wide
	subtype and whose expression is a function call that returns a
	classwide type.

2016-04-27  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_util.ads, sem_util.adb (Output_Entity): New routine.
	(Output_Name): New routine.

2016-04-27  Bob Duff  <duff@adacore.com>

	* exp_ch3.adb (Rewrite_As_Renaming): Disable previous change for now.

From-SVN: r235495
2016-04-27 14:47:56 +02:00
Arnaud Charlet a6ac73115a [multiple changes]
2016-04-27  Vincent Celier  <celier@adacore.com>

	* gnatcmd.adb: For "gnat ls -V -P", recognize switch
	--unchecked-shared-lib-imports and set the flag
	Opt.Unchecked_Shared_Lib_Imports accordingly.

2016-04-27  Ed Schonberg  <schonberg@adacore.com>

	* sem_prag.adb (Analyze_Pre_Post_Condition_In_Decl_Part):
	A generic subprogram is never a primitive operation, and thus
	a classwide condition for it is not legal.

2016-04-27  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_aggr.adb, sem_dim.adb, sem_dim.ads, einfo.adb: Minor
	reformatting.

From-SVN: r235494
2016-04-27 14:42:03 +02:00
Arnaud Charlet 888be6b18a [multiple changes]
2016-04-27  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_res.adb (Flag_Effectively_Volatile_Objects): New routine.
	(Resolve_Actuals): Flag effectively volatile objects with enabled
	property Async_Writers or Effective_Reads as illegal.
	* sem_util.adb (Is_OK_Volatile_Context): Comment reformatting.

2016-04-27  Javier Miranda  <miranda@adacore.com>

	* exp_ch3.adb (Make_Predefined_Primitive_Specs):
	Do not generate the profile of the equality operator if it has
	been explicitly defined as abstract in the parent type. Required
	to avoid reporting an spurious error.

2016-04-27  Ed Schonberg  <schonberg@adacore.com>

	* sem_dim.ads, sem_dim.adb (Check_Expression_Dimensions): New
	procedure to compute the dimension vector of a scalar expression
	and compare it with the dimensions if its expected subtype. Used
	for the ultimate components of a multidimensional aggregate,
	whose components typically are themselves aggregates that are
	expanded separately. Previous to this patch, dimensionality
	checking on such aggregates generated spurious errors.
	* sem_aggr.adb (Resolve_Array_Aggregate): Use
	Check_Expression_Dimensions when needed.

2016-04-27  Javier Miranda  <miranda@adacore.com>

	* einfo.ads, einfo.adb (Corresponding_Function): New attribute
	(applicable to E_Procedure).
	(Corresponding_Procedure): New attribute (applicable to E_Function).
	* exp_util.adb (Build_Procedure_Form): Link the function with
	its internally built proc and viceversa.
	* sem_ch6.adb (Build_Subprogram_Declaration): Propagate the
	attribute Rewritten_For_C and Corresponding_Procedure to the body.
	* exp_ch6.adb (Rewritten_For_C_Func_Id): Removed.
	(Rewritten_For_C_Proc_Id): Removed.
	* exp_unst.adb (Note_Uplevel_Ref): Use the new attribute to
	locate the corresponding procedure.

From-SVN: r235493
2016-04-27 14:37:55 +02:00
Arnaud Charlet c7518e6f52 [multiple changes]
2016-04-27  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_ch13.adb (Analyze_Aspect_Export_Import): Signal that there is no
	corresponding pragma.

2016-04-27  Bob Duff  <duff@adacore.com>

	* exp_ch3.adb: Minor comment improvement.

2016-04-27  Ed Schonberg  <schonberg@adacore.com>

	* exp_ch6.adb (Make_Build_In_Place_Call_In_Object_Declaration): If the
	return type is an untagged limited record with only access
	discriminants and no controlled components, the return value does not
	need to use the secondary stack.

2016-04-27  Javier Miranda  <miranda@adacore.com>

	* exp_util.adb (Remove_Side_Effects): When
	generating C code handle object declarations that have
	discriminants and are initialized by means of a call to a
	function.

2016-04-27  Ed Schonberg  <schonberg@adacore.com>

	* a-textio.adb (Get_Line function): Handle properly the case of
	a line that has the same length as the buffer (or a multiple
	thereof) and there is no line terminator.
	* a-tigeli.adb (Get_Line procedure): Do not store an end_of_file
	in the string when there is no previous line terminator and we
	need at most one additional character.

From-SVN: r235492
2016-04-27 14:30:49 +02:00
Arnaud Charlet 814cc240b8 [multiple changes]
2016-04-27  Arnaud Charlet  <charlet@adacore.com>

	* s-rident.ads: Make No_Implicit_Loops non partition wide.

2016-04-27  Arnaud Charlet  <charlet@adacore.com>

	* sem_ch11.adb (Analyze_Handled_Statements): check useless
	assignments also in entries and task bodies, not only in
	procedures and declaration blocks.
	* sem_ch5.adb (Analyze_Block_Statement): check useless
	assignements in declaration blocks as part of processing their
	handled statement sequence, just like it was done for procedures
	and now is also done for entries and task bodies.
	* sem_warn.adb (Warn_On_Useless_Assignment): detect boundries
	of entries and task bodies just like of procedures.

2016-04-27  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_util.adb (Is_Volatile_Function): Recognize
	a function declared within a protected type as well as the
	protected/unprotected version of a function.

From-SVN: r235491
2016-04-27 14:26:50 +02:00
Bob Duff 24d2fbbeac exp_ch3.adb (Expand_N_Object_Declaration): Rewrite an object declaration of the form "X ...
2016-04-27  Bob Duff  <duff@adacore.com>

	* exp_ch3.adb (Expand_N_Object_Declaration): Rewrite an object
	declaration of the form "X : T := Func (...);", where T is
	controlled, as a renaming.
	* a-strunb-shared.adb (Finalize): Set the Unbounded_String Object
	to be an empty string, instead of null-ing out the Reference.
	* exp_util.adb (Needs_Finalization): Remove redundant code.

From-SVN: r235488
2016-04-27 14:20:54 +02:00
Arnaud Charlet 2e885a6f7c [multiple changes]
2016-04-27  Hristian Kirtchev  <kirtchev@adacore.com>

	* aspects.ads Aspects Export and Import do not require delay. They
	were classified as delayed aspects, but treated as non-delayed
	by the analysis of aspects.
	* freeze.adb (Copy_Import_Pragma): New routine.
	(Wrap_Imported_Subprogram): Copy the import pragma by first
	resetting all semantic fields to avoid an infinite loop when
	performing the copy.
	* sem_ch13.adb (Analyze_Aspects_At_Freeze_Point): Add
	comment on the processing of aspects Export and Import
	at the freeze point.
	(Analyze_Aspect_Convention: New routine.
	(Analyze_Aspect_Export_Import): New routine.
	(Analyze_Aspect_External_Link_Name): New routine.
	(Analyze_Aspect_External_Or_Link_Name): Removed.
	(Analyze_Aspect_Specifications): Factor out the analysis of
	aspects Convention, Export, External_Name, Import, and Link_Name
	in their respective routines.  Aspects Export and Import should
	not generate a Boolean pragma because their corresponding pragmas
	have a very different syntax.
	(Build_Export_Import_Pragma): New routine.
	(Get_Interfacing_Aspects): New routine.

2016-04-27  Eric Botcazou  <ebotcazou@adacore.com>

	* inline.adb (Add_Inlined_Body): Overhaul implementation,
	robustify handling of -gnatn1, add special treatment for
	expression functions.

2016-04-27  Doug Rupp  <rupp@adacore.com>

	* g-traceb.ads: Update comment.
	* exp_ch2.adb: minor style fix in object declaration

From-SVN: r235483
2016-04-27 13:01:35 +02:00
Arnaud Charlet 2a253c5bba [multiple changes]
2016-04-27  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_elab.adb (Check_Internal_Call): Do not
	consider a call when it appears within pragma Initial_Condition
	since the pragma is part of the elaboration statements of a
	package body and may only call external subprograms or subprograms
	whose body is already available.
	(Within_Initial_Condition): New routine.

2016-04-27  Ed Schonberg  <schonberg@adacore.com>

	* exp_util.adb (Build_Procedure_Form): Prevent double generation
	of the procedure form when dealing with an expression function
	whose return type is an array.
	* sem_ch3.adb: Fix out-of order Has_Predicates setting.
	* exp_ch6.adb: Proper conversion for inherited operation in C.
	* sem_ch6.adb: Code cleanup.

2016-04-27  Hristian Kirtchev  <kirtchev@adacore.com>

	* lib-xref.ads, sem_ch10.adb: minor style fix in comment
	* g-socket.adb: Minor reformatting.
	* sinfo.ads: Minor comment correction.
	* sem_warn.ads: minor grammar fix in comment

From-SVN: r235482
2016-04-27 12:58:41 +02:00
Eric Botcazou afc737f052 gigi.h (gnat_to_gnu_entity): Adjust prototype.
* gcc-interface/gigi.h (gnat_to_gnu_entity): Adjust prototype.
	(maybe_pad_type): Adjust comment.
	(finish_record_type): Likewise.
	(rest_of_record_type_compilation): Likewise.
	* gcc-interface/decl.c (gnat_to_gnu_entity): Change DEFINITION type
	parameter from integer to boolean.  Adjust recursive calls.
	<E_Subprogram_Type>: Use copy_type and remove redundant assignments.
	<E_Signed_Integer_Subtype>:  Adjust comment.  Remove call to
	rest_of_record_type_compilation.  Set TYPE_PADDING_P flag earlier.
	Pass false to finish_record_type.  Set the debug type later.
	<E_Record_Subtype>: Remove call to rest_of_record_type_compilation.
	(gnat_to_gnu_component_type): Fix formatting.
	(gnat_to_gnu_field_decl): Adjust call to gnat_to_gnu_entity.
	(gnat_to_gnu_type): Likewise.
	* gcc-interface/trans.c (Identifier_to_gnu): Likewise.
	(Loop_Statement_to_gnu): Likewise.
	(Subprogram_Body_to_gnu): Likewise.
	(Exception_Handler_to_gnu_fe_sjlj): Likewise.
	(Exception_Handler_to_gnu_gcc): Likewise.
	(Compilation_Unit_to_gnu): Likewise.
	(gnat_to_gnu): Likewise.
	(push_exception_label_stack): Likewise.
	(elaborate_all_entities_for_package): Likewise.
	(process_freeze_entity): Likewise.
	(process_decls): Likewise.
	(process_type): Likewise.
	* gcc-interface/utils.c (struct deferred_decl_context_node): Tweak.
	(maybe_pad_type): Adjust comments.  Set the debug type later.  Remove
	call to rest_of_record_type_compilation.
	(rest_of_record_type_compilation): Use copy_type.
	(copy_type): Use correctly typed constants.
	(gnat_signed_or_unsigned_type_for): Use copy_type.
	* gcc-interface/utils2.c (nonbinary_modular_operation): Likewise.
	(build_goto_raise): Adjust call tognat_to_gnu_entity.

From-SVN: r235479
2016-04-27 10:49:35 +00:00
Eric Botcazou 06aed101fc re PR ada/70759 (Ada rts fails to build with -mabi=ilp32)
PR ada/70759
	* stor-layout.h (internal_reference_types): Delete.
	* stor-layout.c (reference_types_internal): Likewise.
	(internal_reference_types): Likewise.
	(layout_type) <REFERENCE_TYPE>: Adjust.
ada/
	* gcc-interface/misc.c (gnat_init): Do not call
	internal_reference_types.

From-SVN: r235472
2016-04-27 07:49:49 +00:00
Svante Signell 1ee806d8d7 Makefile.in (x86 GNU/Hurd): Use s-osinte-gnu.adb.
* gcc-interface/Makefile.in (x86 GNU/Hurd): Use s-osinte-gnu.adb.
	* s-osinte-gnu.ads: Small tweaks.
	* s-osinte-gnu.adb: New file.

From-SVN: r235467
2016-04-27 07:38:41 +00:00
Arnaud Charlet 6c7f7b8c69 [multiple changes]
2016-04-21  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_prag.adb (Match_Constituent): Treat a constant as a legal
	constituent even if it is not to prevent spurious errors.

2016-04-21  Gary Dismukes  <dismukes@adacore.com>

	* sem_ch4.adb: Minor typo fixes and reformatting.

2016-04-21  Dmitriy Anisimkov  <anisimko@adacore.com>

	* g-calend.ads (No_Time): The same value in any timezone.
	* g-socket.adb (Raise_Host_Error): Remove ending
	dot from original error message before append colon delimited
	host name.

From-SVN: r235331
2016-04-21 12:27:54 +02:00
Arnaud Charlet 0310af44bb [multiple changes]
2016-04-21  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_ch3.adb: Code cleanup.
	* sem_ch6.adb: Code cleanup.
	(Is_Matching_Limited_View): New routine.
	(Matches_Limited_With_View): Reimplemented.
	* sem_ch10.adb (Decorate_Type): Code cleanup.

2016-04-21  Doug Rupp  <rupp@adacore.com>

	* tracebak.c (PPC ELF): Add macro defs for lynxos178e.

2016-04-21  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch4.adb (Try_Container_Indexing): If there are overloaded
	indexing functions, collect all overloadings of the call firts,
	and then transfer them to indexing node, to prevent interleaving
	of the set of interpretations of the nodes involved.
	* sem_res.adb (Resolve): Suppress cascaded errors that report
	ambiguities when one of the actuals in an overloaded generatlized
	indexing operation is illegal and has type Any_Type, as is done
	for similar cascaded errors in subprogram calls.
	(Valid_Tagged_Conversion): Cleanup conversion checks when one
	of the types involved is a class-wide subtype.

2016-04-21  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch12.adb (Load_Parent_Of_Generic): When looking for the
	subprogram declaration within a wrapper package, skip pragmas
	that may have been generated by aspect specifications on the
	generic instance.

2016-04-21  Javier Miranda  <miranda@adacore.com>

	* exp_aggr.adb (Component_Not_OK_For_Backend): Generating C
	code return True for array identifiers since the backend needs
	to initialize such component by means of memcpy().

From-SVN: r235330
2016-04-21 12:25:59 +02:00
Arnaud Charlet 150346bd8d a-tasatt.adb, [...] (Fast_Path): Rewritten to avoid reading potentially uninitialized memory.
2016-04-21  Arnaud Charlet  <charlet@adacore.com>

	* a-tasatt.adb, a-tasatt.ads (Fast_Path): Rewritten to avoid reading
	potentially uninitialized memory.
	* sem_ch3.adb: Minor style fix in comment.

From-SVN: r235329
2016-04-21 12:21:56 +02:00
Arnaud Charlet c25f170d2d gnat_rm.texi, [...]: Update doc.
* gnat_rm.texi, gnat_ugn.texi,
        doc/gnat_ugn/gnat_project_manager.rst,
        doc/gnat_ugn/building_executable_programs_with_gnat.rst,
        doc/gnat_ugn/gnat_and_program_execution.rst,
        doc/gnat_ugn/gnat_utility_programs.rst,
        doc/gnat_ugn/the_gnat_compilation_model.rst,
        doc/gnat_rm/implementation_defined_attributes.rst,
        doc/gnat_rm/standard_and_implementation_defined_restrictions.rst,
        doc/gnat_rm/implementation_defined_pragmas.rst,
        doc/gnat_rm/the_gnat_library.rst,
        doc/gnat_rm/implementation_defined_aspects.rst: Update doc.
        * doc/Makefile: Cleanups.

From-SVN: r235328
2016-04-21 12:06:40 +02:00
Arnaud Charlet f76647c2ec [multiple changes]
2016-04-21  Hristian Kirtchev  <kirtchev@adacore.com>

	* exp_pakd.adb, sem_ch13.adb: Minor reformatting.

2016-04-21  Ed Schonberg  <schonberg@adacore.com>

	* exp_dbug.adb, exp_dbug.ads (Qualify_Entity_Name): Add suffixes to
	disambiguate local variables that may be hidden from inner visibility
	by nested block declarations or loop variables.

From-SVN: r235327
2016-04-21 11:54:42 +02:00
Arnaud Charlet 22a4f9d54d [multiple changes]
2016-04-21  Jerome Lambourg  <lambourg@adacore.com>

	* s-soflin.adb: Initialize the Stack_Limit global variable.

2016-04-21  Hristian Kirtchev  <kirtchev@adacore.com>

	* lib-writ.adb: Minor reformatting.

2016-04-21  Ed Schonberg  <schonberg@adacore.com>

	* exp_pakd.adb (Compute_Number_Components): New function to
	build an expression that computes the number of a components of
	an array that may be multidimensional.
	(Expan_Packed_Eq): Use it.

2016-04-21  Arnaud Charlet  <charlet@adacore.com>

	* g-traceb.ads: Update list of supported platforms.

2016-04-21  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch13.adb (Add_Predicates): if the type is declared in
	an inner package it may be frozen outside of the package, and
	the generated pragma has not been analyzed yet, the expression
	for the predicate must be captured and added to the predicate
	function at this point.

2016-04-21  Hristian Kirtchev  <kirtchev@adacore.com>

	* contracts.adb (Analyze_Package_Body_Contract): Do not check
	for a missing package refinement because 1) packages do not have
	"refinement" and 2) the check for proper state refinement is
	performed in a different place.
	* einfo.adb (Has_Non_Null_Visible_Refinement): Reimplemented.
	(Has_Null_Visible_Refinement): Reimplemented.
	* sem_ch3.adb (Analyze_Declarations): Determine whether all
	abstract states have received a refinement and if not, emit
	errors.
	* sem_ch7.adb (Analyze_Package_Declaration): Code
	cleanup. Determine whether all abstract states of the
	package and any nested packages have received a refinement
	and if not, emit errors.
	(Requires_Completion_In_Body): Add new formal parameter
	Do_Abstract_States. Update the comment on usage. Propagate the
	Do_Abstract_States flag to all Unit_Requires_Body calls.
	(Unit_Requires_Body): Remove formal
	parameter Ignore_Abstract_States. Add new formal paramter
	Do_Abstract_States. Propagate the Do_Abstract_States flag to
	all Requires_Completion_In calls.
	* sem_ch7.ads (Unit_Requires_Body): Remove formal
	parameter Ignore_Abstract_States. Add new formal paramter
	Do_Abstract_States. Update the comment on usage.
	* sem_ch9.adb (Analyze_Single_Protected_Declaration): Do
	not initialize the constituent list as this is now done on a
	need-to-add-element basis.
	(Analyze_Single_Task_Declaration):
	Do not initialize the constituent list as this is now done on
	a need-to-add-element basis.
	* sem_ch10.adb (Decorate_State): Do not initialize the constituent
	lists as this is now done on a need-to-add-element basis.
	* sem_prag.adb (Analyze_Constituent): Set the
	refinement constituents when adding a new element.
	(Analyze_Part_Of_In_Decl_Part): Set the Part_Of constituents when
	adding a new element.
	(Analyze_Part_Of_Option): Set the Part_Of
	constituents when adding a new element.
	(Analyze_Pragma): Set the Part_Of constituents when adding a new
	element.
	(Check_Constituent_Usage (all versions)): Reimplemented.
	(Collect_Constituent): Set the refinement constituents when adding
	a new element.
	(Create_Abstract_State): Do not initialize the
	constituent lists as this is now done on a need-to-add-element basis.
	(Propagate_Part_Of): Set the Part_Of constituents when
	adding a new element.
	* sem_util.adb (Check_State_Refinements): New routine.
	(Has_Non_Null_Refinement): Reimplemented.
	(Has_Null_Refinement): Reimplemented.
	(Requires_State_Refinement): Removed.
	* sem_util.ads (Check_State_Refinements): New routine.
	(Requires_State_Refinement): Removed.

From-SVN: r235326
2016-04-21 11:46:18 +02:00
Hristian Kirtchev c4dc212506 lib-writ.adb, [...]: Minor reformatting and code cleanup.
2016-04-21  Hristian Kirtchev  <kirtchev@adacore.com>

	* lib-writ.adb, sem_ch6.adb: Minor reformatting and code cleanup.
	* sem.adb: Fix comment.

From-SVN: r235325
2016-04-21 11:41:45 +02:00
Arnaud Charlet c42aba6bb3 [multiple changes]
2016-04-21  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch3.adb (Analyze_Subtype_Declaration): A subtype
	declaration with no aspects, whose subtype_mark is a subtype
	with predicates, inherits the list of subprograms for the type.

2016-04-21  Arnaud Charlet  <charlet@adacore.com>

	* exp_aggr.adb (Has_Per_Object_Constraint): Refine previous
	change.

2016-04-21  Thomas Quinot  <quinot@adacore.com>

	* g-socket.adb (Raise_Host_Error): Include additional Name parameter.

2016-04-21  Ed Schonberg  <schonberg@adacore.com>

	* lib-writ.adb (Write_ALI): Do not record in ali file units
	that are present in the files table but not analyzed. These
	units are present because they appear in the context of units
	named in limited_with clauses, and the unit being compiled does
	not depend semantically on them.

2016-04-21  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Simplify code to
	create the procedure body for an function returning an array type,
	when generating C code. Reuse the subprogram body rather than
	creating a new one, both as an efficiency measure and because
	in an instance the body may contain global references that must
	be preserved.

From-SVN: r235324
2016-04-21 11:39:38 +02:00
Hristian Kirtchev bbe008b6e9 sem_ch3.adb, [...]: Minor reformatting.
2016-04-21  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_ch3.adb, exp_attr.adb, exp_ch6.adb, exp_aggr.adb: Minor
	reformatting.

From-SVN: r235322
2016-04-21 11:26:02 +02:00
Javier Miranda 35f4f23840 exp_aggr.adb (Component_Check): Extend the check that verifies that the aggregate has no function calls to...
2016-04-21  Javier Miranda  <miranda@adacore.com>

	* exp_aggr.adb (Component_Check): Extend
	the check that verifies that the aggregate has no function
	calls to handle transformations performed by the frontend.
	(Ultimate_Original_Expression): New subprogram.

From-SVN: r235321
2016-04-21 11:18:57 +02:00
Arnaud Charlet a1ad79ed63 [multiple changes]
2016-04-21  Philippe Gil  <gil@adacore.com>

	* krunch.adb (Krunch): Fix krunching of i-java.

2016-04-21  Arnaud Charlet  <charlet@adacore.com>

	* exp_ch8.adb (Evaluation_Required): Always return
	True when Modify_Tree_For_C.

From-SVN: r235320
2016-04-21 11:12:45 +02:00
Arnaud Charlet 9b7924dd17 [multiple changes]
2016-04-21  Eric Botcazou  <ebotcazou@adacore.com>

	* gnatlink.adb (Gnatlink): Robustify detection of Windows target.
	* alloc.ads: Minor comment fixes.
	* einfo.ads: Fix typo.

2016-04-21  Arnaud Charlet  <charlet@adacore.com>

	* exp_aggr.adb (Component_Not_OK_For_Backend): Redo previous
	changes to handle all cases of components depending on the
	discriminant, not just string literals.

2016-04-21  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch3.adb (Analyze_Subtype_Declaration): If the subtype
	declaration is the generated declaration for a generic actual,
	inherit predicates from the actual if it is a predicated subtype.

2016-04-21  Ed Schonberg  <schonberg@adacore.com>

	* exp_ch6.adb (Rewrite_Function_Call_For_C): If the function is
	inherited and its result is controlling,  introduce a conversion
	on the actual for the corresponding procedure call, to avoid
	spurious type errors.

2016-04-21  Jerome Lambourg  <lambourg@adacore.com>

	* krunch.adb (Krunch): Fix krunching of i-vxworks.

From-SVN: r235317
2016-04-21 10:57:30 +02:00
Arnaud Charlet d74716b313 [multiple changes]
2016-04-21  Gary Dismukes  <dismukes@adacore.com>

	* exp_aggr.adb: Minor reformatting and code cleanup.

2016-04-21  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch13.adb (Resolve_Name): Omit quantified expressions from
	resolution, because they introduce local names. Full resolution
	will take place when predicate function is constructed.

From-SVN: r235316
2016-04-21 10:54:25 +02:00
Arnaud Charlet 0ef5cd0ad8 exp_aggr.adb (Component_Not_OK_For_Backend): Refine previous change to take into account Per_Object_Constraint field rather...
2016-04-21  Arnaud Charlet  <charlet@adacore.com>

	* exp_aggr.adb (Component_Not_OK_For_Backend): Refine previous
	change to take into account Per_Object_Constraint field rather
	than special casing strings.
	* exp_ch6.adb: Fix typo in Replace_Returns.

From-SVN: r235314
2016-04-21 10:52:31 +02:00
Arnaud Charlet 2d6aa71558 [multiple changes]
2016-04-21  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_ch5.adb: Minor reformatting.

2016-04-21  Eric Botcazou  <ebotcazou@adacore.com>

	* exp_ch2.adb (Expand_Current_Value): Make an appropriate
	character literal if the entity is of a character type.

2016-04-21  Arnaud Charlet  <charlet@adacore.com>

	* exp_aggr.adb (Backend_Processing_Possible): Return False
	when generating C and aggregate contains function calls.

2016-04-21  Tristan Gingold  <gingold@adacore.com>

	* krunch.adb (Krunch): Only partially krunch children of
	Interfaces that aren't known.

2016-04-21  Ed Schonberg  <schonberg@adacore.com>

	* sem_prag.adb (Make_Inline): Handle properly the instantiation
	of a generic subpprogram that carries an Inline aspect. Place
	inline info on the anonymous subprogram that is constructed in
	the wrapper package.
	(Analyze_Pragma, case Pure): Do not check placement if pragma
	appears within an instantiation, which can be nested at any level.
	* sem_ch12.adb (Analyze_Instance_And_Renamings): Do not copy Freeze
	node from anonymous subprogram to its visible renaming. The
	freeze node will be constructed if the subprogram carries
	delayed aspects.
	(Set_Global): Preserve dimension information if present (from
	code reading).

2016-04-21  Vasiliy Fofanov  <fofanov@adacore.com>

	* gnatlink.adb: Change wording of the warning message on
	problematic filenames to be more neutral. Add a new substring
	"patch" introduced on Windows 10.

From-SVN: r235313
2016-04-21 10:50:36 +02:00
Arnaud Charlet 08f52d9f84 [multiple changes]
2016-04-21  Philippe Gil  <gil@adacore.com>

	* tracebak.c (__gnat_backtrace): handle bad RIP values (win64 only)

2016-04-21  Javier Miranda  <miranda@adacore.com>

	* exp_aggr.adb (Component_Not_OK_For_Backend): Return true for string
	literals.

2016-04-21  Hristian Kirtchev  <kirtchev@adacore.com>

	* einfo.adb (Has_Non_Null_Abstract_State): New routine.
	* einfo.ads New synthesized attribute
	Has_Non_Null_Abstract_State along with occurrences in entities.
	(Has_Non_Null_Abstract_State): New routine.
	* sem_ch7.adb (Unit_Requires_Body): Add local variable
	Requires_Body. A package declaring an abstract state requires
	a body only when the state is non-null and the package contains
	at least one other construct that requires completion in a body.
	* sem_util.adb (Mode_Is_Off): Removed.
	(Requires_State_Refinement): Remove an obsolete check. Code
	cleanup.

2016-04-21  Bob Duff  <duff@adacore.com>

	* sem_attr.adb (Analyze_Attribute): In processing
	the 'Old attribute, a warning is given for infinite recursion. Fix
	the code to not crash when the prefix of 'Old denotes a protected
	function.
	* sem_ch5.adb (Analyze_Iterator_Specification):
	Avoid calling Is_Dependent_Component_Of_Mutable_Object in cases
	where the parameter would not be an object.

2016-04-21  Eric Botcazou  <ebotcazou@adacore.com>

	* sem_eval.adb (Compile_Time_Compare): Be prepared for an empty
	Etype or Underlying_Type of the operands.

2016-04-21  Eric Botcazou  <ebotcazou@adacore.com>

	* atree.adb (Print_Statistics): Protect against overflows and
	print the memory consumption in bytes.
	* table.adb (Reallocate): Do the intermediate calculation of the new
	size using the Memory.size_t type.

From-SVN: r235312
2016-04-21 10:48:04 +02:00
Arnaud Charlet b943a97113 [multiple changes]
2016-04-21  Gary Dismukes  <dismukes@adacore.com>

	* exp_attr.adb (Is_Inline_Floating_Point_Attribute): Suppress
	expansion of Attribute_Machine and Attribute_Model for AAMP.

2016-04-21  Ed Schonberg  <schonberg@adacore.com>

	* freeze.adb: Disable previous change for now.

2016-04-21  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch8.adb (Find_Selected_Component): If prefix has an
	access type and designated type is a limited view, introduce
	an explicit dereference before continuing the analysis, and
	set its type to the non-limited view of the designated type,
	if we are in context where it is available.

From-SVN: r235311
2016-04-21 10:30:19 +02:00
Ed Schonberg 78bc7fe67e freeze.adb: Freeze profile in ASIS mode.
2016-04-21  Ed Schonberg  <schonberg@adacore.com>

	* freeze.adb: Freeze profile in ASIS mode.

From-SVN: r235309
2016-04-21 10:26:57 +02:00
Arnaud Charlet 6dc87f5f53 [multiple changes]
2016-04-21  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_aux.ads, sem_aux.adb (Has_Rep_Item): New variant.
	* sem_util.adb (Inherit_Rep_Item_Chain): Reimplemented.

2016-04-21  Hristian Kirtchev  <kirtchev@adacore.com>

	* exp_ch6.adb: Minor reformatting.

2016-04-21  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch13.adb: Minor comment update.

2016-04-21  Ed Schonberg  <schonberg@adacore.com>

	* freeze.ads, freeze.adb (Freeze_Entity, Freeze_Before): Add
	boolean parameter to determine whether freezing an overloadable
	entity freezes its profile as well. This is required by
	AI05-019. The call to Freeze_Profile within Freeze_Entity is
	conditioned by the value of this flag, whose default is True.
	* sem_attr.adb (Resolve_Attribute, case 'Access): The attribute
	reference freezes the prefix, but it the prefix is a subprogram
	it does not freeze its profile.

From-SVN: r235308
2016-04-21 10:25:21 +02:00
Arnaud Charlet a14bbbb4a4 [multiple changes]
2016-04-21  Javier Miranda  <miranda@adacore.com>

	* exp_util.adb (Build_Procedure_Form): No action needed for
	subprogram renamings since the backend can generate the call
	using the renamed subprogram. This leaves the tree more clean
	to the backend.
	* exp_ch6.adb (Expand_Call): Extend previous patch for
	rewritten-for-c entities to handle subprogram renamings.
	(Rewrite_Function_Call_For_C): Handle subprogram renamings.

2016-04-21  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch13.adb: Code cleanup.

From-SVN: r235307
2016-04-21 10:23:05 +02:00