-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[clang] Support __typeof_unqual__ in all C modes #87392
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
Conversation
GCC has added __typeof_unqual__ to allow typeof_unqual to be used in all C modes (not just C23 and newer), similar to __typeof__ and typeof. https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=607d9d50ee44163cee621cd991600acaf78c2fee The Linux kernel would like to start using __typeof_unqual__ to strip type qualifiers such as address spaces from inputs to macros but cannot switch to C23 due to compiler version requirements. Match GCC and allow __typeof_unqual__ in all C modes. Closes: llvm#76423 Link: https://lore.kernel.org/CAFULd4YG21NdF_qNVBGDtXO6xnaYFeRPvKicB=gpgUUqYE=4jw@mail.gmail.com/ Signed-off-by: Nathan Chancellor <[email protected]>
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.
Thanks for the patch!
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.
Thank you for this; I think it's a very reasonable extension!
Allow __typeof_unqual__ in C++ Signed-off-by: Nathan Chancellor <[email protected]>
While in the area, add a test for __typeof, which should be handled in the same manner as __typeof__. Signed-off-by: Nathan Chancellor <[email protected]>
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.
LGTM, please add a C++-specific test when landing, since this is also going into C++.
Add a C++ test, as this will be exposed there as well Signed-off-by: Nathan Chancellor <[email protected]>
Does 4f9e79b seem reasonable on that front? Should I add a test that |
Yup, thank you!
I don't think there's a need for that (your patch doesn't change the status quo for |
Include more coverage for new test Signed-off-by: Nathan Chancellor <[email protected]>
Since it is a new test, I will add that coverage just to make it a little more obvious that is expected: c89b969 I'll merge this once presubmit is finished and no obvious regressions are noticed, thank you both for the quick feedback! |
Would it make sense to apply this to |
The final decision is Toms, but I don't think it qualifies since we are so late in the current process and that 19 will start in just a few months. |
GCC has added
__typeof_unqual__
to allowtypeof_unqual
to be used in all C modes (not just C23 and newer), similar to__typeof__
andtypeof
.https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=607d9d50ee44163cee621cd991600acaf78c2fee
The Linux kernel would like to start using
__typeof_unqual__
to strip type qualifiers such as address spaces from inputs to macros but cannot switch to C23 due to compiler version requirements.Match GCC and allow
__typeof_unqual__
in all C modes.Closes: #76423
Link: https://lore.kernel.org/CAFULd4YG21NdF_qNVBGDtXO6xnaYFeRPvKicB=gpgUUqYE=4jw@mail.gmail.com/
PR notes/commentary:
__typeof__
was being used normally versus being explicitly tested aside from this test.