[all-commits] [llvm/llvm-project] 79a28a: [clang] Ignore GCC 11 [[malloc(x)]] attribute

Alois Klink via All-commits all-commits at lists.llvm.org
Thu Feb 27 08:07:21 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 79a28aa0a48feba34ddc3c1791ea0be88f354542
      https://github.com/llvm/llvm-project/commit/79a28aa0a48feba34ddc3c1791ea0be88f354542
  Author: Alois Klink <alois at aloisklink.com>
  Date:   2025-02-27 (Thu, 27 Feb 2025)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/Attr.td
    M clang/include/clang/Basic/AttrDocs.td
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/CodeGen/CGCall.cpp
    M clang/lib/Sema/SemaDeclAttr.cpp
    A clang/test/CodeGen/attr-malloc.c
    M clang/test/Sema/attr-args.c
    M clang/test/SemaCXX/attr-print.cpp

  Log Message:
  -----------
  [clang] Ignore GCC 11 [[malloc(x)]] attribute

Ignore the `[[malloc(x)]]` or `[[malloc(x, 1)]]` function attribute
syntax added in [GCC 11][1] and print a warning instead of an error.

Unlike `[[malloc]]` with no arguments (which is supported by Clang),
GCC uses the one or two argument form to specify a deallocator for
GCC's static analyzer.

Code currently compiled with `[[malloc(x)]]` or
`__attribute((malloc(x)))` fails with the following error:
`'malloc' attribute takes no arguments`.

[1]: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;f=gcc/doc/extend.texi;h=dce6c58db87ebf7f4477bd3126228e73e4eeee97#patch6

Fixes: https://github.com/llvm/llvm-project/issues/51607
Partial-Bug: https://github.com/llvm/llvm-project/issues/53152



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list