Commit Graph

196429 Commits

Author SHA1 Message Date
Patrick Palka 4e4e3ffd10 libstdc++: Move stream initialization into compiled library [PR44952]
This patch moves the static object for constructing the standard streams
out from <iostream> and into the compiled library on systems that support
init priorities.  This'll mean <iostream> no longer introduces a separate
global constructor in each TU that includes it.

We can do this only if the init_priority attribute is supported because
we need a way to ensure the stream initialization runs first before any
user global initializer, particularly when linking with a static
libstdc++.a.

	PR libstdc++/44952
	PR libstdc++/39796
	PR libstdc++/98108

libstdc++-v3/ChangeLog:

	* include/std/iostream (__ioinit): No longer define here if
	the init_priority attribute is usable.
	* src/c++98/ios_init.cc (__ioinit): Define here instead if
	init_priority is usable, via ...
	* src/c++98/ios_base_init.h: ... this new file.
2022-11-06 11:16:00 -05:00
Patrick Palka d0a492faa6 c++: correct __has_attribute(init_priority)
Currently __has_attribute(init_priority) always returns true, even on
targets that don't actually support init priorities, and when using the
attribute on such targets we just get a hard error about them being
unsupported.  This makes it impossible to conditionally use the attribute
by querying __has_attribute.

This patch fixes this by including init_priority in the attribute table
only if the target supports init priorities.  Thus on such targets
__has_attribute(init_priority) will now return false and we'll treat it
as just another unrecognized attribute (e.g. using it gives a -Wattribute
warning instead of a hard error).

gcc/cp/ChangeLog:

	* tree.cc (cxx_attribute_table): Include init_priority entry
	only if SUPPORTS_INIT_PRIORITY.
	(handle_init_priority_attribute): Add ATTRIBUTE_UNUSED.  Assert
	SUPPORTS_INIT_PRIORITY is true.

gcc/testsuite/ChangeLog:

	* g++.dg/special/initpri3.C: New test.
2022-11-06 11:09:26 -05:00
Jakub Jelinek 89d0a14a1f Manually add ChangeLog entries from r13-3652-ge4cba49413ca429dc82f6aa2e88129ecb3fdd943
This commit caused failure of update_version_git due to the removal of
liboffloadmic with ChangeLog in it, so I had to blacklist that commit
and here I'm adding ChangeLog entries manually.
2022-11-06 12:12:47 +01:00
GCC Administrator 05788e9b95 Daily bump. 2022-11-06 11:05:22 +00:00
Jakub Jelinek 2175b3976f Add another commit to ignore
We can't handle r13-3652-ge4cba49413ca429dc82f6aa2e88129ecb3fdd943

	* gcc-changelog/git_update_version.py: Add
	e4cba49413 to ignored commits.
2022-11-06 12:03:14 +01:00
Xi Ruoyao 3628025ac6 LoongArch: Add fcopysign instructions
Add fcopysign.{s,d} with the names copysign{sf,df}3 so GCC will expand
__builtin_copysign{f,} to a single instruction.

Link: https://sourceware.org/pipermail/libc-alpha/2022-November/143177.html

gcc/ChangeLog:

	* config/loongarch/loongarch.md (UNSPEC_FCOPYSIGN): New unspec.
	(type): Add fcopysign.
	(copysign<mode>3): New instruction template.

gcc/testsuite/ChangeLog:

	* gcc.target/loongarch/fcopysign.c: New test.
2022-11-06 15:56:52 +08:00
Bernhard Reutner-Fischer 07b0096e5b Plug memory leak in attribute target_clones
It looks like there was some memory leak in the handling
of attribute target_clones.

Ok for trunk if testing passes?

gcc/ChangeLog:

	* multiple_target.cc (expand_target_clones): Free memory.

Signed-off-by: Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
2022-11-06 01:53:20 +01:00
Bernhard Reutner-Fischer efbf11e97b cgraph_node: Remove redundant section clearing
Ok for trunk if testing passes?

gcc/ChangeLog:

	* cgraph.cc (cgraph_node::make_local): Remove redundant set_section.
	* multiple_target.cc (create_dispatcher_calls): Likewise.

Signed-off-by: Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
2022-11-06 01:52:40 +01:00
Iain Buclaw a111cfba48 d: Adjust test to pass when compiling with -m32
Noticed when running on x86_64-linux-gnu with `-m32', this test
triggered other errors.  Adjusted the test to use a different register
that is common between x86 and x86_64.

gcc/testsuite/ChangeLog:

	* gdc.dg/attr_register2.d: Adjust test.
2022-11-05 19:49:03 +01:00
Iain Buclaw 3c28d6a3a0 d: Add support for vector comparison operators
The front-end added semantic support to permit comparing two vector
expressions.  This removes the restriction in the code generator, as
well as the intrisics that previously exposed the same operation.

gcc/d/ChangeLog:

	* d-target.cc (Target::isVectorOpSupported): Remove cases for
	comparison operators.
	* intrinsics.cc (maybe_set_intrinsic): Remove cases for vector
	comparison intrinsics.
	(maybe_warn_intrinsic_mismatch): Likewise.
	(expand_intrinsic_vec_cond): Remove.
	(maybe_expand_intrinsic): Remove cases for vector comparison
	intrinsics.
	* intrinsics.def (INTRINSIC_EQUALMASK): Remove.
	(INTRINSIC_NOTEQUALMASK): Remove.
	(INTRINSIC_GREATERMASK): Remove.
	(INTRINSIC_GREATEREQUALMASK): Remove.

libphobos/ChangeLog:

	* libdruntime/gcc/simd.d (equalMask): Implement using generics.
	(notEqualMask): Likewise.
	(greaterMask): Likewise.
	(greaterOrEqualMask): Likewise.
	(notMask): Likewise.
	(andAndMask): Likewise.
	(orOrMask): Likewise.

gcc/testsuite/ChangeLog:

	* gdc.dg/Wbuiltin_declaration_mismatch2.d: Remove comparision tests.
	* gdc.dg/simd2a.d: Update comparison tests.
	* gdc.dg/simd2b.d: Likewise.
	* gdc.dg/simd2c.d: Likewise.
	* gdc.dg/simd2d.d: Likewise.
	* gdc.dg/simd2e.d: Likewise.
	* gdc.dg/simd2f.d: Likewise.
	* gdc.dg/simd2g.d: Likewise.
	* gdc.dg/simd2h.d: Likewise.
	* gdc.dg/simd2i.d: Likewise.
	* gdc.dg/simd2j.d: Likewise.
2022-11-05 19:47:16 +01:00
Lewis Hyatt 3ad2167bba c++: libcpp: Support raw strings with newlines in directives [PR55971]
It's not currently possible to use a C++11 raw string containing a newline as
part of the definition of a macro, or in any other preprocessing directive,
such as:

 #define X R"(two
lines)"

 #error R"(this error has
two lines)"

Add support for that by relaxing the conditions under which
_cpp_get_fresh_line() refuses to get a new line. For the case of lexing a raw
string, it's OK to do so as long as there is another line within the current
buffer. The code in cpp_get_fresh_line() was refactored into a new function
get_fresh_line_impl(), so that the new logic is applied only when processing a
raw string and not any other times.

libcpp/ChangeLog:

	PR preprocessor/55971
	* lex.cc (get_fresh_line_impl): New function refactoring the code
	from...
	(_cpp_get_fresh_line): ...here.
	(lex_raw_string): Use the new version of get_fresh_line_impl() to
	support raw strings containing new lines when processing a directive.

gcc/testsuite/ChangeLog:

	PR preprocessor/55971
	* c-c++-common/raw-string-directive-1.c: New test.
	* c-c++-common/raw-string-directive-2.c: New test.

gcc/c-family/ChangeLog:

	PR preprocessor/55971
	* c-ppoutput.cc (adjust_for_newlines): Update comment.
2022-11-05 10:23:20 -04:00
Jakob Hasse b83f01d005 libstdc++: fix pointer type exception catch (no RTTI) [PR105387]
__pbase_type_info::__do_catch(), used to catch pointer type exceptions,
did not check if the type info object to compare against is a pointer
type info object before doing a static down-cast to a pointer type info
object. If RTTI is disabled, this leads to the following situation:
Since a pointer type info object has additional fields, they would
end up being undefined if the actual type info object was not a pointer
type info object.

A simple check has been added before the down-cast happens.

Note that a consequence of this check is that exceptions of type
pointer-to-member cannot be caught anymore.

In case RTTI is enabled, this does not seem to be a problem because
RTTI-based checks would run before and prevent running into the bad
down-cast. Hence, the fix is disabled if RTTI is enabled and exceptions
of type pointer-to-member can still be caught.

libstdc++-v3/ChangeLog:

	PR libstdc++/105387
	* libsupc++/pbase_type_info.cc (__do_catch) [!__cpp_rtti]: Add
	check that the thrown type is actually a pointer.
	* testsuite/18_support/105387.cc: New test.
	* testsuite/18_support/105387_memptr.cc: New test.

Signed-off-by: Jakob Hasse <jakob.hasse@espressif.com>
2022-11-05 14:03:08 +00:00
Jonathan Wakely 7c6008e75d libstdc++: Do not use SFINAE for propagate_const conversions [PR107525]
As the PR notes, the current conversion operators are defined as
function templates so that we can use SFINAE. But this changes how they
are considered for overload resolution. This moves those operators into
base classes that can be specialized so the operators are obsent unless
the constraints are satisfied.

libstdc++-v3/ChangeLog:

	PR libstdc++/107525
	* include/experimental/propagate_const (operator element_type*()):
	Move into base class that can be partially specilized to iompose
	constraints.
	(operator const element_type*()): Likewise.
	* testsuite/experimental/propagate_const/observers/107525.cc: New test.
2022-11-05 14:01:30 +00:00
Jonathan Wakely e50ea3a42f doc: Document correct -fwide-exec-charset defaults [PR41041]
As shown in the PR, the default is not UTF-32 but rather UTF-32BE or
UTF-32LE, avoiding the need for a byte order mark in literals.

gcc/ChangeLog:

	PR c/41041
	* doc/cppopts.texi: Document -fwide-exec-charset defaults
	correctly.
2022-11-05 12:36:35 +00:00
Alexandre Oliva 6b1a2474f9 Support multilib-aware target lib flags self-specs overriding
This patch introduces -fmultiflags, short for multilib TFLAGS, as an
option that does nothing by default, but that can be added to TFLAGS
and mapped to useful options by driver self-specs.


for  gcc/ChangeLog

	* common.opt (fmultiflags): New.
	* doc/invoke.texi: Document it.
	* gcc.cc (driver_self_specs): Discard it.
	* opts.cc (common_handle_option): Ignore it in the driver.
2022-11-05 03:14:33 -03:00
Jakub Jelinek 95ba31bc4f testsuite: Add testcase from C++23 P2314R4 - Character sets and encodings
I've read the paper and I believe we just implement it with no changes
needed (at least since PR67224 and similar libcpp changes in GCC 10),
but I could be wrong.

The following patch at least adds a testcase from the start of the paper.

2022-11-04  Jakub Jelinek  <jakub@redhat.com>

	* g++.dg/cpp23/charset1.C: New testcase from C++23 P2314R4.
2022-11-04 18:20:36 +01:00
Jakub Jelinek 2662d537b0 libcpp: Update to Unicode 15
The following pseudo-patch regenerates the libcpp tables with Unicode 15.0.0
which added 4489 new characters.

As mentioned previously, this isn't just a matter of running the
two libcpp/make*.cc programs on the new Unicode files, but one needs
to manually update a table inside of makeuname2c.cc according to
a table in Unicode text (which is partially reflected in the text
files, but e.g. in Unicode 14.0.0 not 100% accurately, in 15.0.0
actually accurately).
I've also added some randomly chosen subset of those 4489 new
characters to a testcase.

2022-11-04  Jakub Jelinek  <jakub@redhat.com>

gcc/testsuite/
	* c-c++-common/cpp/named-universal-char-escape-1.c: Add tests for some
	characters newly added in Unicode 15.0.0.
libcpp/
	* makeuname2c.cc (struct generated): Update from Unicode 15.0.0
	table 4-8.
	* ucnid.h: Regenerated for Unicode 15.0.0.
	* uname2c.h: Likewise.
2022-11-04 18:18:42 +01:00
Wilco Dijkstra 26d2db895b AArch64: Fix testcase
gcc/testsuite/
	* gcc.target/aarch64/mgeneral-regs_3.c: Fix testcase.
2022-11-04 17:09:30 +00:00
Jeff Chapman II 0386c40eeb input: add get_source_text_between
The c++-contracts branch uses this to retrieve the source form of the
contract predicate, to be returned by contract_violation::comment().

Co-authored-by: Jason Merrill  <jason@redhat.com>

gcc/ChangeLog:

	* input.cc (get_source_text_between): New fn.
	* input.h (get_source_text_between): Declare.
2022-11-04 13:07:14 -04:00
Aldy Hernandez 679be32e66 Set nonzero bits for multiplication and divisions by a power of 2.
We're missing a lot of TLC in keeping track of nonzero bits across
range-ops.  It isn't an oversight, but just limited amount of hours to
implement stuff.

This patch keeps better track of the nonzero mask (really
maybe_nonzero bits as discussed) across multiplication and division
when the RHS is a power of 2.

It fixes PR107342 and also touches on PR55157.  In the latter, the
nonzero mask is being set quite late (CCP2) but could be set by evrp
time if we enhanced range-ops.  I have added tests from both PRs.

Tested

	PR tree-optimization/107342

gcc/ChangeLog:

	* range-op.cc (operator_mult::fold_range): New.
	(operator_div::fold_range): New.

gcc/testsuite/ChangeLog:

	* gcc.dg/tree-ssa/vrp122.c: New test.
	* gcc.dg/tree-ssa/vrp123.c: New test.
2022-11-04 15:18:18 +01:00
Eric Botcazou 0bdf10bdf1 Fix recent thinko in operand_equal_p
There is a thinko in a recent improvement made to operand_equal_p where
the code just looks at operand 2 of COMPONENT_REF, if it is present, to
compare addresses.  That's wrong because operand 2 contains the number of
DECL_OFFSET_ALIGN-bit-sized words so, when DECL_OFFSET_ALIGN > 8, not all
the  bytes are included and some of them are in DECL_FIELD_BIT_OFFSET, see
get_inner_reference for the model computation.

In other words, you would need to compare operand 2 and DECL_OFFSET_ALIGN
and DECL_FIELD_BIT_OFFSET in this situation, but I'm not sure this is worth
the hassle in practice so the fix just removes this alternate handling.

gcc/
	* fold-const.cc (operand_compare::operand_equal_p) <COMPONENT_REF>:
	Do not take into account operand 2.
	(operand_compare::hash_operand) <COMPONENT_REF>: Likewise.

gcc/testsuite/
	* gnat.dg/opt99.adb: New test.
	* gnat.dg/opt99_pkg1.ads, gnat.dg/opt99_pkg1.adb: New helper.
	* gnat.dg/opt99_pkg2.ads: Likewise.
2022-11-04 15:14:50 +01:00
Eric Botcazou 3e2bdf2460 Do not use subword paradoxical subregs in emit_group_store
The goal of the trick is to make life easier for the combiner, but subword
paradoxical subregs make it harder for the register allocator instead.

gcc/
	* expr.cc (emit_group_store): Do not use subword paradoxical subregs
2022-11-04 15:14:50 +01:00
Jonathan Wakely 418999fe38 libstdc++: Simplify lifetime of eh_globals variable [PR107500]
Since this is a trivial type, we probably don't need to do anything to
ensure it's still accessible after other static dtors.

libstdc++-v3/ChangeLog:

	PR libstdc++/107500
	* libsupc++/eh_globals.cc (eh_globals): Remove immortalizing
	wrapper.
	(__cxxabiv1::__cxa_get_globals_fast): Adjust.
	(__cxxabiv1::__cxa_get_globals): Adjust.
2022-11-04 14:04:53 +00:00
Jonathan Wakely f505f37a8e libstdc++: Define _GNU_SOURCE for secure_getenv on Cygwin [PR107511]
As in r12-6867-ge20486d508afdf we need to define _GNU_SOURCE explicitly
for Cygwin, because configure finds it in libc but it isn't declared
unless we request it.

libstdc++-v3/ChangeLog:

	PR libstdc++/107511
	* libsupc++/eh_alloc.cc (_GNU_SOURCE): Define.
2022-11-04 14:04:53 +00:00
Justin Squirek 5f18278717 ada: Fix for validity checks combined with aliasing checks
Attribute Overlaps_Storage, which can appear implicitly in expansion of
aliasing checks, is now excluded from operand validity checks. Likewise
for attribute Has_Same_Storage.

gcc/ada/

	* exp_attr.adb (Expand_N_Attribute_Reference): Skip operand
	validity checks for attributes Has_Same_Storage and
	Overlaps_Storage.
2022-11-04 14:47:31 +01:00
Eric Botcazou 4eac8834f9 ada: Fix couple of issues with arrays indexed by enumeration type
The first one is that Remove_Warning_Messages reinstates the Original_Node
of an N_Raise_Constraint_Error node in the tree for no clear reasons, and
the Original_Node may contain constructs whose expansion has been stopped
when the Constraint_Error was asserted, eventually causing gigi to stop.

The second one is that a path in Build_Array_Aggr_Code.Gen_Loop does not
copy the loop bounds, unlike other paths, thus triggering a sharing issue.

gcc/ada/

	* errout.adb (Remove_Warning_Messages.Check_For_Warning): Do not
	reinstate the Original_Node in the tree.
	* exp_aggr.adb (Build_Array_Aggr_Code.Gen_Loop): Copy the bounds
	on all paths.
2022-11-04 14:47:31 +01:00
Piotr Trojanek 9a27e6a9f9 ada: Fix typo in comment referring to pragma Restrictions
Comment cleanup only.

gcc/ada/

	* libgnat/g-excact.ads
	(Register_Global_Action): Refill comment.
	(Name_To_Id): Change pragma Restriction from singular to plural.
2022-11-04 14:47:31 +01:00
Piotr Trojanek 052888415b ada: Cleanup code for warnings about unreferenced formal parameters
Cleanup related to new checks for unset references.

gcc/ada/

	* sem_warn.adb (Check_References): Remove redundant guard, as it
	is implied by a preceding call to Referenced_Check_Spec.
2022-11-04 14:47:30 +01:00
Piotr Trojanek 3139280179 ada: Cleanup code for unreferenced variables
Further cleanups related to warnings about unreferenced objects.

gcc/ada/

	* sem_warn.adb (Check_References): Remove useless query for "spec"
	of a variable; refactor nested if-statements into a single
	condition.
2022-11-04 14:47:30 +01:00
Piotr Trojanek 72baa4e2b7 ada: Cleanup code for warnings about unset references
Cleanup related to new checks for unset references.

gcc/ada/

	* sem_util.adb
	(In_Pragma_Expression): Add standard guard against searching too
	far.
	(In_Quantified_Expression): Likewise.
	* sem_warn.adb
	(May_Need_Initialized_Actual): Remove redundant parens.
	(Check_References): Remove guard that duplicates a condition from
	the enclosing if-statement; only assign E1T variable when
	necessary.
	(Within_Postcondition): Fix layout.
	(No_Warn_On_In_Out): Balance parens in comment.
2022-11-04 14:47:30 +01:00
Steve Baird 7e1fe87899 ada: Static intrinsic functions are a core language extension.
GNAT-defined Ada extensions are divided into two categories: those that are
enabled by either -gnatX or -gnatX0 and those which require -gnatX0.
Move static intrinsic functions from the second category into the first.

gcc/ada/

	* doc/gnat_rm/implementation_defined_pragmas.rst: Add the standard
	'... "On" enables this extension.' sentence to the description of
	static intrinsic functions.
	* sem_ch13.adb
	(Analyze_Aspect_Spec): In the call to Error_Msg_GNAT_Extension for
	a Static aspect specification for an intrinsic function, specify
	Is_Core_Extension => True.
	* sem_eval.adb
	(Eval_Intrinsic_Call): Test Core_Extensions_Allowed instead of
	testing All_Extensions_Allowed.
	* gnat_rm.texi: Regenerate.
2022-11-04 14:47:30 +01:00
Piotr Trojanek 1207432c21 ada: Remove redundant calls in handling of aspect specifications
Routine Set_Aspect_Specifications sets the Has_Aspect flag, so there is
no need to set this flag again afterwards.

Code cleanup; semantics is unaffected.

gcc/ada/

	* aspects.adb (Relocate_Aspect): Remove call to Set_Has_Aspects.
	* sem_ch12.adb (Analyze_Formal_Package_Declaration): Likewise.
	* sem_util.adb (Copy_Ghost_Aspect, Copy_SPARK_Mode_Aspect):
	Likewise.
2022-11-04 14:47:29 +01:00
Javier Miranda fe960a3a19 ada: Flag unsupported dispatching constructor calls
gcc/ada/

	* exp_intr.adb
	(Expand_Dispatching_Constructor_Call): Report an error on
	unsupported dispatching constructor calls and report a warning on
	calls that may fail at run time.

gcc/testsuite/

	* gnat.dg/abstract1.ads: Cleanup whitespaces.
	* gnat.dg/abstract1.adb: Likewise and add -gnatws to silence new
	warning.
2022-11-04 14:47:29 +01:00
Piotr Trojanek 5f780a2d02 ada: Avoid repeated iteration over private protected components
The First_Entity/Next_Entity chain includes private entities, so there
it no need to iterate starting both from First_Entity and
First_Private_Entity.

Code cleanup related to improved detection of references to
uninitialized objects; behavior is unaffected.

gcc/ada/

	* sem_util.adb
	(Check_Components): Iterate using
	First/Next_Component_Or_Discriminant.
	(Has_Preelaborable_Initialization): Avoid repeated iteration with
	calls to Check_Components with First_Entity and
	First_Private_Entity.
	(Is_Independent_Object_Entity): Tune indentation.
2022-11-04 14:47:29 +01:00
Piotr Trojanek cb3c260460 ada: Cleanup clearing flags on package variables
When killing flags on assignable entities we iterated from First_Entity
and then again from First_Private_Entity. This second iteration was
unnecessary, because the entity chain that starts with First_Entity
contains all entities, including the private ones.

This is just a performance improvement; the behavior is unchanged.

gcc/ada/

	* sem_ch7.adb (Clear_Constants): Only iterate from First_Entity
	through Next_Entity; only examine variables because packages have
	no assignable formal parameters.
2022-11-04 14:47:29 +01:00
Piotr Trojanek 265341dc52 ada: Fix various typos in GNAT User's Guide
Fix uncontroversial typos.

gcc/ada/

	* doc/gnat_ugn/building_executable_programs_with_gnat.rst: Fix
	typos.
	* doc/gnat_ugn/elaboration_order_handling_in_gnat.rst: Fix typos
	and refill as necessary; remove trailing whitespace.
	* doc/gnat_ugn/gnat_and_program_execution.rst: Fix typos.
	* gnat_ugn.texi: Regenerate.
2022-11-04 14:47:28 +01:00
Marc Poulhiès 12cfb29497 ada: Fix loop unnesting issue.
During loop unnesting, when the loop statements are wrapped in a code
block, the newly created block's scope must be set to the loop
scope (instead of the previous 'Current_Scope' that would point to an
upper scope).

gcc/ada/

	* sem_util.ads (Add_Block_Identifier): Add new extra Scope
	argument.
	* sem_util.adb (Add_Block_Identifier): Likewise and use this scope
	variable instead of Current_Scope.
	* exp_util.adb (Wrap_Statements_In_Block): Add new scope argument
	to Add_Block_Identifier call.
2022-11-04 14:47:28 +01:00
Piotr Trojanek 73d04a073b ada: Fix repeated killing of private entity values
When killing known values of assignable entities we iterated from
First_Entity and then again from First_Private_Entity. This second
iteration was unnecessary, because the entity chain that starts with
First_Entity contains all entities, including the private ones.

This is just a performance improvement; the behavior is unchanged.

gcc/ada/

	* sem_util.adb (Kill_Current_Values): Only iterate from
	First_Entity through Next_Entity.
2022-11-04 14:47:28 +01:00
Piotr Trojanek 50bd9f4e6f ada: Simplify detection of controlling formals
When detecting controlling formals we are only interested in formal
parameters and not in other entities.

gcc/ada/

	* sem_ch6.adb (Controlling_Formal): Iterate with First/Next_Formal
	and not with First/Next_Entity.
2022-11-04 14:47:28 +01:00
Javier Miranda 64b10736a1 ada: Skip dynamic interface conversion under configurable runtime
gcc/ada/

	* exp_disp.adb
	(Expand_Interface_Conversion): Fix typo in comment.
2022-11-04 14:47:27 +01:00
Javier Miranda 5150978dfe ada: Skip dynamic interface conversion under configurable runtime
gcc/ada/

	* exp_disp.adb
	(Expand_Interface_Conversion): Under configurable runtime, when
	the target type is an interface that is an ancestor of the operand
	type, skip generating code to displace the pointer to reference
	the target dispatch table.
	* sem_disp.adb
	(Propagate_Tag): Handle class-wide types when checking for the
	addition of an implicit interface conversion.
2022-11-04 14:47:27 +01:00
Ronan Desplanques e491cb26ec ada: Fix typo
Fix typo in documentation.

gcc/ada/

	* doc/gnat_rm/standard_library_routines.rst: Fix typo.
	* gnat_rm.texi: Regenerate.
2022-11-04 14:47:27 +01:00
Ghjuvan Lacambre 48c206e044 ada: Remove sa_messages
Spark and CodePeer do not depend on this unit anymore.

gcc/ada/

	* sa_messages.ads, sa_messages.adb: Remove files.
2022-11-04 14:47:27 +01:00
Ghjuvan Lacambre 7d0d27d90d ada: Refactor: replace uses of not Present(X) with No (X)
`No (X)` is essentially `not Present (X)`, there's no reason for not
using this shorter form.

gcc/ada/

	* checks.adb, exp_atag.adb, exp_attr.adb, exp_ch4.adb, exp_ch6.adb,
	exp_ch7.adb, exp_dbug.adb, exp_disp.adb, exp_unst.adb, exp_util.adb,
	freeze.adb, layout.adb, pprint.adb, rtsfind.adb, sem_aggr.adb,
	sem_attr.adb, sem_case.adb, sem_ch12.adb, sem_ch13.adb, sem_ch3.adb,
	sem_ch5.adb, sem_ch6.adb, sem_ch8.adb, sem_dim.adb, sem_prag.adb,
	sem_util.adb, sem_warn.adb:
	Replace uses of `not Present (X)` with `No (X)`.
2022-11-04 14:47:26 +01:00
Piotr Trojanek 587af00955 ada: Fix various typos in node and entity description comments
Fix typos in units that describe GNAT abstract syntax tree.

gcc/ada/

	* einfo.ads: Fix typos in comments; refill as necessary.
	* sinfo.ads: Likewise.
2022-11-04 14:47:25 +01:00
Piotr Trojanek 1d201131fe ada: Fix various typos in GNAT RM
List of unknown words in files can be produced with:

  $ cat *.rst | ispell -l |
    tr '[:upper:]' '[:lower:]' | sort | uniq | less

and can be easily filtered with eyes.

gcc/ada/

	* doc/gnat_rm/implementation_defined_aspects.rst: Fix typos.
	* doc/gnat_rm/implementation_defined_attributes.rst: Likewise
	* doc/gnat_rm/implementation_defined_characteristics.rst: Likewise
	* doc/gnat_rm/implementation_defined_pragmas.rst: Likewise
	* doc/gnat_rm/standard_library_routines.rst: Likewise.
	* gnat_rm.texi: Regenerate.
2022-11-04 14:47:25 +01:00
Piotr Trojanek 533d79ac93 ada: Improve efficiency of scope stack restoration
We save/restore visibility by setting the Is_Immediately_Visible flag
and appending entities to / removing them from the tail of an element
list.

However, the Is_Immediately_Visible flag can be restored in any order,
while the element list is singly-linked and removal from the tail is
inefficient. This change removes a performance hot spot, which accounted
for up to 10% of compilation time of complex applications (e.g. QGen),
at least as measured on GNAT built with profiling support.

gcc/ada/

	* sem_ch8.adb (Restore_Scope_Stack): Remove elements from the head
	and not the tail of an element list.
2022-11-04 14:47:25 +01:00
Ronan Desplanques 41d5a493ed ada: Small editorial changes to documentation comments
gcc/ada/

	* sinfo.ads: Small editorial changes.
2022-11-04 14:47:25 +01:00
Steve Baird 1e78b49adb ada: Allow enabling a restricted set of language extensions.
The -gnatX switch (and the related Extensions_Allowed pragma) is currently a
two-valued all-or-nothing option. Add support for enabling a curated subset
of language extensions without enabling others via the -gnatX switch
and for enabling all language extensions via the new -gnatX0 switch.
Similarly, the existing "ON" argument for the Extensions_Allowed pragma
now only enables the curated subset; the new argument "ALL" enables all
language extensions. The subset of language extensions currently includes
prefixed-view notation with an untagged prefix, fixed-low-bound array
subtypes, and casing on composite values.

gcc/ada/

	* opt.ads: Replace Ada_Version_Type enumeration literal
	Ada_With_Extensions with two literals, Ada_With_Core_Extensions
	and Ada_With_All_Extensions. Update uses of the deleted literal.
	Replace Extensions_Allowed function with two functions:
	All_Extensions_Allowed and Core_Extensions_Allowed.
	* errout.ads, errout.adb: Add Boolean parameter to
	Error_Msg_GNAT_Extension to indicate whether the construct in
	question belongs to the curated subset.
	* exp_ch5.adb, par-ch4.adb, sem_case.adb, sem_ch3.adb:
	* sem_ch4.adb, sem_ch5.adb, sem_ch8.adb: Replace calls to
	Extensions_Allowed with calls to Core_Extensions_Allowed for
	constructs that are in the curated subset.
	* sem_attr.adb, sem_ch13.adb, sem_eval.adb, sem_util.adb: Replace
	calls to Extensions_Allowed with calls to All_Extensions_Allowed
	for constructs that are not in the curated subset.
	* par-ch3.adb: Override default for new parameter in calls to
	Error_Msg_GNAT_Extension for constructs in the curated subset.
	* par-prag.adb: Add Boolean parameter to Check_Arg_Is_On_Or_Off to
	also allow ALL. Set Opt.Ada_Version appropriately for ALL or ON
	arguments.
	* sem_prag.adb: Allowed ALL argument for an Extensions_Allowed
	pragma. Set Opt.Ada_Version appropriately for ALL or ON arguments.
	* switch-c.adb: The -gnatX switch now enables only the curated
	subset of language extensions (formerly it enabled all of them);
	the new -gnatX0 switch enables all of them.
	* doc/gnat_ugn/building_executable_programs_with_gnat.rst:
	Document new "-gnatX0" switch and update documentation for
	"-gnatX" switch.
	* doc/gnat_rm/implementation_defined_pragmas.rst: Document new ALL
	argument for pragma Extensions_Allowed and update documentation
	for the ON argument. Delete mention of Ada 2022 Reduce attribute
	as an extension.
	* gnat_rm.texi, gnat_ugn.texi: Regenerate.
2022-11-04 14:47:24 +01:00
Steve Baird c07da8567b ada: Generate missing object decls for adainit/adafinal registration calls
A previous change on this ticket introduced calls to CUDA_Register_Function
for adainit and adafinal, but failed to introduce declarations for the
C string variables that are initialized and then passed as actual parameters
in this call. Provide the missing declarations (and, incidentally, change
the names of the two variables).

gcc/ada/

	* bindgen.adb: Introduce two new string constants for the names of
	the C-String variables that are assigned the names for adainit and
	adafinal. Replace string literals in Gen_CUDA_Init with references
	to these constants. In Gen_CUDA_Defs, generate C-String variable
	declarations where these constants are the names of the variables.
2022-11-04 14:47:23 +01:00