summaryrefslogtreecommitdiff
path: root/absl/random
diff options
context:
space:
mode:
authorGravatar Niranjan Nilakantan <niranjan.nilakantan@hotmail.com>2023-05-18 19:23:52 -0700
committerGravatar Niranjan Nilakantan <niranjan.nilakantan@hotmail.com>2023-05-18 19:23:52 -0700
commitbd748714ce32841d410b1b8ec5f2daa5043ee6b2 (patch)
tree88d585155a09eaf65c22c2c9ebe628318488b238 /absl/random
parentf6f65f9bcd775b9a9a7bf0345018a45a85c8815b (diff)
Add a declaration for __cpuid for the IntelLLVM compiler.
__cpuid is declared in intrin.h, but is "excluded" on non-Windows platforms. We add this declaration to compensate. Fixes #1358
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..0ad23cb2 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.
+void __cpuid(int[4], int);
#else
// MSVC-equivalent __cpuid intrinsic function.
static void __cpuid(int cpu_info[4], int info_type) {