[PATCH v2] dtc: Add support for named integer constants
Stephen Warren
swarren at nvidia.com
Tue Sep 20 08:13:55 EST 2011
David Gibson wrote at Thursday, September 08, 2011 7:35 PM:
> On Thu, Sep 08, 2011 at 11:32:11AM -0700, Grant Likely wrote:
> > On Thu, Sep 08, 2011 at 06:09:27AM -0700, Simon Glass wrote:
> > > Hi Stephen,
> > >
> > > On Fri, Sep 2, 2011 at 11:34 AM, Stephen Warren <swarren at nvidia.com> wrote:
> > > > Stephen Warren wrote at Tuesday, August 30, 2011 3:30 PM:
> > > >> You may define constants as follows:
> > > >>
> > > >> /define/ TWO 2;
> > > >> /define/ FOUR 4;
> > > >> /define/ OTHER FOUR;
> > > >>
> > > >> And properties may use these values as follows:
> > > >>
> > > >> foo = <1 TWO 3 FOUR 5>;
> > > >>
> > > >> Signed-off-by: Stephen Warren <swarren at nvidia.com>
...
> >
> > What are the risks of symbol conflict with this approach? I'm
> > concerned that a poorly chosen /define/ name will break parsing in
> > non-obvious ways. Would it be better to have a every define reference
> > to be explicit in the syntax?
>
> I really don't want to make identifiers - which is essentially what
> we're talking here - explicitly marked, on the basis of "be like C".
> I believe they should be safe, as long as we don't attempt to
> recognize them in property/nodename context.
Grant,
As far as I understand the parser code, the define names aren't accepted
where they'd cause conflicts with node names etc. I just tested using
node names that matched names set up with /define/, and didn't see it
cause any unexpected syntax errors.
Jon, David,
Does the change look good to go in?
--
nvpublic
More information about the devicetree-discuss
mailing list