[PATCH] libcpp: Use [[likely]] conditionally
Marek Polacek
polacek@redhat.com
Tue Nov 23 15:38:19 GMT 2021
On Tue, Nov 23, 2021 at 04:26:19PM +0100, Christophe LYON via Gcc-patches wrote:
> Hi!
>
> On 23/11/2021 01:26, Jeff Law via Gcc-patches wrote:
> >
> >
> > On 11/22/2021 10:22 AM, Marek Polacek via Gcc-patches wrote:
> > > Let's hide [[likely]] behind a macro, to suppress warnings if the
> > > compiler doesn't support it.
> > >
> > > Co-authored-by: Jonathan Wakely <jwakely@redhat.com>
> > >
> > > Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk?
> > >
> > > PR preprocessor/103355
> > >
> > > libcpp/ChangeLog:
> > >
> > > * lex.c: Use ATTR_LIKELY instead of [[likely]].
> > > * system.h (ATTR_LIKELY): Define.
> > OK
> > jeff
>
>
> This patch breaks the build when the host compiler is gcc-4.8.5, because
> __has_cpp_attribute is not defined.
Ah, of course.
> Is this small patch OK with a proper ChangeLog?
Yes, please.
> diff --git a/libcpp/system.h b/libcpp/system.h
> index f6fc583ab80..b78ab813d2f 100644
> --- a/libcpp/system.h
> +++ b/libcpp/system.h
> @@ -430,6 +430,8 @@ extern void fancy_abort (const char *, int, const char
> *) ATTRIBUTE_NORETURN;
> # else
> # define ATTR_LIKELY
> # endif
> +#else
> +# define ATTR_LIKELY
> #endif
>
> /* Poison identifiers we do not want to use. */
>
>
> Thanks,
>
>
> Christophe
>
>
>
Marek
More information about the Gcc-patches
mailing list