[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 9 08:58:48 PDT 2024
================
@@ -10798,6 +10798,95 @@ def warn_imp_cast_drops_unaligned : Warning<
"implicit cast from type %0 to type %1 drops __unaligned qualifier">,
InGroup<DiagGroup<"unaligned-qualifier-implicit-cast">>;
+def warn_func_effect_allocates : Warning<
+ "'%0' function must not allocate or deallocate memory">,
----------------
Sirraide wrote:
I think I’ve already pointed this out before, but it’s been a while, so just as a reminder, since this is probably issued in a function anyway, I don’t think the function name really needs to be included in the diagnostic.
Also, unless this is accompanied by other diagnostics—and even then maybe actually—this diagnostic should probably indicate *why* it shouldn’t allocate memory, e.g. maybe something along the lines of ‘\<whatever expression is causing this warning> is not allowed in function declared 'nolock'/'noalloc'/\<whatever effect is causing this to be disallowed>’
https://github.com/llvm/llvm-project/pull/84983
More information about the cfe-commits
mailing list