From 39f48141c5d50f6203590e6153a76c042e4c465e Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Wed, 18 Apr 2018 20:08:22 +0100 Subject: [PATCH] Fix some warnings and miswritten test case, add test for BOOST_HAS_PRAGMA_DETECT_MISMATCH. --- checks/Jamfile.v2 | 3 ++- checks/test_case.cpp | 7 ++++- test/all/Jamfile.v2 | 5 +++- test/boost_has_detect_mismatch.ipp | 24 +++++++++++++++++ test/boost_has_part_alloc.ipp | 2 +- test/boost_no_cxx11_hdr_atomic.ipp | 2 ++ test/boost_no_cxx11_hdr_tuple.ipp | 1 + test/boost_no_cxx11_pointer_traits.ipp | 4 +-- test/boost_no_std_allocator.ipp | 2 +- test/config_info.cpp | 2 ++ test/config_test.cpp | 12 ++++++++- test/has_detect_mismatch_fail.cpp | 37 ++++++++++++++++++++++++++ test/has_detect_mismatch_pass.cpp | 37 ++++++++++++++++++++++++++ 13 files changed, 130 insertions(+), 8 deletions(-) create mode 100644 test/boost_has_detect_mismatch.ipp create mode 100644 test/has_detect_mismatch_fail.cpp create mode 100644 test/has_detect_mismatch_pass.cpp diff --git a/checks/Jamfile.v2 b/checks/Jamfile.v2 index 2c4d4672..0c26bce1 100644 --- a/checks/Jamfile.v2 +++ b/checks/Jamfile.v2 @@ -1,6 +1,6 @@ # # *** DO NOT EDIT THIS FILE BY HAND *** -# This file was automatically generated on Tue Mar 6 17:44:35 2018 +# This file was automatically generated on Wed Apr 18 20:03:40 2018 # by libs/config/tools/generate.cpp # Copyright John Maddock. # Use, modification and distribution are subject to the @@ -14,6 +14,7 @@ import path ; obj two_arg_use_facet : test_case.cpp : TEST_BOOST_HAS_TWO_ARG_USE_FACET ; obj bethreads : test_case.cpp : TEST_BOOST_HAS_BETHREADS ; obj clock_gettime : test_case.cpp : TEST_BOOST_HAS_CLOCK_GETTIME ; +obj pragma_detect_mismatch : test_case.cpp : TEST_BOOST_HAS_PRAGMA_DETECT_MISMATCH ; obj dirent_h : test_case.cpp : TEST_BOOST_HAS_DIRENT_H ; obj expm1 : test_case.cpp : TEST_BOOST_HAS_EXPM1 ; obj float128 : test_case.cpp : TEST_BOOST_HAS_FLOAT128 ; diff --git a/checks/test_case.cpp b/checks/test_case.cpp index 7c0f8a3f..7d9cb10c 100644 --- a/checks/test_case.cpp +++ b/checks/test_case.cpp @@ -1,4 +1,4 @@ -// This file was automatically generated on Tue Mar 6 17:44:35 2018 +// This file was automatically generated on Wed Apr 18 20:03:40 2018 // by libs/config/tools/generate.cpp // Copyright John Maddock 2002-4. // Use, modification and distribution are subject to the @@ -26,6 +26,11 @@ # error "Feature macro BOOST_HAS_CLOCK_GETTIME is not defined." # endif #endif +#ifdef TEST_BOOST_HAS_PRAGMA_DETECT_MISMATCH +# ifndef BOOST_HAS_PRAGMA_DETECT_MISMATCH +# error "Feature macro BOOST_HAS_PRAGMA_DETECT_MISMATCH is not defined." +# endif +#endif #ifdef TEST_BOOST_HAS_DIRENT_H # ifndef BOOST_HAS_DIRENT_H # error "Feature macro BOOST_HAS_DIRENT_H is not defined." diff --git a/test/all/Jamfile.v2 b/test/all/Jamfile.v2 index bff9133a..ae3457c2 100644 --- a/test/all/Jamfile.v2 +++ b/test/all/Jamfile.v2 @@ -1,7 +1,7 @@ # # Regression test Jamfile for boost configuration setup. # *** DO NOT EDIT THIS FILE BY HAND *** -# This file was automatically generated on Tue Mar 6 17:44:35 2018 +# This file was automatically generated on Wed Apr 18 20:03:40 2018 # by libs/config/tools/generate.cpp # Copyright John Maddock. # Use, modification and distribution are subject to the @@ -31,6 +31,9 @@ test-suite "BOOST_HAS_BETHREADS" : test-suite "BOOST_HAS_CLOCK_GETTIME" : [ run ../has_clock_gettime_pass.cpp ] [ compile-fail ../has_clock_gettime_fail.cpp ] ; +test-suite "BOOST_HAS_PRAGMA_DETECT_MISMATCH" : +[ run ../has_detect_mismatch_pass.cpp ] +[ compile-fail ../has_detect_mismatch_fail.cpp ] ; test-suite "BOOST_HAS_DIRENT_H" : [ run ../has_dirent_h_pass.cpp ] [ compile-fail ../has_dirent_h_fail.cpp ] ; diff --git a/test/boost_has_detect_mismatch.ipp b/test/boost_has_detect_mismatch.ipp new file mode 100644 index 00000000..3f29fcd3 --- /dev/null +++ b/test/boost_has_detect_mismatch.ipp @@ -0,0 +1,24 @@ +// (C) Copyright John Maddock 2018. +// Use, modification and distribution are subject to 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) + +// See http://www.boost.org/libs/config for most recent version. + +// MACRO: BOOST_HAS_PRAGMA_DETECT_MISMATCH +// TITLE: detect_mismatch pragma +// DESCRIPTION: The compiler supports #pragma detect_mismatch + +#include + + +namespace boost_has_pragma_detect_mismatch { + +int test() +{ +# pragma detect_mismatch("Boost_Config", "1") + return 0; +} + +} + diff --git a/test/boost_has_part_alloc.ipp b/test/boost_has_part_alloc.ipp index 3e4c2cb8..ea31dd94 100644 --- a/test/boost_has_part_alloc.ipp +++ b/test/boost_has_part_alloc.ipp @@ -25,7 +25,7 @@ namespace boost_has_partial_std_allocator{ // template -int test_allocator(const T& i) +int test_allocator(const T&) { typedef std::allocator alloc1_t; #if !((__cplusplus > 201700) || (defined(_MSVC_LANG) && (_MSVC_LANG > 201700))) diff --git a/test/boost_no_cxx11_hdr_atomic.ipp b/test/boost_no_cxx11_hdr_atomic.ipp index edede3fc..171dcc3d 100644 --- a/test/boost_no_cxx11_hdr_atomic.ipp +++ b/test/boost_no_cxx11_hdr_atomic.ipp @@ -52,6 +52,8 @@ int test() a1 |= 2; a1 ^= 3; + a2 = 0u; + a3.store(&v); a3.fetch_add(1); a3.fetch_sub(1); diff --git a/test/boost_no_cxx11_hdr_tuple.ipp b/test/boost_no_cxx11_hdr_tuple.ipp index 34bdc4df..6911ee34 100644 --- a/test/boost_no_cxx11_hdr_tuple.ipp +++ b/test/boost_no_cxx11_hdr_tuple.ipp @@ -17,6 +17,7 @@ namespace boost_no_cxx11_hdr_tuple { int test() { std::tuple t(0, 1, 2); + (void)t; return 0; } diff --git a/test/boost_no_cxx11_pointer_traits.ipp b/test/boost_no_cxx11_pointer_traits.ipp index d7223f32..3d1bb1f8 100644 --- a/test/boost_no_cxx11_pointer_traits.ipp +++ b/test/boost_no_cxx11_pointer_traits.ipp @@ -18,7 +18,7 @@ namespace boost_no_cxx11_pointer_traits { template struct pointer { template - using rebind = pointer; + using rebind = pointer; }; template @@ -31,7 +31,7 @@ struct result > { int test() { - return result >::rebind >::value; + return result >::rebind >::value; } } /* boost_no_cxx11_pointer_traits */ diff --git a/test/boost_no_std_allocator.ipp b/test/boost_no_std_allocator.ipp index 80e048e4..c3868dd8 100644 --- a/test/boost_no_std_allocator.ipp +++ b/test/boost_no_std_allocator.ipp @@ -25,7 +25,7 @@ namespace boost_no_std_allocator{ #endif template -int test_allocator(const T& i) +int test_allocator(const T&) { typedef std::allocator alloc1_t; #if !((__cplusplus > 201700) || (defined(_MSVC_LANG) && (_MSVC_LANG > 201700))) diff --git a/test/config_info.cpp b/test/config_info.cpp index 15ea5d4a..b5629772 100644 --- a/test/config_info.cpp +++ b/test/config_info.cpp @@ -1054,6 +1054,7 @@ void print_boost_macros() PRINT_MACRO(BOOST_HAS_NL_TYPES_H); PRINT_MACRO(BOOST_HAS_NRVO); PRINT_MACRO(BOOST_HAS_PARTIAL_STD_ALLOCATOR); + PRINT_MACRO(BOOST_HAS_PRAGMA_DETECT_MISMATCH); PRINT_MACRO(BOOST_HAS_PTHREADS); PRINT_MACRO(BOOST_HAS_PTHREAD_DELAY_NP); PRINT_MACRO(BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE); @@ -1235,6 +1236,7 @@ void print_boost_macros() + // END GENERATED BLOCK PRINT_MACRO(BOOST_INTEL); diff --git a/test/config_test.cpp b/test/config_test.cpp index 2d27e53c..c7e4e8a6 100644 --- a/test/config_test.cpp +++ b/test/config_test.cpp @@ -1,4 +1,4 @@ -// This file was automatically generated on Tue Mar 6 17:44:35 2018 +// This file was automatically generated on Wed Apr 18 20:03:40 2018 // by libs/config/tools/generate.cpp // Copyright John Maddock 2002-4. // Use, modification and distribution are subject to the @@ -823,6 +823,11 @@ namespace boost_has_bethreads = empty_boost; #else namespace boost_has_clock_gettime = empty_boost; #endif +#ifdef BOOST_HAS_PRAGMA_DETECT_MISMATCH +#include "boost_has_detect_mismatch.ipp" +#else +namespace boost_has_pragma_detect_mismatch = empty_boost; +#endif #ifdef BOOST_HAS_DIRENT_H #include "boost_has_dirent_h.ipp" #else @@ -1006,6 +1011,11 @@ int main( int, char *[] ) std::cerr << "Failed test for BOOST_HAS_CLOCK_GETTIME at: " << __FILE__ << ":" << __LINE__ << std::endl; ++error_count; } + if(0 != boost_has_pragma_detect_mismatch::test()) + { + std::cerr << "Failed test for BOOST_HAS_PRAGMA_DETECT_MISMATCH at: " << __FILE__ << ":" << __LINE__ << std::endl; + ++error_count; + } if(0 != boost_has_dirent_h::test()) { std::cerr << "Failed test for BOOST_HAS_DIRENT_H at: " << __FILE__ << ":" << __LINE__ << std::endl; diff --git a/test/has_detect_mismatch_fail.cpp b/test/has_detect_mismatch_fail.cpp new file mode 100644 index 00000000..5a544b13 --- /dev/null +++ b/test/has_detect_mismatch_fail.cpp @@ -0,0 +1,37 @@ +// This file was automatically generated on Wed Apr 18 20:03:40 2018 +// by libs/config/tools/generate.cpp +// Copyright John Maddock 2002-4. +// Use, modification and distribution are subject to 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) + +// See http://www.boost.org/libs/config for the most recent version.// +// Revision $Id$ +// + + +// Test file for macro BOOST_HAS_PRAGMA_DETECT_MISMATCH +// This file should not compile, if it does then +// BOOST_HAS_PRAGMA_DETECT_MISMATCH should be defined. +// See file boost_has_detect_mismatch.ipp for details + +// Must not have BOOST_ASSERT_CONFIG set; it defeats +// the objective of this file: +#ifdef BOOST_ASSERT_CONFIG +# undef BOOST_ASSERT_CONFIG +#endif + +#include +#include "test.hpp" + +#ifndef BOOST_HAS_PRAGMA_DETECT_MISMATCH +#include "boost_has_detect_mismatch.ipp" +#else +#error "this file should not compile" +#endif + +int main( int, char *[] ) +{ + return boost_has_pragma_detect_mismatch::test(); +} + diff --git a/test/has_detect_mismatch_pass.cpp b/test/has_detect_mismatch_pass.cpp new file mode 100644 index 00000000..ea47fb88 --- /dev/null +++ b/test/has_detect_mismatch_pass.cpp @@ -0,0 +1,37 @@ +// This file was automatically generated on Wed Apr 18 20:03:40 2018 +// by libs/config/tools/generate.cpp +// Copyright John Maddock 2002-4. +// Use, modification and distribution are subject to 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) + +// See http://www.boost.org/libs/config for the most recent version.// +// Revision $Id$ +// + + +// Test file for macro BOOST_HAS_PRAGMA_DETECT_MISMATCH +// This file should compile, if it does not then +// BOOST_HAS_PRAGMA_DETECT_MISMATCH should not be defined. +// See file boost_has_detect_mismatch.ipp for details + +// Must not have BOOST_ASSERT_CONFIG set; it defeats +// the objective of this file: +#ifdef BOOST_ASSERT_CONFIG +# undef BOOST_ASSERT_CONFIG +#endif + +#include +#include "test.hpp" + +#ifdef BOOST_HAS_PRAGMA_DETECT_MISMATCH +#include "boost_has_detect_mismatch.ipp" +#else +namespace boost_has_pragma_detect_mismatch = empty_boost; +#endif + +int main( int, char *[] ) +{ + return boost_has_pragma_detect_mismatch::test(); +} +