2
0
mirror of https://github.com/boostorg/scope.git synced 2026-01-19 04:42:10 +00:00

Enabled warnings-as-errors for tests.

This commit is contained in:
Andrey Semashev
2024-02-05 00:03:54 +03:00
parent 8861d0297d
commit 127c3aaa4e
3 changed files with 25 additions and 5 deletions

View File

@@ -1,11 +1,11 @@
# Copyright 2023 Peter Dimov
# Copyright 2023 Andrey Semashev
# Copyright 2023-2024 Andrey Semashev
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
include(BoostTest OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST)
if(NOT HAVE_BOOST_TEST)
if (NOT HAVE_BOOST_TEST)
return()
endif()
@@ -19,12 +19,24 @@ set(BOOST_TEST_COMPILE_FEATURES
cxx_uniform_initialization
)
if (WIN32)
set(BOOST_TEST_COMPILE_DEFINITIONS "_CRT_SECURE_NO_WARNINGS" "_CRT_SECURE_NO_DEPRECATE")
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(BOOST_TEST_COMPILE_OPTIONS "-Wall" "-Wextra" "-Werror")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(BOOST_TEST_COMPILE_OPTIONS "/W4" "/WX")
endif()
file(GLOB RUN_TESTS LIST_DIRECTORIES OFF CONFIGURE_DEPENDS run/*.cpp)
foreach(TEST IN LISTS RUN_TESTS)
boost_test(TYPE run SOURCES ${TEST})
endforeach()
unset(BOOST_TEST_COMPILE_OPTIONS)
file(GLOB COMPILE_TESTS LIST_DIRECTORIES OFF CONFIGURE_DEPENDS compile/*.cpp)
foreach(TEST IN LISTS COMPILE_TESTS)

View File

@@ -1,4 +1,4 @@
# Copyright 2023 Andrey Semashev
# Copyright 2023-2024 Andrey Semashev
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
@@ -38,6 +38,9 @@ project
cxx11_unified_initialization_syntax
cxx11_hdr_system_error
]
<target-os>windows:<define>_CRT_SECURE_NO_WARNINGS
<target-os>windows:<define>_CRT_SECURE_NO_DEPRECATE
;
# this rule enumerates through all the sources and invokes
@@ -75,7 +78,12 @@ rule test_all
}
for file in [ glob run/*.cpp ]
{
all_rules += [ run $(file) ] ;
all_rules += [ run $(file) : : :
<warnings>extra
<toolset>msvc:<warnings-as-errors>on
<toolset>clang:<warnings-as-errors>on
<toolset>gcc:<warnings-as-errors>on
] ;
}
#ECHO All rules: $(all_rules) ;

View File

@@ -24,7 +24,7 @@
template< typename Resource >
struct empty_resource_deleter
{
void operator() (Resource const& res) const noexcept
void operator() (Resource const&) const noexcept
{
}
};