@cryptotaxi247 / netdata-1 / commits / 209600207

Increase minimum language standards to C17 and C++17, and update to the latest versions of Protobuf and Abseil. (#21574)

* Bump minimum C/C++ standards to C17 and C++17 This requires GCC 8 or Clang 5, which is available on all platforms we support other than Amazon Linux 2 and RHEL 7. We retain the existing fallback for C11/C++11 via a CMake option to continue support for those platforms. C17 is functionally the language standard equivalent of a bugfix release, and thus doesn’t really have any significant impact. The rationale behind updating to C17 from C11 was mostly a matter of consistency with the C++ standard we require. C++17 has a number of new features and removed a couple of already deprecated features, but all of our code builds cleanly against it with no changes. Updating to C++17 as our C++ requirement lets us update to the latest versions of Protobuf and Abseil, as well as providing generally greater compatibility with possible future dependencies. * Bump bundled Protobuf and Abseil to the latest versions. This gets us a number of fixes, and should also make them play nicer with newer compilers. * Only use C17 if CMake is new enough to know about it. * Key off of compiler features instead of CMake version for C17. This should be more reliable when dealing with problematic systems that have new enough versions of CMake that for some reason don’t actually properly support C17. It should also let us continue working with older compilers that don’t actually support C17.

Austin S. Hemmelgarn committed Feb 16, 2026 at 11:40 UTC 20960020717117afefe58f09f669fe4367c2fde3
2 files changed +15 -10
CMakeLists.txt
+9 -4
@@ -37,12 +37,17 @@ if(STATIC_BUILD)
37 endif()
38
39 set(CMAKE_INSTALL_MESSAGE LAZY)
40 -
41 -set(CMAKE_C_STANDARD 11)
42 -set(CMAKE_CXX_STANDARD 14)
40 set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "netdata")
41
45 -option(USE_CXX_11 "Use C++11 instead of C++14 (should only be used on legacy systems that cannot support C++14, may disable some features)" False)
42 +if("c_std_17" IN_LIST CMAKE_C_KNOWN_FEATURES)
43 + set(CMAKE_C_STANDARD 17)
44 +else()
45 + set(CMAKE_C_STANDARD 11)
46 +endif()
47 +
48 +set(CMAKE_CXX_STANDARD 17)
49 +
50 +option(USE_CXX_11 "Use C++11 instead of C++17 (should only be used on legacy systems that cannot support C++17, may disable some features)" False)
51 mark_as_advanced(USE_CXX_11)
52
53 if(USE_CXX_11)
packaging/cmake/Modules/NetdataProtobuf.cmake
+6 -6
@@ -9,10 +9,10 @@ function(netdata_bundle_protobuf)
9 set(PROTOBUF_TAG f0dc78d7e6e331b8c6bb2d5283e06aa26883ca7c) # v21.12
10 set(NEED_ABSL False)
11
12 - if(CMAKE_CXX_STANDARD GREATER_EQUAL 14)
13 - set(PROTOBUF_TAG 4a2aef570deb2bfb8927426558701e8bfc26f2a4) # v25.3
12 + if(CMAKE_CXX_STANDARD GREATER_EQUAL 17)
13 + set(PROTOBUF_TAG edaa823d8b36a8656d7b2b9241b7d0bfe50af878) # v33.4
14 set(NEED_ABSL True)
15 - set(ABSL_TAG 2f9e432cce407ce0ae50676696666f33a77d42ac) # 20240116.1
15 + set(ABSL_TAG d407ef122a08203648451e0fec77b3f868b71112) # 20260107.0
16 endif()
17
18 set(FETCHCONTENT_TRY_FIND_PACKAGE_MODE NEVER)
@@ -29,12 +29,13 @@ function(netdata_bundle_protobuf)
29 set(BUILD_SHARED_LIBS Off)
30 set(ABSL_BUILD_TESTING Off)
31 set(absl_SOURCE_DIR "${CMAKE_BINARY_DIR}/_deps/absl-src")
32 + set(absl_repo https://github.com/abseil/abseil-cpp)
33
34 message(STATUS "Preparing bundled Abseil (required by bundled Protobuf)")
35 find_program(PATCH patch REQUIRED)
36 if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.28)
37 FetchContent_Declare(absl
37 - GIT_REPOSITORY https://github.com/abseil/abseil-cpp
38 + GIT_REPOSITORY ${absl_repo}
39 GIT_TAG ${ABSL_TAG}
40 SOURCE_DIR ${absl_SOURCE_DIR}
41 PATCH_COMMAND ${CMAKE_SOURCE_DIR}/packaging/cmake/patches/apply-patches.sh
@@ -45,7 +46,7 @@ function(netdata_bundle_protobuf)
46 )
47 else()
48 FetchContent_Declare(absl
48 - GIT_REPOSITORY https://github.com/abseil/abseil-cpp
49 + GIT_REPOSITORY ${absl_repo}
50 GIT_TAG ${ABSL_TAG}
51 SOURCE_DIR ${absl_SOURCE_DIR}
52 PATCH_COMMAND ${CMAKE_SOURCE_DIR}/packaging/cmake/patches/apply-patches.sh
@@ -157,7 +158,6 @@ macro(netdata_detect_protobuf)
158 endif()
159 endmacro()
160
160 -
161 # Helper function to compile protocol definitions into C++ code.
162 function(netdata_protoc_generate_cpp PROTO_ROOT_DIR OUTPUT_ROOT_DIR GENERATED_SOURCES GENERATED_HEADERS)
163 if(NOT ARGN)