Always disable conversion warnings when including boost header files

On one of my compile platforms, GCC was giving conversion warnings from
any boost include that was not wrapped in pragmas to disable conversion
warnings. To make things easier and more robust, I created a pair of
macros, VTKM_BOOST_PRE_INCLUDE and VTKM_BOOST_POST_INCLUDE, that should
be wrapped around any #include of a boost header file.
This commit is contained in:
Kenneth Moreland 2015-07-30 16:02:21 -06:00
parent 5e5203d6be
commit 21b3b318ba
36 changed files with 101 additions and 19 deletions

@ -24,8 +24,10 @@
#include <vtkm/internal/ExportMacros.h>
VTKM_BOOST_PRE_INCLUDE
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_base_of.hpp>
VTKM_BOOST_POST_INCLUDE
namespace vtkm {

@ -38,14 +38,17 @@
// boost seems to want to undefine those macros so that it can implement the
// C99 templates and other implementations of the same name. Get around the
// problem by using the boost version when compiling for a CPU.
VTKM_BOOST_PRE_INCLUDE
#include <boost/math/special_functions/fpclassify.hpp>
#include <boost/math/special_functions/sign.hpp>
VTKM_BOOST_POST_INCLUDE
#include <cmath>
#define VTKM_USE_BOOST_CLASSIFY
#define VTKM_USE_BOOST_SIGN
#endif // !VTKM_CUDA
#if defined(VTKM_MSVC) && !defined(VTKM_CUDA)
VTKM_BOOST_PRE_INCLUDE
#include <boost/math/special_functions/acosh.hpp>
#include <boost/math/special_functions/asinh.hpp>
#include <boost/math/special_functions/atanh.hpp>
@ -53,6 +56,7 @@
#include <boost/math/special_functions/expm1.hpp>
#include <boost/math/special_functions/log1p.hpp>
#include <boost/math/special_functions/round.hpp>
VTKM_BOOST_POST_INCLUDE
#define VTKM_USE_BOOST_MATH
#if _MSC_VER <= 1600
#define VTKM_USE_STL_MIN_MAX

@ -50,14 +50,17 @@ $# Ignore the following comment. It is meant for the generated file.
// boost seems to want to undefine those macros so that it can implement the
// C99 templates and other implementations of the same name. Get around the
// problem by using the boost version when compiling for a CPU.
VTKM_BOOST_PRE_INCLUDE
#include <boost/math/special_functions/fpclassify.hpp>
#include <boost/math/special_functions/sign.hpp>
VTKM_BOOST_POST_INCLUDE
#include <cmath>
#define VTKM_USE_BOOST_CLASSIFY
#define VTKM_USE_BOOST_SIGN
#endif // !VTKM_CUDA
#if defined(VTKM_MSVC) && !defined(VTKM_CUDA)
VTKM_BOOST_PRE_INCLUDE
#include <boost/math/special_functions/acosh.hpp>
#include <boost/math/special_functions/asinh.hpp>
#include <boost/math/special_functions/atanh.hpp>
@ -65,6 +68,7 @@ $# Ignore the following comment. It is meant for the generated file.
#include <boost/math/special_functions/expm1.hpp>
#include <boost/math/special_functions/log1p.hpp>
#include <boost/math/special_functions/round.hpp>
VTKM_BOOST_POST_INCLUDE
#define VTKM_USE_BOOST_MATH
#if _MSC_VER <= 1600
#define VTKM_USE_STL_MIN_MAX

@ -27,7 +27,9 @@
#include <vtkm/cont/TopologyType.h>
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
VTKM_BOOST_PRE_INCLUDE
#include <boost/static_assert.hpp>
VTKM_BOOST_POST_INCLUDE
namespace vtkm {

@ -24,10 +24,12 @@
#include <vtkm/internal/Configure.h>
#include <vtkm/internal/ExportMacros.h>
VTKM_BOOST_PRE_INCLUDE
#include <boost/mpl/or.hpp>
#include <boost/type_traits/is_floating_point.hpp>
#include <boost/type_traits/is_signed.hpp>
#include <boost/utility/enable_if.hpp>
VTKM_BOOST_POST_INCLUDE
/*!
* \namespace vtkm

@ -22,7 +22,9 @@
#include <vtkm/Types.h>
VTKM_BOOST_PRE_INCLUDE
#include <boost/type_traits/remove_const.hpp>
VTKM_BOOST_POST_INCLUDE
namespace vtkm {

@ -37,7 +37,9 @@
#include <vtkm/cont/testing/Testing.h>
#include <vtkm/benchmarking/Benchmarker.h>
VTKM_BOOST_PRE_INCLUDE
#include <boost/random.hpp>
VTKM_BOOST_POST_INCLUDE
#include <algorithm>
#include <cmath>

@ -31,11 +31,13 @@
#include <vtkm/cont/internal/ArrayHandleExecutionManager.h>
#include <vtkm/cont/internal/DeviceAdapterTag.h>
VTKM_BOOST_PRE_INCLUDE
#include <boost/concept_check.hpp>
#include <boost/mpl/not.hpp>
#include <boost/smart_ptr/scoped_ptr.hpp>
#include <boost/smart_ptr/shared_ptr.hpp>
#include <boost/type_traits/is_base_of.hpp>
VTKM_BOOST_POST_INCLUDE
#include <vector>

@ -28,7 +28,9 @@
#include <vtkm/internal/FunctionInterface.h>
VTKM_BOOST_PRE_INCLUDE
#include <boost/static_assert.hpp>
VTKM_BOOST_POST_INCLUDE
#include <sstream>

@ -27,7 +27,9 @@
#include <vtkm/cont/DynamicArrayHandle.h>
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
VTKM_BOOST_PRE_INCLUDE
#include <boost/type_traits/is_base_of.hpp>
VTKM_BOOST_POST_INCLUDE
namespace vtkm {
namespace cont {

@ -29,8 +29,10 @@
#include <vtkm/cont/internal/DynamicTransform.h>
VTKM_BOOST_PRE_INCLUDE
#include <boost/smart_ptr/shared_ptr.hpp>
#include <boost/utility/enable_if.hpp>
VTKM_BOOST_POST_INCLUDE
namespace vtkm {
namespace cont {

@ -27,7 +27,9 @@
#include <vtkm/cont/internal/DynamicTransform.h>
#include <vtkm/cont/internal/SimplePolymorphicContainer.h>
VTKM_BOOST_PRE_INCLUDE
#include <boost/smart_ptr/shared_ptr.hpp>
VTKM_BOOST_POST_INCLUDE
namespace vtkm {
namespace cont {

@ -27,7 +27,9 @@
#include <vtkm/cont/internal/DynamicTransform.h>
VTKM_BOOST_PRE_INCLUDE
#include <boost/shared_ptr.hpp>
VTKM_BOOST_POST_INCLUDE
namespace vtkm {
namespace cont {

@ -28,7 +28,11 @@
#define VTKM_STORAGE VTKM_STORAGE_BASIC
#endif
#include <vtkm/internal/ExportMacros.h>
VTKM_BOOST_PRE_INCLUDE
#include <boost/static_assert.hpp>
VTKM_BOOST_POST_INCLUDE
namespace vtkm {
namespace cont {

@ -20,8 +20,12 @@
#ifndef vtk_m_cont_arg_ControlSignatureTagBase_h
#define vtk_m_cont_arg_ControlSignatureTagBase_h
#include <vtkm/internal/ExportMacros.h>
VTKM_BOOST_PRE_INCLUDE
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_base_of.hpp>
VTKM_BOOST_POST_INCLUDE
namespace vtkm {
namespace cont {

@ -26,8 +26,10 @@
#include <vtkm/exec/ExecutionObjectBase.h>
VTKM_BOOST_PRE_INCLUDE
#include <boost/mpl/assert.hpp>
#include <boost/type_traits/is_base_of.hpp>
VTKM_BOOST_POST_INCLUDE
namespace vtkm {
namespace cont {

@ -20,11 +20,15 @@
#ifndef vtk_m_cont_arg_TypeCheckTagExecObject_h
#define vtk_m_cont_arg_TypeCheckTagExecObject_h
#include <vtkm/internal/ExportMacros.h>
#include <vtkm/cont/arg/TypeCheck.h>
#include <vtkm/exec/ExecutionObjectBase.h>
VTKM_BOOST_PRE_INCLUDE
#include <boost/type_traits/is_base_of.hpp>
VTKM_BOOST_POST_INCLUDE
namespace vtkm {
namespace cont {

@ -30,8 +30,10 @@
#include <vtkm/exec/internal/ErrorMessageBuffer.h>
VTKM_BOOST_PRE_INCLUDE
#include <boost/iterator/counting_iterator.hpp>
#include <boost/utility/enable_if.hpp>
VTKM_BOOST_POST_INCLUDE
#include <algorithm>
#include <numeric>

@ -25,7 +25,9 @@
#include <string>
VTKM_BOOST_PRE_INCLUDE
#include <boost/static_assert.hpp>
VTKM_BOOST_POST_INCLUDE
#define VTKM_DEVICE_ADAPTER_ERROR -2
#define VTKM_DEVICE_ADAPTER_UNDEFINED -1

@ -24,7 +24,9 @@
#include <vtkm/cont/Assert.h>
VTKM_BOOST_PRE_INCLUDE
#include <boost/iterator/iterator_facade.hpp>
VTKM_BOOST_POST_INCLUDE
namespace vtkm {
namespace cont {

@ -22,8 +22,10 @@
#include <vtkm/Types.h>
VTKM_BOOST_PRE_INCLUDE
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_base_of.hpp>
VTKM_BOOST_POST_INCLUDE
/// Checks that the argument is a proper \c PointCoordinates class. This is a
/// handy concept check for functions and classes to make sure that a template

@ -22,7 +22,9 @@
#include <vtkm/Types.h>
VTKM_BOOST_PRE_INCLUDE
#include <boost/smart_ptr/shared_ptr.hpp>
VTKM_BOOST_POST_INCLUDE
namespace vtkm {
namespace cont {

@ -32,7 +32,9 @@
#include <vtkm/cont/ErrorExecution.h>
#include <vtkm/cont/internal/DeviceAdapterAlgorithmGeneral.h>
VTKM_BOOST_PRE_INCLUDE
#include <boost/type_traits/remove_reference.hpp>
VTKM_BOOST_POST_INCLUDE
// Disable warnings we check vtkm for but TBB does not.
#if defined(VTKM_GCC) || defined(VTKM_CLANG)

@ -20,8 +20,12 @@
#ifndef vtk_m_exec_arg_ExecutionSignatureTagBase_h
#define vtk_m_exec_arg_ExecutionSignatureTagBase_h
#include <vtkm/internal/ExportMacros.h>
VTKM_BOOST_PRE_INCLUDE
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_base_of.hpp>
VTKM_BOOST_POST_INCLUDE
namespace vtkm {
namespace exec {

@ -24,7 +24,9 @@
#include <vtkm/exec/arg/Fetch.h>
#include <vtkm/exec/TopologyData.h>
VTKM_BOOST_PRE_INCLUDE
#include <boost/type_traits.hpp>
VTKM_BOOST_POST_INCLUDE
namespace vtkm {
namespace exec {

@ -25,8 +25,10 @@
#include <vtkm/exec/ExecutionObjectBase.h>
VTKM_BOOST_PRE_INCLUDE
#include <boost/mpl/assert.hpp>
#include <boost/type_traits/is_base_of.hpp>
VTKM_BOOST_POST_INCLUDE
namespace vtkm {
namespace exec {

@ -24,7 +24,9 @@
#include <vtkm/cont/ArrayPortalToIterators.h>
#include <iterator>
VTKM_BOOST_PRE_INCLUDE
#include <boost/type_traits/remove_const.hpp>
VTKM_BOOST_POST_INCLUDE
// Disable warnings we check vtkm for but Thrust does not.
#if defined(VTKM_GCC) || defined(VTKM_CLANG)
@ -39,8 +41,10 @@
#pragma GCC diagnostic pop
#endif // gcc || clang
VTKM_BOOST_PRE_INCLUDE
#include <boost/type_traits/integral_constant.hpp>
#include <boost/utility/enable_if.hpp>
VTKM_BOOST_POST_INCLUDE
namespace vtkm {
namespace exec {

@ -26,8 +26,10 @@
#include <vtkm/testing/Testing.h>
VTKM_BOOST_PRE_INCLUDE
#include <boost/mpl/assert.hpp>
#include <boost/type_traits/is_same.hpp>
VTKM_BOOST_POST_INCLUDE
namespace {

@ -103,24 +103,32 @@
# endif
#endif
// Define a pair of macros, VTKM_BOOST_PRE_INCLUDE and VTKM_BOOST_POST_INCLUDE,
// that should be wrapped around any #include for a boost header file. Mostly
// this is used to set pragmas that dissable warnings that VTK-m checks for
// but boost does not.
#if defined(VTKM_GCC) || defined(VTKM_CLANG)
#define VTKM_BOOST_PRE_INCLUDE \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wconversion\"")
#define VTKM_BOOST_POST_INCLUDE \
_Pragma("GCC diagnostic pop")
#else
#define VTKM_BOOST_PRE_INCLUDE
#define VTKM_BOOST_POST_INCLUDE
#endif
// Determine whether we will use variadic templates (a new feature in C++11).
// Currently have VARIADIC_TEMPLATE support off.
#cmakedefine VTKM_NO_VARIADIC_TEMPLATE
#if !defined(VTKM_USE_VARIADIC_TEMPLATE) && !defined(VTKM_NO_VARIADIC_TEMPLATE)
// Currently using Boost to determine support.
# if defined(VTKM_GCC) || defined(VTKM_CLANG)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wconversion"
# endif // gcc || clang
VTKM_BOOST_PRE_INCLUDE
# include <boost/config.hpp>
VTKM_BOOST_POST_INCLUDE
# if defined(VTKM_GCC) || defined(VTKM_CLANG)
# pragma GCC diagnostic pop
# endif // gcc || clang
# if defined(BOOST_HAS_VARIADIC_TMPL)
# define VTKM_USE_VARIADIC_TEMPLATE 1
# endif

@ -25,12 +25,7 @@
#include <vtkm/internal/IndexTag.h>
// Disable conversion warnings inside boost
# if defined(VTKM_GCC) || defined(VTKM_CLANG)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wconversion"
# endif // gcc || clang
VTKM_BOOST_PRE_INCLUDE
#include <boost/function_types/components.hpp>
#include <boost/function_types/function_arity.hpp>
#include <boost/function_types/function_type.hpp>
@ -45,12 +40,9 @@
#include <boost/mpl/less.hpp>
#include <boost/mpl/push_back.hpp>
#include <boost/utility/enable_if.hpp>
VTKM_BOOST_POST_INCLUDE
# if defined(VTKM_GCC) || defined(VTKM_CLANG)
# pragma GCC diagnostic pop
# endif // gcc || clang
#include <vtkm/internal/FunctionInterfaceDetailPre.h>

@ -30,8 +30,10 @@
#include <vtkm/Types.h>
#include <vtkm/internal/IndexTag.h>
VTKM_BOOST_PRE_INCLUDE
#include <boost/function_types/function_type.hpp>
#include <boost/mpl/at.hpp>
VTKM_BOOST_POST_INCLUDE
#define VTKM_MAX_FUNCTION_PARAMETERS 10

@ -42,8 +42,10 @@ $# Ignore the following comment. It is meant for the generated file.
#include <vtkm/Types.h>
#include <vtkm/internal/IndexTag.h>
VTKM_BOOST_PRE_INCLUDE
#include <boost/function_types/function_type.hpp>
#include <boost/mpl/at.hpp>
VTKM_BOOST_POST_INCLUDE
$py(max_parameters=10)\
#define VTKM_MAX_FUNCTION_PARAMETERS $(max_parameters)

@ -26,7 +26,9 @@
#include <vtkm/TypeTraits.h>
#include <vtkm/VecTraits.h>
VTKM_BOOST_PRE_INCLUDE
#include <boost/static_assert.hpp>
VTKM_BOOST_POST_INCLUDE
#include <iostream>
#include <sstream>

@ -26,7 +26,9 @@
#include <vtkm/testing/Testing.h>
VTKM_BOOST_PRE_INCLUDE
#include <boost/type_traits/remove_const.hpp>
VTKM_BOOST_POST_INCLUDE
namespace vtkm {
namespace testing {

@ -36,10 +36,12 @@
#include <vtkm/exec/internal/WorkletInvokeFunctor.h>
VTKM_BOOST_PRE_INCLUDE
#include <boost/mpl/assert.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_base_of.hpp>
#include <boost/utility/enable_if.hpp>
VTKM_BOOST_POST_INCLUDE
#include <sstream>

@ -24,7 +24,9 @@
#include <vtkm/cont/testing/Testing.h>
#include <vtkm/cont/testing/MakeTestDataSet.h>
VTKM_BOOST_PRE_INCLUDE
#include <boost/shared_ptr.hpp>
VTKM_BOOST_POST_INCLUDE
namespace {