[clang] [clang] Ignore GCC 11 `[[malloc(x)]]` attribute (PR #68059)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 11 10:36:41 PDT 2023


================
@@ -177,6 +177,10 @@ def warn_unknown_attribute_ignored : Warning<
   "unknown attribute %0 ignored">, InGroup<UnknownAttributes>;
 def warn_attribute_ignored : Warning<"%0 attribute ignored">,
   InGroup<IgnoredAttributes>;
+def warn_multiarg_malloc_attribute_ignored: Warning<
+  "'malloc' attribute ignored because"
+  " Clang does not support the one/two argument form">,
+  InGroup<IgnoredAttributes>;
----------------
AaronBallman wrote:

```suggestion
def warn_attribute_form_ignored : Warning<
  "%0 attribute ignored; Clang does not yet support this attribute signature">,
  InGroup<IgnoredAttributes>;
```
If we generalize the wording a bit, we can reuse this diagnostic for other circumstances where we don't yet support a particular signature.

Also, this diagnostic should be moved to DiagnosticSemaKinds.td (it's only diagnosed from `clang/lib/Sema`, so no need for it to be in the "common" diagnostics file for cross-lib diagnostics).

https://github.com/llvm/llvm-project/pull/68059


More information about the cfe-commits mailing list