-
-
Notifications
You must be signed in to change notification settings - Fork 641
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
Mangle conflict after ImportC statement expression gets expanded from macro #20831
Comments
To reproduce::
app.d
bug.c
ping @dkorpel since you are the author of the PR and ping @WalterBright since it impacts ImportC |
I followed your steps, but I don't see those linker warnings or a slowdown. I tried dmd master, be8668e, and the commit before that. They all take ~0.094 seconds and don't output any warnings. From inspecting nuklear.h and your linker output, I'm guessing there's a name collision when a macro containing an assert() gets expanded multiple times: #define NK_STYLE_PUSH_IMPLEMENATION(prefix, type, stack) \
...
NK_ASSERT(ctx);\
... The GNU assert macro gets expanded to a statement expression, which ImportC translates to a function literal with a supposedly unique "dgliteral_LOCATION" name, but in your case different asserts get the same mangled name. The location in your linker output point to lines 19113-19123, which doesn't match my copy of nuklear.h. Can you post the exact commit / content of your nuklear.h? |
To make sure we are testing the same thing OS: Linux x64 I'm compiling a debug build of DMD this way: EDIT: Can you add |
Edit: I can reproduce it now. I'll try to reduce it. |
Self-contained example: #include "assert.h"
int* p;
#define IMPL() \
f()\
{\
assert(p);\
assert(4 < 3);\
}
void IMPL()
void main(void) {} |
…gets expanded from macro
…gets expanded from macro
Thanks for the fix |
I'm using ImportC in my project, and i'm compiling it as a shared library, the commit be8668e introduces the following issue:
It's symbols from C source code: https://github.com/Immediate-Mode-UI/Nuklear/
It also causes heavy compilation slowdown
Build flags:
-shared -debug -betterC -fPIC
The text was updated successfully, but these errors were encountered: