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 th
@@ -1,12 +1,14 @@
-// RUN: %clang_cc1 -verify -Wunused -Wused-but-marked-unused
-Wunused-parameter -fsyntax-only %s
+// RUN: %clang_cc1 -verify -Wunused -Wused-but-marked-unused
-Wunused-parameter -fsyntax-only -fdeclspec %s
int a;
inline __attribute__((noreturn(a))) void *f
@@ -289,6 +289,11 @@ Bug Fixes to Compiler Builtins
Bug Fixes to Attribute Support
^^
+- Clang now emits a warning instead of an error when using the one or two
+ argument form of GCC 11's ``__attribute__((malloc(deallocator)))``
+ or ``__attribut
@@ -1629,6 +1629,8 @@ def IFunc : Attr, TargetSpecificAttr {
def Restrict : InheritableAttr {
let Spellings = [Declspec<"restrict">, GCC<"malloc">];
+ let Args = [IdentifierArgument<"Deallocator", /*opt*/ 1>,
+ ParamIdxArgument<"DeallocatorPtrArgIndex", /*opt*/
@@ -177,6 +177,10 @@ def warn_unknown_attribute_ignored : Warning<
"unknown attribute %0 ignored">, InGroup;
def warn_attribute_ignored : Warning<"%0 attribute ignored">,
InGroup;
+def warn_multiarg_malloc_attribute_ignored: Warning<
+ "'malloc' attribute ignored because"
https://github.com/aloisklink updated
https://github.com/llvm/llvm-project/pull/68059
>From a76561f522f628b0882572f8dabee6f7e4abd5f5 Mon Sep 17 00:00:00 2001
From: Alois Klink
Date: Mon, 2 Oct 2023 19:59:06 +0100
Subject: [PATCH 1/5] [clang] Ignore GCC 11 [[malloc(x)]] attribute
Ignore the `[[
@@ -2064,13 +2064,26 @@ static void handleTLSModelAttr(Sema &S, Decl *D, const
ParsedAttr &AL) {
static void handleRestrictAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
QualType ResultType = getFunctionOrMethodResultType(D);
- if (ResultType->isAnyPointerType() || ResultT
aloisklink wrote:
> We generally want ignored attributes to be diagnosed as being ignored;
> otherwise users have a much harder time determining whether the attribute is
> working or not. I think we should issue an "attribute ignored" warning when
> we're dropping the attribute in the AST.
Pe
https://github.com/aloisklink updated
https://github.com/llvm/llvm-project/pull/68059
>From a76561f522f628b0882572f8dabee6f7e4abd5f5 Mon Sep 17 00:00:00 2001
From: Alois Klink
Date: Mon, 2 Oct 2023 19:59:06 +0100
Subject: [PATCH] [clang] Ignore GCC 11 [[malloc(x)]] attribute
Ignore the `[[mall
@@ -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
https://github.com/aloisklink created
https://github.com/llvm/llvm-project/pull/68059
Ignore the `[[malloc(x)]]` or `[[malloc(x, 1)]]` function attribute syntax
added in [GCC 11][1].
Unlike `[[malloc]]` with no arguments (which is supported by Clang), GCC uses
the one or two argument form to
11 matches
Mail list logo