public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Iain Buclaw <ibuclaw@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-2619] d: Only handle named enums in enum_initializer_decl
Date: Fri, 30 Jul 2021 10:56:11 +0000 (GMT)	[thread overview]
Message-ID: <20210730105611.A118F393D034@sourceware.org> (raw)

https://gcc.gnu.org/g:370f66b6af3e70ac31593d60a00d328a3368834a

commit r12-2619-g370f66b6af3e70ac31593d60a00d328a3368834a
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Mon Jul 26 19:10:47 2021 +0200

    d: Only handle named enums in enum_initializer_decl
    
    Anonymous enums neither generate an initializer nor typeinfo symbol, so
    it's safe to assert that all enum declarations passed to this function
    always have an identifier.
    
    gcc/d/ChangeLog:
    
            * decl.cc (enum_initializer_decl): Only handle named enums.

Diff:
---
 gcc/d/decl.cc | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/gcc/d/decl.cc b/gcc/d/decl.cc
index cf61cd49159..0d46ee180e7 100644
--- a/gcc/d/decl.cc
+++ b/gcc/d/decl.cc
@@ -2218,13 +2218,10 @@ enum_initializer_decl (EnumDeclaration *decl)
   if (decl->sinit)
     return decl->sinit;
 
-  tree type = build_ctype (decl->type);
+  gcc_assert (decl->ident);
 
-  Identifier *ident_save = decl->ident;
-  if (!decl->ident)
-    decl->ident = Identifier::generateId ("__enum");
+  tree type = build_ctype (decl->type);
   tree ident = mangle_internal_decl (decl, "__init", "Z");
-  decl->ident = ident_save;
 
   decl->sinit = declare_extern_var (ident, type);
   DECL_LANG_SPECIFIC (decl->sinit) = build_lang_decl (NULL);


                 reply	other threads:[~2021-07-30 10:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210730105611.A118F393D034@sourceware.org \
    --to=ibuclaw@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /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).