Skip to content

Commit 4891167

Browse files
[SYCL][NFC] Ignore GCC compatibility warning for diagnose_if (#9314)
This commit ignores the warning about GCC compatibility produced by the use of diagnose_if in device::has and platform::has. --------- Signed-off-by: Larsen, Steffen <[email protected]>
1 parent 7902d6b commit 4891167

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

sycl/include/sycl/device.hpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,15 @@ class __SYCL_EXPORT device : public detail::OwnerLessBase<device> {
223223
/// \return the backend associated with this device.
224224
backend get_backend() const noexcept;
225225

226+
// Clang may warn about the use of diagnose_if in __SYCL_WARN_IMAGE_ASPECT, so
227+
// we disable that warning as we make appropriate checks to ensure its
228+
// existence.
229+
// TODO: Remove this diagnostics when __SYCL_WARN_IMAGE_ASPECT is removed.
230+
#if defined(__clang__)
231+
#pragma clang diagnostic push
232+
#pragma clang diagnostic ignored "-Wgcc-compat"
233+
#endif // defined(__clang__)
234+
226235
/// Indicates if the SYCL device has the given feature.
227236
///
228237
/// \param Aspect is one of the values in Table 4.20 of the SYCL 2020
@@ -231,6 +240,11 @@ class __SYCL_EXPORT device : public detail::OwnerLessBase<device> {
231240
/// \return true if the SYCL device has the given feature.
232241
bool has(aspect Aspect) const __SYCL_WARN_IMAGE_ASPECT(Aspect);
233242

243+
// TODO: Remove this diagnostics when __SYCL_WARN_IMAGE_ASPECT is removed.
244+
#if defined(__clang__)
245+
#pragma clang diagnostic pop
246+
#endif // defined(__clang__)
247+
234248
private:
235249
std::shared_ptr<detail::device_impl> impl;
236250
device(std::shared_ptr<detail::device_impl> impl) : impl(impl) {}

sycl/include/sycl/platform.hpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,15 @@ class __SYCL_EXPORT platform : public detail::OwnerLessBase<platform> {
141141
/// \return the backend associated with this platform
142142
backend get_backend() const noexcept;
143143

144+
// Clang may warn about the use of diagnose_if in __SYCL_WARN_IMAGE_ASPECT, so
145+
// we disable that warning as we make appropriate checks to ensure its
146+
// existence.
147+
// TODO: Remove this diagnostics when __SYCL_WARN_IMAGE_ASPECT is removed.
148+
#if defined(__clang__)
149+
#pragma clang diagnostic push
150+
#pragma clang diagnostic ignored "-Wgcc-compat"
151+
#endif // defined(__clang__)
152+
144153
/// Indicates if all of the SYCL devices on this platform have the
145154
/// given feature.
146155
///
@@ -151,6 +160,11 @@ class __SYCL_EXPORT platform : public detail::OwnerLessBase<platform> {
151160
/// given feature.
152161
bool has(aspect Aspect) const __SYCL_WARN_IMAGE_ASPECT(Aspect);
153162

163+
// TODO: Remove this diagnostics when __SYCL_WARN_IMAGE_ASPECT is removed.
164+
#if defined(__clang__)
165+
#pragma clang diagnostic pop
166+
#endif // defined(__clang__)
167+
154168
/// Return this platform's default context
155169
///
156170
/// \return the default context

0 commit comments

Comments
 (0)