diff --git a/CMakeLists.txt b/CMakeLists.txt index 25d7f26..16d72b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,9 @@ cmake_minimum_required(VERSION 3.5) +# Disable defaulting the warning flags for MSVC +# this isn't bad, it's just inconvenient +cmake_policy(SET CMP0092 NEW) + if (PROJECT_NAME) set(IS_SUBPROJECT TRUE) endif () @@ -69,6 +73,9 @@ set(header_files "include/bpstd/variant.hpp" ) +include(SourceGroup) +source_group_tree("include" PREFIX "Header Files" FILES ${header_files}) + add_library(${PROJECT_NAME} INTERFACE) add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) @@ -93,7 +100,7 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" ) add_compile_options(-Wall -Werror -Wextra -pedantic -pedantic-errors) elseif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" ) - # TODO: Determine MSVC necessary compiler flags + add_compile_options(/W4 /WX) endif () # Header Self-Containment Tests diff --git a/cmake/SourceGroup.cmake b/cmake/SourceGroup.cmake new file mode 100644 index 0000000..4a489eb --- /dev/null +++ b/cmake/SourceGroup.cmake @@ -0,0 +1,109 @@ +# Copyright (c) Matthew Rodusek +# Distributed under the OSI-approved MIT License. See accompanying +# file LICENSE.txt or https://opensource.org/licenses/MIT for details. + +#.rst: +# SourceGroup +# ----------- +# +# This module defines additional source_group functionality that is +# compatible with older versions of CMake + +if (CMAKE_VERSION VERSION_LESS 3.5.0) + include(CMakeParseArguments) +endif () + +#.rst +# .. command:: source_group_tree +# +# This command defines a grouping for source files in IDE project +# generation. +# +# This function is not supported in CMake 3.7 or before, and is +# added here for compatibility. +# +# If this is executed in CMake 3.8 or later, it defaults to +# source_group(TREE ...) instead to preserve functionality. +# +# .. code-block:: cmake +# +# source_group_tree( [PREFIX ] [FILES ]) +# +# Creates groups recursively based on the specified ```` +# along with their relative paths to the given source files. +# +# The options are: +# +# ``PREFIX`` +# Source group and files located directly in path, will +# be placed in source groups. +# +# ``FILES`` +# Any source file specified explicitly will be placed in group +# made up of the relative path between ```` and the file. +# Relative paths are interpreted with respect to the +# current source directory. +# It is an error if any ```` is not prefixed by ```` +function(source_group_tree root) + + cmake_parse_arguments( + SOURCE_GROUP_TREE # Prefix + "" # Option args + PREFIX # Single args + FILES # Multi args + ${ARGN} + ) + + if (SOURCE_GROUP_TREE_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "source_group: Unknown arguments specified: ${SOURCE_GROUP_TREE_UNPARSED_ARGUMENTS}") + endif () + + if (IS_ABSOLUTE "${root}") + set(root_path "${root}") + else () + set(root_path "${CMAKE_CURRENT_SOURCE_DIR}/${root}") + get_filename_component(root_path "${root_path}" ABSOLUTE) + endif () + + # source_group(TREE ...) introduced in 3.8 + if (CMAKE_VERSION VERSION_GREATER 3.8) + set(args) + if (SOURCE_GROUP_TREE_PREFIX) + set(args PREFIX "${SOURCE_GROUP_TREE_PREFIX}" ${args}) + endif () + if (SOURCE_GROUP_TREE_FILES) + set(args FILES "${SOURCE_GROUP_TREE_FILES}" ${args}) + endif () + source_group( TREE "${root_path}" ${args} ) + else () + foreach (file IN LISTS SOURCE_GROUP_TREE_FILES) + if (SOURCE_GROUP_TREE_PREFIX) + set(group "${SOURCE_GROUP_TREE_PREFIX}") + else () + set(group) + endif () + + if (IS_ABSOLUTE "${file}") + set(absolute_file "${file}") + else () + # All relative paths should be relative to the source directory + set(absolute_file "${CMAKE_CURRENT_SOURCE_DIR}/${file}") + get_filename_component(absolute_file "${absolute_file}" ABSOLUTE) + endif () + + file(RELATIVE_PATH group_suffix "${root_path}" "${absolute_file}") + if (group_suffix MATCHES "(\\.\\.).*") + message(FATAL_ERROR "source_group ROOT: ${root_path} is not a prefix of file ${absolute_file}") + endif () + get_filename_component(group_suffix "${group_suffix}" DIRECTORY) + string(REPLACE "/" "\\" group_suffix "${group_suffix}") + + if (group AND group_suffix) + set(group "${SOURCE_GROUP_TREE_PREFIX}\\${group_suffix}") + elseif (group_suffix) + set(group "${group_suffix}") + endif () + source_group("${group}" FILES "${absolute_file}") + endforeach () + endif () +endfunction() diff --git a/include/bpstd/any.hpp b/include/bpstd/any.hpp index d3fe7c4..8c2a49b 100644 --- a/include/bpstd/any.hpp +++ b/include/bpstd/any.hpp @@ -43,6 +43,8 @@ #include // placement-new #include // assert +BPSTD_COMPILER_DIAGNOSTIC_PREAMBLE + namespace bpstd { class any; @@ -928,4 +930,6 @@ const T* bpstd::any_cast(const any* operand) return static_cast(p); } +BPSTD_COMPILER_DIAGNOSTIC_POSTAMBLE + #endif /* BPSTD_ANY_HPP */ diff --git a/include/bpstd/chrono.hpp b/include/bpstd/chrono.hpp index 8782d6a..bdd9b6a 100644 --- a/include/bpstd/chrono.hpp +++ b/include/bpstd/chrono.hpp @@ -35,6 +35,8 @@ #include // std::chrono::duration, std::chrono::system_clock, etc #include // std::int32_t +BPSTD_COMPILER_DIAGNOSTIC_PREAMBLE + namespace bpstd { namespace chrono { @@ -182,5 +184,6 @@ bpstd::chrono::duration return chrono::duration{x}; } +BPSTD_COMPILER_DIAGNOSTIC_POSTAMBLE #endif /* BPSTD_CHRONO_HPP */ diff --git a/include/bpstd/complex.hpp b/include/bpstd/complex.hpp index 0d6037c..271579b 100644 --- a/include/bpstd/complex.hpp +++ b/include/bpstd/complex.hpp @@ -34,6 +34,8 @@ #include +BPSTD_COMPILER_DIAGNOSTIC_PREAMBLE + namespace bpstd { //============================================================================ @@ -115,5 +117,6 @@ bpstd::complex return complex{0, static_cast(i)}; } +BPSTD_COMPILER_DIAGNOSTIC_POSTAMBLE #endif /* BPSTD_COMPLEX_HPP */ diff --git a/include/bpstd/cstddef.hpp b/include/bpstd/cstddef.hpp index b59c183..4993e8c 100644 --- a/include/bpstd/cstddef.hpp +++ b/include/bpstd/cstddef.hpp @@ -40,6 +40,10 @@ #include // std::is_integral #include // __cpp_lib_byte, and to proxy API +BPSTD_COMPILER_DIAGNOSTIC_PREAMBLE + +// The below implementation is based on GSL's implementation of 'gsl::byte' + // VS2017 15.8 added support for the __cpp_lib_byte definition // To do: drop _HAS_STD_BYTE when support for pre 15.8 expires #if defined(_MSC_VER) @@ -249,4 +253,6 @@ Integer bpstd::to_integer(byte b) return static_cast(b); } +BPSTD_COMPILER_DIAGNOSTIC_POSTAMBLE + #endif /* BPSTD_CSTDDEF_HPP */ diff --git a/include/bpstd/detail/config.hpp b/include/bpstd/detail/config.hpp index 70b6b82..0fdea82 100644 --- a/include/bpstd/detail/config.hpp +++ b/include/bpstd/detail/config.hpp @@ -82,4 +82,20 @@ # define BPSTD_INLINE_VISIBILITY #endif +#if defined(_MSC_VER) +# define BPSTD_COMPILER_DIAGNOSTIC_PREAMBLE \ + __pragma(warning(push)) \ + __pragma(warning(disable:4714)) \ + __pragma(warning(disable:4100)) +#else +# define BPSTD_COMPILER_DIAGNOSTIC_PREAMBLE +#endif + +#if defined(_MSC_VER) +# define BPSTD_COMPILER_DIAGNOSTIC_POSTAMBLE \ + __pragma(warning(pop)) +#else +# define BPSTD_COMPILER_DIAGNOSTIC_POSTAMBLE +#endif + #endif /* BPSTD_DETAIL_CONFIG_HPP */ diff --git a/include/bpstd/detail/invoke.hpp b/include/bpstd/detail/invoke.hpp index 41b9a34..4e02c66 100644 --- a/include/bpstd/detail/invoke.hpp +++ b/include/bpstd/detail/invoke.hpp @@ -41,6 +41,8 @@ #include +BPSTD_COMPILER_DIAGNOSTIC_PREAMBLE + namespace bpstd { namespace detail { @@ -181,4 +183,6 @@ namespace bpstd { } // namespace detail } // namespace bpstd +BPSTD_COMPILER_DIAGNOSTIC_POSTAMBLE + #endif /* BPSTD_DETAIL_INVOKE_HPP */ diff --git a/include/bpstd/detail/move.hpp b/include/bpstd/detail/move.hpp index 523cbb8..471e665 100644 --- a/include/bpstd/detail/move.hpp +++ b/include/bpstd/detail/move.hpp @@ -38,6 +38,8 @@ #include +BPSTD_COMPILER_DIAGNOSTIC_PREAMBLE + namespace bpstd { //---------------------------------------------------------------------------- @@ -108,4 +110,6 @@ typename std::remove_reference::type&& bpstd::move(T&& x) return static_cast(x); } +BPSTD_COMPILER_DIAGNOSTIC_POSTAMBLE + #endif /* BPSTD_DETAIL_MOVE_HPP */ diff --git a/include/bpstd/detail/proxy_iterator.hpp b/include/bpstd/detail/proxy_iterator.hpp index e49a9cc..e9a043e 100644 --- a/include/bpstd/detail/proxy_iterator.hpp +++ b/include/bpstd/detail/proxy_iterator.hpp @@ -38,6 +38,8 @@ #include "config.hpp" #include +BPSTD_COMPILER_DIAGNOSTIC_PREAMBLE + namespace bpstd { namespace detail { @@ -443,5 +445,6 @@ inline BPSTD_CPP14_CONSTEXPR bpstd::detail::proxy_iterator return proxy_iterator{lhs} -= rhs; } +BPSTD_COMPILER_DIAGNOSTIC_POSTAMBLE #endif /* BPSTD_DETAIL_PROXY_ITERATOR_HPP */ diff --git a/include/bpstd/detail/variant_base.hpp b/include/bpstd/detail/variant_base.hpp index 3437887..687c9f0 100644 --- a/include/bpstd/detail/variant_base.hpp +++ b/include/bpstd/detail/variant_base.hpp @@ -37,6 +37,8 @@ #include // std::size_t #include // std::forward +BPSTD_COMPILER_DIAGNOSTIC_PREAMBLE + namespace bpstd { namespace detail { @@ -188,17 +190,26 @@ bpstd::detail::variant_base::variant_base() } +#if defined(_MSC_VER) +# pragma warning(push) +# pragma warning(disable:4702) +#endif + template template inline BPSTD_INLINE_VISIBILITY constexpr bpstd::detail::variant_base::variant_base(variant_index_tag, - Args&&...args) + Args&&...args) : m_union{variant_index_tag{}, std::forward(args)...}, m_index{N} { } +#if defined(_MSC_VER) +# pragma warning(pop) +#endif + //------------------------------------------------------------------------------ template @@ -224,4 +235,6 @@ void bpstd::detail::variant_base::destroy_active_object() m_index = static_cast(-1); } +BPSTD_COMPILER_DIAGNOSTIC_POSTAMBLE + #endif /* BPSTD_DETAIL_VARIANT_BASE_HPP */ diff --git a/include/bpstd/detail/variant_traits.hpp b/include/bpstd/detail/variant_traits.hpp index 5be3ace..cb1354a 100644 --- a/include/bpstd/detail/variant_traits.hpp +++ b/include/bpstd/detail/variant_traits.hpp @@ -31,9 +31,12 @@ #ifndef BPSTD_DETAIL_VARIANT_TRAITS_HPP #define BPSTD_DETAIL_VARIANT_TRAITS_HPP +#include "config.hpp" #include "variant_fwds.hpp" #include "invoke.hpp" // invoke_result +BPSTD_COMPILER_DIAGNOSTIC_PREAMBLE + namespace bpstd { namespace detail { @@ -104,4 +107,6 @@ namespace bpstd { } // namespace detail } // namespace bpstd +BPSTD_COMPILER_DIAGNOSTIC_POSTAMBLE + #endif /* BPSTD_DETAIL_VARIANT_TRAITS_HPP */ diff --git a/include/bpstd/detail/variant_union.hpp b/include/bpstd/detail/variant_union.hpp index 160953c..0dcf68e 100644 --- a/include/bpstd/detail/variant_union.hpp +++ b/include/bpstd/detail/variant_union.hpp @@ -40,6 +40,8 @@ #include // std::decay #include +BPSTD_COMPILER_DIAGNOSTIC_PREAMBLE + namespace bpstd { namespace detail { @@ -573,4 +575,6 @@ const bpstd::detail::nth_type_t&& return bpstd::move(do_union_get(variant_index_tag{}, u)); } +BPSTD_COMPILER_DIAGNOSTIC_POSTAMBLE + #endif /* BPSTD_DETAIL_VARIANT_UNION_HPP */ diff --git a/include/bpstd/detail/variant_visitors.hpp b/include/bpstd/detail/variant_visitors.hpp index 23b5b5a..de8996c 100644 --- a/include/bpstd/detail/variant_visitors.hpp +++ b/include/bpstd/detail/variant_visitors.hpp @@ -41,6 +41,8 @@ #include // placement new #include // std::swap +BPSTD_COMPILER_DIAGNOSTIC_PREAMBLE + namespace bpstd { namespace detail { @@ -188,4 +190,6 @@ namespace bpstd { } // namespace detail } // namespace bpstd +BPSTD_COMPILER_DIAGNOSTIC_POSTAMBLE + #endif /* BPSTD_DETAIL_VARIANT_VISITORS_HPP */ diff --git a/include/bpstd/exception.hpp b/include/bpstd/exception.hpp index f097d42..a69d4b9 100644 --- a/include/bpstd/exception.hpp +++ b/include/bpstd/exception.hpp @@ -38,6 +38,8 @@ #include +BPSTD_COMPILER_DIAGNOSTIC_PREAMBLE + // The large #if/endif block below, and the definition of // bpstd::uncaught_exceptions is taken from boost: // https://beta.boost.org/doc/libs/develop/boost/core/uncaught_exceptions.hpp @@ -192,4 +194,6 @@ int bpstd::uncaught_exceptions() #endif } +BPSTD_COMPILER_DIAGNOSTIC_POSTAMBLE + #endif /* BPSTD_EXCEPTION_HPP */ diff --git a/include/bpstd/functional.hpp b/include/bpstd/functional.hpp index d9ce299..b063b13 100644 --- a/include/bpstd/functional.hpp +++ b/include/bpstd/functional.hpp @@ -41,6 +41,8 @@ #include // to proxy API +BPSTD_COMPILER_DIAGNOSTIC_PREAMBLE + namespace bpstd { /// \brief Invoke the Callable object \p function with the parameters \p args. @@ -692,4 +694,6 @@ bpstd::detail::not_fn_t> bpstd::not_fn(Fn&& fn) return { bpstd::forward(fn) }; } +BPSTD_COMPILER_DIAGNOSTIC_POSTAMBLE + #endif /* BPSTD_FUNCTIONAL_HPP */ diff --git a/include/bpstd/iterator.hpp b/include/bpstd/iterator.hpp index 447ff17..b92cbea 100644 --- a/include/bpstd/iterator.hpp +++ b/include/bpstd/iterator.hpp @@ -41,6 +41,8 @@ #include // std::size_t #include +BPSTD_COMPILER_DIAGNOSTIC_PREAMBLE + namespace bpstd { //============================================================================ @@ -271,4 +273,6 @@ inline BPSTD_INLINE_VISIBILITY constexpr return N; } +BPSTD_COMPILER_DIAGNOSTIC_POSTAMBLE + #endif /* BPSTD_ITERATOR_HPP */ diff --git a/include/bpstd/memory.hpp b/include/bpstd/memory.hpp index c4a33eb..1bcfad3 100644 --- a/include/bpstd/memory.hpp +++ b/include/bpstd/memory.hpp @@ -42,6 +42,8 @@ #include // std::size_t #include // std::declval +BPSTD_COMPILER_DIAGNOSTIC_PREAMBLE + namespace bpstd { namespace detail { @@ -254,4 +256,6 @@ bpstd::detail::to_address_result_t return detail::to_address_impl(p, detail::has_to_address{}); } +BPSTD_COMPILER_DIAGNOSTIC_POSTAMBLE + #endif /* BPSTD_MEMORY_HPP */ diff --git a/include/bpstd/optional.hpp b/include/bpstd/optional.hpp index ca75127..e159c6c 100644 --- a/include/bpstd/optional.hpp +++ b/include/bpstd/optional.hpp @@ -46,6 +46,8 @@ #include // std::logic_error #include // placement new +BPSTD_COMPILER_DIAGNOSTIC_PREAMBLE + namespace bpstd { template class optional; @@ -1767,4 +1769,6 @@ void bpstd::swap(optional& lhs, optional& rhs) lhs.swap(rhs); } +BPSTD_COMPILER_DIAGNOSTIC_POSTAMBLE + #endif /* BPSTD_OPTIONAL_HPP */ diff --git a/include/bpstd/span.hpp b/include/bpstd/span.hpp index 43a2016..e0d253b 100644 --- a/include/bpstd/span.hpp +++ b/include/bpstd/span.hpp @@ -41,6 +41,8 @@ #include // std::array #include // std::iterator_traits +BPSTD_COMPILER_DIAGNOSTIC_PREAMBLE + namespace bpstd { //============================================================================ @@ -799,4 +801,6 @@ inline bpstd::span bpstd::as_writable_bytes(span(s.data()), s.size_bytes()}; } +BPSTD_COMPILER_DIAGNOSTIC_POSTAMBLE + #endif /* BPSTD_SPAN_HPP */ diff --git a/include/bpstd/string.hpp b/include/bpstd/string.hpp index c5191cd..20f004c 100644 --- a/include/bpstd/string.hpp +++ b/include/bpstd/string.hpp @@ -34,6 +34,8 @@ #include +BPSTD_COMPILER_DIAGNOSTIC_PREAMBLE + namespace bpstd { inline namespace literals { @@ -77,5 +79,6 @@ std::wstring return std::wstring{s, len}; } +BPSTD_COMPILER_DIAGNOSTIC_POSTAMBLE #endif /* BPSTD_STRING_HPP */ diff --git a/include/bpstd/string_view.hpp b/include/bpstd/string_view.hpp index 21235cd..0066fbf 100644 --- a/include/bpstd/string_view.hpp +++ b/include/bpstd/string_view.hpp @@ -45,6 +45,8 @@ #include // std::reverse_iterator #include // std::streamsize +BPSTD_COMPILER_DIAGNOSTIC_PREAMBLE + namespace bpstd { // back-port std ////////////////////////////////////////////////////////////////////////////// @@ -712,8 +714,13 @@ typename bpstd::basic_string_view::size_type throw std::out_of_range("Index out of range in basic_string_view::copy"); } - const size_type rcount = std::min(m_size - pos,count+1); - std::copy( m_str + pos, m_str + pos + rcount, dest); + const auto rcount = std::min(m_size - pos,count+1); + auto* const begin = m_str + pos; + auto* const end = m_str + pos + rcount; + for (auto it = begin; it != end; ++it) { + *dest = *it; + ++dest; + } return rcount; } @@ -1517,4 +1524,6 @@ namespace bpstd { } // namespace bpstd +BPSTD_COMPILER_DIAGNOSTIC_POSTAMBLE + #endif /* BPSTD_STRING_VIEW_HPP */ diff --git a/include/bpstd/tuple.hpp b/include/bpstd/tuple.hpp index abe46c9..0c7e375 100644 --- a/include/bpstd/tuple.hpp +++ b/include/bpstd/tuple.hpp @@ -41,6 +41,8 @@ #include // std::tuple_element, and to proxy API #include // std::size_t +BPSTD_COMPILER_DIAGNOSTIC_PREAMBLE + namespace bpstd { //============================================================================ @@ -218,6 +220,11 @@ const T&& bpstd::get(const tuple&& t) // definition : apply //============================================================================== +#if defined(_MSC_VER) +# pragma warning(push) +# pragma warning(disable:4100) // MSVC warns that 'tuple' is not used below +#endif + namespace bpstd { namespace detail { template @@ -232,6 +239,10 @@ namespace bpstd { } // namespace detail } // namespace bpstd +#if defined(_MSC_VER) +# pragma warning(pop) +#endif + template inline BPSTD_INLINE_VISIBILITY constexpr bpstd::detail::apply_result_t bpstd::apply(Fn&& fn, Tuple&& tuple) @@ -247,6 +258,11 @@ bpstd::detail::apply_result_t bpstd::apply(Fn&& fn, Tuple&& tuple) // definition : make_from_tuple //============================================================================== +#if defined(_MSC_VER) +# pragma warning(push) +# pragma warning(disable:4100) // MSVC warns that 'tuple' is not used below +#endif + namespace bpstd { namespace detail { template @@ -258,6 +274,10 @@ namespace bpstd { } // namespace detail } // namespace bpstd +#if defined(_MSC_VER) +# pragma warning(pop) +#endif + template inline BPSTD_INLINE_VISIBILITY constexpr T bpstd::make_from_tuple(Tuple&& tuple) @@ -268,4 +288,6 @@ T bpstd::make_from_tuple(Tuple&& tuple) ); } +BPSTD_COMPILER_DIAGNOSTIC_POSTAMBLE + #endif /* BPSTD_TUPLE_HPP */ diff --git a/include/bpstd/type_traits.hpp b/include/bpstd/type_traits.hpp index 8bae3e6..d1f599e 100644 --- a/include/bpstd/type_traits.hpp +++ b/include/bpstd/type_traits.hpp @@ -41,6 +41,8 @@ #include #include // std::size_t +BPSTD_COMPILER_DIAGNOSTIC_PREAMBLE + // GCC versions prior to gcc-5 did not implement the type traits for triviality // in completion. Several traits are implemented under a different names from // pre-standardization, such as 'has_trivial_copy_destructor' instead of @@ -1391,4 +1393,6 @@ namespace bpstd { } // namespace bpstd +BPSTD_COMPILER_DIAGNOSTIC_POSTAMBLE + #endif /* BPSTD_TYPE_TRAITS_HPP */ diff --git a/include/bpstd/utility.hpp b/include/bpstd/utility.hpp index 0740a45..0bef0e5 100644 --- a/include/bpstd/utility.hpp +++ b/include/bpstd/utility.hpp @@ -41,6 +41,8 @@ #include // to proxy the API #include // std::size_t +BPSTD_COMPILER_DIAGNOSTIC_PREAMBLE + namespace bpstd { //============================================================================ @@ -375,4 +377,6 @@ const T&& bpstd::get(const pair&& p) return move(p.second); } +BPSTD_COMPILER_DIAGNOSTIC_POSTAMBLE + #endif /* BPSTD_UTILITY_HPP */ diff --git a/include/bpstd/variant.hpp b/include/bpstd/variant.hpp index bd72812..2e8a5d3 100644 --- a/include/bpstd/variant.hpp +++ b/include/bpstd/variant.hpp @@ -51,6 +51,8 @@ #include // std::size_t #include // std::forward, std::move +BPSTD_COMPILER_DIAGNOSTIC_PREAMBLE + namespace bpstd { //============================================================================ @@ -1949,4 +1951,6 @@ bpstd::add_pointer_t return get_if(pv); } +BPSTD_COMPILER_DIAGNOSTIC_POSTAMBLE + #endif /* BPSTD_VARIANT_HPP */ diff --git a/test/src/bpstd/any.test.cpp b/test/src/bpstd/any.test.cpp index a09af21..8946f30 100644 --- a/test/src/bpstd/any.test.cpp +++ b/test/src/bpstd/any.test.cpp @@ -30,6 +30,13 @@ #include +// MSVC 2015 seems to emit an error that __forceinline'd functions may not be +// __forceinline'd at the *end of the translation unit* using it, for some +// stupid reason. +#if defined(_MSC_VER) +# pragma warning(disable:4714) +#endif + namespace { // A testing string that is sufficiently long enough to avoid string SBO. diff --git a/test/src/bpstd/complex.test.cpp b/test/src/bpstd/complex.test.cpp index bda20cf..2321751 100644 --- a/test/src/bpstd/complex.test.cpp +++ b/test/src/bpstd/complex.test.cpp @@ -26,6 +26,13 @@ #include +// MSVC 2015 seems to emit an error that __forceinline'd functions may not be +// __forceinline'd at the *end of the translation unit* using it, for some +// stupid reason. +#if defined(_MSC_VER) +# pragma warning(disable:4714) +#endif + TEST_CASE("operator\"\"_il(long double)", "[literal]") { using bpstd::literals::complex_literals::operator""_il; diff --git a/test/src/bpstd/exception.test.cpp b/test/src/bpstd/exception.test.cpp index 8296db7..78a9c27 100644 --- a/test/src/bpstd/exception.test.cpp +++ b/test/src/bpstd/exception.test.cpp @@ -26,6 +26,13 @@ #include #include +// MSVC 2015 seems to emit an error that __forceinline'd functions may not be +// __forceinline'd at the *end of the translation unit* using it, for some +// stupid reason. +#if defined(_MSC_VER) +# pragma warning(disable:4714) +#endif + namespace { template struct require_exception_in_dtor diff --git a/test/src/bpstd/functional.test.cpp b/test/src/bpstd/functional.test.cpp index 9312de2..40f4704 100644 --- a/test/src/bpstd/functional.test.cpp +++ b/test/src/bpstd/functional.test.cpp @@ -28,6 +28,13 @@ #include // std::shared_ptr #include // std::reference_wrapper +// MSVC 2015 seems to emit an error that __forceinline'd functions may not be +// __forceinline'd at the *end of the translation unit* using it, for some +// stupid reason. +#if defined(_MSC_VER) +# pragma warning(disable:4714) +#endif + namespace { struct const_functor { diff --git a/test/src/bpstd/iterator.test.cpp b/test/src/bpstd/iterator.test.cpp index 4d6ecec..37d9208 100644 --- a/test/src/bpstd/iterator.test.cpp +++ b/test/src/bpstd/iterator.test.cpp @@ -28,6 +28,13 @@ #include #include +// MSVC 2015 seems to emit an error that __forceinline'd functions may not be +// __forceinline'd at the *end of the translation unit* using it, for some +// stupid reason. +#if defined(_MSC_VER) +# pragma warning(disable:4714) +#endif + TEST_CASE("make_reverse_iterator(...)", "[iterator]") { const auto input = std::vector{1,2,3,4,5}; diff --git a/test/src/bpstd/memory.test.cpp b/test/src/bpstd/memory.test.cpp index 002d295..42963f9 100644 --- a/test/src/bpstd/memory.test.cpp +++ b/test/src/bpstd/memory.test.cpp @@ -27,6 +27,13 @@ #include #include +// MSVC 2015 seems to emit an error that __forceinline'd functions may not be +// __forceinline'd at the *end of the translation unit* using it, for some +// stupid reason. +#if defined(_MSC_VER) +# pragma warning(disable:4714) +#endif + //------------------------------------------------------------------------------ // make_unique //------------------------------------------------------------------------------ diff --git a/test/src/bpstd/optional.test.cpp b/test/src/bpstd/optional.test.cpp index 5942fb9..aa8f489 100644 --- a/test/src/bpstd/optional.test.cpp +++ b/test/src/bpstd/optional.test.cpp @@ -27,6 +27,13 @@ #include #include +// MSVC 2015 seems to emit an error that __forceinline'd functions may not be +// __forceinline'd at the *end of the translation unit* using it, for some +// stupid reason. +#if defined(_MSC_VER) +# pragma warning(disable:4714) +#endif + namespace { class dtor_test diff --git a/test/src/bpstd/span.test.cpp b/test/src/bpstd/span.test.cpp index ab20220..ec1a7e2 100644 --- a/test/src/bpstd/span.test.cpp +++ b/test/src/bpstd/span.test.cpp @@ -30,6 +30,13 @@ #include // std::array #include // std::equal +// MSVC 2015 seems to emit an error that __forceinline'd functions may not be +// __forceinline'd at the *end of the translation unit* using it, for some +// stupid reason. +#if defined(_MSC_VER) +# pragma warning(disable:4714) +#endif + //------------------------------------------------------------------------------ // Constructors //------------------------------------------------------------------------------ diff --git a/test/src/bpstd/string_view.test.cpp b/test/src/bpstd/string_view.test.cpp index 7ee25db..5e53f54 100644 --- a/test/src/bpstd/string_view.test.cpp +++ b/test/src/bpstd/string_view.test.cpp @@ -29,6 +29,13 @@ #include +// MSVC 2015 seems to emit an error that __forceinline'd functions may not be +// __forceinline'd at the *end of the translation unit* using it, for some +// stupid reason. +#if defined(_MSC_VER) +# pragma warning(disable:4714) +#endif + //---------------------------------------------------------------------------- // Constructors //---------------------------------------------------------------------------- diff --git a/test/src/bpstd/tuple.test.cpp b/test/src/bpstd/tuple.test.cpp index 11b87d0..d517474 100644 --- a/test/src/bpstd/tuple.test.cpp +++ b/test/src/bpstd/tuple.test.cpp @@ -28,6 +28,13 @@ #include +// MSVC 2015 seems to emit an error that __forceinline'd functions may not be +// __forceinline'd at the *end of the translation unit* using it, for some +// stupid reason. +#if defined(_MSC_VER) +# pragma warning(disable:4714) +#endif + //============================================================================== // Behavior Tests //============================================================================== diff --git a/test/src/bpstd/utility.test.cpp b/test/src/bpstd/utility.test.cpp index a23e22a..eb772b4 100644 --- a/test/src/bpstd/utility.test.cpp +++ b/test/src/bpstd/utility.test.cpp @@ -26,6 +26,13 @@ #include +// MSVC 2015 seems to emit an error that __forceinline'd functions may not be +// __forceinline'd at the *end of the translation unit* using it, for some +// stupid reason. +#if defined(_MSC_VER) +# pragma warning(disable:4714) +#endif + TEST_CASE("get(pair&)", "[utility]") { auto sut = bpstd::pair{1,3.14f}; diff --git a/test/src/bpstd/variant.test.cpp b/test/src/bpstd/variant.test.cpp index a279d2c..9081863 100644 --- a/test/src/bpstd/variant.test.cpp +++ b/test/src/bpstd/variant.test.cpp @@ -22,6 +22,13 @@ SOFTWARE. */ +// MSVC 2015 seems to emit "unreachable code" diagnostics in the wrong function +// whenever a function is inlined. The error will not be seen in the inlined +// function, but it may be seen in the surrounding scope of the inlined function +#if defined(_MSC_VER) +# pragma warning(disable:4702) +#endif + #include #include @@ -32,6 +39,14 @@ #include // std::runtime_error #include // assert +// MSVC 2015 seems to emit an error that __forceinline'd functions may not be +// __forceinline'd at the *end of the translation unit* using it, for some +// stupid reason. +#if defined(_MSC_VER) +# pragma warning(disable:4714) +# pragma warning(disable:4702) +#endif + static_assert( std::is_trivially_destructible>::value, "Variant containing trivially destructible types must be trivially destructible"