[clang] [clang] Ignore GCC 11 `[[malloc(x)]]` attribute (PR #68059)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 25 14:35:48 PST 2025
================
@@ -4122,6 +4122,9 @@ def RestrictDocs : Documentation {
The ``malloc`` attribute indicates that the function acts like a system memory
allocation function, returning a pointer to allocated storage disjoint from the
storage for any other object accessible to the caller.
+
+The form of ``malloc`` with one or two arguments (supported by GCC 11) is
+currently ignored by Clang.
----------------
erichkeane wrote:
I would like it if we updated the documentation here to be something more like:
```
The ``malloc`` attribute has two forms with different functionality. The first
is when it is used without arguments, where it marks that a function acts like
a system memory allocation function, returning a pointer to allocated storage
that does not alias storage from any other object accessible to the caller.
The second form is when ``malloc`` takes one or two arguments. The first argument
names a function that should be associated with this function as its deallocation
function. When this form is used, it enables the compiler to diagnose when the
incorrect deallocation function is used with this variable. However the associated
warning, spelled `-Wmismatched-dealloc` in GCC, is not yet implemented in clang.
```
https://github.com/llvm/llvm-project/pull/68059
More information about the cfe-commits
mailing list