[PATCH] libstdc++: bvector: undef always_inline macro

Patrick Palka ppalka@redhat.com
Wed Nov 15 02:20:55 GMT 2023


On Thu, 9 Nov 2023, Jonathan Wakely wrote:

> On Thu, 9 Nov 2023 at 19:49, Alexandre Oliva <oliva@adacore.com> wrote:
> >
> > On Nov  9, 2023, Jonathan Wakely <jwakely@redhat.com> wrote:
> >
> > > But I've just realised we probably want to #undef the macro at the end
> > > of bits/stl_bvector.h too.
> >
> > I'm not sure why (what if another libstdc++ header were to define the
> > macro, includes stl_bvector.h, and then use the macro expecting it to
> > still be there?), but I suppose this is what you mean.
> 
> It's consistent with all the other definitions of the macro in our
> headers. We always define it locally and then undef it again at the
> end of the header. You're right that that makes it rather hard to use
> reliably.

Hmm, in which headers do we currently undef _GLIBCXX_ALWAYS_INLINE?  A
bunch of headers seem to conditionally define it, e.g. bits/atomic_futex.h,
but none seem to undef it.  I wonder why we don't just conditionally
define this macro once in c++config?

> 
> >  Regstrapped on
> > x86_64-linux-gnu just to be sure.  Ok to install?
> 
> OK thanks.
> 
> 
> >
> >
> > From: Alexandre Oliva <oliva@adacore.com>
> >
> > It's customary to undefine temporary internal macros at the end of the
> > header that defines them, even such widely-usable ones as
> > _GLIBCXX_ALWAYS_INLINE, so do so in the header where the define was
> > recently introduced.
> >
> >
> > for  libstdc++-v3/ChangeLog
> >
> >         * include/bits/stl_bvector.h (_GLIBCXX_ALWAYS_INLINE): Undef.
> > ---
> >  libstdc++-v3/include/bits/stl_bvector.h |    2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/libstdc++-v3/include/bits/stl_bvector.h b/libstdc++-v3/include/bits/stl_bvector.h
> > index 2b91af2005f2d..1b7648535c523 100644
> > --- a/libstdc++-v3/include/bits/stl_bvector.h
> > +++ b/libstdc++-v3/include/bits/stl_bvector.h
> > @@ -1628,4 +1628,6 @@ _GLIBCXX_END_NAMESPACE_CONTAINER
> >  _GLIBCXX_END_NAMESPACE_VERSION
> >  } // namespace std
> >
> > +#undef _GLIBCXX_ALWAYS_INLINE
> > +
> >  #endif
> >
> > --
> > Alexandre Oliva, happy hacker            https://FSFLA.org/blogs/lxo/
> >    Free Software Activist                   GNU Toolchain Engineer
> > More tolerance and less prejudice are key for inclusion and diversity
> > Excluding neuro-others for not behaving ""normal"" is *not* inclusive
> >
> 
> 



More information about the Libstdc++ mailing list