Not all platforms support priority attribute. I'm moving conditional definition of this attribute to include/__config.
Details
- Reviewers
ldionne aaron.ballman - Group Reviewers
Restricted Project - Commits
- rG2c7e24c4b689: Guard init_priority attribute within libc++
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Time | Test | |
---|---|---|
390 ms | linux > HWAddressSanitizer-x86_64.TestCases::sizes.cpp |
Event Timeline
libcxx/include/__config | ||
---|---|---|
1444 | You should use __has_attribute(init_priority). |
libcxx/include/__config | ||
---|---|---|
1444 | Oh, and I would just define that in iostream.cpp if we don't use it anywhere else, to avoid adding complexity to __config (which is already a monster). |
Thank you for review Louis. Please see inline comments.
libcxx/include/__config | ||
---|---|---|
1444 |
Sure , this will require additional changes since that attribute is enabled by default and will have to be disabled at least for z/OS. |
libcxx/include/__config | ||
---|---|---|
1444 | Interesting. In that case, I think it's fine to leave it in __config, however can you please also de-duplicate the usage in memory_resource.cpp? |
libcxx/include/__config | ||
---|---|---|
1444 | Sure, not sure if you still want to disable init_priority and use __has_attribute() guard. Please let me know before I investigate how to disable it. |
I moved the logic from memory_resource.cpp to __config as since I'm not familiar with Apple and Microsoft restrictions are still correct.
libcxx/include/experimental/__config | ||
---|---|---|
80 | Just remove that entirely and use the one from the main <__config> file. |
Moving macro to common place as requested. This makes assumption that MS and Apple restrictions were lifted at some point.
clang/include/clang/Basic/Attr.td | ||
---|---|---|
384 | This is not a very descriptive name -- if this is only supposed to be used for init_priority how about TargetSupportsInitPriority instead? Also, this change is missing test coverage and documentation changes. |
clang/include/clang/Basic/Attr.td | ||
---|---|---|
384 | For now, we can use TargetSupportsInitPriority, we can always change it if we find the need to disable other attributes. Thank you Arraon for review and suggestion for the name. |
clang/test/SemaCXX/init-priority-attr.cpp | ||
---|---|---|
26 ↗ | (On Diff #306524) | Rather than using the preprocessor, you can assign a prefix to be checked to -verify. e.g., -verify=unknown would allow you to do // unknown-warning {{unknown attribute 'init_priority' ignored}} or unknown-no-diagnostics that is only checked when -verify=unknown. I wonder if it would be cleaner to use that solution here instead of the preprocessor by adding a new RUN line that's specific to AIX, and setting some non-AIX triples for the other run lines. |
LGTM from libc++'s perspective. You should wait until the Clang part is LGTM'd before committing, of course.
clang/test/SemaCXX/init-priority-attr.cpp | ||
---|---|---|
26 ↗ | (On Diff #306524) | That simplifies a lot in the expanse of duplicating the run. |
This is not a very descriptive name -- if this is only supposed to be used for init_priority how about TargetSupportsInitPriority instead?
Also, this change is missing test coverage and documentation changes.