-
Notifications
You must be signed in to change notification settings - Fork 798
[SYCL] Deprecate syclcompat #19861
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
[SYCL] Deprecate syclcompat #19861
Conversation
// MSVC ignores [[deprecated]] attribute on namespace unless compiled with | ||
// /W3 or above. | ||
#ifdef _MSC_VER | ||
#define __SYCLCOMPAT_STRINGIFY(x) #x | ||
#define __SYCLCOMPAT_TOSTRING(x) __SYCLCOMPAT_STRINGIFY(x) | ||
|
||
#define __SYCLCOMPAT_WARNING(msg) \ | ||
__pragma(message(__FILE__ \ | ||
"(" __SYCLCOMPAT_TOSTRING(__LINE__) "): warning: " msg)) | ||
|
||
__SYCLCOMPAT_WARNING("syclcompat is deprecated and the deprecation warnings " | ||
"are ignored unless compiled with /W3 or above.") | ||
|
||
#undef __SYCLCOMPAT_WARNING | ||
#undef __SYCLCOMPAT_TOSTRING | ||
#undef __SYCLCOMPAT_STRINGIFY | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized that this isn't of much help as SYCL headers are treated as system headers and warnings are suppressed from them. Another option is to use #warning
instead of pragma but not all MSVC versions support #warning, as it's a C++23 feature.
@aelovikov-intel suggestions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see how that's an issue: https://godbolt.org/z/YG75Kx5rE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this Godbolt accurately describes our compilation toolchain. I was debugging the failure in the new test I added (sycl/test/syclcompat/warnings_deprecated_msvc.cpp
) and that when I found that no warning is being thrown for MSVC. Instead of including the header via -fsycl
, if I explicitly include the header -I
, then the warning is thrown properly (so the problem isn't with macros).
I also saw that we faced the same problem in #6808 as well.
In clang driver, do you know if we explicitly suppress warnings from system headers somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What warning? On the namespace syclcompat
? pragma message
isn't a warning, just a message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed offline. The problem was with clang-cl
's imitation of MSVC's option. See https://godbolt.org/z/96aG1K1G8 - clang-cl's interpretation of /external:W0
is different from that of MSVC and the clang-cl also disables pragma messages with /external:W0
.
Also, clang-cl, unlike MSVC, do not ignore [[deprecated]]
attribute and so, I've modified warnings_deprecated.cpp
test to also run on windows.
…eprecated_msvc.cpp test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, all is as expected
No description provided.