From ff2080a39e82985928d5ff513eaba02eedf19b2c Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Sat, 30 Aug 2025 16:49:51 +0900 Subject: [PATCH] Centralize C++ version in Makefiles (#2713) --- .github/workflows/ci.yml | 2 +- Makefile.am | 2 +- configure.ac | 5 ++++- src/Makefile.am | 2 +- test/Makefile.am | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 46315d8..5715eea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -143,7 +143,7 @@ jobs: - name: Build run: | ./autogen.sh - PKG_CONFIG_PATH=/usr/local/opt/curl/lib/pkgconfig:/usr/local/opt/openssl/lib/pkgconfig ./configure CXXFLAGS='-std=c++14' + PKG_CONFIG_PATH=/usr/local/opt/curl/lib/pkgconfig:/usr/local/opt/openssl/lib/pkgconfig ./configure make --jobs=$(sysctl -n hw.ncpu) - name: Cppcheck diff --git a/Makefile.am b/Makefile.am index 9143f88..9749e69 100644 --- a/Makefile.am +++ b/Makefile.am @@ -38,7 +38,7 @@ clang-tidy: cppcheck: cppcheck --quiet --error-exitcode=1 \ --inline-suppr \ - --std=c++14 \ + --std=@CPP_VERSION@ \ --xml \ -D HAVE_ATTR_XATTR_H \ -D HAVE_SYS_EXTATTR_H \ diff --git a/configure.ac b/configure.ac index d18d58c..6c47825 100644 --- a/configure.ac +++ b/configure.ac @@ -34,7 +34,10 @@ AC_CHECK_HEADERS([attr/xattr.h]) AC_CHECK_HEADERS([sys/extattr.h]) AC_CHECK_FUNCS([fallocate]) -CXXFLAGS="-Wall -fno-exceptions -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=3 -std=c++14 $CXXFLAGS" +CPP_VERSION=c++14 +AC_SUBST([CPP_VERSION]) + +CXXFLAGS="-Wall -fno-exceptions -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=3 -std=$CPP_VERSION $CXXFLAGS" dnl ---------------------------------------------- dnl For macOS diff --git a/src/Makefile.am b/src/Makefile.am index 4a7294b..87153ab 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -103,7 +103,7 @@ TESTS = \ test_string_util clang-tidy: - clang-tidy -extra-arg-before=-xc++ -extra-arg=-std=c++14 \ + clang-tidy -extra-arg-before=-xc++ -extra-arg=-std=@CPP_VERSION@ \ *.h $(s3fs_SOURCES) test_curl_util.cpp test_page_list.cpp test_string_util.cpp \ -- $(DEPS_CFLAGS) $(CPPFLAGS) diff --git a/test/Makefile.am b/test/Makefile.am index db6f311..547c068 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -43,7 +43,7 @@ truncate_read_file_SOURCES = truncate_read_file.cc cr_filename_SOURCES = cr_filename.cc clang-tidy: - clang-tidy -extra-arg=-std=c++14 \ + clang-tidy -extra-arg=-std=@CPP_VERSION@ \ $(junk_data_SOURCES) \ $(write_multiblock_SOURCES) \ $(mknod_test_SOURCES) \