-
-
Notifications
You must be signed in to change notification settings - Fork 657
importC: fix issue #20410 #22056
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
base: master
Are you sure you want to change the base?
importC: fix issue #20410 #22056
Conversation
|
Thanks for your pull request and interest in making D better, @Emmankoko! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.
|
5d16db3 to
4998e22
Compare
| version( Windows) | ||
| { | ||
| if (idx == "complex" || identx == "complex") |
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.
Where is the test for this? Why is this here?
| /* check for compiler builtins macros/ or specifier references. | ||
| * this is a workaround to avoid trying to resolve macros that | ||
| * reference other identifiers or functions | ||
| * so D users should avoid using custom macros beginning with __ | ||
| * to reference identifers |
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.
Why workaround? GDC knows what all these built-ins are so is not in the best interest to skip them.
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.
it ends up in a lot of undefined identifiers. especially when compiling druntime
compiler/src/dmd/cparse.d
Outdated
| //} | ||
| } | ||
|
|
||
| bool isCmacrosame(const(char)[] idx, const(char)[] ident) |
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.
Is this function really needed when all it's doing is id1 == id2?
compiler/src/dmd/declaration.h
Outdated
| Dsymbol *aliassym; | ||
| Dsymbol *overnext; // next in overload list | ||
| Dsymbol *_import; // !=NULL if unresolved internal alias for selective import | ||
| bool isCmacro; |
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.
Don't use bool in C++ for field members, it's a variable sized type, resulting in an incompatible class layout on some targets such as darwin/ppc.
| bool isCmacro; | |
| d_bool isCmacro; |
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.
noted.
| * probably a builtin one we don't define | ||
| * stop processing it. C macro refering identifiers | ||
| * can point to absolutely anything either defined or not | ||
| * #ifdefine hsgshsh hsshhshs is a valid C compile but emit on usage |
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.
What does this comment even mean?
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.
sometimes macros can be defined actually referring to nothing and doesn't err on compilation and can disturb importC. it can lead to breaking D semantics. so we avoid those too.
closes #20410
@dkorpel @thewilsonator