melver added a comment.
In D103958#2808967 <https://reviews.llvm.org/D103958#2808967>, @jdoerfert wrote:
>> Please bear with me, I'm updating examples and documentation. I didn't think
>> anybody would look at this while [WIP]. :-)
>
> People try to help so you have early design feedback ;)
Thank you for that. The LKML discussion got a little heated, so I worry
slightly that underpresenting the issue will cause a bad first impression.
But while we're here:
There is the consideration to make this a __builtin and not an attribute.
AFAIK a __builtin suffers from the usual problem that the information cannot be
propagated between TUs:
file1.c:
bool foo(void) { return __builtin_mustcontrol(READ_ONCE(...)); }
file2.c:
void bar(void) { if (foo()) { WRITE_ONCE(...); } }
Or is a language builtin that gives you an error when used in the wrong context
acceptable? It seems a little odd because I'm unaware of other builtins that do
that.
GCC devs expressed that GNU attribute syntax may be abused:
https://lkml.kernel.org/r/[email protected]
The attribute is simpler, and hypothetically, if it were to become part of the
language std we'd have to use [[...]] syntax anyway, so the GNU attribute
problem seems somewhat artificial to me.
[[mustcontrol]] if (READ_ONCE(...)) { ... }
[[mustcontrol]] while (...) { }
Preferences?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103958/new/
https://reviews.llvm.org/D103958
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits