diff options
author | Jakub Jelinek <jakub@redhat.com> | 2024-12-18 12:00:13 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2024-12-18 12:00:13 +0100 |
commit | 7eb2acb7221b5a219ece1a693d9ac594f229a61a (patch) | |
tree | e8b8643885ab5736a6af60347e992654f5c6d016 /gcc/c-family/c-omp.cc | |
parent | 190d9a2b384e626bcd0554e01513939af1ed5339 (diff) | |
download | gcc-7eb2acb7221b5a219ece1a693d9ac594f229a61a.zip gcc-7eb2acb7221b5a219ece1a693d9ac594f229a61a.tar.gz gcc-7eb2acb7221b5a219ece1a693d9ac594f229a61a.tar.bz2 |
c++: Fix up pedantic handling of alignas [PR110345]
The following patch on top of the PR110345 P2552R3 series
emits pedantic pedwarns for alignas appertaining to incorrect entities.
As the middle-end and attribute exclusions look for "aligned" attribute,
the patch transforms alignas into "internal "::aligned attribute (didn't
use [[aligned (x)]] so that people can't type it that way).
2024-12-18 Jakub Jelinek <jakub@redhat.com>
PR c++/110345
gcc/c-family/
* c-common.h (attr_aligned_exclusions): Declare.
(handle_aligned_attribute): Likewise.
* c-attribs.cc (handle_aligned_attribute): No longer
static.
(attr_aligned_exclusions): Use extern instead of static.
gcc/cp/
* cp-tree.h (enum cp_tree_index): Add CPTI_INTERNAL_IDENTIFIER.
(internal_identifier): Define.
(internal_attribute_table): Declare.
* parser.cc (cp_parser_exception_declaration): Error on alignas
on exception declaration.
(cp_parser_std_attribute_spec): Turn alignas into internal
ns aligned attribute rather than gnu.
* decl.cc (initialize_predefined_identifiers): Initialize
internal_identifier.
* tree.cc (handle_alignas_attribute): New function.
(internal_attributes): New variable.
(internal_attribute_table): Likewise.
* cp-objcp-common.h (cp_objcp_attribute_table): Add
internal_attribute_table entry.
gcc/testsuite/
* g++.dg/cpp0x/alignas1.C: Add dg-options "".
* g++.dg/cpp0x/alignas2.C: Likewise.
* g++.dg/cpp0x/alignas7.C: Likewise.
* g++.dg/cpp0x/alignas21.C: New test.
* g++.dg/ext/bitfield9.C: Expect a warning.
* g++.dg/cpp2a/is-layout-compatible3.C: Add dg-options -pedantic.
Expect a warning.
Diffstat (limited to 'gcc/c-family/c-omp.cc')
0 files changed, 0 insertions, 0 deletions