-
Notifications
You must be signed in to change notification settings - Fork 58
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
CurlHandle: fix error message handling #522
Conversation
Can you add a description of what you observed is the problematic thing this is fixing please? |
cpp/include/kvikio/shim/libcurl.hpp
Outdated
* `std::string` from a `char*`, the compiler might optimize the code such that the `std::string` | ||
* is created from the full size of `__FILE__` including the trailing `\0` chars. | ||
*/ | ||
__attribute__((optnone)) inline std::string fix_conda_file_path_hack(std::string filename) |
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.
issue: I think we should explicitly request noinline
rather than hoping that optnone
will ensure the function is not inlined.
__attribute__((optnone)) inline std::string fix_conda_file_path_hack(std::string filename) | |
__attribute__((noinline)) inline std::string fix_conda_file_path_hack(std::string filename) |
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 think we can do both, no?
__attribute__((optnone)) __attribute__((noinline)) std::string fix_conda_file_path_hack(std::string filename)
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 couldn't see optnone
as a valid attribute in the GCC documentation: https://gcc.gnu.org/onlinedocs/gcc-14.2.0/gcc/Common-Function-Attributes.html
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.
Interesting, somehow it's not in GCC's but it's in Clang's saying it's available in GNU (I assume GCC): https://clang.llvm.org/docs/AttributeReference.html#optnone
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.
Maybe it should be __attribute__((optimize(0)))
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.
Maybe it should be
__attribute__((optimize(0)))
instead?
Does clang support optimize(0)
?
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.
optimize
is undocumented in Clang. 🤣
I guess you'll either have to risk leaving optnone
or do some compiler checking.
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.
Heh, lovely :)
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.
Let's see if __attribute__((noinline))
is enough
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.
If a68b9aa works then this is probably good as is. However, as @wence- pointed out optnone
is not documented in GCC and perhaps might require something different such as optimize(0)
.
/merge |
@wence- @pentschev, thanks for the help debugging this! |
When building with conda, the
__FILE__
macro will contain the (long) conda build path. At install time, this is replaced by the actual path, which may be shorter. Any extra characters are replaced by\0
.The extra
\0
is problematic ifCurlHandle
later throws an exception to Cython since while converting the exception to Python, Cython might truncate the error message.