Re: [RFC PATCH 18/77] dtc-parser.y: Avoid an empty proplist
David Gibson <[email protected]> Thu, 15 Jan 2026 12:34:19 +1100
| Newsgroups | org.kernel.vger.devicetree-spec,org.kernel.vger.devicetree-compiler,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <aWhEG0GQp04wjcLs@zatzit> |
On Mon, Jan 12, 2026 at 03:19:08PM +0100, Herve Codina wrote:
> In the dts parser grammar, a nodedef is defined by
> '{' proplist subnodes '}' ';'
> with both proplist and subnodes that can be empty lists.
>
> Soon a new list will be added in the nodedef related to export symbol
> list.
>
> Having all those lists with support for empty lists will lead to some
> Bison warnings:
> warning: 4 shift/reduce conflicts [-Wconflicts-sr]
> warning: 1 reduce/reduce conflict [-Wconflicts-rr]
>
> The simpler way to remove those warning and thus have a robust parsing
> is to avoid those empty lists.
>
> Update the proplist definition and nodedef definition to avoid those
> multiple empty lists. Instead of allowing a proplist to be an empty
> list, force the list to be a non empty one and update the nodedef to
> handle explicitly the absence of the proplist to support the case where
> no properties are available, i.e. the case of a node composed only of
> sub-nodes.
>
> This doesn't change the functional behavior.
>
> Signed-off-by: Herve Codina <[email protected]>
I think it makes sense to apply this on its own before the rest of the
series, but the commit message will want rewording for that context.
> ---
> dtc-parser.y | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/dtc-parser.y b/dtc-parser.y
> index d8914d2..2e152b0 100644
> --- a/dtc-parser.y
> +++ b/dtc-parser.y
> @@ -272,12 +272,16 @@ nodedef:
> {
> $$ = build_node($2, $3, &@$);
> }
> + | '{' subnodes '}' ';'
> + {
> + $$ = build_node(NULL, $2, &@$);
> + }
> ;
>
> proplist:
> - /* empty */
> + propdef
> {
> - $$ = NULL;
> + $$ = chain_property($1, NULL);
> }
> | proplist propdef
> {
> --
> 2.52.0
>
>
--
David Gibson (he or they) | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you, not the other way
| around.
http://www.ozlabs.org/~dgibson
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmloRBoACgkQzQJF27ox 2Gd4JBAAgAIzlV/ggBtlSdHGn3PxECYpJUqGJNlb47ISIL0ebOUqBqV0/81DcatR rV6TTBirPJdGntpeWcMMKZvPo7pBMOH8bwi5Os5N/F32vA5KiT3Ozp/s1EnoDJI5 SD7LbQ2/vSpVvWEaPYCoe8nO7km0HBcozVuqy1fzhcmNgKN4Qp3CljD6eWMzamjJ 3z5su+B34UrFF3MC2yN3Arm3ekCFyBB0nANSAGKJR3Ige8TTdWNFYGn41yU/YMZH aPA8mFmCbxRMZEO3nm4GreO9hf+WBeZAtpmvaFerdMol6Za1aBjWoxKu399jsjpj yh0hM/UXvy/cxtI7JpO6in1Jpg9zC/TPMzR4HWpNcMYWAAW3A+Go2BIsAiSxEIP+ KmjDNpxA2iO/ire45kFHtRni3egiCA9IfZtRUUKaqJ4FSvzcfApn9qSNuXCeQ4DR QvlhXxQP3cuUxQ/szsTHzgSl67/vFkL3RJjZNVcPdJYdsJqskUNmb1osRwcJb929 4ql4kcZEHJJ2OfaKnB3qmiSeyQkz2FfXlDeqLHqf22zG8orYRqOzBItXVR/UkrUe FLMllpbxtZEVo5JVpaPm3Wl2MD00O/3iZNBWdVrOvjN59DTxAmtjNYr/qSHAyn7V ty2mQNJ7T1QHRImvxtKdkwVho0107nzCG1dNfENN2/GtbPI/n5g= =Dz7q -----END PGP SIGNATURE-----