> On Oct 28, 2025, at 14:26, Joseph Myers <[email protected]> wrote: > > 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).
Yeah, I think you are correct. The “counted_by” attribute is an GNU extension itself already. So, you are suggesting to support “counted_by” for VOID pointer by default, but Issue warnings when -Wpointer-arith is presenting? Qing > -- > Joseph S. Myers > [email protected] >
