Skip to content

[SYCL][NFC] Ignore GCC compatibility warning for diagnose_if #9314

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions sycl/include/sycl/device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,15 @@ class __SYCL_EXPORT device : public detail::OwnerLessBase<device> {
/// \return the backend associated with this device.
backend get_backend() const noexcept;

// Clang may warn about the use of diagnose_if in __SYCL_WARN_IMAGE_ASPECT, so
// we disable that warning as we make appropriate checks to ensure its
// existence.
// TODO: Remove this diagnostics when __SYCL_WARN_IMAGE_ASPECT is removed.
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wgcc-compat"
#endif // defined(__clang__)

/// Indicates if the SYCL device has the given feature.
///
/// \param Aspect is one of the values in Table 4.20 of the SYCL 2020
Expand All @@ -231,6 +240,11 @@ class __SYCL_EXPORT device : public detail::OwnerLessBase<device> {
/// \return true if the SYCL device has the given feature.
bool has(aspect Aspect) const __SYCL_WARN_IMAGE_ASPECT(Aspect);

// TODO: Remove this diagnostics when __SYCL_WARN_IMAGE_ASPECT is removed.
#if defined(__clang__)
#pragma clang diagnostic pop
#endif // defined(__clang__)

private:
std::shared_ptr<detail::device_impl> impl;
device(std::shared_ptr<detail::device_impl> impl) : impl(impl) {}
Expand Down
14 changes: 14 additions & 0 deletions sycl/include/sycl/platform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,15 @@ class __SYCL_EXPORT platform : public detail::OwnerLessBase<platform> {
/// \return the backend associated with this platform
backend get_backend() const noexcept;

// Clang may warn about the use of diagnose_if in __SYCL_WARN_IMAGE_ASPECT, so
// we disable that warning as we make appropriate checks to ensure its
// existence.
// TODO: Remove this diagnostics when __SYCL_WARN_IMAGE_ASPECT is removed.
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wgcc-compat"
#endif // defined(__clang__)

/// Indicates if all of the SYCL devices on this platform have the
/// given feature.
///
Expand All @@ -151,6 +160,11 @@ class __SYCL_EXPORT platform : public detail::OwnerLessBase<platform> {
/// given feature.
bool has(aspect Aspect) const __SYCL_WARN_IMAGE_ASPECT(Aspect);

// TODO: Remove this diagnostics when __SYCL_WARN_IMAGE_ASPECT is removed.
#if defined(__clang__)
#pragma clang diagnostic pop
#endif // defined(__clang__)

/// Return this platform's default context
///
/// \return the default context
Expand Down