build(c): work around clang making __COUNTER__ a warning#4044
build(c): work around clang making __COUNTER__ a warning#4044lidavidm merged 4 commits intoapache:mainfrom
__COUNTER__ a warning#4044Conversation
|
CC @paleolimbot this happens on recent Clang: google/benchmark#2057 I did the hacky thing to get around it but maybe it would be better to fix this in nanoarrow. |
paleolimbot
left a comment
There was a problem hiding this comment.
Can you wrap auto&& NAME = (RHS) in a scope in the _IMPL macros?
do {
auto&& NAME = (RHS);
if (!(NAME).ok()) {
return (NAME).ToADBC(ERROR);
}
} while(0);...should be safe, although won't work for UNWRAP_RESULT(some_type some_var) unless this works:
lhs;
do {
auto&& NAME = (RHS);
if (!(NAME).has_value()) {
return std::move(name).status();
}
lhs = std::move((name).value());
} while(0);In nanoarrow I think I can just define the status name to be a hard-coded long but almost certainly unique value since all return values would happen via side-effect and not the result code.
In apache/arrow-adbc#4044, ADBC has to work around a clang warning that declares `__COUNTER__` an extension. We don't strictly need it here so I just removed the usage. Claude Opus seems to think this is safe because of the `do { ... } while(0);` scoping but alternative opinions are welcome!
|
Updated the vendored nanoarrow and updated the macros similarly |
paleolimbot
left a comment
There was a problem hiding this comment.
Thank you!
It's a tiny bit of a bummer we can't do UNWRAP_RESULT(std::string_view create, create_query.GetString()); anymore but it's also only internal usage.
|
I think the fun time will come when arrow-cpp has to decide how/whether to fix this, since I believe we all derived our macros from that one 😅 |
Closes #4042.