https://bugs.llvm.org/show_bug.cgi?id=52545
Bug ID: 52545
Summary: Need __has_pragma
Product: clang
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected]
We have __has_feature and __has_attribute and a number of other variants so
that code can take advantage of new features while still functioning with older
clang versions. We should also have __has_pragma for the same reason.
In particular, I was recently bitten by trying to use the clang fp
reassociate(on) pragma, which is available in clang-11+; rather than producing
an "unknown pragma" warning, older clangs produce the error "invalid option
'reassociate'; expected contract".
An alternative solution (which would have worked in my case) would be to have
unknown pragma options always be a warning instead of an error, but in general
it's a better option to have __has_pragma, because it gives the user the
building block to fallback on a different solution or to produce an error in
cases where that's more appropriate.
I think a minimum-viable __has_pragma would take a string argument that's the
entire pragma body and produce a result of 1 if the string is an accepted
pragma for the current target.
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs