Only suppress unused-local-typedef warning when it exists

The recently added pragma to suppress warnings about unused local
typedefs caused lots of dashboard failures because many GCC and clang
compiler do not have this warning so did not recognized the pragma to
suppress it. Now only use the pragma on clang compilers with a large
enough version.

I also discovered that the check for VTKM_CLANG was wrong (at least for
the most modern versions of XCode). Fixed that as well as some uses of
VTKM_CLANG that were wrong.
This commit is contained in:
Kenneth Moreland 2015-09-17 07:44:56 -06:00
parent 2ff6576c65
commit 9b22a72d6c
3 changed files with 23 additions and 7 deletions

@ -30,7 +30,7 @@ namespace vtkm {
// operation, and than casted back down to char's when return.
// This causes a false positive warning, even when the values is within
// the value types range
#if defined(VTKM_GCC)
#if defined(VTKM_GCC) || defined(VTKM_CLANG)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif // gcc || clang
@ -129,4 +129,4 @@ struct BitwiseXor
} // namespace vtkm
#endif //vtk_m_BinaryOperators_h
#endif //vtk_m_BinaryOperators_h

@ -676,7 +676,7 @@ struct BindRightBinaryOp
// operation, and than casted back down to char's when return.
// This causes a false positive warning, even when the values is within
// the value types range
#if defined(VTKM_GCC)
#if defined(VTKM_GCC) || defined(VTKM_CLANG)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif // gcc || clang

@ -32,7 +32,7 @@
#define VTKM_MSVC
#endif
#ifdef ____clang__
#if defined(____clang__) || defined(__clang__)
#define VTKM_CLANG
#endif
@ -119,14 +119,30 @@
// this is used to set pragmas that dissable warnings that VTK-m checks for
// but boost and thrust does not.
#if (defined(VTKM_GCC) || defined(VTKM_CLANG)) && !defined(VTKM_PGI)
#define VTKM_THIRDPARTY_PRE_INCLUDE \
_Pragma("GCC diagnostic push") \
#define VTK_M_THIRDPARTY_GCC_WARNING_PRAGMAS \
_Pragma("GCC diagnostic ignored \"-Wconversion\"") \
_Pragma("GCC diagnostic ignored \"-Wshadow\"") \
_Pragma("GCC diagnostic ignored \"-Wunused-parameter\"") \
_Pragma("GCC diagnostic ignored \"-Wunused-parameter\"")
// Newer versions of clang have an unused-local-typedef warning, but not older
// versions. This checks for the apple version of clang, which is different
// than other clang compiled versions. If using a non-apple version of clang,
// you might need to extend this condition.
#if defined(VTKM_CLANG) && (__apple_build_version__ >= 7000072)
#define VTK_M_THIRDPARTY_CLANG_WARNING_PRAGMAS \
_Pragma("GCC diagnostic ignored \"-Wunused-local-typedef\"")
#else
#define VTK_M_THIRDPARTY_CLANG_WARNING_PRAGMAS
#endif
#define VTKM_THIRDPARTY_PRE_INCLUDE \
_Pragma("GCC diagnostic push") \
VTK_M_THIRDPARTY_GCC_WARNING_PRAGMAS \
VTK_M_THIRDPARTY_CLANG_WARNING_PRAGMAS
#define VTKM_THIRDPARTY_POST_INCLUDE \
_Pragma("GCC diagnostic pop")
#else
#define VTKM_THIRDPARTY_PRE_INCLUDE
#define VTKM_THIRDPARTY_POST_INCLUDE