Skip to content

Commit 2894df0

Browse files
committed
Using macro to save lines of code
1 parent d5f2340 commit 2894df0

File tree

1 file changed

+15
-35
lines changed

1 file changed

+15
-35
lines changed

sycl/include/sycl/ext/intel/experimental/fpga_annotated_properties.hpp

Lines changed: 15 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -345,44 +345,24 @@ template <typename... Args> struct checkHasConduitAndRegisterMap {
345345
static constexpr bool value = !(has_Conduit && has_RegisterMap);
346346
};
347347

348+
#define CHECK_INVALID_PROPERTY(property, list) \
349+
static constexpr bool has_##property = \
350+
ContainsProperty<property##_key, list>::value; \
351+
static_assert(!has_##property, \
352+
"Property " #property " cannot be specified for " \
353+
"annotated_arg<T> when T is a non pointer type.");
354+
348355
template <typename... Args>
349356
struct checkPropertiesForNonPointerType : std::true_type {
350357
using list = std::tuple<Args...>;
351-
static constexpr bool has_BufferLocation =
352-
ContainsProperty<buffer_location_key, list>::value;
353-
static_assert(!has_BufferLocation,
354-
"Property buffer location cannot be specified for "
355-
"annotated_arg<T> when T is a non pointer type.");
356-
static constexpr bool has_awidth = ContainsProperty<awidth_key, list>::value;
357-
static_assert(!has_awidth, "Property awidth cannot be specified for "
358-
"annotated_arg<T> when T is a non pointer type.");
359-
static constexpr bool has_dwidth = ContainsProperty<dwidth_key, list>::value;
360-
static_assert(!has_dwidth, "Property dwidth cannot be specified for "
361-
"annotated_arg<T> when T is a non pointer type.");
362-
static constexpr bool has_latency =
363-
ContainsProperty<latency_key, list>::value;
364-
static_assert(!has_latency, "Property latency cannot be specified for "
365-
"annotated_arg<T> when T is a non pointer type.");
366-
static constexpr bool has_read_write_mode =
367-
ContainsProperty<read_write_mode_key, list>::value;
368-
static_assert(!has_read_write_mode,
369-
"Property read_write_mode cannot be specified for "
370-
"annotated_arg<T> when T is a non pointer type.");
371-
static constexpr bool has_maxburst =
372-
ContainsProperty<maxburst_key, list>::value;
373-
static_assert(!has_maxburst,
374-
"Property maxburst cannot be specified for "
375-
"annotated_arg<T> when T is a non pointer type.");
376-
static constexpr bool has_wait_request =
377-
ContainsProperty<wait_request_key, list>::value;
378-
static_assert(!has_wait_request,
379-
"Property wait_request cannot be specified for "
380-
"annotated_arg<T> when T is a non pointer type.");
381-
static constexpr bool has_alignment =
382-
ContainsProperty<alignment_key, list>::value;
383-
static_assert(!has_alignment,
384-
"Property alignment cannot be specified for "
385-
"annotated_arg<T> when T is a non pointer type.");
358+
CHECK_INVALID_PROPERTY(buffer_location, list);
359+
CHECK_INVALID_PROPERTY(awidth, list);
360+
CHECK_INVALID_PROPERTY(dwidth, list);
361+
CHECK_INVALID_PROPERTY(latency, list);
362+
CHECK_INVALID_PROPERTY(read_write_mode, list);
363+
CHECK_INVALID_PROPERTY(maxburst, list);
364+
CHECK_INVALID_PROPERTY(wait_request, list);
365+
CHECK_INVALID_PROPERTY(alignment, list);
386366
};
387367
} // namespace detail
388368

0 commit comments

Comments
 (0)