[PATCH V2 2/2] dtc: cpp co-existence: add support for #line directives
David Gibson
david at gibson.dropbear.id.au
Thu Sep 27 17:07:46 EST 2012
On Wed, Sep 26, 2012 at 10:18:05AM -0600, Stephen Warren wrote:
> From: Stephen Warren <swarren at nvidia.com>
>
> Line control directives of the following formats are supported:
> #line LINE "FILE"
> # LINE "FILE" [FLAGS]
>
> This allows dtc to consume the output of pre-processors, and to provide
> error messages that refer to the original filename, including taking
> into account any #include directives that the pre-processor may have
> performed.
>
> Signed-off-by: Stephen Warren <swarren at nvidia.com>
Nice. Two small changes I'd like to see:
> +<*>^"#"(line{WS}|" "){WS}*[0-9]+{WS}+{STRING}({WS}+[0-9]+)? {
I think this can be done slightly more cleanly as:
^"#"(line)?{WS}+[0-9]+{WS}+{STRING}({WS}+[0-9]+)?
[snip]
> diff --git a/tests/propname_escapes.dts b/tests/propname_escapes.dts
> index 9f70618..9f5793d 100644
> --- a/tests/propname_escapes.dts
> +++ b/tests/propname_escapes.dts
> @@ -1,5 +1,12 @@
> /dts-v1/;
>
> +/* common format */
> +#line 3 "foo.dts"
> +/* newer gcc format */
> +# 6 "bar.dts"
> +/* newer gcc sometimes uses */
> +# 9 "baz.dts" 1
> +
I'd prefer a separate testcase for the line directives, rather than
piggybacking on the propnodename escaping testcase.
--
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
More information about the devicetree-discuss
mailing list