-
Notifications
You must be signed in to change notification settings - Fork 24
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
__builtin_FILE()
and __FILE__
have different strings
#42
Comments
What is the problem, and what do you think a solution would be? We shortened the file version to minimize the IRAM/flash usage (some of our templates have names that expand to 100 chars, plus space for the full user path to the install dir) |
Just to note it as a difference, tbh it was a surprise to me that it does that. I'd prefer not solving it :)
(brb searching the history) |
I don't think you can wrap If there's a problem I think we can do the same patch in the C++ libs. There are lots of functional correctness patches already, two more won't make any difference. :) |
Maybe it should do this instead?
And yes, I meant the 2nd one - at specific call sites make constexpr
const char* __basename__(const char* ptr) {
...
return ptr;
}
...
foo(__basename__(__FILE__)); -> https://godbolt.org/z/WKr1v7Pvn (it escapes me why the asm string still has the |
I believe there were issues with the file-prefix-map when tried a couple years earlier. Either it was unsupported or the platform.txt infrastructure to make it work was spaghetti code. For now, since it's not hurting anything, I say we can just leave this here and if it crops up sometime later we can dig deeper. |
__FILE__
has a short onehttps://github.com/earlephilhower/esp-quick-toolchain/blob/master/patches/gcc10.3/gcc-file-shortname.patch
Builtin gives the long one (even in the current master?)
https://github.com/gcc-mirror/gcc/blob/9b111debbfb79a0aa01091c8b1936b05a11ffcf9/gcc/builtins.cc#L9519-L9534
https://github.com/gcc-mirror/gcc/blob/9b111debbfb79a0aa01091c8b1936b05a11ffcf9/libcpp/macro.cc#L544-L576
Minor issue, but the only thing it affects is
std::source_location
(c++20) akastd::experimental::source_location
(before c++20)https://en.cppreference.com/w/cpp/experimental/source_location
https://en.cppreference.com/w/cpp/source_location
The text was updated successfully, but these errors were encountered: