[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260112142009.1006236-19-herve.codina@bootlin.com>
Date: Mon, 12 Jan 2026 15:19:08 +0100
From: Herve Codina <herve.codina@...tlin.com>
To: David Gibson <david@...son.dropbear.id.au>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk@...nel.org>,
Conor Dooley <conor+dt@...nel.org>
Cc: Ayush Singh <ayush@...gleboard.org>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
devicetree-compiler@...r.kernel.org,
devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org,
devicetree-spec@...r.kernel.org,
Hui Pu <hui.pu@...ealthcare.com>,
Ian Ray <ian.ray@...ealthcare.com>,
Luca Ceresoli <luca.ceresoli@...tlin.com>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
Herve Codina <herve.codina@...tlin.com>
Subject: [RFC PATCH 18/77] dtc-parser.y: Avoid an empty proplist
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 <herve.codina@...tlin.com>
---
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
Powered by blists - more mailing lists