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

Alois Klink via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 1 13:35:30 PDT 2023


aloisklink wrote:

I've fixed reviewer comments! Sorry for the delay! I didn't have much time, and my PC isn't the fastest, so building Clang + regression tests takes a while!

As recommended by https://github.com/llvm/llvm-project/pull/68059#discussion_r1355449108, I added type checking for the attribute arguments so that we should throw an error on any invalid args that GCC throws an error (or even a warning on). Since this is a pretty substantial change, I made it all as `fixup!` commits to make the changes easier to review.

---

> gcc to have the same name for basically two different attributes

I agree, it's not ideal! Having a separate name for this attribute (e.g. `[[dealloc(func)]]` or `[[deallocator(func)]]` would be my preference. Although I think it might be worth asking the GCC team to implement it first. After all, this PR doesn't actually add support for the `[[malloc(deallocator)]]` attribute form in Clang, it just ignores it, instead of throwing an error.


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


More information about the cfe-commits mailing list