-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL][XPTI] Enable code location info when NDEBUG is not defined #5023
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
Conversation
Use the same macro as other diagnostic utilities
@@ -24,30 +24,46 @@ | |||
__SYCL_INLINE_NAMESPACE(cl) { | |||
namespace sycl { | |||
namespace detail { | |||
|
|||
#if !defined(NDEBUG) && (_MSC_VER > 1929 || __has_builtin(__builtin_FILE)) | |||
#define __XPTI_FILE_NAME __builtin_FILE() |
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 am not sure about the name of the macros because code_location can be used by different components.
Can we have __CLOC or __CODELOC prefix instead?
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.
Yes, we can. I will change it to __CODELOC.
As far as I can see, this patch does opposite - allows users to opt-IN of extended debugging information(filenames) by NOT specifying NDEBUG macro, is that correct? |
To be more specific, this patch aligns with C and C++ standards: if user defines NDEBUG, debugging facilities are disabled. You can grep CFE for NDEBUG, it is not set by the compiler, rather by your build system, like CMake. This aligns with how assert() works, for example: if you do not specify -DNDEBUG, full paths to your file will be embedded to the binary. |
Agree with that, my point was that without that patch filenames are not included with and without |
This was introduced in #5023, and broke the build with recent gcc (11.1), as gcc doesn't implement `__builtin_COLUMN` (according to LanguageExtensions.rst). The `ifdef` was simply checking for the wrong one, the build works fine with this patch.
Allow users to opt-out of extended debugging information by specifying NDEBUG macro.