[PATCH] sys/platform/x86.h: Change _Bool to bool

H.J. Lu hjl.tools@gmail.com
Tue Dec 17 13:24:07 GMT 2024


On Tue, Dec 17, 2024, 9:08 PM Florian Weimer <fweimer@redhat.com> wrote:

> * H. J. Lu:
>
> > Change _Bool to bool to silence clang++ error:
> >
> > $ cat c.cc
> >
> > int
> > foo ()
> > {
> >   return CPU_FEATURE_PRESENT (SSE2);
> > }
> > $ clang++ -c -std=c++98 c.cc
> > In file included from c.cc:1:
> > In file included from /usr/include/sys/platform/x86.h:25:
> > /usr/include/bits/platform/features.h:31:19: error: unknown type name
> '_Bool'
> >    31 | static __inline__ _Bool
> >       |                   ^
> > In file included from c.cc:1:
> > /usr/include/sys/platform/x86.h:33:19: error: unknown type name '_Bool'
> >    33 | static __inline__ _Bool
> >       |                   ^
> > /usr/include/sys/platform/x86.h:46:19: error: unknown type name '_Bool'
> >    46 | static __inline__ _Bool
> >       |                   ^
> > 3 errors generated.
> > $
>
> GCC has this in <stdbool.h>:
>
> /* Supporting _Bool in C++ is a GCC extension.  */
> #define _Bool   bool
>
> So I'd suggest to change the commit message to say that we are no longer
> relying on a GCC extension.
>

Something like

Drop the GCC extension by changing _Bool to bool to silence clang++ error.



> The change itself is fine, <stdbool.h> is already included.
>
> Thanks,
> Florian
>
>
> H.J.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20241217/5ef4ecc0/attachment.htm>


More information about the Libc-alpha mailing list