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

Florian Weimer fweimer@redhat.com
Tue Dec 17 13:08:41 GMT 2024


* 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.

The change itself is fine, <stdbool.h> is already included.

Thanks,
Florian



More information about the Libc-alpha mailing list