On Tue, 28 Oct 2025, Qing Zhao wrote:

> +      if (flag_iso)
> +     {
> +       error_at (DECL_SOURCE_LOCATION (decl),
> +                 "%qE attribute is not allowed for a pointer to void"
> +                 " when GNU extension is not enabled",
> +                 name);
> +       *no_add_attrs = true;
> +     }
> +      else if (warn_pointer_arith)
> +       pedwarn (DECL_SOURCE_LOCATION (decl),
> +                OPT_Wpointer_arith,
> +                "%qE attribute is used for a pointer to void",
> +                name);

counted_by itself is an extension, so I don't think it makes any sense for 
flag_iso to affect what cases are accepted, or to produce pedwarns for 
certain cases.  Rather, just do a warning, not a pedwarn, with 
OPT_Wpointer_arith (since it does make sense for -Wpointer-arith to affect 
whether this is diagnosed, just not for it to be an error or pedwarn).

-- 
Joseph S. Myers
[email protected]

Reply via email to