Commit Graph

6242 Commits

Author SHA1 Message Date
Eric Botcazou 2560723055 system-linux-armeb.ads (Backend_Overflow_Checks): Change to True.
* system-linux-armeb.ads (Backend_Overflow_Checks): Change to True.
	* system-linux-mips.ads (Backend_Overflow_Checks): Likewise.
	* system-linux-mips64el.ads (Backend_Overflow_Checks): Likewise.
	* system-linux-mipsel.ads (Backend_Overflow_Checks): Likewise.
	* system-linux-sparcv9.ads (Backend_Overflow_Checks): Likewise.
	* system-rtems.ads: Likewise.

From-SVN: r241003
2016-10-11 19:50:31 +00:00
Andris Pavenis 91f2eb13cb adaint.c: Include process.h, signal.h, dir.h and utime.h for DJGPP.
2016-10-11  Andris Pavenis  <andris.pavenis@iki.fi>

	* adaint.c: Include process.h, signal.h, dir.h and utime.h for DJGPP.
	ISALPHA: include <ctype.h> and define to isalpha for DJGPP when IN_RTS is defined.
	(DIR_SEPARATOR) define to '\\' for DJGPP.
	(__gnat_get_file_names_case_sensitive): return 0 for DJGPP unless
	overriden in environment
	(__gnat_is_absolute_path): Support MS-DOS style absolute paths for DJGPP.
	(__gnat_portable_spawn): Use spewnvp for DJGPP.
	(__gnat_portable_no_block_spawn): Use spawnvp for DJGPP.
	(__gnat_portable_wait): Return 0 for DJGPP.

From-SVN: r240999
2016-10-11 21:24:45 +03:00
Andris Pavenis a5297b0470 Makefile.in (LIBGNAT_TARGET_PAIRS): Define for DJGPP target
2016-10-11  Andris Pavenis  <andris.pavenis@iki.fi>

	* gcc-interface/Makefile.in (LIBGNAT_TARGET_PAIRS): Define for DJGPP target
	(EH_MECHANISM): Define to -gcc for DJGPP
	* system-djgpp.ads: New file

From-SVN: r240998
2016-10-11 21:19:07 +03:00
Andris Pavenis 4f100fd7db ctrl_c.c: Do not use macro SA_RESTART for DJGPP.
2016-10-11  Andris Pavenis  <andris.pavenis@iki.fi>

	* ctrl_c.c: Do not use macro SA_RESTART for DJGPP.
	* gsocket.h: Do not support sockets for DJGPP.
	* init.c (__gnat_install_handler): Implememt for DJGPP
	* sysdep.c: Include <io.h> for DJGPP
	(_setmode): Define to setmode for DJGPP
	(__gnat_set_mode): Add implementation for DJGPP
	(__gnat_localtime_tzoff): Use localtime_r for DJGPP
	* terminals.c: Add DJGPP to list of unsupported platforms.
	* env.c (__gnat_clearenv): use _gnat_unsetenv on all entries for DJGPP

From-SVN: r240997
2016-10-11 21:12:52 +03:00
Eric Botcazou 9760fbe005 Minor tweaks
From-SVN: r240988
2016-10-11 10:37:24 +00:00
Pierre-Marie de Rodat 656b031126 exp_dbug.adb (Debug_Renaming_Declaration): Process underlying types.
* exp_dbug.adb (Debug_Renaming_Declaration): Process underlying types.
	Emit GNAT encodings for object renamings involving record components
	whose normalized bit offset is not null.
	* uintp.h (UI_No_Uint): Declare.
	* gcc-interface/gigi.h (can_materialize_object_renaming_p): New.
	* gcc-interface/utils.c (can_materialize_object_renaming_p): New
	function.
	* gcc-interface/trans.c (gnat_to_gnu) <N_Object_Renaming_Declaration>:
	In code generation mode, materialize all renamings as long as they need
	debug info and we are not optimizing.

From-SVN: r240985
2016-10-11 10:35:43 +00:00
Pierre-Marie de Rodat 08ef2c1677 utils2.c (build_binary_op): Add a NO_FOLD argument.
* gcc-interface/utils2.c (build_binary_op): Add a NO_FOLD
	argument.  Disable folding when true.
	* gcc-interface/gigi.h (choices_to_gnu): Remove declaration.
	(build_binary_op): Update signature and comment.
	* gcc-interface/decl.c (choices_to_gnu): Make static.  Disable
	folding for all calls to build_binary_op.

From-SVN: r240978
2016-10-11 10:19:39 +00:00
Tristan Gingold abb3ea16fa fe.h (Constant_Value): Declare.
* fe.h (Constant_Value): Declare.
	* gcc-interface/decl.c (compile_time_known_address_p): Also consider
	references to constants.

From-SVN: r240977
2016-10-11 10:11:49 +00:00
Eric Botcazou 87e25aac8e trans.c (gnat_to_gnu): Adjust comment.
* gcc-interface/trans.c (gnat_to_gnu) <N_Op_Add>: Adjust comment.
	<N_Op_Minus>: Add comment and missing guard.
	* gcc-interface/trans.c (build_binary_op_trapv): Use an explicit test.

From-SVN: r240976
2016-10-11 10:03:49 +00:00
Eric Botcazou 9fd7cd44d6 utils.c (type_unsigned_for_rm): New predicate.
* gcc-interface/utils.c (type_unsigned_for_rm): New predicate.
	(make_type_from_size): Use it.
	(unchecked_convert): Likewise.  Do not skip the extension step if the
	source type is not integral.

From-SVN: r240975
2016-10-11 09:52:35 +00:00
Eric Botcazou f153e9d5b0 system-linux-ppc64.ads: Delete.
* system-linux-ppc64.ads: Delete.
	* system-linux-ppc.ads: Make 32-bit/64-bit neutral.
	* gcc-interface/Makefile.in (PowerPC/Linux): Simplify.

Co-Authored-By: Tristan Gingold <gingold@adacore.com>

From-SVN: r240973
2016-10-11 09:12:25 +00:00
Eric Botcazou 41683e1a62 decl.c (gnat_to_gnu_entity): Put volatile qualifier on types at the very end of the processing.
* gcc-interface/decl.c (gnat_to_gnu_entity): Put volatile qualifier
	on types at the very end of the processing.
	(gnat_to_gnu_param): Remove redundant test.
	(change_qualified_type): Do nothing for unconstrained array types.

From-SVN: r240915
2016-10-10 10:09:13 +00:00
Eric Botcazou 036a2fa23e utils2.c (find_common_type): Do not return the LHS type if it's an array with non-constant lower bound and...
* gcc-interface/utils2.c (find_common_type): Do not return the LHS type
	if it's an array with non-constant lower bound and the RHS type is an
	array with a constant one.

From-SVN: r240913
2016-10-10 09:46:10 +00:00
Eric Botcazou 55cfd746c7 utils.c (convert): For a biased input type, convert the bias itself to the base type before adding it.
* gcc-interface/utils.c (convert): For a biased input type, convert
	the bias itself to the base type before adding it.

From-SVN: r240910
2016-10-10 08:47:52 +00:00
Eric Botcazou 9c453de707 utils.c (convert): Add missing break.
* gcc-interface/utils.c (convert) <VECTOR_CST>: Add missing break.

	Revert
	2016-09-26  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* gcc-interface/decl.c: Fix fall through comment formatting.
	* gcc-interface/misc.c: Likewise.
	* gcc-interface/trans.c: Likewise.
	* gcc-interface/utils.c: Likewise.
	* gcc-interface/utils2.c: Likewise.

From-SVN: r240890
2016-10-08 17:04:28 +00:00
James Greenhalgh 75304c8793 [Patch] Remove all uses of TARGET_FLT_EVAL_METHOD_NON_DEFAULT and poison it
I'm going to hookize TARGET_FLT_EVAL_METHOD, so the current definition
of TARGET_FLT_EVAL_METHOD_NON_DEFAULT will stop working.

The relaxation enabled by TARGET_FLT_METHOD_NON_DEFAULT isn't portable,
and keeping it in place is tricky, so this patch removes it, and poisons
TARGET_FLT_EVAL_METHOD_NON_DEFAULT in system.h to prevent future use.

gcc/

	* defaults.h (TARGET_FLT_EVAL_METHOD_NON_DEFAULT): Remove.
	* system.h (TARGET_FLT_EVAL_METHOD_NON_DEFAULT): Poison.

gcc/c-family/

	* c-opts.c (c_common_post_options): Remove special case for
	TARGET_FLT_EVAL_METHOD_NON_DEFAULT with -fexcess-precision=standard
	in C++.

gcc/java/

	* lang.c (java_post_options): Remove special case for
	TARGET_FLT_EVAL_METHOD_NON_DEFAULT with -fexcess-precision=standard.

gcc/fortran/

	* options.c (gfc_post_options): Remove special case for
	TARGET_FLT_EVAL_METHOD_NON_DEFAULT with -fexcess-precision=standard.

gcc/ada/

	* gcc-interface/misc.c (gnat_post_options): Remove special case for
	TARGET_FLT_EVAL_METHOD_NON_DEFAULT with -fexcess-precision=standard.

From-SVN: r240614
2016-09-29 08:41:34 +00:00
Jakub Jelinek bbfac6da60 auto-inc-dec.c (try_merge): Remove break after return.
* auto-inc-dec.c (try_merge): Remove break after return.
	* cselib.c (autoinc_split): Likewise.
	* explow.c (promote_mode): Likewise.
	* fixed-value.c (fixed_arithmetic): Likewise.
	* hsa.c (hsa_internal_fn::get_arity): Likewise.
	* rtlanal.c (modified_between_p, modified_in_p): Likewise.
	* trans-mem.c (get_attrs_for): Likewise.
	* tree-if-conv.c (if_convertible_stmt_p): Likewise.
	* tree-vrp.c (simplify_stmt_using_ranges): Likewise.
	* config/aarch64/aarch64-builtins.c (aarch64_fold_builtin): Likewise.
	* config/aarch64/aarch64.c (aarch64_get_condition_code_1): Likewise.
	* config/c6x/c6x.c (c6x_get_unit_specifier): Likewise.
	* config/cr16/cr16.c (legitimate_pic_operand_p): Likewise.
	* config/cris/cris.c (cris_op_str): Likewise.
	* config/mn10300/mn10300.c (cc_flags_for_code): Likewise.
	* config/tilepro/tilepro.c (tilepro_emit_setcc_internal_di): Likewise.
c-family/
	* c-ada-spec.c (print_ada_declaration): Remove break after return.
objc/
	* objc-act.c (continue_class): Remove break after return.
	(objc_maybe_printable_name): Likewise.
fortran/
	* dependency.c (gfc_dep_compare_expr): Remove break after return.
	* frontend-passes.c (optimize_op): Likewise.
	* interface.c (gfc_current_interface_head): Likewise.
	* symbol.c (check_conflict): Likewise.
	* trans-intrinsic.c (build_fix_expr): Likewise.
ada/
	* terminals.c (is_gui_app): Remove break after return.

From-SVN: r240554
2016-09-27 20:14:10 +02:00
Rainer Orth fbedd170be Fix fallthrough comments for Ada, Solaris/x86, SPARC
gcc:
	* config/i386/i386.c (ix86_print_operand)
	[HAVE_AS_IX86_CMOV_SUN_SYNTAX]: Add gcc_fallthrough.
	* config/sparc/sparc.c (check_pic): Add fallthrough comment.
	(epilogue_renumber): Likewise.

	gcc/ada:
	* gcc-interface/decl.c: Fix fall through comment formatting.
	* gcc-interface/misc.c: Likewise.
	* gcc-interface/trans.c: Likewise.
	* gcc-interface/utils.c: Likewise.
	* gcc-interface/utils2.c: Likewise.

From-SVN: r240509
2016-09-26 20:13:21 +00:00
Jakub Jelinek aaa1b10f54 * hsa-gen.c (hsa_op_immed::hsa_op_immed Use CONSTRUCTOR_NELTS (...)
instead of vec_safe_length (CONSTRUCTOR_ELTS (...)).
	(gen_hsa_ctor_assignment): Likewise.
	* print-tree.c (print_node): Likewise.
	* tree-dump.c (dequeue_and_dump): Likewise.
	* tree-sra.c (sra_modify_constructor_assign): Likewise.
	* expr.c (store_constructor): Likewise.
	* fold-const.c (operand_equal_p): Likewise.
	* tree-pretty-print.c (dump_generic_node): Likewise.
	* hsa-brig.c (hsa_op_immed::emit_to_buffer): Likewise.
	* ipa-icf-gimple.c (func_checker::compare_operand): Likewise.
cp/
	* typeck2.c (process_init_constructor_record): Use
	CONSTRUCTOR_NELTS (...) instead of
	vec_safe_length (CONSTRUCTOR_ELTS (...)).
	* decl.c (reshape_init_r): Likewise.
	(check_initializer): Likewise.
ada/
	* gcc-interface/decl.c (gnat_to_gnu_entity): Use
	CONSTRUCTOR_NELTS (...) instead of
	vec_safe_length (CONSTRUCTOR_ELTS (...)).

From-SVN: r240390
2016-09-23 09:34:43 +02:00
Eric Botcazou 8234d02aa4 decl.c (gnat_to_gnu_entity): Also use the void pointer type if the designated type is incomplete and has no...
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Access_Type>: Also use
	the void pointer type if the designated type is incomplete and has no
	full view in LTO mode.
	<E_Access_Protected_Subprogram_Type>: Adjust comment.
	<E_Incomplete_Type>: Likewise.
	* gcc-interface/trans.c (Call_to_gnu): Do not convert to the type of
	the actual if it is a dummy type.

From-SVN: r238333
2016-07-14 11:12:22 +00:00
Bernd Edlinger 25b75a48d2 Convert TYPE_ALIGN_OK to a TYPE_LANG_FLAG.
2016-07-11  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        Convert TYPE_ALIGN_OK to a TYPE_LANG_FLAG.
        * tree-core.h (tree_base::nothrow_flag): Adjust comment.
        (tree_type_common::lang_flag_7): New.
        (tree_type_common::spare): Reduce size.
        * tree.h (TYPE_ALIGN_OK): Remove.
        (TYPE_LANG_FLAG_7): New.
        (get_inner_reference): Adjust header.
        * print-tree.c (print_node): Adjust.
        * expr.c (get_inner_reference): Remove parameter keep_aligning.
        (get_bit_range, expand_assignment, expand_expr_addr_expr_1): Adjust
        calls to get_inner_reference.
        (expand_expr_real_1): Adjust call to get_inner_reference.  Remove
        handling of TYPE_ALIGN_OK.
        * builtins.c (get_object_alignment_2): Adjust call to
        get_inner_reference.  Remove handling of VIEW_CONVERT_EXPR.
        * emit-rtl.c (set_mem_attributes_minus_bitpos): Remove handling of
        TYPE_ALIGN_OK.
        * asan.c (instrument_derefs): Adjust calls to get_inner_reference.
        * cfgexpand.c (expand_debug_expr): Likewise.
        * dbxout.c (dbxout_expand_expr): Likewise.
        * dwarf2out.c (loc_list_for_address_of_addr_expr_of_indirect_ref,
        loc_list_from_tree, fortran_common): Likewise.
        * fold-const.c (optimize_bit_field_compare,
        decode_field_reference, fold_unary_loc, fold_comparison,
        split_address_to_core_and_offset): Likewise.
        * gimple-laddress.c (execute): Likewise.
        * gimple-ssa-strength-reduction.c (slsr_process_ref): Likewise.
        * gimplify.c (gimplify_scan_omp_clauses): Likewise.
        * hsa-gen.c (gen_hsa_addr): Likewise.
        * simplifx-rtx.c (delegitimize_mem_from_attrs): Likewise.
        * tsan.c (instrument_expr): Likewise.
        * ubsan.c (instrument_bool_enum_load, instrument_object_size): Likewise.
        * tree.c (verify_type_variant): Remove handling of TYPE_ALIGN_OK.
        * tree-affine.c (tree_to_aff_combination,
        get_inner_reference_aff): Adjust calls to get_inner_reference.
        * tree-data-ref.c (split_constant_offset_1,
        dr_analyze_innermost): Likewise.
        * tree-scalar-evolution.c (interpret_rhs_expr): Likewise.
        * tree-sra.c (ipa_sra_check_caller): Likewise.
        * tree-ssa-loop-ivopts.c (split_address_cost): Likewise.
        * tree-ssa-math-opts.c (find_bswap_or_nop_load,
        bswap_replace): Likewise.
        * tree-vect-data-refs.c (vect_check_gather,
        vect_analyze_data_refs): Likewise.
        * config/mips/mips.c (r10k_safe_mem_expr_p): Likewise.
        * config/pa/pa.c (pa_emit_move_sequence): Remove handling of
        TYPE_ALIGN_OK.

ada:
2016-07-11  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        Convert TYPE_ALIGN_OK to a TYPE_LANG_FLAG.
        * gcc-interface/ada-tree.h (TYPE_ALIGN_OK): Define.
        * gcc-interface/trans.c (Attribute_to_gnu): Adjust call to
        get_inner_reference.
        * gcc-interface/utils2.c (build_unary_op): Likewise.

From-SVN: r238210
2016-07-11 15:02:12 +00:00
Eric Botcazou 7352723b9e trans.c (add_decl_expr): Minor tweak.
* gcc-interface/trans.c (add_decl_expr): Minor tweak.
	* gcc-interface/utils.c (create_var_decl): For an external variable,
	also clear TREE_READONLY in LTO mode if the initializer is not a valid
	constant and set DECL_READONLY_ONCE_ELAB instead.

From-SVN: r238206
2016-07-11 08:16:48 +00:00
Eric Botcazou 833c1dbc60 re PR ada/71817 (suspicious condition in C code)
PR ada/71817
	* adaint.c (__gnat_is_read_accessible_file): Add parentheses.
	(__gnat_is_write_accessible_file): Likewise.

From-SVN: r238204
2016-07-11 07:41:11 +00:00
Arnaud Charlet 86ec3bfb9f [multiple changes]
2016-07-07  Ed Schonberg  <schonberg@adacore.com>

	* exp_ch6.adb (Expand_Internal_Init_Call): Subsidiary procedure
	to Expand_Protected_ Subprogram_Call, to handle properly a
	call to a protected function that provides the initialization
	expression for a private component of the same protected type.
	* sem_ch9.adb (Analyze_Protected_Definition): Layout must be
	applied to itypes generated for a private operation of a protected
	type that has a formal of an anonymous access to subprogram,
	because these itypes have no freeze nodes and are frozen in place.
	* sem_ch4.adb (Analyze_Selected_Component): If prefix is a
	protected type and it is not a current instance, do not examine
	the first private component of the type.

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

	* exp_imgv.adb, g-dynhta.adb, s-regexp.adb, s-fatgen.adb, s-poosiz.adb:
	Minor removal of extra whitespace.
	* einfo.ads: minor removal of repeated "as" in comment

2016-07-07  Vadim Godunko  <godunko@adacore.com>

	* adaint.c: Complete previous change.

From-SVN: r238117
2016-07-07 15:20:30 +02:00
Arnaud Charlet 0640c7d139 [multiple changes]
2016-07-07  Vadim Godunko  <godunko@adacore.com>

	* adainit.h, adainit.c (__gnat_is_read_accessible_file): New
	subprogram.
	(__gnat_is_write_accessible_file): New subprogram.
	* s-os_lib.ads, s-os_lib.adb (Is_Read_Accessible_File): New subprogram.
	(Is_Write_Accessible_File): New subprogram.

2016-07-07  Justin Squirek  <squirek@adacore.com>

	* sem_ch12.adb (Install_Body): Minor refactoring in the order
	of local functions.
	(In_Same_Scope): Change loop condition to be more expressive.

From-SVN: r238116
2016-07-07 15:17:51 +02:00
Arnaud Charlet 8c519039a6 [multiple changes]
2016-07-07  Gary Dismukes  <dismukes@adacore.com>

	* sem_ch3.adb, sem_prag.adb, sem_prag.ads, prj-ext.adb, freeze.adb,
	sem_attr.adb: Minor reformatting, fix typos.

2016-07-07  Justin Squirek  <squirek@adacore.com>

	* sem_ch12.adb (In_Same_Scope): Created this function to check
	a generic package definition against an instantiation for scope
	dependancies.
	(Install_Body): Add function In_Same_Scope and
	amend conditional in charge of delaying the package instance.
	(Is_In_Main_Unit): Add guard to check if parent is present in
	assignment of Current_Unit.

From-SVN: r238115
2016-07-07 15:16:05 +02:00
Eric Botcazou 9cc6b3f86a sem_ch6.adb (Analyze_Subprogram_Body_Helper): Remove redundant test, adjust comments and formatting.
2016-07-07  Eric Botcazou  <ebotcazou@adacore.com>

	* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Remove redundant test,
	adjust comments and formatting.
	* sem_prag.adb (Inlining_Not_Possible): Do not test Front_End_Inlining
	here but...
	(Make_Inline): ...here before calling Inlining_Not_Possible instead.
	(Set_Inline_Flags): Remove useless test.
	(Analyze_Pragma) <Pragma_Inline>: Add comment about -gnatn switch.

From-SVN: r238113
2016-07-07 15:12:55 +02:00
Arnaud Charlet 0e77949e87 [multiple changes]
2016-07-07  Ed Schonberg  <schonberg@adacore.com>

	* sem_prag.ads, sem_prag.adb (Build_Classwide_Expression): Include
	overridden operation as parameter, in order to map formals of
	the overridden and overring operation properly prior to rewriting
	the inherited condition.
	* freeze.adb (Check_Inherited_Cnonditions): Change call to
	Build_Class_Wide_Expression accordingly.  In Spark_Mode, add
	call to analyze the contract of the parent operation, prior to
	mapping formals between operations.

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

	* adabkend.adb (Scan_Back_End_Switches): Ignore -o/-G switches
	as done in back_end.adb.
	(Scan_Compiler_Args): Remove special case for CodePeer/SPARK, no longer
	needed, and prevents proper handling of multi-unit sources.

2016-07-07  Thomas Quinot  <quinot@adacore.com>

	* g-sechas.adb, g-sechas.ads (GNAT.Secure_Hashes.H): Add Hash_Stream
	type with Write primitive calling Update on the underlying context
	(and dummy Read primitive raising P_E).

2016-07-07  Thomas Quinot  <quinot@adacore.com>

	* sem_ch13.adb: Minor reformatting.

From-SVN: r238111
2016-07-07 15:05:08 +02:00
Arnaud Charlet 7dccd19430 [multiple changes]
2016-07-07  Thomas Quinot  <quinot@adacore.com>

	* g-socket.ads: Document performance consideration for stream
	wrapper.

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

	* osint-c.ads (Set_File_Name): Clarify spec.

From-SVN: r238110
2016-07-07 15:02:31 +02:00
Eric Botcazou c765803988 freeze.adb: Reenable code.
2016-07-07  Eric Botcazou  <ebotcazou@adacore.com>

	* freeze.adb: Reenable code.

From-SVN: r238109
2016-07-07 15:00:54 +02:00
Yannick Moy 0bb97bdf5a sem_ch6.adb (Process_Formals): Set ghost flag on formal entities of ghost subprograms.
2016-07-07  Yannick Moy  <moy@adacore.com>

	* sem_ch6.adb (Process_Formals): Set ghost flag
	on formal entities of ghost subprograms.
	* ghost.adb (Check_Ghost_Context.Is_OK_Ghost_Context): Accept ghost
	entities in use type clauses.

From-SVN: r238106
2016-07-07 14:59:06 +02:00
Javier Miranda a5fa15228d sem_ch6.adb (Check_Inline_Pragma): if the subprogram has no spec then move its aspects to the internally built...
2016-07-06  Javier Miranda  <miranda@adacore.com>

	* sem_ch6.adb (Check_Inline_Pragma): if the subprogram has no spec
	then move its aspects to the internally built subprogram spec.

From-SVN: r238052
2016-07-06 15:45:55 +02:00
Yannick Moy 6dfc5e671f sem_ch6.adb (Analyze_Expression_Function): Mark body of expression function as ghost if needed when created.
2016-07-06  Yannick Moy  <moy@adacore.com>

	* sem_ch6.adb (Analyze_Expression_Function): Mark body of
	expression function as ghost if needed when created.
	* sem_prag.adb (Analyze_Pragma.Process_Inline.Set_Inline_Flags):
	Remove special case.

From-SVN: r238051
2016-07-06 15:41:20 +02:00
Arnaud Charlet d030f3a451 [multiple changes]
2016-07-06  Arnaud Charlet  <charlet@adacore.com>

	* lib.adb (Check_Same_Extended_Unit): Complete previous change.
	* sem_intr.adb (Errint): New parameter Relaxed. Refine previous
	change to only disable errors selectively.
	* sem_util.adb: minor style fix in object declaration

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

	* sem_warn.adb (Check_Infinite_Loop_Warning.Find_Var): Special case a
	call to a volatile function, so that it does not lead to a warning in
	that case.

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

	* sem_ch12.adb, sem_ch4.adb, sem_ch6.adb: Minor reformatting.

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

	* gnat1drv.adb: Code clean up. Do not emit any
	code generation errors when the unit is ignored Ghost.

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

	* sem_eval.adb (Check_Non_Static_Context): If the expression
	is a real literal of a floating point type that is part of a
	larger expression and is not a static expression, transform it
	into a machine number now so that the rest of the computation,
	even if other components are static, is not evaluated with
	extra precision.

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

	* sem_ch13.adb (Freeze_Entity_Checks): Undo previous patch and move the
	needed functionality to Analyze_Freeze_Generic_Entity.
	(Analyze_Freeze_Generic_Entity): If the entity is not already frozen
	and has delayed aspects then analyze them.

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

	* sem_prag.adb (Analyze_Pragma.Process_Inline.Set_Inline_Flags):
	Special case for unanalyzed body entity of ghost expression function.

From-SVN: r238050
2016-07-06 15:38:37 +02:00
Javier Miranda 136236bd31 sem_ch7.adb (Analyze_Package_Specification): Insert its freezing nodes after the last declaration.
2016-07-06  Javier Miranda  <miranda@adacore.com>

	* sem_ch7.adb (Analyze_Package_Specification): Insert its
	freezing nodes after the last declaration. Needed to ensure
	that global entities referenced in aspects of frozen types are
	properly handled.
	* freeze.adb (Freeze_Entity): Minor code reorganization to ensure
	that freezing nodes of generic packages are handled.
	* sem_ch13.adb (Freeze_Entity_Checks): Handle N_Freeze_Generic nodes.
	* sem_ch12.adb (Save_References_In_Identifier): Handle selected
	components which denote a named number that is constant folded
	in the analyzed copy of the tree.

From-SVN: r238047
2016-07-06 15:14:25 +02:00
Arnaud Charlet bb072d1c17 [multiple changes]
2016-07-06  Hristian Kirtchev  <kirtchev@adacore.com>

	* exp_aggr.adb Remove with and use clauses for Exp_Ch11 and Inline.
	(Initialize_Array_Component): Protect the initialization
	statements in an abort defer / undefer block when the associated
	component is controlled.
	(Initialize_Record_Component): Protect the initialization statements
	in an abort defer / undefer block when the associated component is
	controlled.
	(Process_Transient_Component_Completion): Use Build_Abort_Undefer_Block
	to create an abort defer / undefer block.
	* exp_ch3.adb Remove with and use clauses for Exp_ch11 and Inline.
	(Default_Initialize_Object): Use Build_Abort_Undefer_Block to
	create an abort defer / undefer block.
	* exp_ch5.adb (Expand_N_Assignment_Statement): Mark an abort
	defer / undefer block as such.
	* exp_ch9.adb (Find_Enclosing_Context): Do not consider an abort
	defer / undefer block as a suitable context for an activation
	chain or a master.
	* exp_util.adb Add with and use clauses for Exp_Ch11.
	(Build_Abort_Undefer_Block): New routine.
	* exp_util.ads (Build_Abort_Undefer_Block): New routine.
	* sinfo.adb (Is_Abort_Block): New routine.
	(Set_Is_Abort_Block): New routine.
	* sinfo.ads New attribute Is_Abort_Block along with occurrences
	in nodes.
	(Is_Abort_Block): New routine along with pragma Inline.
	(Set_Is_Abort_Block): New routine along with pragma Inline.

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

	* sem_ch4.adb (Analyze_One_Call): Add a conditional to handle
	disambiguation.

From-SVN: r238045
2016-07-06 14:40:07 +02:00
Arnaud Charlet 937e96763e [multiple changes]
2016-07-06  Hristian Kirtchev  <kirtchev@adacore.com>

	* einfo.adb Flag252 is now used as Is_Finalized_Transient. Flag295
	is now used as Is_Ignored_Transient.
	(Is_Finalized_Transient): New routine.
	(Is_Ignored_Transient): New routine.
	(Is_Processed_Transient): Removed.
	(Set_Is_Finalized_Transient): New routine.
	(Set_Is_Ignored_Transient): New routine.
	(Set_Is_Processed_Transient): Removed.
	(Write_Entity_Flags): Output Flag252 and Flag295.
	* einfo.ads: New attributes Is_Finalized_Transient
	and Is_Ignored_Transient along with occurrences in
	entities. Remove attribute Is_Processed_Transient.
	(Is_Finalized_Transient): New routine along with pragma Inline.
	(Is_Ignored_Transient): New routine along with pragma Inline.
	(Is_Processed_Transient): Removed along with pragma Inline.
	(Set_Is_Finalized_Transient): New routine along with pragma Inline.
	(Set_Is_Ignored_Transient): New routine along with pragma Inline.
	(Set_Is_Processed_Transient): Removed along with pragma Inline.
	* exp_aggr.adb Add with and use clauses for Exp_Ch11 and Inline.
	(Build_Record_Aggr_Code): Change the handling
	of controlled record components.
	(Ctrl_Init_Expression): Removed.
	(Gen_Assign): Add new formal parameter In_Loop
	along with comment on usage.  Remove local variables Stmt and
	Stmt_Expr. Change the handling of controlled array components.
	(Gen_Loop): Update the call to Gen_Assign.
	(Gen_While): Update the call to Gen_Assign.
	(Initialize_Array_Component): New routine.
	(Initialize_Ctrl_Array_Component): New routine.
	(Initialize_Ctrl_Record_Component): New routine.
	(Initialize_Record_Component): New routine.
	(Process_Transient_Component): New routine.
	(Process_Transient_Component_Completion): New routine.
	* exp_ch4.adb (Process_Transient_In_Expression): New routine.
	(Process_Transient_Object): Removed. Replace all existing calls
	to this routine with calls to Process_Transient_In_Expression.
	* exp_ch6.adb (Expand_Ctrl_Function_Call): Remove local constant
	Is_Elem_Ref. Update the comment on ignoring transients.
	* exp_ch7.adb (Process_Declarations): Do not process ignored
	or finalized transient objects.
	(Process_Transient_In_Scope): New routine.
	(Process_Transients_In_Scope): New routine.
	(Process_Transient_Objects): Removed. Replace all existing calls
	to this routine with calls to Process_Transients_In_Scope.
	* exp_util.adb (Build_Transient_Object_Statements): New routine.
	(Is_Finalizable_Transient): Do not consider a transient object
	which has been finalized.
	(Requires_Cleanup_Actions): Do not consider ignored or finalized
	transient objects.
	* exp_util.ads (Build_Transient_Object_Statements): New routine.
	* sem_aggr.adb: Major code clean up.
	* sem_res.adb: Update documentation.

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

	* sem_ch3.adb (Analyze_Subtype_Declaration): For generated
	subtypes, such as actual subtypes of unconstrained formals,
	inherit predicate functions, if any, from the parent type rather
	than creating redundant new ones.

From-SVN: r238044
2016-07-06 14:37:54 +02:00
Arnaud Charlet 75e4e36dfe [multiple changes]
2016-07-06  Hristian Kirtchev  <kirtchev@adacore.com>

	* exp_attr.adb, sem_attr.adb, sem_ch13.adb: Minor reformatting.

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

	* lib.adb (Check_Same_Extended_Unit): Prevent looping forever.
	* gnatbind.adb: Disable some consistency checks in codepeer mode,
	which are not needed.

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

	* sem_ch12.adb (Check_Fixed_Point_Actual): Add a warning when
	a formal fixed point type is instantiated with a type that has
	a user-defined arithmetic operations, but the generic has no
	corresponding formal functions. This is worth a warning because
	of the special semantics of fixed-point operators.

From-SVN: r238043
2016-07-06 14:34:52 +02:00
Bob Duff 1956beb8aa sem_attr.adb (Analyze_Attribute): Allow any expression of discrete type.
2016-07-06  Bob Duff  <duff@adacore.com>

	* sem_attr.adb (Analyze_Attribute): Allow any expression of
	discrete type.
	* exp_attr.adb (Expand_N_Attribute_Reference): Change the
	constant-folding code to correctly handle cases newly allowed
	by Analyze_Attribute.

From-SVN: r238042
2016-07-06 14:32:35 +02:00
Eric Botcazou b0ad2d78b2 decl.c (gnat_to_gnu_entity): Invoke global_bindings_p last when possible.
* gcc-interface/decl.c (gnat_to_gnu_entity): Invoke global_bindings_p
	last when possible.  Do not call elaborate_expression_2 on offsets in
	local record types and avoid useless processing for constant offsets.

From-SVN: r238001
2016-07-05 10:32:43 +00:00
Arnaud Charlet 5f5f7b7d73 Update documentation.
From-SVN: r237979
2016-07-04 14:57:30 +02:00
Arnaud Charlet cbe91164ce Cleanups.
From-SVN: r237977
2016-07-04 14:47:30 +02:00
Arnaud Charlet 0c3f76bac4 [multiple changes]
2016-07-04  Ed Schonberg  <schonberg@adacore.com>

	* sem_attr.adb (Analyze_Attribute_Old_Result): The attributes can
	appear in the postcondition of a subprogram renaming declaration,
	when the renamed entity is an attribute reference that is a
	function (such as 'Value).
	* sem_attr.adb (Eval_Attribute): It doesn't
	need to be static, just known at compile time, so use
	Compile_Time_Known_Value instead of Is_Static_Expression.
	This is an efficiency improvement over the previous bug fix.
	* sem_ch13.adb (Analyze_One_Aspect): Use Original_Node to detect
	illegal aspects on subprogram renaming declarations that may
	have been rewritten as bodies.

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

	* sem_intr.adb (Errint): Do not emit error message in
	Relaxed_RM_Semantics mode.

From-SVN: r237976
2016-07-04 14:32:22 +02:00
Bob Duff f3e0f7c3c1 sem_attr.adb (Eval_Attribute): The code was assuming that X'Enum_Rep...
2016-07-04  Bob Duff  <duff@adacore.com>

	* sem_attr.adb (Eval_Attribute): The code was assuming
	that X'Enum_Rep, where X denotes a constant, can be constant
	folded. Fix it so it makes that assumption only when X denotes
	a STATIC constant.

From-SVN: r237975
2016-07-04 14:30:44 +02:00
Arnaud Charlet 1d2d8a8f5a [multiple changes]
2016-07-04  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch4.adb (Compatible_Types_In_Predicate): New function
	to handle cases where a formal of a predicate function and the
	corresponding actual have different views of the same type.

2016-07-04  Philippe Gil  <gil@adacore.com>

	* g-debpoo.adb (Free_Blocks) free blocks also until
	Logically_Deallocated less than Maximum_Logically_Freed_Memory
	(Dump) add dump of number of traceback & validity elements
	already allocated.

2016-07-04  Justin Squirek  <squirek@adacore.com>

	* sem_ch12.adb (Instantiate_Package_Body): Add
	a guard to ignore Itypes which fail when installing primitives.

From-SVN: r237973
2016-07-04 12:48:48 +02:00
Bob Duff e49de265ef sem_eval.adb (Decompose_Expr): Set 'out' parameters Kind and Cons to valid values, to avoid use of uninit vars.
2016-07-04  Bob Duff  <duff@adacore.com>

	* sem_eval.adb (Decompose_Expr): Set 'out' parameters
	Kind and Cons to valid values, to avoid use of uninit vars.
	(Extract_Length): Reorder the check to make it clearer that
	we're depending on BOTH Ent1 and Ent2 to be Present.
	* sem_aggr.adb (Resolve_Aggregate): Remove dead code.
	(Check_Misspelled_Component): Remove exit statement, because
	it's covered by the 'while' condition.
	* checks.adb (Apply_Selected_Range_Checks): Remove useless
	condition "or else not Checks_On".
	(Selected_Range_Checks):
	Initialize Known_LB and Known_HB to False, because they are
	tested unconditionally; avoid use of uninit vars.
	* frontend.adb (Frontend): Removed useless condition
	"Operating_Mode = Check_Semantics and then", and added an Assert
	to clarify why it was useless.
	* prep.adb (Preprocess): Remove redundant condition. Add an
	assertion.
	* sem_ch10.adb (Analyze_Proper_Body): Moved redundant condition
	"Original_Operating_Mode = Generate_Code" to an Assert.
	(Process_Spec_Clauses, Process_Body_Clauses): Change parameters
	from 'in out' to 'out', and don't initialize actuals.
	* sem_ch12.adb (Is_In_Main_Unit): Removed useless condition
	"Unum = Main_Unit or else".
	(Save_Global_Descendant): Moved
	redundant condition "D = Union_Id (No_List)" to an Assert.
	* sem_ch4.adb (Check_Misspelled_Selector): Remove exit
	statement, because it's covered by the 'while' condition.
	(Analyze_Case_Expression): Initialize Wrong_Alt to Empty,
	because it looks like it is used uninitialized otherwise.
	* sem_ch6.adb (Check_Return_Subtype_Indication): Moved redundant
	condition "not R_Type_Is_Anon_Access" to an Assert.
	* sem_elim.adb (Line_Num_Match): Moved redundant condition
	"Sloc_Trace (Idx) = '['" to an Assert.
	* sem_util.adb (Compile_Time_Constraint_Error): Change "J" to
	"J - 1". This code is trying to replace "?" with "<", but not if
	the "?" is quoted, as in "'?", so we want to check the PREVIOUS
	character for '''.
	* snames.adb-tmpl (Is_Pragma_Name): Remove useless condition
	"or else N = Name_Relative_Deadline". It's useless because
	Name_Relative_Deadline is in the range First_Pragma_Name
	.. Last_Pragma_Name.
	* treepr.adb (Visit_Node): Moved redundant condition "D =
	Union_Id (No_List)" to an Assert.
	* sem_ch3.adb (Derive_Subprogram, Derive_Subprograms): Change
	parameters from 'in out' to 'out'.
	* errout.adb (Error_Msg_Internal): Replace redundant test with Assert.
	* inline.adb (Add_Inlined_Body): Code cleanup.

From-SVN: r237972
2016-07-04 12:46:47 +02:00
Hristian Kirtchev 890975e344 g-sercom-mingw.adb, [...]: Minor reformatting.
2016-07-04  Hristian Kirtchev  <kirtchev@adacore.com>

	* g-sercom-mingw.adb, sem_ch6.adb: Minor reformatting.

From-SVN: r237971
2016-07-04 12:44:24 +02:00
Arnaud Charlet ae4c4d53b4 [multiple changes]
2016-07-04  Olivier Hainque  <hainque@adacore.com>

	* g-sercom-mingw.adb (Set): Fix port configuration for the
	non-blocking + null-timeout case, request of immediate return.

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

	* sem_ch6.adb (Is_Non_Overriding_Operation): Add guard to test
	of generic parent type when operation is a parameterless function
	that may dispatch on result.

From-SVN: r237970
2016-07-04 12:43:01 +02:00
Arnaud Charlet c70cf4f8eb [multiple changes]
2016-07-04  Hristian Kirtchev  <kirtchev@adacore.com>

	* freeze.adb, ghost.adb, sem_ch13.adb: Minor reformatting.

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

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

2016-07-04  Justin Squirek  <squirek@adacore.com>

	* sem_ch7.adb (Install_Parent_Private_Declarations): When
	instantiating a child unit, do not install private declaration of
	a non-generic ancestor of the generic that is also an ancestor
	of the current unit: its private part will be installed when
	private part of ancestor itself is analyzed.

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

	* sem_ch12.adb (Instantiate_Object): In SPARK mode add a guard
	to verify that the actual is an object reference before checking
	for volatility.
	(Check_Generic_Child_Unit): Prevent cascaded errors when prefix
	is illegal.

From-SVN: r237969
2016-07-04 12:41:23 +02:00
Arnaud Charlet d4b56371aa [multiple changes]
2016-07-04  Gary Dismukes  <dismukes@adacore.com>

	* sem_ch12.ads, freeze.adb: Minor reformatting and typo fixes.

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

	* sem_ch13.adb (New_Stream_Subprogram): If the attribute
	definition clause comes from an aspect specification, place the
	generated subprogram renaming in the freeze actions of the type.

2016-07-04  Philippe Gil  <gil@adacore.com>

	* g-debpoo.adb (Dump.Do_Report) - add space prefix to backtrace
	address dump - avoid new line sent directly to stdout.

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

	* gnat1drv.adb, sem_ch12.adb, sem_elab.adb, sem_prag.adb, sem_res.adb:
	Relax elaboration checks in SPARK_Mode so that we rely on the
	static elaboration model (if used). We'll have a more precise
	check performed in flow analysis of gnat2why.

From-SVN: r237968
2016-07-04 12:38:22 +02:00
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