From: Joseph Myers <joseph@codesourcery.com>
To: Martin Uecker <uecker@tugraz.at>
Cc: <gcc-patches@gcc.gnu.org>
Subject: Re: [C PATCH 4/6] c23: tag compatibility rules for enums
Date: Tue, 7 Nov 2023 23:20:05 +0000 [thread overview]
Message-ID: <1391a10-fa87-2e87-e812-411dad8aa14@codesourcery.com> (raw)
In-Reply-To: <525f0f422f6d907b415d42e16daf8acdbd92ebe6.camel@tugraz.at>
On Sat, 26 Aug 2023, Martin Uecker via Gcc-patches wrote:
> Allow redefinition of enum types and enumerators.
>
> gcc/c:
> * c-decl.cc (start_num): Allow redefinition.
start_enum not start_num.
> @@ -9606,9 +9624,15 @@ start_enum (location_t loc, struct c_enum_contents *the_enum, tree name,
> if (name != NULL_TREE)
> enumtype = lookup_tag (ENUMERAL_TYPE, name, true, &enumloc);
>
> + if (flag_isoc2x && enumtype != NULL_TREE
> + && TREE_CODE (enumtype) == ENUMERAL_TYPE
> + && TYPE_VALUES (enumtype) != NULL_TREE)
> + enumtype = NULL_TREE;
Much the same comment applies as on the struct/union patch regarding
ensuring nested redefinitions are detected when there's a previous
definition outside the two nested definitions, in addition to the point
there about making sure that a definition nested inside an enum type
specifier for another definition of the same enum gets detected.
--
Joseph S. Myers
joseph@codesourcery.com
next prev parent reply other threads:[~2023-11-07 23:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-26 16:19 c23 type compatibility rules, v2 Martin Uecker
2023-08-26 16:20 ` [C PATCH 1/6] c: reorganize recursive type checking Martin Uecker
2023-09-06 20:59 ` Joseph Myers
2023-09-10 8:17 ` [C PATCH 1/6 v2] " Martin Uecker
2023-09-11 20:28 ` Joseph Myers
2023-08-26 16:22 ` [C PATCH 2/6] c23: recursive type checking of tagged type Martin Uecker
2023-11-07 23:06 ` Joseph Myers
2023-08-26 16:23 ` [C PATCH 3/6] c23: tag compatibility rules for struct and unions Martin Uecker
2023-11-07 23:18 ` Joseph Myers
2023-08-26 16:24 ` [C PATCH 4/6] c23: tag compatibility rules for enums Martin Uecker
2023-11-07 23:20 ` Joseph Myers [this message]
2023-08-26 16:25 ` [C PATCH 5/6] c23: aliasing of compatible tagged types Martin Uecker
2023-08-26 16:26 ` [C PATCH 6/6] c23: construct composite type for " Martin Uecker
2023-11-07 23:45 ` Joseph Myers
2023-08-26 16:26 ` [C PATCH] c: flag for tag compatibility rules Martin Uecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1391a10-fa87-2e87-e812-411dad8aa14@codesourcery.com \
--to=joseph@codesourcery.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=uecker@tugraz.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).