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
- use enum to index into diagnostics
- rename err_counted_by* diagnostics to err_count_attr* when the
diagnostic applies to other attributes than only counted_by (sized_by,
counted_by_or_null, sized_by_or_null)
- suggest using counted_by when arrays are annotated with sized_by,
counted_by_or_null or sized_by_or_null
- update release notes with example use case for sized_by_or_null
"'%select{counted_by|sized_by|counted_by_or_null|sized_by_or_null}1' field %0 isn't within the same struct as the annotated %select{pointer|flexible array}2">;
"'%select{counted_by|sized_by|counted_by_or_null|sized_by_or_null}0' only applies to pointers%select{ or C99 flexible array members|||}0%select{|; did you mean to use 'counted_by'?}1">;
structbar**ptr__counted_by_or_null(global); // expected-error {{field 'global' in 'counted_by_or_null' not inside structure}}
81
+
};
82
+
83
+
structself_referrential {
84
+
intbork;
85
+
structbar*self[] __counted_by_or_null(self); // expected-error {{use of undeclared identifier 'self'}}
86
+
};
87
+
88
+
structnon_int_count {
89
+
doubledbl_count;
90
+
structbar**ptr__counted_by_or_null(dbl_count); // expected-error {{'counted_by_or_null' requires a non-boolean integer type argument}}
91
+
};
92
+
93
+
structarray_of_ints_count {
94
+
intintegers[2];
95
+
structbar**ptr__counted_by_or_null(integers); // expected-error {{'counted_by_or_null' requires a non-boolean integer type argument}}
96
+
};
97
+
98
+
structnot_a_c99_fam {
99
+
intcount;
100
+
structbar*non_c99_fam[0] __counted_by_or_null(count); // expected-error {{'counted_by_or_null' only applies to pointers; did you mean to use 'counted_by'?}}
101
+
};
102
+
103
+
structannotated_with_anon_struct {
104
+
unsigned longflags;
105
+
struct {
106
+
unsigned charcount;
107
+
int*ptr__counted_by_or_null(crount); // expected-error {{use of undeclared identifier 'crount'}}
structcount_unknown*ptr__counted_by_or_null(count); // expected-error {{'counted_by_or_null' cannot be applied to a pointer with pointee of unknown size because 'struct count_unknown' is an incomplete type}}
119
+
};
120
+
121
+
structon_member_ptr_incomplete_const_ty_ty_pos {
122
+
intcount;
123
+
conststructcount_unknown*ptr__counted_by_or_null(count); // expected-error {{'counted_by_or_null' cannot be applied to a pointer with pointee of unknown size because 'const struct count_unknown' is an incomplete type}}
124
+
};
125
+
126
+
structon_member_ptr_void_ty_ty_pos {
127
+
intcount;
128
+
void*ptr__counted_by_or_null(count); // expected-error {{'counted_by_or_null' cannot be applied to a pointer with pointee of unknown size because 'void' is an incomplete type}}
129
+
};
130
+
131
+
typedefvoid(fn_ty)(int);
132
+
133
+
structon_member_ptr_fn_ptr_ty {
134
+
intcount;
135
+
fn_ty**ptr__counted_by_or_null(count);
136
+
};
137
+
138
+
structon_member_ptr_fn_ty {
139
+
intcount;
140
+
fn_ty*ptr__counted_by_or_null(count); // expected-error {{'counted_by_or_null' cannot be applied to a pointer with pointee of unknown size because 'fn_ty' (aka 'void (int)') is a function type}}
0 commit comments