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

H.J. Lu hjl.tools@gmail.com
Tue Dec 17 12:46:27 GMT 2024


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

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
 sysdeps/unix/sysv/linux/x86/bits/platform/features.h | 2 +-
 sysdeps/x86/bits/platform/features.h                 | 2 +-
 sysdeps/x86/sys/platform/x86.h                       | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/x86/bits/platform/features.h b/sysdeps/unix/sysv/linux/x86/bits/platform/features.h
index 7704febe92..1e63743e3f 100644
--- a/sysdeps/unix/sysv/linux/x86/bits/platform/features.h
+++ b/sysdeps/unix/sysv/linux/x86/bits/platform/features.h
@@ -28,7 +28,7 @@ enum
   x86_feature_1_shstk		= 1U << 1
 };
 
-static __inline__ _Bool
+static __inline__ bool
 x86_cpu_cet_active (unsigned int __index)
 {
 #ifdef __x86_64__
diff --git a/sysdeps/x86/bits/platform/features.h b/sysdeps/x86/bits/platform/features.h
index f02489266e..676ad0000a 100644
--- a/sysdeps/x86/bits/platform/features.h
+++ b/sysdeps/x86/bits/platform/features.h
@@ -20,7 +20,7 @@
 # error "Never include <bits/platform/features.h> directly; use <sys/platform/x86.h> instead."
 #endif
 
-static __inline__ _Bool
+static __inline__ bool
 x86_cpu_cet_active (unsigned int __index)
 {
   return false;
diff --git a/sysdeps/x86/sys/platform/x86.h b/sysdeps/x86/sys/platform/x86.h
index b8066ccc9f..1f5378031c 100644
--- a/sysdeps/x86/sys/platform/x86.h
+++ b/sysdeps/x86/sys/platform/x86.h
@@ -30,7 +30,7 @@ __BEGIN_DECLS
 extern const struct cpuid_feature *__x86_get_cpuid_feature_leaf (unsigned int)
      __attribute__ ((pure));
 
-static __inline__ _Bool
+static __inline__ bool
 x86_cpu_present (unsigned int __index)
 {
   const struct cpuid_feature *__ptr = __x86_get_cpuid_feature_leaf
@@ -43,7 +43,7 @@ x86_cpu_present (unsigned int __index)
   return __ptr->cpuid_array[__reg] & (1 << __bit);
 }
 
-static __inline__ _Bool
+static __inline__ bool
 x86_cpu_active (unsigned int __index)
 {
   if (__index == x86_cpu_IBT || __index == x86_cpu_SHSTK)
-- 
2.47.1



More information about the Libc-alpha mailing list