Skip to content

Commit

Permalink
Remove empty quotation marks for static_assert
Browse files Browse the repository at this point in the history
  • Loading branch information
masterleinad committed Nov 2, 2023
1 parent 0e5aa15 commit 3b8c449
Show file tree
Hide file tree
Showing 36 changed files with 555 additions and 739 deletions.
4 changes: 2 additions & 2 deletions algorithms/unit_tests/TestStdAlgorithmsModOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ struct MyMovableType {
TEST(std_algorithms_mod_ops_test, move) {
MyMovableType a;
using move_t = decltype(std::move(a));
static_assert(std::is_rvalue_reference<move_t>::value, "");
static_assert(std::is_rvalue_reference<move_t>::value);

// move constr
MyMovableType b(std::move(a));
Expand All @@ -70,7 +70,7 @@ struct StdAlgoModSeqOpsTestMove {
void operator()(const int index) const {
typename ViewType::value_type a{11};
using move_t = decltype(std::move(a));
static_assert(std::is_rvalue_reference<move_t>::value, "");
static_assert(std::is_rvalue_reference<move_t>::value);
m_view(index) = std::move(a);
}

Expand Down
6 changes: 2 additions & 4 deletions algorithms/unit_tests/TestStdAlgorithmsPartitionCopy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,9 @@ void verify_data(const std::string& name, ResultType my_result,
ViewTypeDestFalse view_dest_false, PredType pred) {
using value_type = typename ViewTypeFrom::value_type;
static_assert(
std::is_same<value_type, typename ViewTypeDestTrue::value_type>::value,
"");
std::is_same<value_type, typename ViewTypeDestTrue::value_type>::value);
static_assert(
std::is_same<value_type, typename ViewTypeDestFalse::value_type>::value,
"");
std::is_same<value_type, typename ViewTypeDestFalse::value_type>::value);

const std::size_t ext = view_from.extent(0);

Expand Down
2 changes: 1 addition & 1 deletion containers/src/Kokkos_DynRankView.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1340,7 +1340,7 @@ class ViewMapping<

template <class MemoryTraits>
struct apply {
static_assert(Kokkos::is_memory_traits<MemoryTraits>::value, "");
static_assert(Kokkos::is_memory_traits<MemoryTraits>::value);

using traits_type =
Kokkos::ViewTraits<data_type, array_layout,
Expand Down
11 changes: 4 additions & 7 deletions core/src/Cuda/Kokkos_CudaSpace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,15 +280,12 @@ const std::unique_ptr<Kokkos::Cuda>& cuda_get_deep_copy_space(
bool initialize = true);

static_assert(Kokkos::Impl::MemorySpaceAccess<Kokkos::CudaSpace,
Kokkos::CudaSpace>::assignable,
"");
static_assert(Kokkos::Impl::MemorySpaceAccess<Kokkos::CudaUVMSpace,
Kokkos::CudaUVMSpace>::assignable,
"");
Kokkos::CudaSpace>::assignable);
static_assert(Kokkos::Impl::MemorySpaceAccess<
Kokkos::CudaUVMSpace, Kokkos::CudaUVMSpace>::assignable);
static_assert(
Kokkos::Impl::MemorySpaceAccess<Kokkos::CudaHostPinnedSpace,
Kokkos::CudaHostPinnedSpace>::assignable,
"");
Kokkos::CudaHostPinnedSpace>::assignable);

//----------------------------------------

Expand Down
3 changes: 1 addition & 2 deletions core/src/HIP/Kokkos_HIP_Space.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,7 @@ struct Impl::is_hip_type_space<HIPManagedSpace> : public std::true_type {};
namespace Kokkos {
namespace Impl {

static_assert(Kokkos::Impl::MemorySpaceAccess<HIPSpace, HIPSpace>::assignable,
"");
static_assert(Kokkos::Impl::MemorySpaceAccess<HIPSpace, HIPSpace>::assignable);

//----------------------------------------

Expand Down
4 changes: 2 additions & 2 deletions core/src/KokkosExp_MDRangePolicy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ constexpr Array to_array_potentially_narrowing(const U (&init)[M]) {
using T = typename Array::value_type;
Array a{};
constexpr std::size_t N = a.size();
static_assert(M <= N, "");
static_assert(M <= N);
auto* ptr = a.data();
// NOTE equivalent to
// std::transform(std::begin(init), std::end(init), a.data(),
Expand All @@ -120,7 +120,7 @@ constexpr NVCC_WONT_LET_ME_CALL_YOU_Array to_array_potentially_narrowing(
using T = typename NVCC_WONT_LET_ME_CALL_YOU_Array::value_type;
NVCC_WONT_LET_ME_CALL_YOU_Array a{};
constexpr std::size_t N = a.size();
static_assert(M <= N, "");
static_assert(M <= N);
for (std::size_t i = 0; i < M; ++i) {
a[i] = checked_narrow_cast<T>(other[i]);
(void)checked_narrow_cast<IndexType>(other[i]); // see note above
Expand Down
7 changes: 3 additions & 4 deletions core/src/Kokkos_HBWSpace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,9 @@ namespace Kokkos {

namespace Impl {

static_assert(
Kokkos::Impl::MemorySpaceAccess<Kokkos::Experimental::HBWSpace,
Kokkos::Experimental::HBWSpace>::assignable,
"");
static_assert(Kokkos::Impl::MemorySpaceAccess<
Kokkos::Experimental::HBWSpace,
Kokkos::Experimental::HBWSpace>::assignable);

template <>
struct MemorySpaceAccess<Kokkos::HostSpace, Kokkos::Experimental::HBWSpace> {
Expand Down
3 changes: 1 addition & 2 deletions core/src/Kokkos_HostSpace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ namespace Kokkos {
namespace Impl {

static_assert(Kokkos::Impl::MemorySpaceAccess<Kokkos::HostSpace,
Kokkos::HostSpace>::assignable,
"");
Kokkos::HostSpace>::assignable);

template <typename S>
struct HostMirror {
Expand Down
2 changes: 1 addition & 1 deletion core/src/Kokkos_MathematicalFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ using promote_3_t = typename promote_3<T, U, V>::type;
long double> \
FUNC(T1 x, T2 y) { \
using Promoted = Kokkos::Impl::promote_2_t<T1, T2>; \
static_assert(std::is_same_v<Promoted, long double>, ""); \
static_assert(std::is_same_v<Promoted, long double>); \
using std::FUNC; \
return FUNC(static_cast<Promoted>(x), static_cast<Promoted>(y)); \
}
Expand Down
10 changes: 5 additions & 5 deletions core/src/Kokkos_View.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -814,15 +814,15 @@ class View : public ViewTraits<DataType, Properties...> {

template <typename... Is>
static KOKKOS_FUNCTION void check_access_member_function_valid_args(Is...) {
static_assert(rank <= sizeof...(Is), "");
static_assert(sizeof...(Is) <= 8, "");
static_assert(Kokkos::Impl::are_integral<Is...>::value, "");
static_assert(rank <= sizeof...(Is));
static_assert(sizeof...(Is) <= 8);
static_assert(Kokkos::Impl::are_integral<Is...>::value);
}

template <typename... Is>
static KOKKOS_FUNCTION void check_operator_parens_valid_args(Is...) {
static_assert(rank == sizeof...(Is), "");
static_assert(Kokkos::Impl::are_integral<Is...>::value, "");
static_assert(rank == sizeof...(Is));
static_assert(Kokkos::Impl::are_integral<Is...>::value);
}

public:
Expand Down
15 changes: 6 additions & 9 deletions core/src/SYCL/Kokkos_SYCL_Space.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,19 +166,16 @@ struct is_sycl_type_space<Kokkos::Experimental::SYCLHostUSMSpace>
: public std::true_type {};

static_assert(Kokkos::Impl::MemorySpaceAccess<
Kokkos::Experimental::SYCLDeviceUSMSpace,
Kokkos::Experimental::SYCLDeviceUSMSpace>::assignable,
"");
Kokkos::Experimental::SYCLDeviceUSMSpace,
Kokkos::Experimental::SYCLDeviceUSMSpace>::assignable);

static_assert(Kokkos::Impl::MemorySpaceAccess<
Kokkos::Experimental::SYCLSharedUSMSpace,
Kokkos::Experimental::SYCLSharedUSMSpace>::assignable,
"");
Kokkos::Experimental::SYCLSharedUSMSpace,
Kokkos::Experimental::SYCLSharedUSMSpace>::assignable);

static_assert(Kokkos::Impl::MemorySpaceAccess<
Kokkos::Experimental::SYCLDeviceUSMSpace,
Kokkos::Experimental::SYCLDeviceUSMSpace>::assignable,
"");
Kokkos::Experimental::SYCLDeviceUSMSpace,
Kokkos::Experimental::SYCLDeviceUSMSpace>::assignable);

template <>
struct MemorySpaceAccess<Kokkos::HostSpace,
Expand Down
7 changes: 3 additions & 4 deletions core/src/impl/Kokkos_ViewArray.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ struct ViewDataAnalysis<DataType, ArrayLayout, Kokkos::Array<V, N, P>> {
private:
using array_analysis = ViewArrayAnalysis<DataType>;

static_assert(std::is_void<P>::value, "");
static_assert(std::is_void<P>::value);
static_assert(std::is_same<typename array_analysis::non_const_value_type,
Kokkos::Array<V, N, P>>::value,
"");
Kokkos::Array<V, N, P>>::value);
static_assert(std::is_scalar<V>::value,
"View of Array type must be of a scalar type");

Expand Down Expand Up @@ -507,7 +506,7 @@ class ViewMapping<
Kokkos::LayoutStride>::value))>,
SrcTraits, Args...> {
private:
static_assert(SrcTraits::rank == sizeof...(Args), "");
static_assert(SrcTraits::rank == sizeof...(Args));

enum : bool {
R0 = is_integral_extent<0, Args...>::value,
Expand Down
28 changes: 13 additions & 15 deletions core/src/impl/Kokkos_ViewMapping.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -657,21 +657,20 @@ struct SubviewExtents {
template <size_t... DimArgs, class... Args>
KOKKOS_INLINE_FUNCTION SubviewExtents(const ViewDimension<DimArgs...>& dim,
Args... args) {
static_assert(DomainRank == sizeof...(DimArgs), "");
static_assert(DomainRank == sizeof...(Args), "");
static_assert(DomainRank == sizeof...(DimArgs));
static_assert(DomainRank == sizeof...(Args));

// Verifies that all arguments, up to 8, are integral types,
// integral extents, or don't exist.
static_assert(
RangeRank == unsigned(is_integral_extent<0, Args...>::value) +
unsigned(is_integral_extent<1, Args...>::value) +
unsigned(is_integral_extent<2, Args...>::value) +
unsigned(is_integral_extent<3, Args...>::value) +
unsigned(is_integral_extent<4, Args...>::value) +
unsigned(is_integral_extent<5, Args...>::value) +
unsigned(is_integral_extent<6, Args...>::value) +
unsigned(is_integral_extent<7, Args...>::value),
"");
static_assert(RangeRank ==
unsigned(is_integral_extent<0, Args...>::value) +
unsigned(is_integral_extent<1, Args...>::value) +
unsigned(is_integral_extent<2, Args...>::value) +
unsigned(is_integral_extent<3, Args...>::value) +
unsigned(is_integral_extent<4, Args...>::value) +
unsigned(is_integral_extent<5, Args...>::value) +
unsigned(is_integral_extent<6, Args...>::value) +
unsigned(is_integral_extent<7, Args...>::value));

if (RangeRank == 0) {
m_length[0] = 0;
Expand Down Expand Up @@ -814,8 +813,7 @@ struct ViewDataAnalysis {
// Must match array analysis when this default template is used.
static_assert(
std::is_same<ValueType,
typename array_analysis::non_const_value_type>::value,
"");
typename array_analysis::non_const_value_type>::value);

public:
using specialize = void; // No specialization
Expand Down Expand Up @@ -3896,7 +3894,7 @@ class ViewMapping<

template <class MemoryTraits>
struct apply {
static_assert(Kokkos::is_memory_traits<MemoryTraits>::value, "");
static_assert(Kokkos::is_memory_traits<MemoryTraits>::value);

using traits_type =
Kokkos::ViewTraits<data_type, array_layout,
Expand Down
2 changes: 1 addition & 1 deletion core/src/traits/Kokkos_IndexTypeTrait.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ struct IndexTypePolicyMixin : AnalyzeNextTrait {
"Kokkos Error: More than one index type given. Search "
"compiler output for 'show_extra_index_type' to see the "
"type of the errant tag.");
static_assert(std::is_integral<IntegralIndexType>::value, "");
static_assert(std::is_integral<IntegralIndexType>::value);
static constexpr bool index_type_is_defaulted = false;
using index_type = Kokkos::IndexType<IntegralIndexType>;
};
Expand Down
2 changes: 1 addition & 1 deletion core/src/traits/Kokkos_OccupancyControlTrait.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ auto prefer(Policy const& p, DesiredOccupancy occ) {

template <typename Policy>
constexpr auto prefer(Policy const& p, MaximizeOccupancy) {
static_assert(Kokkos::is_execution_policy<Policy>::value, "");
static_assert(Kokkos::is_execution_policy<Policy>::value);
using new_policy_t =
Kokkos::Impl::OccupancyControlTrait::policy_with_trait<Policy,
MaximizeOccupancy>;
Expand Down
4 changes: 2 additions & 2 deletions core/src/traits/Kokkos_PolicyTraitAdaptor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct PolicyTraitAdaptorImpl<
TraitSpec, PolicyTemplate, type_list<ProcessedTraits...>,
type_list<MatchingTrait, ToProcessTraits...>, NewTrait,
std::enable_if_t<PolicyTraitMatcher<TraitSpec, MatchingTrait>::value>> {
static_assert(PolicyTraitMatcher<TraitSpec, NewTrait>::value, "");
static_assert(PolicyTraitMatcher<TraitSpec, NewTrait>::value);
using type = PolicyTemplate<ProcessedTraits..., NewTrait, ToProcessTraits...>;
};

Expand All @@ -92,7 +92,7 @@ template <class TraitSpec, template <class...> class PolicyTemplate,
struct PolicyTraitAdaptorImpl<TraitSpec, PolicyTemplate,
type_list<ProcessedTraits...>, type_list<>,
NewTrait> {
static_assert(PolicyTraitMatcher<TraitSpec, NewTrait>::value, "");
static_assert(PolicyTraitMatcher<TraitSpec, NewTrait>::value);
using type = PolicyTemplate<ProcessedTraits..., NewTrait>;
};

Expand Down
2 changes: 1 addition & 1 deletion core/src/traits/Kokkos_ScheduleTrait.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ namespace Experimental {

template <class Policy, class ScheduleType>
constexpr auto require(Policy const& p, Kokkos::Schedule<ScheduleType>) {
static_assert(Kokkos::is_execution_policy<Policy>::value, "");
static_assert(Kokkos::is_execution_policy<Policy>::value);
using new_policy_t = Kokkos::Impl::ScheduleTrait::policy_with_trait<
Policy, Kokkos::Schedule<ScheduleType>>;
return new_policy_t{p};
Expand Down
2 changes: 1 addition & 1 deletion core/src/traits/Kokkos_WorkItemPropertyTrait.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace Experimental {
template <class Policy, unsigned long Property>
constexpr auto require(const Policy p,
WorkItemProperty::ImplWorkItemProperty<Property>) {
static_assert(Kokkos::is_execution_policy<Policy>::value, "");
static_assert(Kokkos::is_execution_policy<Policy>::value);
using new_policy_t = Kokkos::Impl::WorkItemPropertyTrait::policy_with_trait<
Policy, WorkItemProperty::ImplWorkItemProperty<Property>>;
return new_policy_t{p};
Expand Down
30 changes: 13 additions & 17 deletions core/unit_test/TestAggregate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,35 +29,31 @@ void TestViewAggregate() {
value_type>;

static_assert(
std::is_same<typename analysis_1d::specialize, Kokkos::Array<> >::value,
"");
std::is_same<typename analysis_1d::specialize, Kokkos::Array<> >::value);

using a32_traits = Kokkos::ViewTraits<value_type **, DeviceType>;
using flat_traits =
Kokkos::ViewTraits<typename a32_traits::scalar_array_type, DeviceType>;

static_assert(
std::is_same<typename a32_traits::specialize, Kokkos::Array<> >::value,
"");
std::is_same<typename a32_traits::specialize, Kokkos::Array<> >::value);
static_assert(
std::is_same<typename a32_traits::value_type, value_type>::value, "");
static_assert(a32_traits::rank == 2, "");
static_assert(a32_traits::rank_dynamic == 2, "");
std::is_same<typename a32_traits::value_type, value_type>::value);
static_assert(a32_traits::rank == 2);
static_assert(a32_traits::rank_dynamic == 2);

static_assert(std::is_void<typename flat_traits::specialize>::value, "");
static_assert(flat_traits::rank == 3, "");
static_assert(flat_traits::rank_dynamic == 2, "");
static_assert(flat_traits::dimension::N2 == 32, "");
static_assert(std::is_void<typename flat_traits::specialize>::value);
static_assert(flat_traits::rank == 3);
static_assert(flat_traits::rank_dynamic == 2);
static_assert(flat_traits::dimension::N2 == 32);

using a32_type = Kokkos::View<Kokkos::Array<double, 32> **, DeviceType>;
using a32_flat_type = typename a32_type::array_type;

static_assert(std::is_same<typename a32_type::value_type, value_type>::value,
"");
static_assert(std::is_same<typename a32_type::pointer_type, double *>::value,
"");
static_assert(a32_type::rank == 2, "");
static_assert(a32_flat_type::rank == 3, "");
static_assert(std::is_same<typename a32_type::value_type, value_type>::value);
static_assert(std::is_same<typename a32_type::pointer_type, double *>::value);
static_assert(a32_type::rank == 2);
static_assert(a32_flat_type::rank == 3);

a32_type x("test", 4, 5);
a32_flat_type y(x);
Expand Down
20 changes: 9 additions & 11 deletions core/unit_test/TestComplex.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,17 +451,15 @@ TEST(TEST_CATEGORY, complex_issue_3867) {
ASSERT_FLOAT_EQ(x.real(), y.real());
ASSERT_FLOAT_EQ(x.imag(), y.imag());

#define CHECK_POW_COMPLEX_PROMOTION(ARGTYPE1, ARGTYPE2, RETURNTYPE) \
static_assert( \
std::is_same<RETURNTYPE, \
decltype(Kokkos::pow(std::declval<ARGTYPE1>(), \
std::declval<ARGTYPE2>()))>::value, \
""); \
static_assert( \
std::is_same<RETURNTYPE, \
decltype(Kokkos::pow(std::declval<ARGTYPE2>(), \
std::declval<ARGTYPE1>()))>::value, \
"");
#define CHECK_POW_COMPLEX_PROMOTION(ARGTYPE1, ARGTYPE2, RETURNTYPE) \
static_assert( \
std::is_same<RETURNTYPE, \
decltype(Kokkos::pow(std::declval<ARGTYPE1>(), \
std::declval<ARGTYPE2>()))>::value); \
static_assert( \
std::is_same<RETURNTYPE, \
decltype(Kokkos::pow(std::declval<ARGTYPE2>(), \
std::declval<ARGTYPE1>()))>::value);

CHECK_POW_COMPLEX_PROMOTION(Kokkos::complex<long double>, long double,
Kokkos::complex<long double>);
Expand Down

0 comments on commit 3b8c449

Please sign in to comment.