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.