Re: String concatenation problem in dtc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Sat, Mar 30, 2019 at 08:11:39PM +0100, Pavel Machek wrote:
> On Sat 2019-03-30 19:52:06, Jacek Anaszewski wrote:
> > On 3/29/19 10:01 PM, Jacek Anaszewski wrote:
> > >Hi,
> > >
> > >I tried to create a macro for automatic composition of "-N" suffixed LED
> > >functions (where N is a number). Unfortunately, the preprocessor
> > >of the dtc compiler seems not to accept string concatenation.
> > >I.e. it is not possible to to the following assignment:
> > 
> > s/to to/to do/
> > 
> > >
> > >function = "hdd""-1"
> > 
> > To clarify - "function" is a new property to be introduced in the common
> > LED bindings. And in fact, probably the preprocessor has nothing to do
> > with that string concatenation it's just Device Tree compiler
> > shortcoming.
> 
> Stack overflow says:
> 
> Concatenation of adjacent string litterals isn't a feature of the
> preprocessor, it is a feature of the core languages (both C and
> C++). You could write:
> 
> And that's accurate, AFAICT. Looks like dtc does not have that
> feature.

That's correct.  I've been thinking for a while about adding some sort
of string concatenation in dtc, as well as possibly other sorts of
string expressions.  TBH, I've chiefly been hung up on the syntax.
The preferred form would be as C - just put the strings next to each
other, but I think that might cause complications in the grammar.

-- 
David Gibson			| 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

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux