https://github.com/erichkeane closed
https://github.com/llvm/llvm-project/pull/68059
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
erichkeane wrote:
Closing, as I separately submitted this with my changes here:
[79a28aa](https://github.com/llvm/llvm-project/commit/79a28aa0a48feba34ddc3c1791ea0be88f354542)
Note original author should be in tact. Thank you for your contribution!
https://github.com/llvm/llvm-project/pull/68
erichkeane wrote:
also-also: A bug report to improve the diagnostic for `-Wmismatched-dealloc`
based on this being in the AST would be appreciated. If you could file one, it
would be greatly appreciated.
Again, sorry for the delay on this one, we managed to drop the ball on this
review.
htt
@@ -2064,13 +2064,87 @@ 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
https://github.com/erichkeane edited
https://github.com/llvm/llvm-project/pull/68059
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -2064,13 +2064,87 @@ 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
@@ -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/erichkeane commented:
Note that this just came up in another bug report (see discussion here:
https://github.com/llvm/llvm-project/issues/128026).
it seems we let this go, so I was hoping we could get this merged!.
@aloisklink : I see you're still around github, but seem t
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 `[[
erichkeane wrote:
> Hi, yes the really bad choice here is by gcc to have the same name for
> basically two different attributes. For the value, they also missed the
> opportunity to do something sensible when moving to C++ attributes, what a
> pitty. For a concrete guideline in that jungle, wh
gustedt wrote:
Hi,
yes the really bad choice here is by gcc to have the same name for basically
two different attributes.
For the value, they also missed the opportunity to do something sensible when
moving to C++ attributes, what a pitty.
For a concrete guideline in that jungle, when (= whi
erichkeane wrote:
> > I see that the fix is almost ready, good. But generally it would also have
> > helped if the `__has_c_attribute` feature test for this type of borrowed
> > attributes would provide means to distinguish different versions. Here gcc
> > as well as clang only have the value
AaronBallman wrote:
> I see that the fix is almost ready, good. But generally it would also have
> helped if the `__has_c_attribute` feature test for this type of borrowed
> attributes would provide means to distinguish different versions. Here gcc as
> well as clang only have the value 1. So
gustedt wrote:
I see that the fix is almost ready, good. But generally it would also have
helped if the `__has_c_attribute` feature test for this type of borrowed
attributes would provide means to distinguish different versions. Here gcc as
well as clang only have the value 1. So if the patch
@@ -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
@@ -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
@@ -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"
@@ -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*/
@@ -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*/
https://github.com/shafik commented:
Just a nit
https://github.com/llvm/llvm-project/pull/68059
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/shafik edited https://github.com/llvm/llvm-project/pull/68059
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -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
https://github.com/AaronBallman commented:
Thank you for the fix!
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'
@@ -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
@@ -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
@@ -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
34 matches
Mail list logo