[clang] [clang][X86] Fix -Wundef warning in cpuid.h (PR #89842)
Dan Klishch via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 23 15:42:05 PDT 2024
https://github.com/DanShaders created https://github.com/llvm/llvm-project/pull/89842
Caught by compiling a project (SerenityOS) that uses compiler-rt and not silencing warnings from system headers.
>From 8c924ea810352c27bffaf1ac30bbe4ad4ffbadc2 Mon Sep 17 00:00:00 2001
From: Dan Klishch <danilklishch at gmail.com>
Date: Tue, 23 Apr 2024 18:41:16 -0400
Subject: [PATCH] [clang][X86] Fix -Wundef warning in cpuid.h
Caught by compiling a project (SerenityOS) that uses compiler-rt and
not silencing warnings from system headers.
---
clang/lib/Headers/cpuid.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/clang/lib/Headers/cpuid.h b/clang/lib/Headers/cpuid.h
index 0bb9912b465ffe..bb7692efb78ffe 100644
--- a/clang/lib/Headers/cpuid.h
+++ b/clang/lib/Headers/cpuid.h
@@ -10,7 +10,7 @@
#ifndef __CPUID_H
#define __CPUID_H
-#if !(__x86_64__ || __i386__)
+#if !defined(__x86_64__) && !defined(__i386__)
#error this header is for x86 only
#endif
@@ -256,7 +256,7 @@
#define bit_AVX10_256 0x00020000
#define bit_AVX10_512 0x00040000
-#if __i386__
+#ifdef __i386__
#define __cpuid(__leaf, __eax, __ebx, __ecx, __edx) \
__asm("cpuid" : "=a"(__eax), "=b" (__ebx), "=c"(__ecx), "=d"(__edx) \
: "0"(__leaf))
@@ -285,7 +285,7 @@ static __inline unsigned int __get_cpuid_max (unsigned int __leaf,
unsigned int *__sig)
{
unsigned int __eax, __ebx, __ecx, __edx;
-#if __i386__
+#ifdef __i386__
int __cpuid_supported;
__asm(" pushfl\n"
More information about the cfe-commits
mailing list