mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-16 17:22:55 +00:00
Suppress bad conversion warnings generated by gcc.
This commit is contained in:
parent
0b4cb9c2c6
commit
06f1345316
@ -24,6 +24,17 @@
|
||||
|
||||
namespace vtkm {
|
||||
|
||||
// Disable conversion warnings for Sum and Product on GCC only.
|
||||
// GCC creates false positive warnings for signed/unsigned char* operations.
|
||||
// This occurs because the values are implicitly casted up to int's for the
|
||||
// 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)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wconversion"
|
||||
#endif // gcc || clang
|
||||
|
||||
/// Binary Predicate that takes two arguments argument \c x, and \c y and
|
||||
/// returns sum (addition) of the two values.
|
||||
/// Note: Requires Type \p T implement the + operator.
|
||||
@ -48,6 +59,11 @@ struct Product
|
||||
}
|
||||
};
|
||||
|
||||
#if defined(VTKM_GCC) || defined(VTKM_CLANG)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif // gcc || clang
|
||||
|
||||
|
||||
/// Binary Predicate that takes two arguments argument \c x, and \c y and
|
||||
/// returns the \c x if x > y otherwise returns \c y.
|
||||
/// Note: Requires Type \p T implement the < operator.
|
||||
|
14
vtkm/Types.h
14
vtkm/Types.h
@ -670,6 +670,16 @@ struct BindRightBinaryOp
|
||||
}
|
||||
};
|
||||
|
||||
// Disable conversion warnings for Add, Subtract, Multiply, Divide on GCC only.
|
||||
// GCC creates false positive warnings for signed/unsigned char* operations.
|
||||
// This occurs because the values are implicitly casted up to int's for the
|
||||
// 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)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wconversion"
|
||||
#endif // gcc || clang
|
||||
struct Add
|
||||
{
|
||||
template<typename T>
|
||||
@ -715,6 +725,10 @@ struct Negate
|
||||
}
|
||||
};
|
||||
|
||||
#if defined(VTKM_GCC) || defined(VTKM_CLANG)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif // gcc || clang
|
||||
|
||||
} // namespace internal
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user