+2026-05-03 Bruno Haible <bruno@clisp.org>
+
+ exclude: Use the counted_by attribute.
+ * lib/exclude.c (struct exclude_pattern): Mark the exclude field as
+ counted_by exclude_count. Swap these fields (needed for clang, see
+ <https://discourse.llvm.org/t/rfc-forward-referencing-a-struct-member-within-bounds-annotations/85510>).
+ (new_exclude_segment): Update.
+ (add_exclude): Increase pat->exclude_count before writing into
+ pat->exclude.
+
2026-05-03 Bruno Haible <bruno@clisp.org>
dfa: Use the counted_by attribute.
struct exclude_pattern
{
- struct patopts *exclude;
- idx_t exclude_alloc;
idx_t exclude_count;
+ struct patopts *exclude
+ _GL_ATTRIBUTE_COUNTED_BY (exclude_count);
+ idx_t exclude_alloc;
};
enum exclude_type
switch (type)
{
case exclude_pattern:
- sp->v.pat = (struct exclude_pattern) { NULL, 0, 0 };
+ sp->v.pat = (struct exclude_pattern) { 0, NULL, 0 };
break;
case exclude_hash:
if (pat->exclude_count == pat->exclude_alloc)
pat->exclude = xpalloc (pat->exclude, &pat->exclude_alloc, 1, -1,
sizeof *pat->exclude);
- struct patopts *patopts = &pat->exclude[pat->exclude_count++];
+ idx_t pat_index = pat->exclude_count++;
+ struct patopts *patopts = &pat->exclude[pat_index];
patopts->options = options;
if (options & EXCLUDE_REGEX)