From 286d6f70c83aaa814994f9376bfdca29d5bdfcbc Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Sat, 28 Aug 2021 09:54:05 +0300 Subject: [PATCH] build: require c++17 We don't technically need it yet, but will do so during the 1.7.x series. --- configure.ac | 6 +++--- m4/Makefile.am | 3 ++- m4/m4_ax_cxx_compile_stdcxx_17.m4 | 35 +++++++++++++++++++++++++++++++ meson.build | 3 +-- 4 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 m4/m4_ax_cxx_compile_stdcxx_17.m4 diff --git a/configure.ac b/configure.ac index 73b8c423..0485978e 100644 --- a/configure.ac +++ b/configure.ac @@ -42,15 +42,15 @@ AC_PROG_CC_C99 AC_PROG_INSTALL AC_HEADER_STDC -extra_flags="-Wformat-security \ +extra_flags="-Wformat-security \ -Wstack-protector \ -Wstack-protector-all \ -Wno-cast-function-type \ -Wno-bad-function-cast" -AX_CXX_COMPILE_STDCXX_14 +AX_CXX_COMPILE_STDCXX_17 AX_COMPILER_FLAGS_CXXFLAGS([],[],[${extra_cflags}]) -AX_APPEND_COMPILE_FLAGS([-Wno-inline ],[CXXFLAGS]) +AX_APPEND_COMPILE_FLAGS([-Wno-inline],[CXXFLAGS]) AX_VALGRIND_CHECK LT_INIT diff --git a/m4/Makefile.am b/m4/Makefile.am index 27a49eeb..9b3829b0 100644 --- a/m4/Makefile.am +++ b/m4/Makefile.am @@ -1,4 +1,4 @@ -## Copyright (C) 2008-2020 Dirk-Jan C. Binnema +## Copyright (C) 2008-2021 Dirk-Jan C. Binnema ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -36,6 +36,7 @@ EXTRA_DIST= \ ax_compiler_flags_ldflags.m4 \ ax_cxx_compile_stdcxx.m4 \ ax_cxx_compile_stdcxx_14.m4 \ + ax_cxx_compile_stdcxx_17.m4 \ ax_file_escapes.m4 \ ax_is_release.m4 \ ax_lib_readline.m4 \ diff --git a/m4/m4_ax_cxx_compile_stdcxx_17.m4 b/m4/m4_ax_cxx_compile_stdcxx_17.m4 new file mode 100644 index 00000000..a6834171 --- /dev/null +++ b/m4/m4_ax_cxx_compile_stdcxx_17.m4 @@ -0,0 +1,35 @@ +# ============================================================================= +# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_17.html +# ============================================================================= +# +# SYNOPSIS +# +# AX_CXX_COMPILE_STDCXX_17([ext|noext], [mandatory|optional]) +# +# DESCRIPTION +# +# Check for baseline language coverage in the compiler for the C++17 +# standard; if necessary, add switches to CXX and CXXCPP to enable +# support. +# +# This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX +# macro with the version set to C++17. The two optional arguments are +# forwarded literally as the second and third argument respectively. +# Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for +# more information. If you want to use this macro, you also need to +# download the ax_cxx_compile_stdcxx.m4 file. +# +# LICENSE +# +# Copyright (c) 2015 Moritz Klammler +# Copyright (c) 2016 Krzesimir Nowak +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 2 + +AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX]) +AC_DEFUN([AX_CXX_COMPILE_STDCXX_17], [AX_CXX_COMPILE_STDCXX([17], [$1], [$2])]) diff --git a/meson.build b/meson.build index 8d51e94d..3b370397 100644 --- a/meson.build +++ b/meson.build @@ -25,7 +25,7 @@ project('mu', ['c', 'cpp'], 'buildtype=debugoptimized', 'warning_level=1', 'c_std=c11', - 'cpp_std=c++14' + 'cpp_std=c++17' ] ) @@ -51,7 +51,6 @@ extra_flags = [ '-Winit-self', '-Wmissing-include-dirs', '-Wpointer-arith', - #'-Wswitch-enum', '-Wswitch-default', ]