https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88134

--- Comment #32 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Segher Boessenkool from comment #31)
> A straightforward backport of that gives
> 
> In file included from /home/segher/src/gcc/gcc/config/rs6000/rs6000.cc:28765:
> ./gt-rs6000.h:143:6: error: 'atomic_update_decl' was not declared in this
> scope
>   143 |     &atomic_update_decl,
>       |      ^~~~~~~~~~~~~~~~~~
> ./gt-rs6000.h:145:13: error: 'atomic_update_decl' was not declared in this
> scope
>   145 |     sizeof (atomic_update_decl),
>       |             ^~~~~~~~~~~~~~~~~~
> ./gt-rs6000.h:150:6: error: 'atomic_clear_decl' was not declared in this
> scope
>   150 |     &atomic_clear_decl,
>       |      ^~~~~~~~~~~~~~~~~
> ./gt-rs6000.h:152:13: error: 'atomic_clear_decl' was not declared in this
> scope
>   152 |     sizeof (atomic_clear_decl),
>       |             ^~~~~~~~~~~~~~~~~
> ./gt-rs6000.h:157:6: error: 'atomic_hold_decl' was not declared in this scope
>   157 |     &atomic_hold_decl,
>       |      ^~~~~~~~~~~~~~~~
> ./gt-rs6000.h:159:13: error: 'atomic_hold_decl' was not declared in this
> scope
>   159 |     sizeof (atomic_hold_decl),
>       |             ^~~~~~~~~~~~~~~~
> 
> Help?

The issue is that the decls are inside

#ifdef RS6000_GLIBC_ATOMIC_FENV
...
#endif

but gengtype will unconditionally register the root, refering to the variables.

I suggest to remove the #ifdef guard and instead wrap the decls inside

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused"
..
#pragma GCC idagnostic pop

The C++ FE doesn't seem to allow ATTRIBUTE_UNUSED anywhere here and I guess
"fixing" gengtype isn't a thing you want to do ;)

Reply via email to