Skip to content

Commit 0a4cffc

Browse files
committed
fixup: expand the diagnostic message
1 parent b3b2309 commit 0a4cffc

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3450,8 +3450,9 @@ def warn_attribute_return_pointers_only : Warning<
34503450
"%0 attribute only applies to return values that are pointers">,
34513451
InGroup<IgnoredAttributes>;
34523452
def warn_attribute_return_span_only
3453-
: Warning<"%0 attribute only applies to return values that are span-like "
3454-
"structures">,
3453+
: Warning<"%0 attribute only applies to functions that return span-like structures: "
3454+
"one field is a pointer to the allocated memory and another field is an integer with "
3455+
"the size of the allocated memory">,
34553456
InGroup<IgnoredAttributes>;
34563457
def warn_attribute_return_pointers_refs_only : Warning<
34573458
"%0 attribute only applies to return values that are pointers or references">,

clang/test/Sema/attr-malloc_span.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %clang_cc1 -verify -fsyntax-only %s
22
// RUN: %clang_cc1 -emit-llvm -o %t %s
33

4-
#include <stddef.h>
4+
typedef __SIZE_TYPE__ size_t;
55

66
typedef struct {
77
void *ptr;
@@ -21,11 +21,11 @@ typedef struct {
2121
void *ptr;
2222
void *ptr2;
2323
} invalid_span1;
24-
invalid_span1 returns_non_std_span1 (void) __attribute((malloc_span)); // expected-warning {{attribute only applies to return values that are span-like structures}}
24+
invalid_span1 returns_non_std_span1 (void) __attribute((malloc_span)); // expected-warning {{attribute only applies to functions that return span-like structures}}
2525

2626
typedef struct {
2727
void *ptr;
2828
size_t n;
2929
size_t n2;
3030
} invalid_span2;
31-
invalid_span2 returns_non_std_span2 (void) __attribute((malloc_span)); // expected-warning {{attribute only applies to return values that are span-like structures}}
31+
invalid_span2 returns_non_std_span2 (void) __attribute((malloc_span)); // expected-warning {{attribute only applies to functions that return span-like structures}}

0 commit comments

Comments
 (0)