summaryrefslogtreecommitdiff
path: root/absl/random
diff options
context:
space:
mode:
authorGravatar niranjan-nilakantan <123265571+niranjan-nilakantan@users.noreply.github.com>2023-05-23 09:27:11 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2023-05-23 09:27:54 -0700
commit79ca5d7aad63973c83a4962a66ab07cd623131ea (patch)
treeaa33f6b945eaedcf9178b94850a3ccbce9231ed2 /absl/random
parent9d43470921bef911145ad78a8e822ee1b297f937 (diff)
Add a declaration for __cpuid for the IntelLLVM compiler.
Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1452 __cpuid is declared in intrin.h, but is excluded on non-Windows platforms. We add this declaration to compensate. Fixes #1358 PiperOrigin-RevId: 534449804 Change-Id: I91027f79d8d52c4da428d5c3a53e2cec00825c13
Diffstat (limited to 'absl/random')
-rw-r--r--absl/random/internal/randen_detect.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/absl/random/internal/randen_detect.cc b/absl/random/internal/randen_detect.cc
index 6dababa3..bdeab877 100644
--- a/absl/random/internal/randen_detect.cc
+++ b/absl/random/internal/randen_detect.cc
@@ -45,6 +45,10 @@
#if defined(ABSL_INTERNAL_USE_X86_CPUID)
#if defined(_WIN32) || defined(_WIN64)
#include <intrin.h> // NOLINT(build/include_order)
+#elif ABSL_HAVE_BUILTIN(__cpuid)
+// MSVC-equivalent __cpuid intrinsic declaration for clang-like compilers
+// for non-Windows build environments.
+extern void __cpuid(int[4], int);
#else
// MSVC-equivalent __cpuid intrinsic function.
static void __cpuid(int cpu_info[4], int info_type) {