]> git.ipfire.org Git - thirdparty/gcc.git/commit
gengtype: Avoid Werror bootstrap fail when a subclass has no GTY fields
authorMartin Jambor <mjambor@suse.cz>
Mon, 15 Dec 2025 23:44:44 +0000 (00:44 +0100)
committerMartin Jambor <jamborm@gcc.gnu.org>
Mon, 15 Dec 2025 23:52:51 +0000 (00:52 +0100)
commitc8ddca48512179b58d32dde4fcfec1d131659526
tree194f77c268287ecd550e22d5c73e1421a2d6321f
parente1eca9a8f580943d4d38a311e37eb41b5c997086
gengtype: Avoid Werror bootstrap fail when a subclass has no GTY fields

In a follow-up patch, I have created a GTYed subclass which does not
have any garbage collectible fields, just integers (a "sibling"
subclass does).  This leads to gengtype outputting code like this to
gtype-desc.cc:

   2722         case CIIK_SIMPLE:
   2723           {
   2724             cgraph_simple_indirect_info *sub = static_cast <cgraph_simple_indirect_info *> (x);
   2725           }
   2726           break;

And because in stage2 of our bootstrap we compile the file with -Wall
-Werror, this leads to a bootstrap failure because of
-Werror=unused-variable.

I have briefly looked into building that particular file with
-Wno-error but did not found a simple way to do that, at least not
yet.

So instead this patch generates statement "(void) sub;" after each
such static_assert to avoid the warning in the first place.

gcc/ChangeLog:

2025-10-17  Martin Jambor  <mjambor@suse.cz>

* gengtype.cc (walk_subclasses): Avoid generating code with unused
variables.
gcc/gengtype.cc