diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 50abd86563..0777b97b8b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,31 +8,58 @@ on: jobs: build: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: include: - # GCC 12 - - cc: gcc-12 + # GCC 12 (default standard) + - os: ubuntu-24.04 + cc: gcc-12 cxx: g++-12 f77: gfortran-12 packages: gcc-12 g++-12 gfortran-12 - # GCC 14 - - cc: gcc-14 + # GCC 14 (C++14) + - os: ubuntu-24.04 + cc: gcc-14 cxx: g++-14 f77: gfortran-14 packages: gcc-14 g++-14 gfortran-14 - # Clang 18 - - cc: clang-18 + cxx_std: 14 + # GCC 16 (C++17) + - os: ubuntu-26.04 + cc: gcc-16 + cxx: g++-16 + f77: gfortran-16 + packages: gcc-16 g++-16 gfortran-16 + cxx_std: 17 + # GCC 16 (C++20) + - os: ubuntu-26.04 + cc: gcc-16 + cxx: g++-16 + f77: gfortran-16 + packages: gcc-16 g++-16 gfortran-16 + cxx_std: 20 + # Clang 18 (C++14) + - os: ubuntu-24.04 + cc: clang-18 cxx: clang++-18 f77: gfortran-14 packages: gfortran-14 clang-18 + cxx_std: 14 + # Clang 22 (C++20) + - os: ubuntu-26.04 + cc: clang-22 + cxx: clang++-22 + f77: gfortran-15 + packages: gfortran-15 clang-22 + cxx_std: 20 env: CC: ${{ matrix.cc }} CXX: ${{ matrix.cxx }} FC: ${{ matrix.f77 }} + UCX_TLS: tcp,self,sm steps: - uses: actions/checkout@v4 @@ -45,7 +72,7 @@ jobs: - name: Set up ccache uses: hendrikmuhs/ccache-action@v1 with: - key: ${{ matrix.cc }} + key: ${{ matrix.os }}-${{ matrix.cc }}-cxx${{ matrix.cxx_std }} - name: Configure ccache symlinks run: | @@ -73,7 +100,11 @@ jobs: run: | ccache -s mkdir build && cd build - cmake -DEL_TESTS=ON -DEL_EXAMPLES=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/Install .. || \ + STD_FLAG="" + if [ -n "${{ matrix.cxx_std }}" ]; then + STD_FLAG="-DCMAKE_CXX_STANDARD=${{ matrix.cxx_std }}" + fi + cmake $STD_FLAG -DEL_TESTS=ON -DEL_EXAMPLES=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/Install .. || \ (cat CMakeFiles/CMakeError.log; exit 1) make -j$(nproc) make install diff --git a/CMakeLists.txt b/CMakeLists.txt index cc79bcb9dc..53f03f6bc1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -385,10 +385,33 @@ endif() # -------------- include(detect/Fortran) -# Detect C++11 -# ------------ +# Select the C++ standard +# ----------------------- +# Default to C++14; override with -DCMAKE_CXX_STANDARD=17 (or 20). This must +# precede detect/CXX so that its feature checks compile at the selected +# standard (CMP0067). +if(NOT DEFINED CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 14) +endif() +set(CMAKE_CXX_STANDARD_REQUIRED ON) +# CMAKE_CXX_STANDARD only affects this build, so also append the flag to +# CXX_FLAGS, which is what gets exported to downstream consumers via +# Elemental_COMPILE_FLAGS and ElVars' EL_COMPILE_FLAGS. +# GNU needs extended mode (-std=gnu++XX) for libquadmath literals. +if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") + set(CMAKE_CXX_EXTENSIONS ON) + set(CXX_FLAGS + "${CXX_FLAGS} ${CMAKE_CXX${CMAKE_CXX_STANDARD}_EXTENSION_COMPILE_OPTION}") +else() + set(CMAKE_CXX_EXTENSIONS OFF) + set(CXX_FLAGS + "${CXX_FLAGS} ${CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION}") +endif() +message(STATUS "Building with C++${CMAKE_CXX_STANDARD}") + +# Detect C++ features +# ------------------- include(detect/CXX) -set(CXX_FLAGS "${CXX_FLAGS} ${CXX14_COMPILER_FLAGS}") # Detect MPI # ---------- diff --git a/cmake/detect/CXX.cmake b/cmake/detect/CXX.cmake index 89f157e930..ef8019d996 100644 --- a/cmake/detect/CXX.cmake +++ b/cmake/detect/CXX.cmake @@ -6,12 +6,10 @@ # which can be found in the LICENSE file in the root directory, or at # http://opensource.org/licenses/BSD-2-Clause # -include(FindCXXFeatures) include(CheckCXXSourceCompiles) -message(STATUS "CXX11_COMPILER_FLAGS=${CXX11_COMPILER_FLAGS}") -message(STATUS "CXX14_COMPILER_FLAGS=${CXX14_COMPILER_FLAGS}") -set(CMAKE_REQUIRED_FLAGS ${CXX14_COMPILER_FLAGS}) +# NOTE: the checks below compile at ${CMAKE_CXX_STANDARD}, which CMake +# propagates into try_compile() via CMP0067. # TODO(poulson): Test for C++14 features such as [[deprecated]] @@ -131,5 +129,4 @@ set(PRETTY_FUNCTION_CODE }") check_cxx_source_compiles("${PRETTY_FUNCTION_CODE}" EL_HAVE_PRETTY_FUNCTION) -unset(CMAKE_REQUIRED_FLAGS) unset(CMAKE_REQUIRED_DEFINITIONS) diff --git a/cmake/external_projects/ElMath/BLIS_LAPACK.cmake b/cmake/external_projects/ElMath/BLIS_LAPACK.cmake index db9f375232..a503a9edbb 100644 --- a/cmake/external_projects/ElMath/BLIS_LAPACK.cmake +++ b/cmake/external_projects/ElMath/BLIS_LAPACK.cmake @@ -103,6 +103,7 @@ elseif(EL_HAVE_F90_INTERFACE AND TMP_DIR ${LAPACK_BINARY_DIR}/tmp UPDATE_COMMAND "" CMAKE_ARGS + -D CMAKE_POLICY_VERSION_MINIMUM=3.5 -D CMAKE_C_COMPILER=${CMAKE_C_COMPILER} -D CMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} -D CMAKE_C_FLAGS=${CMAKE_C_FLAGS} diff --git a/cmake/external_projects/ElMath/METIS.cmake b/cmake/external_projects/ElMath/METIS.cmake index aee5477275..9eb5510deb 100644 --- a/cmake/external_projects/ElMath/METIS.cmake +++ b/cmake/external_projects/ElMath/METIS.cmake @@ -49,6 +49,7 @@ elseif(NOT EL_PREVENT_METIS_DOWNLOAD) TMP_DIR ${METIS_BINARY_DIR}/tmp UPDATE_COMMAND "" CMAKE_ARGS + -D CMAKE_POLICY_VERSION_MINIMUM=3.5 -D PCRE=${METIS_PCRE} -D GKREGEX=${METIS_GKREGEX} -D CMAKE_C_COMPILER=${CMAKE_C_COMPILER} diff --git a/cmake/external_projects/ElMath/ParMETIS.cmake b/cmake/external_projects/ElMath/ParMETIS.cmake index a493b2d335..7fa3c00bc1 100644 --- a/cmake/external_projects/ElMath/ParMETIS.cmake +++ b/cmake/external_projects/ElMath/ParMETIS.cmake @@ -74,6 +74,7 @@ elseif(NOT EL_PREVENT_PARMETIS_DOWNLOAD) UPDATE_COMMAND "" LIST_SEPARATOR ^^ CMAKE_ARGS + -D CMAKE_POLICY_VERSION_MINIMUM=3.5 -D PCRE=${METIS_PCRE} -D GKREGEX=${METIS_GKREGEX} -D CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} diff --git a/cmake/external_projects/ElMath/ScaLAPACK.cmake b/cmake/external_projects/ElMath/ScaLAPACK.cmake index 22e7114ec1..8868e8e618 100644 --- a/cmake/external_projects/ElMath/ScaLAPACK.cmake +++ b/cmake/external_projects/ElMath/ScaLAPACK.cmake @@ -279,6 +279,7 @@ elseif(EL_HAVE_F90_INTERFACE AND EL_HAVE_MPI_FORTRAN AND UPDATE_COMMAND "" LIST_SEPARATOR ^^ CMAKE_ARGS + -D CMAKE_POLICY_VERSION_MINIMUM=3.5 -D CMAKE_C_COMPILER=${CMAKE_C_COMPILER} -D CMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER} -D CMAKE_C_FLAGS=${CMAKE_C_FLAGS} diff --git a/cmake/modules/FindCXXFeatures.cmake b/cmake/modules/FindCXXFeatures.cmake deleted file mode 100644 index 69418bdddb..0000000000 --- a/cmake/modules/FindCXXFeatures.cmake +++ /dev/null @@ -1,206 +0,0 @@ -#.rst: -# FindCXXFeatures -# --------------- -# -# Check which features of the C++ standard the compiler supports -# -# When found it will set the following variables:: -# -# CXX11_COMPILER_FLAGS - the compiler flags needed to get C++11 features -# CXX14_COMPILER_FLAGS - the compiler flags needed to get C++14 features -# -# CXXFeatures_auto_FOUND - auto keyword -# CXXFeatures_class_override_final_FOUND - override and final keywords for classes and methods -# CXXFeatures_constexpr_FOUND - constexpr keyword -# CXXFeatures_cstdint_header_FOUND - cstdint header -# CXXFeatures_decltype_FOUND - decltype keyword -# CXXFeatures_defaulted_functions_FOUND - default keyword for functions -# CXXFeatures_delegating_constructors_FOUND - delegating constructors -# CXXFeatures_deleted_functions_FOUND - delete keyword for functions -# CXXFeatures_func_identifier_FOUND - __func__ preprocessor constant -# CXXFeatures_initializer_list_FOUND - initializer list -# CXXFeatures_lambda_FOUND - lambdas -# CXXFeatures_long_long_FOUND - long long signed & unsigned types -# CXXFeatures_nullptr_FOUND - nullptr -# CXXFeatures_rvalue_references_FOUND - rvalue references -# CXXFeatures_sizeof_member_FOUND - sizeof() non-static members -# CXXFeatures_static_assert_FOUND - static_assert() -# CXXFeatures_variadic_templates_FOUND - variadic templates - -#============================================================================= -# Copyright 2011-2013 Rolf Eike Beer -# Copyright 2012 Andreas Weis -# Copyright 2013 Jan Kundrát -# Copyright 2016 Jack Poulson -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# - Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# - Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# - Neither the name of the owner nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -#============================================================================= - -if(NOT CMAKE_CXX_COMPILER_LOADED) - message(FATAL_ERROR - "CXXFeatures modules only works if language CXX is enabled") -endif() - -# Check for needed compiler flags -include(CheckCXXCompilerFlag) - -function(test_11_flags FLAG NAME) - check_cxx_compiler_flag("${FLAG}" _HAS_${NAME}_FLAG) - if(_HAS_${NAME}_FLAG) - set(CXX11_COMPILER_FLAGS "${FLAG}" PARENT_SCOPE) - endif() -endfunction() - -function(test_14_flags FLAG NAME) - check_cxx_compiler_flag("${FLAG}" _HAS_${NAME}_FLAG) - if(_HAS_${NAME}_FLAG) - set(CXX14_COMPILER_FLAGS "${FLAG}" PARENT_SCOPE) - endif() -endfunction() - -if(CMAKE_CXX_COMPILER_ID STREQUAL "XL") - test_11_flags("-qlanglvl=extended0x" CXX11) - test_14_flags("-qlanglvl=extended1y" CXX14) -elseif (CMAKE_CXX_COMPILER_ID MATCHES "(Borland|Watcom)") - # No C++11 or C++14 flag for those compilers, but check_cxx_compiler_flag() - # can't detect because they either will not always complain (Borland) - # or will hang (Watcom). -elseif (CMAKE_CXX_COMPILER_ID MATCHES "Cray") - test_11_flags("-h std=c++11" CXX11) - test_14_flags("-h std=c++14" CXX14) - if(NOT CXX14_COMPILER_FLAGS) - message(FATAL_ERROR "Could not use -h std=c++14 with Cray C/C++") - endif() -elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel" AND WIN32) - # The Intel compiler on Windows may use these flags. - test_11_flags("/Qstd=c++11" CXX11) - test_14_flags("/Qstd=c++14" CXX14) -elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU") - # GCC needs -std=gnu++11 or -std=gnu++14 for the libquadmath literals; - # Intel does not - test_11_flags("-std=gnu++11" CXX11) - test_14_flags("-std=gnu++14" CXX14) - if(NOT CXX14_COMPILER_FLAGS) - message(FATAL_ERROR "Could not use -std=gnu++14 with GCC") - endif() -else() - test_11_flags("-std=c++11" CXX11) - test_14_flags("-std=c++14" CXX14) - if(NOT CXX14_COMPILER_FLAGS) - message(FATAL_ERROR "Could not use -std=c++14 with unknown compiler") - endif() -endif() - -# TODO(poulson): Extend to test C++14 features such as [[deprecated]] -function(cxx_check_feature FEATURE_NAME) - set(RESULT_VAR "CXXFeatures_${FEATURE_NAME}_FOUND") - if(DEFINED ${RESULT_VAR}) - return() - endif() - - set(_bindir "${CMAKE_CURRENT_BINARY_DIR}/cxx_${FEATURE_NAME}") - - set(_SRCFILE_BASE ${CMAKE_CURRENT_LIST_DIR}/FindCXXFeatures/cxx11-${FEATURE_NAME}) - set(_LOG_NAME "\"${FEATURE_NAME}\"") - message(STATUS "Checking C++ support for ${_LOG_NAME}") - - set(_SRCFILE "${_SRCFILE_BASE}.cxx") - set(_SRCFILE_FAIL_COMPILE "${_SRCFILE_BASE}_fail_compile.cxx") - - try_compile(${RESULT_VAR} "${_bindir}" "${_SRCFILE}" - COMPILE_DEFINITIONS "${CXX11_COMPILER_FLAGS}" - OUTPUT_VARIABLE _SRCFILE_COMPILE_PASS_OUTPUT) - - if(${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL_COMPILE}) - try_compile(_TMP_RESULT "${_bindir}_fail_compile" "${_SRCFILE_FAIL_COMPILE}" - COMPILE_DEFINITIONS "${CXX11_COMPILER_FLAGS}" - OUTPUT_VARIABLE _SRCFILE_COMPILE_FAIL_OUTPUT) - if(_TMP_RESULT) - set(${RESULT_VAR} FALSE) - else() - set(${RESULT_VAR} TRUE) - endif() - endif() - - if(${RESULT_VAR}) - message(STATUS "Checking C++ support for ${_LOG_NAME}: works") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Checking C++ support for ${_LOG_NAME} passed.\n" - "Compile pass output:\n${_SRCFILE_COMPILE_PASS_OUTPUT}\n" - "Compile fail output:\n${_SRCFILE_COMPILE_FAIL_OUTPUT}\n") - else() - message(STATUS "Checking C++ support for ${_LOG_NAME}: not supported") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Checking C++ support for ${_LOG_NAME} failed.\n" - "Compile pass output:\n${_SRCFILE_COMPILE_PASS_OUTPUT}\n" - "Compile fail output:\n${_SRCFILE_COMPILE_FAIL_OUTPUT}\n") - endif() - set(${RESULT_VAR} "${${RESULT_VAR}}" CACHE INTERNAL - "C++ support for ${_LOG_NAME}") -endfunction(cxx_check_feature) - -set(_CXX_ALL_FEATURES - auto - class_override_final - constexpr - cstdint_header - decltype - defaulted_functions - delegating_constructors - deleted_functions - func_identifier - initializer_list - lambda - long_long - nullptr - rvalue_references - sizeof_member - static_assert - variadic_templates -) - -if (CXXFeatures_FIND_COMPONENTS) - foreach (_cxx_feature IN LISTS CXXFeatures_FIND_COMPONENTS) - list(FIND _CXX_ALL_FEATURES "${_cxx_feature}" _feature_index) - if (_feature_index EQUAL -1) - message(FATAL_ERROR "Unknown component: '${_cxx_feature}'") - endif () - endforeach () - unset(_feature_index) -else () - set(CXXFEATURES_FIND_COMPONENTS ${_CXX_ALL_FEATURES}) -endif () - -foreach (_cxx_feature IN LISTS CXXFEATURES_FIND_COMPONENTS) - cxx_check_feature(${_cxx_feature} ${FEATURE_NAME}) -endforeach (_cxx_feature) - -include(FindPackageHandleStandardArgs) -set(DUMMY_VAR TRUE) -find_package_handle_standard_args(CXXFeatures REQUIRED_VARS DUMMY_VAR HANDLE_COMPONENTS) -unset(DUMMY_VAR) -unset(_CXX_ALL_FEATURES) diff --git a/cmake/modules/FindCXXFeatures/cxx11-auto.cxx b/cmake/modules/FindCXXFeatures/cxx11-auto.cxx deleted file mode 100644 index 19491e69ef..0000000000 --- a/cmake/modules/FindCXXFeatures/cxx11-auto.cxx +++ /dev/null @@ -1,11 +0,0 @@ -int main() -{ - auto i = 5; - auto f = 3.14159f; - auto d = 3.14159; - bool ret = ( - (sizeof(f) < sizeof(d)) && - (sizeof(i) == sizeof(int)) - ); - return ret ? 0 : 1; -} diff --git a/cmake/modules/FindCXXFeatures/cxx11-auto_fail_compile.cxx b/cmake/modules/FindCXXFeatures/cxx11-auto_fail_compile.cxx deleted file mode 100644 index ac152d518d..0000000000 --- a/cmake/modules/FindCXXFeatures/cxx11-auto_fail_compile.cxx +++ /dev/null @@ -1,7 +0,0 @@ -int main(void) -{ - // must fail because there is no initializer - auto i; - - return 0; -} diff --git a/cmake/modules/FindCXXFeatures/cxx11-class_override_final.cxx b/cmake/modules/FindCXXFeatures/cxx11-class_override_final.cxx deleted file mode 100644 index 5e938ff30e..0000000000 --- a/cmake/modules/FindCXXFeatures/cxx11-class_override_final.cxx +++ /dev/null @@ -1,21 +0,0 @@ -class base { -public: - virtual int foo(int a) - { return 4 + a; } - virtual int bar(int a) final - { return a - 2; } -}; - -class sub final : public base { -public: - virtual int foo(int a) override - { return 8 + 2 * a; }; -}; - -int main(void) -{ - base b; - sub s; - - return (b.foo(2) * 2 == s.foo(2)) ? 0 : 1; -} diff --git a/cmake/modules/FindCXXFeatures/cxx11-class_override_final_fail_compile.cxx b/cmake/modules/FindCXXFeatures/cxx11-class_override_final_fail_compile.cxx deleted file mode 100644 index bc00b278ed..0000000000 --- a/cmake/modules/FindCXXFeatures/cxx11-class_override_final_fail_compile.cxx +++ /dev/null @@ -1,25 +0,0 @@ -class base { -public: - virtual int foo(int a) - { return 4 + a; } - virtual int bar(int a) final - { return a - 2; } -}; - -class sub final : public base { -public: - virtual int foo(int a) override - { return 8 + 2 * a; }; - virtual int bar(int a) - { return a; } -}; - -class impossible : public sub { }; - -int main(void) -{ - base b; - sub s; - - return 1; -} diff --git a/cmake/modules/FindCXXFeatures/cxx11-constexpr.cxx b/cmake/modules/FindCXXFeatures/cxx11-constexpr.cxx deleted file mode 100644 index ba66d655c1..0000000000 --- a/cmake/modules/FindCXXFeatures/cxx11-constexpr.cxx +++ /dev/null @@ -1,19 +0,0 @@ -constexpr int square(int x) -{ - return x * x; -} - -constexpr int the_answer() -{ - return 42; -} - -int main() -{ - int test_arr[square(3)]; - bool ret = ( - (square(the_answer()) == 1764) && - (sizeof(test_arr)/sizeof(test_arr[0]) == 9) - ); - return ret ? 0 : 1; -} diff --git a/cmake/modules/FindCXXFeatures/cxx11-cstdint_header.cxx b/cmake/modules/FindCXXFeatures/cxx11-cstdint_header.cxx deleted file mode 100644 index d02e93c350..0000000000 --- a/cmake/modules/FindCXXFeatures/cxx11-cstdint_header.cxx +++ /dev/null @@ -1,11 +0,0 @@ -#include - -int main() -{ - bool test = - (sizeof(int8_t) == 1) && - (sizeof(int16_t) == 2) && - (sizeof(int32_t) == 4) && - (sizeof(int64_t) == 8); - return test ? 0 : 1; -} diff --git a/cmake/modules/FindCXXFeatures/cxx11-decltype.cxx b/cmake/modules/FindCXXFeatures/cxx11-decltype.cxx deleted file mode 100644 index ce33089c11..0000000000 --- a/cmake/modules/FindCXXFeatures/cxx11-decltype.cxx +++ /dev/null @@ -1,10 +0,0 @@ -bool check_size(int i) -{ - return sizeof(int) == sizeof(decltype(i)); -} - -int main() -{ - bool ret = check_size(42); - return ret ? 0 : 1; -} diff --git a/cmake/modules/FindCXXFeatures/cxx11-defaulted_functions.cxx b/cmake/modules/FindCXXFeatures/cxx11-defaulted_functions.cxx deleted file mode 100644 index c7ca5b8944..0000000000 --- a/cmake/modules/FindCXXFeatures/cxx11-defaulted_functions.cxx +++ /dev/null @@ -1,13 +0,0 @@ -struct A { - int foo; - - A(int foo): foo(foo) {} - A() = default; -}; - -int main(void) -{ - A bar; - A baz(10); - return 0; -} diff --git a/cmake/modules/FindCXXFeatures/cxx11-delegating_constructors.cxx b/cmake/modules/FindCXXFeatures/cxx11-delegating_constructors.cxx deleted file mode 100644 index e2f6abdb83..0000000000 --- a/cmake/modules/FindCXXFeatures/cxx11-delegating_constructors.cxx +++ /dev/null @@ -1,25 +0,0 @@ -class del { -public: - del(); - del(int k); - - int m_k; -}; - -del::del() - : del(42) -{ -} - -del::del(int k) - : m_k(k) -{ -} - -int main() -{ - del q(41); - del a; - - return a.m_k - q.m_k - 1; -} diff --git a/cmake/modules/FindCXXFeatures/cxx11-deleted_functions.cxx b/cmake/modules/FindCXXFeatures/cxx11-deleted_functions.cxx deleted file mode 100644 index c1ec2b994d..0000000000 --- a/cmake/modules/FindCXXFeatures/cxx11-deleted_functions.cxx +++ /dev/null @@ -1,10 +0,0 @@ -struct A { - A() = delete; - A(int) {} -}; - -int main(void) -{ - A bar(10); - return 0; -} diff --git a/cmake/modules/FindCXXFeatures/cxx11-deleted_functions_fail_compile.cxx b/cmake/modules/FindCXXFeatures/cxx11-deleted_functions_fail_compile.cxx deleted file mode 100644 index 216f074704..0000000000 --- a/cmake/modules/FindCXXFeatures/cxx11-deleted_functions_fail_compile.cxx +++ /dev/null @@ -1,18 +0,0 @@ -struct A { - A() = delete; - ~A() = delete; - int m; - int ret(); -}; - -int A::ret() -{ - return 2 * m; -} - -int main(void) -{ - A bar; - bar.m = 1; - return bar.ret(); -} diff --git a/cmake/modules/FindCXXFeatures/cxx11-func_identifier.cxx b/cmake/modules/FindCXXFeatures/cxx11-func_identifier.cxx deleted file mode 100644 index e29273b639..0000000000 --- a/cmake/modules/FindCXXFeatures/cxx11-func_identifier.cxx +++ /dev/null @@ -1,10 +0,0 @@ -#include - -int main(void) -{ - if (!__func__) - return 1; - if (!(*__func__)) - return 1; - return strstr(__func__, "main") != 0; -} diff --git a/cmake/modules/FindCXXFeatures/cxx11-initializer_list.cxx b/cmake/modules/FindCXXFeatures/cxx11-initializer_list.cxx deleted file mode 100644 index a23e962fd4..0000000000 --- a/cmake/modules/FindCXXFeatures/cxx11-initializer_list.cxx +++ /dev/null @@ -1,28 +0,0 @@ -#include -#include - -class seq { -public: - seq(std::initializer_list list); - - int length() const; -private: - std::vector m_v; -}; - -seq::seq(std::initializer_list list) - : m_v(list) -{ -} - -int seq::length() const -{ - return m_v.size(); -} - -int main(void) -{ - seq a = {18, 20, 2, 0, 4, 7}; - - return (a.length() == 6) ? 0 : 1; -} diff --git a/cmake/modules/FindCXXFeatures/cxx11-lambda.cxx b/cmake/modules/FindCXXFeatures/cxx11-lambda.cxx deleted file mode 100644 index a302b2f3ab..0000000000 --- a/cmake/modules/FindCXXFeatures/cxx11-lambda.cxx +++ /dev/null @@ -1,5 +0,0 @@ -int main() -{ - int ret = 0; - return ([&ret]() -> int { return ret; })(); -} diff --git a/cmake/modules/FindCXXFeatures/cxx11-long_long.cxx b/cmake/modules/FindCXXFeatures/cxx11-long_long.cxx deleted file mode 100644 index 3fa59fbc90..0000000000 --- a/cmake/modules/FindCXXFeatures/cxx11-long_long.cxx +++ /dev/null @@ -1,7 +0,0 @@ -int main(void) -{ - long long l; - unsigned long long ul; - - return ((sizeof(l) >= 8) && (sizeof(ul) >= 8)) ? 0 : 1; -} diff --git a/cmake/modules/FindCXXFeatures/cxx11-nullptr.cxx b/cmake/modules/FindCXXFeatures/cxx11-nullptr.cxx deleted file mode 100644 index 317f4710f6..0000000000 --- a/cmake/modules/FindCXXFeatures/cxx11-nullptr.cxx +++ /dev/null @@ -1,19 +0,0 @@ -int func(int) -{ - return 1; -} - -int func(void *) -{ - return 0; -} - -int main(void) -{ - void *v = nullptr; - - if (v) - return 1; - - return func(nullptr); -} diff --git a/cmake/modules/FindCXXFeatures/cxx11-nullptr_fail_compile.cxx b/cmake/modules/FindCXXFeatures/cxx11-nullptr_fail_compile.cxx deleted file mode 100644 index adfd24f657..0000000000 --- a/cmake/modules/FindCXXFeatures/cxx11-nullptr_fail_compile.cxx +++ /dev/null @@ -1,6 +0,0 @@ -int main(void) -{ - int i = nullptr; - - return 1; -} diff --git a/cmake/modules/FindCXXFeatures/cxx11-rvalue_references.cxx b/cmake/modules/FindCXXFeatures/cxx11-rvalue_references.cxx deleted file mode 100644 index e6e7e5a98a..0000000000 --- a/cmake/modules/FindCXXFeatures/cxx11-rvalue_references.cxx +++ /dev/null @@ -1,57 +0,0 @@ -#include - -class rvmove { -public: - void *ptr; - char *array; - - rvmove() - : ptr(0), - array(new char[10]) - { - ptr = this; - } - - rvmove(rvmove &&other) - : ptr(other.ptr), - array(other.array) - { - other.array = 0; - other.ptr = 0; - } - - ~rvmove() - { - assert(((ptr != 0) && (array != 0)) || ((ptr == 0) && (array == 0))); - delete[] array; - } - - rvmove &operator=(rvmove &&other) - { - delete[] array; - ptr = other.ptr; - array = other.array; - other.array = 0; - other.ptr = 0; - return *this; - } - - static rvmove create() - { - return rvmove(); - } -private: - rvmove(const rvmove &); - rvmove &operator=(const rvmove &); -}; - -int main() -{ - rvmove mine; - if (mine.ptr != &mine) - return 1; - mine = rvmove::create(); - if (mine.ptr == &mine) - return 1; - return 0; -} diff --git a/cmake/modules/FindCXXFeatures/cxx11-sizeof_member.cxx b/cmake/modules/FindCXXFeatures/cxx11-sizeof_member.cxx deleted file mode 100644 index 8aebc554f4..0000000000 --- a/cmake/modules/FindCXXFeatures/cxx11-sizeof_member.cxx +++ /dev/null @@ -1,14 +0,0 @@ -struct foo { - char bar; - int baz; -}; - -int main(void) -{ - bool ret = ( - (sizeof(foo::bar) == 1) && - (sizeof(foo::baz) >= sizeof(foo::bar)) && - (sizeof(foo) >= sizeof(foo::bar) + sizeof(foo::baz)) - ); - return ret ? 0 : 1; -} diff --git a/cmake/modules/FindCXXFeatures/cxx11-static_assert.cxx b/cmake/modules/FindCXXFeatures/cxx11-static_assert.cxx deleted file mode 100644 index 5976cfce52..0000000000 --- a/cmake/modules/FindCXXFeatures/cxx11-static_assert.cxx +++ /dev/null @@ -1,5 +0,0 @@ -int main(void) -{ - static_assert(0 < 1, "your ordering of integers is screwed"); - return 0; -} diff --git a/cmake/modules/FindCXXFeatures/cxx11-static_assert_fail_compile.cxx b/cmake/modules/FindCXXFeatures/cxx11-static_assert_fail_compile.cxx deleted file mode 100644 index 484abc0a87..0000000000 --- a/cmake/modules/FindCXXFeatures/cxx11-static_assert_fail_compile.cxx +++ /dev/null @@ -1,5 +0,0 @@ -int main(void) -{ - static_assert(1 < 0, "your ordering of integers is screwed"); - return 0; -} diff --git a/cmake/modules/FindCXXFeatures/cxx11-variadic_templates.cxx b/cmake/modules/FindCXXFeatures/cxx11-variadic_templates.cxx deleted file mode 100644 index e81ca9db0c..0000000000 --- a/cmake/modules/FindCXXFeatures/cxx11-variadic_templates.cxx +++ /dev/null @@ -1,23 +0,0 @@ -int Accumulate() -{ - return 0; -} - -template -int Accumulate(T v, Ts... vs) -{ - return v + Accumulate(vs...); -} - -template -int CountElements() -{ - return sizeof...(Is); -} - -int main() -{ - int acc = Accumulate(1, 2, 3, 4, -5); - int count = CountElements<1,2,3,4,5>(); - return ((acc == 5) && (count == 5)) ? 0 : 1; -} diff --git a/cmake/modules/language_support_v2.cmake b/cmake/modules/language_support_v2.cmake index d8218d5cd3..fb0e60e35e 100644 --- a/cmake/modules/language_support_v2.cmake +++ b/cmake/modules/language_support_v2.cmake @@ -22,7 +22,7 @@ function(workaround_9220 language language_works) set(text "project(test NONE) -cmake_minimum_required(VERSION 2.6.0) +cmake_minimum_required(VERSION 3.5) set(CMAKE_${language}_COMPILER ${CMAKE_${language}_COMPILER}) enable_language(${language} OPTIONAL) " diff --git a/compiler_bugs/MSVC/constexpr/CMakeLists.txt b/compiler_bugs/MSVC/constexpr/CMakeLists.txt index 55fe3cd4e1..482db4c098 100644 --- a/compiler_bugs/MSVC/constexpr/CMakeLists.txt +++ b/compiler_bugs/MSVC/constexpr/CMakeLists.txt @@ -6,16 +6,11 @@ # which can be found in the LICENSE file in the root directory, or at # http://opensource.org/licenses/BSD-2-Clause # -cmake_minimum_required(VERSION 2.8.12) -project(ConstExprBug) +cmake_minimum_required(VERSION 3.5) +project(ConstExprBug CXX) -# Ensure that we can find the FindCXXFeatures.cmake module to determine the -# compiler flags needed to enable C++11 -list(APPEND CMAKE_MODULE_PATH - "${CMAKE_CURRENT_SOURCE_DIR}/../../../external/cmake/") -include(FindCXXFeatures) -message(STATUS "CXX11_COMPILER_FLAGS=${CXX11_COMPILER_FLAGS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX11_COMPILER_FLAGS}") +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) option(TEST_CONSTEXPR "Test the MSVC bug via the use of a constexpr?" ON) if(TEST_CONSTEXPR) diff --git a/debian/copyright b/debian/copyright index d40430f273..085d9b3c02 100644 --- a/debian/copyright +++ b/debian/copyright @@ -40,13 +40,6 @@ Copyright: 2000-2015 Kitware, Inc. 2015 Jack Poulson License: BSD-3-clause -Files: cmake/modules/FindCXXFeatures.cmake - cmake/modules/FindCXXFeatures/* -Copyright: 2011-2013 Rolf Eike Beer - 2012 Andreas Weis - 2013 Jan Kundrát -License: BSD-3-clause - Files: cmake/modules/FindMETIS.cmake cmake/modules/FindParMETIS.cmake Copyright: 2010-2012 Garth N. Wells, Anders Logg, Johannes Ring