You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Subject: drm/radeon: Remove __counted_by from StateArray.states[]
5
+
6
+
Work for __counted_by on generic pointers in structures (not just
7
+
flexible array members) has started landing in Clang 19 (current tip of
8
+
tree). During the development of this feature, a restriction was added
9
+
to __counted_by to prevent the flexible array member's element type from
10
+
including a flexible array member itself such as:
11
+
12
+
struct foo {
13
+
int count;
14
+
char buf[];
15
+
};
16
+
17
+
struct bar {
18
+
int count;
19
+
struct foo data[] __counted_by(count);
20
+
};
21
+
22
+
because the size of data cannot be calculated with the standard array
23
+
size formula:
24
+
25
+
sizeof(struct foo) * count
26
+
27
+
This restriction was downgraded to a warning but due to CONFIG_WERROR,
28
+
it can still break the build. The application of __counted_by on the
29
+
states member of 'struct _StateArray' triggers this restriction,
30
+
resulting in:
31
+
32
+
drivers/gpu/drm/radeon/pptable.h:442:5: error: 'counted_by' should not be applied to an array with element of unknown size because 'ATOM_PPLIB_STATE_V2' (aka 'struct _ATOM_PPLIB_STATE_V2') is a struct type with a flexible array member. This will be an error in a future compiler version [-Werror,-Wbounds-safety-counted-by-elt-type-unknown-size]
0 commit comments