This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch main in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=ec57799ae0f62738f343ddd119c27ad3d700ee15 commit ec57799ae0f62738f343ddd119c27ad3d700ee15 Author: Guillem Jover <[email protected]> AuthorDate: Thu Jul 25 04:26:38 2024 +0200 build: Bump minimum required C++ standard to C++14 Most major compilers support C++14, and if the platform has a compiler that does not support it, using gcc or clang to build the project is always an option which does not seem unreasonable. This new version of C++ provides several important features, among other things move semantics. --- configure.ac | 2 +- doc/coding-style.txt | 6 ++---- m4/dpkg-compiler.m4 | 37 +++++++++++++++++++++++++++++++++---- 3 files changed, 36 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index 8a7fd2215..3f1a86362 100644 --- a/configure.ac +++ b/configure.ac @@ -96,7 +96,7 @@ AC_PROG_EGREP AC_PROG_CC DPKG_C_STD([99]) AC_PROG_CXX -DPKG_CXX_STD([11]) +DPKG_CXX_STD([14]) DPKG_PROG_PATCH AC_CHECK_PROGS([DOXYGEN], [doxygen]) AC_CHECK_PROG([HAVE_DOT], [dot], [YES], [NO]) diff --git a/doc/coding-style.txt b/doc/coding-style.txt index 536e5ca3c..94389f2c5 100644 --- a/doc/coding-style.txt +++ b/doc/coding-style.txt @@ -68,7 +68,7 @@ second argument quoted tightly surrounding the code, like this: or the output will get messed up. -Dpkg C/C++ coding style 2016-01-29 +Dpkg C/C++ coding style 2024-07-24 ======================= Standards @@ -79,9 +79,7 @@ The C code base assumes C99, except for the following features: - Variable length arrays. - Mixed declaration and code. -The C++ code base assumes C++03, plus the following C++11 extension: - - + Null pointer keyword (nullptr). +The C++ code base assumes C++14. The code base assumes a POSIX.1-2008 compatible environment. diff --git a/m4/dpkg-compiler.m4 b/m4/dpkg-compiler.m4 index 29570ee49..ca22d22e4 100644 --- a/m4/dpkg-compiler.m4 +++ b/m4/dpkg-compiler.m4 @@ -111,9 +111,16 @@ AC_DEFUN([DPKG_CHECK_COMPILER_WARNINGS], [ DPKG_CHECK_COMPILER_FLAG([-Wstrict-prototypes]) ], [C++], [ - DPKG_CHECK_COMPILER_FLAG([-Wc++11-compat]) - DPKG_CHECK_COMPILER_FLAG([-Wc++11-compat-pedantic]) - DPKG_CHECK_COMPILER_FLAG([-Wc++11-extensions]) + AS_IF([test "$dpkg_cxx_std_version" -eq "_DPKG_CXX_CXX11_VERSION"], [ + DPKG_CHECK_COMPILER_FLAG([-Wc++11-compat]) + DPKG_CHECK_COMPILER_FLAG([-Wc++11-compat-pedantic]) + ], [test "$dpkg_cxx_std_version" -ge "_DPKG_CXX_CXX14_VERSION"], [ + DPKG_CHECK_COMPILER_FLAG([-Wc++14-compat]) + DPKG_CHECK_COMPILER_FLAG([-Wc++14-compat-pedantic]) + ]) + AS_IF([test "$dpkg_cxx_std_version" -le "_DPKG_CXX_CXX11_VERSION"], [ + DPKG_CHECK_COMPILER_FLAG([-Wc++14-extensions]) + ]) DPKG_CHECK_COMPILER_FLAG([-Wcast-qual]) DPKG_CHECK_COMPILER_FLAG([-Wold-style-cast]) AS_IF([test "$dpkg_cxx_std_version" -ge "_DPKG_CXX_CXX11_VERSION"], [ @@ -352,6 +359,28 @@ m4_define([_DPKG_CXX_CXX11_OPTS], [ -std=c++11 ]) +# _DPKG_CXX_CXX14_VERSION +# ----------------------- +m4_define([_DPKG_CXX_CXX14_VERSION], [201402]) + +# _DPKG_CXX_CXX14_PROLOGUE +# ------------------------ +m4_define([_DPKG_CXX_CXX14_PROLOGUE], [[]]) + +# _DPKG_CXX_CXX14_BODY +# -------------------- +m4_define([_DPKG_CXX_CXX14_BODY], [ + _DPKG_CXX_CXX11_BODY +]) + +# _DPKG_CXX_CXX14_OPTS +# -------------------- +# Define the options to try for C++14. +m4_define([_DPKG_CXX_CXX14_OPTS], [ + -std=gnu++14 + -std=c++14 +]) + # _DPKG_CXX_STD_VERSION # --------------------- m4_define([_DPKG_CXX_STD_VERSION], [[ @@ -384,7 +413,7 @@ AC_DEFUN([_DPKG_CXX_STD_TRY], [ # disabled with a configure option, we are still distributing C++ headers # that we need to support and test during build. # -# Currently supported: C++11. +# Currently supported: C++11, C++14. AC_DEFUN([DPKG_CXX_STD], [ AC_CACHE_CHECK([whether $CXX supports C++$1], [dpkg_cv_cxx_std], [ _DPKG_CXX_STD_TRY([$1], [dpkg_cv_cxx_std=yes], [dpkg_cv_cxx_std=no]) -- Dpkg.Org's dpkg

