> On Apr 7, 2025, at 10:31, Michael Matz <m...@suse.de> wrote: > > Hello, > > On Mon, 7 Apr 2025, Martin Uecker wrote: > >>> So, what specifically would the two attributes do different? FWIW: what >>> worries me about accepting a generic expression in counted_by, that isn't >>> prefixed by a (possibly empty) decl, is that after seeing a non-type >>> identifier the parser doesn't yet know if it's the lone-ident case (look >>> up in struct scope) or the expression case (look up everything in global >>> scope). It requires look-ahead to decide this. >>> >>> Would that be the difference between the attributes? One accepting _only_ >>> a lone-ident or the decl+expr syntax, and the other _only_ expressions >>> that are never looked up in struct-scope (not even if its lone-ident)? >> >> My understanding is that one accepts only a lone identifier and nothing >> else, i.e. >> >> counted_by(identifier) >> >> and the other only accepts expressions, possibly including a forward >> declaration. >> >> counted_by_expr(expression) >> counted_by_expr(decl; expression) > > What exactly happens when counted_by_expr is used with only an identifier > expression, without decl? Is the ident looked up normally, i.e. not in > struct scope. Yes, with the new counted_by_expr, all identifiers in the expression that are not declared before the expression will be looked up normally. Qing > If so, then good, it would resolve my worry. > > > Ciao, > Michael.
- Re: [RFC] [C]New syntax for the argument of counted_by attri... Michael Matz
- Re: [RFC] [C]New syntax for the argument of counted_by attri... Qing Zhao
- Re: [RFC] [C]New syntax for the argument of counted_by attri... Michael Matz
- Re: [RFC] [C]New syntax for the argument of counted_by attri... Martin Uecker
- Re: [RFC] [C]New syntax for the argument of counted_by attri... Bill Wendling
- Re: [RFC] [C]New syntax for the argument of counted_by attri... Qing Zhao
- Re: [RFC] [C]New syntax for the argument of counted_by attri... Bill Wendling
- Re: [RFC] [C]New syntax for the argument of counted_by attri... Michael Matz
- Re: [RFC] [C]New syntax for the argument of counted_by attri... Martin Uecker
- Re: [RFC] [C]New syntax for the argument of counted_by attri... Michael Matz
- Re: [RFC] [C]New syntax for the argument of counted_by attri... Qing Zhao
- Re: [RFC] [C]New syntax for the argument of counted_by attri... Bill Wendling
- Re: [RFC] [C]New syntax for the argument of counted_by attri... Qing Zhao
- Re: [RFC] [C]New syntax for the argument of counted_by attri... Bill Wendling
- Re: [RFC] [C]New syntax for the argument of counted_by attri... Michael Matz
- Re: [RFC] [C]New syntax for the argument of counted_by attri... Martin Uecker
- Re: [RFC] [C]New syntax for the argument of counted_by attri... Kees Cook
- Re: [RFC] [C]New syntax for the argument of counted_by attri... Qing Zhao
- Re: [RFC] [C]New syntax for the argument of counted_by attri... Kees Cook
- Re: [RFC] [C]New syntax for the argument of counted_by attri... Bill Wendling
- Re: [RFC] [C]New syntax for the argument of counted_by attri... Michael Matz