Details
- Reviewers
sivachandra - Commits
- rG93ac449369be: [libc] Make string functions buildable with GCC
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
libc/src/string/memory_utils/bcmp_implementations.h | ||
---|---|---|
103 | What was the problem with these constexpr conditionals? Because the inline_* functions are now potentially excluded by the preprocessor, they could be invisible at compile time? |
libc/src/string/memory_utils/bcmp_implementations.h | ||
---|---|---|
103 | avx512 functions requires a specific ABI. When compiling op_x86.h without avx512 support, GCC complains about these avx512 specific functions not having the right ABI -> I had to selectively exclude them using the preprocessor. Now these functions do not exist anymore when not compiling for avx512, so we cannot refer to them in the XXX_implementations_h files. Using if constexpr would fail since the code still needs to be valid (even if disabled) so I had to use the preprocessor here as well. This is far from ideal, it adds a lot of visual clutter. Another option would be to disable the body of the function in op_x86.h instead of the function itself. So the function would still exist and could be referred to through if constexpr constructs. |
I wish I could but this would result in a compilation failure.
There's a proposal to support this use case but it's not currently implemented.
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2593r0.html
Let me know if you prefer the preprocessor solution that adds more safety at the cost of less readable code.
What was the problem with these constexpr conditionals? Because the inline_* functions are now potentially excluded by the preprocessor, they could be invisible at compile time?