summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Derek Mauro <dmauro@google.com>2022-07-06 19:08:47 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2022-07-06 19:09:41 -0700
commit97ab3dcfd6490434202e4ab00b2eaba9449e42a1 (patch)
tree9a4a5008b535d52ed0be0807a1262c5c7c036922
parent9edef2349c8c4ace11b4a1b97365cf9c9a293dc8 (diff)
Move Abseil to C++14 minimum
Adds policy checks the raise the minimum C++ version to C++14 and the minimum GCC version to GCC 5 Updates the docs to indicate the C++14 minimum. PiperOrigin-RevId: 459401288 Change-Id: I18878f0e13001c57e97e26ad7c9a9c9c12c39265
-rw-r--r--CMake/AbseilHelpers.cmake12
-rw-r--r--CMake/README.md4
-rw-r--r--CMakeLists.txt2
-rw-r--r--README.md15
-rw-r--r--absl/base/policy_checks.h22
5 files changed, 29 insertions, 26 deletions
diff --git a/CMake/AbseilHelpers.cmake b/CMake/AbseilHelpers.cmake
index 6d03381b..ebe9ddc8 100644
--- a/CMake/AbseilHelpers.cmake
+++ b/CMake/AbseilHelpers.cmake
@@ -258,10 +258,10 @@ Cflags: -I\${includedir}${PC_CFLAGS}\n")
endif()
if(ABSL_PROPAGATE_CXX_STD)
- # Abseil libraries require C++11 as the current minimum standard.
+ # Abseil libraries require C++14 as the current minimum standard.
# Top-level application CMake projects should ensure a consistent C++
# standard for all compiled sources by setting CMAKE_CXX_STANDARD.
- target_compile_features(${_NAME} PUBLIC cxx_std_11)
+ target_compile_features(${_NAME} PUBLIC cxx_std_14)
else()
# Note: This is legacy (before CMake 3.8) behavior. Setting the
# target-level CXX_STANDARD property to ABSL_CXX_STANDARD (which is
@@ -306,10 +306,10 @@ Cflags: -I\${includedir}${PC_CFLAGS}\n")
target_compile_definitions(${_NAME} INTERFACE ${ABSL_CC_LIB_DEFINES})
if(ABSL_PROPAGATE_CXX_STD)
- # Abseil libraries require C++11 as the current minimum standard.
+ # Abseil libraries require C++14 as the current minimum standard.
# Top-level application CMake projects should ensure a consistent C++
# standard for all compiled sources by setting CMAKE_CXX_STANDARD.
- target_compile_features(${_NAME} INTERFACE cxx_std_11)
+ target_compile_features(${_NAME} INTERFACE cxx_std_14)
# (INTERFACE libraries can't have the CXX_STANDARD property set, so there
# is no legacy behavior else case).
@@ -418,10 +418,10 @@ function(absl_cc_test)
set_property(TARGET ${_NAME} PROPERTY FOLDER ${ABSL_IDE_FOLDER}/test)
if(ABSL_PROPAGATE_CXX_STD)
- # Abseil libraries require C++11 as the current minimum standard.
+ # Abseil libraries require C++14 as the current minimum standard.
# Top-level application CMake projects should ensure a consistent C++
# standard for all compiled sources by setting CMAKE_CXX_STANDARD.
- target_compile_features(${_NAME} PUBLIC cxx_std_11)
+ target_compile_features(${_NAME} PUBLIC cxx_std_14)
else()
# Note: This is legacy (before CMake 3.8) behavior. Setting the
# target-level CXX_STANDARD property to ABSL_CXX_STANDARD (which is
diff --git a/CMake/README.md b/CMake/README.md
index 8134615e..0be3b926 100644
--- a/CMake/README.md
+++ b/CMake/README.md
@@ -43,8 +43,8 @@ cmake_minimum_required(VERSION 3.8.2)
project(my_app_project)
# Pick the C++ standard to compile with.
-# Abseil currently supports C++11, C++14, and C++17.
-set(CMAKE_CXX_STANDARD 11)
+# Abseil currently supports C++14, C++17, and C++20.
+set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_subdirectory(abseil-cpp)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8a20d04a..10acf3b7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -64,7 +64,7 @@ else()
endif()
option(ABSL_PROPAGATE_CXX_STD
- "Use CMake C++ standard meta features (e.g. cxx_std_11) that propagate to targets that link to Abseil"
+ "Use CMake C++ standard meta features (e.g. cxx_std_14) that propagate to targets that link to Abseil"
OFF) # TODO: Default to ON for CMake 3.8 and greater.
if((${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.8) AND (NOT ABSL_PROPAGATE_CXX_STD))
message(WARNING "A future Abseil release will default ABSL_PROPAGATE_CXX_STD to ON for CMake 3.8 and up. We recommend enabling this option to ensure your project still builds correctly.")
diff --git a/README.md b/README.md
index db3a7b44..89790021 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
# Abseil - C++ Common Libraries
The repository contains the Abseil C++ library code. Abseil is an open-source
-collection of C++ code (compliant to C++11) designed to augment the C++
+collection of C++ code (compliant to C++14) designed to augment the C++
standard library.
## Table of Contents
@@ -85,13 +85,14 @@ Abseil contains the following C++ library components:
<br /> The `hash` library contains the hashing framework and default hash
functor implementations for hashable types in Abseil.
* [`memory`](absl/memory/)
- <br /> The `memory` library contains C++11-compatible versions of
- `std::make_unique()` and related memory management facilities.
+ <br /> The `memory` library contains memory management facilities that
+ augment C++'s `<memory>` library.
* [`meta`](absl/meta/)
- <br /> The `meta` library contains C++11-compatible versions of type checks
+ <br /> The `meta` library contains compatible versions of type checks
available within C++14 and C++17 versions of the C++ `<type_traits>` library.
* [`numeric`](absl/numeric/)
- <br /> The `numeric` library contains C++11-compatible 128-bit integers.
+ <br /> The `numeric` library contains 128-bit integer types as well as
+ implementations of C++20's bitwise math functions.
* [`profiling`](absl/profiling/)
<br /> The `profiling` library contains utility code for profiling C++
entities. It is currently a private dependency of other Abseil libraries.
@@ -100,7 +101,7 @@ Abseil contains the following C++ library components:
`absl::Status` and `absl::StatusOr<T>`.
* [`strings`](absl/strings/)
<br /> The `strings` library contains a variety of strings routines and
- utilities, including a C++11-compatible version of the C++17
+ utilities, including a C++14-compatible version of the C++17
`std::string_view` type.
* [`synchronization`](absl/synchronization/)
<br /> The `synchronization` library contains concurrency primitives (Abseil's
@@ -112,7 +113,7 @@ Abseil contains the following C++ library components:
time zones.
* [`types`](absl/types/)
<br /> The `types` library contains non-container utility types, like a
- C++11-compatible version of the C++17 `std::optional` type.
+ C++14-compatible version of the C++17 `std::optional` type.
* [`utility`](absl/utility/)
<br /> The `utility` library contains utility and helper code.
diff --git a/absl/base/policy_checks.h b/absl/base/policy_checks.h
index 06b32439..d13073c8 100644
--- a/absl/base/policy_checks.h
+++ b/absl/base/policy_checks.h
@@ -50,11 +50,11 @@
#error "This package requires Visual Studio 2015 Update 2 or higher."
#endif
-// We support gcc 4.7 and later.
+// We support gcc 5 and later.
// This minimum will go up.
#if defined(__GNUC__) && !defined(__clang__)
-#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7)
-#error "This package requires gcc 4.7 or higher."
+#if __GNUC__ < 5
+#error "This package requires gcc 5 or higher."
#endif
#endif
@@ -69,13 +69,15 @@
// C++ Version Check
// -----------------------------------------------------------------------------
-// Enforce C++11 as the minimum. Note that Visual Studio has not
-// advanced __cplusplus despite being good enough for our purposes, so
-// so we exempt it from the check.
-#if defined(__cplusplus) && !defined(_MSC_VER)
-#if __cplusplus < 201103L
-#error "C++ versions less than C++11 are not supported."
-#endif
+// Enforce C++14 as the minimum.
+#if defined(_MSVC_LANG)
+#if _MSVC_LANG < 201402L
+#error "C++ versions less than C++14 are not supported."
+#endif // _MSVC_LANG < 201402L
+#elif defined(__cplusplus)
+#if __cplusplus < 201402L
+#error "C++ versions less than C++14 are not supported."
+#endif // __cplusplus < 201402L
#endif
// -----------------------------------------------------------------------------