summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2024-06-24 11:51:06 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2024-06-24 11:51:50 -0700
commita305e859b6d0abe6d88a3fe12c6891152cc6e859 (patch)
tree28c52554a6d8a014ef7382483145363015dc652e
parent72dde9873a59588739ea970fd10bdded999d4f67 (diff)
optimization.h: Add missing <utility> header for C++
PiperOrigin-RevId: 646172195 Change-Id: I089f1d84f2d73b663f12e6818f96436e054e71ae
-rw-r--r--absl/base/optimization.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/absl/base/optimization.h b/absl/base/optimization.h
index f9859958..3aa66e1c 100644
--- a/absl/base/optimization.h
+++ b/absl/base/optimization.h
@@ -18,12 +18,23 @@
// -----------------------------------------------------------------------------
//
// This header file defines portable macros for performance optimization.
+//
+// This header is included in both C++ code and legacy C code and thus must
+// remain compatible with both C and C++. C compatibility will be removed if
+// the legacy code is removed or converted to C++. Do not include this header in
+// new code that requires C compatibility or assume C compatibility will remain
+// indefinitely.
#ifndef ABSL_BASE_OPTIMIZATION_H_
#define ABSL_BASE_OPTIMIZATION_H_
#include <assert.h>
+#ifdef __cplusplus
+// Included for std::unreachable()
+#include <utility>
+#endif // __cplusplus
+
#include "absl/base/config.h"
#include "absl/base/options.h"