All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: Scott Wood <scottwood@freescale.com>
Cc: Mitch Bradley <wmb@firmworks.com>, Michal Marek <mmarek@suse.cz>,
	Stephen Warren <swarren@nvidia.com>,
	devicetree-discuss@lists.ozlabs.org,
	linux-kernel@vger.kernel.org
Subject: Re: dtc: import latest upstream dtc
Date: Wed, 10 Oct 2012 09:15:17 -0600	[thread overview]
Message-ID: <50759105.2000406@wwwdotorg.org> (raw)
In-Reply-To: <1349827466.26044.16@snotra>

On 10/09/2012 06:04 PM, Scott Wood wrote:
> On 10/09/2012 06:20:53 PM, Mitch Bradley wrote:
>> On 10/9/2012 11:16 AM, Stephen Warren wrote:
>> > On 10/01/2012 12:39 PM, Jon Loeliger wrote:
>> >>>
>> >>> What more do you think needs discussion re: dtc+cpp?
>> >>
>> >> How not to abuse the ever-loving shit out of it? :-)
>> >
>> > Perhaps we can just handle this through the regular patch review
>> > process; I think it may be difficult to define and agree upon exactly
>> > what "abuse" means ahead of time, but it's probably going to be easy
>> > enough to recognize it when one sees it?
>>
>>
>> One of the ways it could get out of hand would be via "include
>> dependency hell".  People will be tempted to reuse existing .h files
>> containing pin definitions, which, if history is a guide, will end up
>> depending on all sorts of other .h files.
>>
>> Another problem I often face with symbolic names is the difficulty of
>> figuring out what the numerical values really are (for debugging),
>> especially when .h files are in different subtrees from the files that
>> use the definitions, and when they use multiple macro levels and fancy
>> features like concatenation.  Sometimes I think it's clearer just to
>> write the number and use a comment to say what it is.
> 
> Both comments apply just as well to ordinary C code, and I don't think
> anyone would seriously suggest just using comments instead for C code.
> 
> Is there a way to ask CPP to evaluate a macro in the context of the
> input file, rather than produce normal output?  If not, I guess you
> could make a tool that creates a wrapper file that includes the main
> file and then evaluates the symbol you want.

I'm not sure what "evaluate a macro in the context of the input file"
means. Macros are obviously already evaluated based on the current set
of macros defined by the file that's been processed or those it
included. Do you mean only allowing the use of macros in the current
file and not included files? What exactly would the wrapper you
mentioned do?


WARNING: multiple messages have this Message-ID (diff)
From: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
To: Scott Wood <scottwood-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
Cc: Michal Marek <mmarek-AlSwsSmVLrQ@public.gmane.org>,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: dtc: import latest upstream dtc
Date: Wed, 10 Oct 2012 09:15:17 -0600	[thread overview]
Message-ID: <50759105.2000406@wwwdotorg.org> (raw)
In-Reply-To: <1349827466.26044.16@snotra>

On 10/09/2012 06:04 PM, Scott Wood wrote:
> On 10/09/2012 06:20:53 PM, Mitch Bradley wrote:
>> On 10/9/2012 11:16 AM, Stephen Warren wrote:
>> > On 10/01/2012 12:39 PM, Jon Loeliger wrote:
>> >>>
>> >>> What more do you think needs discussion re: dtc+cpp?
>> >>
>> >> How not to abuse the ever-loving shit out of it? :-)
>> >
>> > Perhaps we can just handle this through the regular patch review
>> > process; I think it may be difficult to define and agree upon exactly
>> > what "abuse" means ahead of time, but it's probably going to be easy
>> > enough to recognize it when one sees it?
>>
>>
>> One of the ways it could get out of hand would be via "include
>> dependency hell".  People will be tempted to reuse existing .h files
>> containing pin definitions, which, if history is a guide, will end up
>> depending on all sorts of other .h files.
>>
>> Another problem I often face with symbolic names is the difficulty of
>> figuring out what the numerical values really are (for debugging),
>> especially when .h files are in different subtrees from the files that
>> use the definitions, and when they use multiple macro levels and fancy
>> features like concatenation.  Sometimes I think it's clearer just to
>> write the number and use a comment to say what it is.
> 
> Both comments apply just as well to ordinary C code, and I don't think
> anyone would seriously suggest just using comments instead for C code.
> 
> Is there a way to ask CPP to evaluate a macro in the context of the
> input file, rather than produce normal output?  If not, I guess you
> could make a tool that creates a wrapper file that includes the main
> file and then evaluates the symbol you want.

I'm not sure what "evaluate a macro in the context of the input file"
means. Macros are obviously already evaluated based on the current set
of macros defined by the file that's been processed or those it
included. Do you mean only allowing the use of macros in the current
file and not included files? What exactly would the wrapper you
mentioned do?

  parent reply	other threads:[~2012-10-10 15:15 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-28 21:25 [PATCH] dtc: import latest upstream dtc Stephen Warren
2012-09-29 21:06 ` Jon Loeliger
2012-10-01 16:09 ` Rob Herring
2012-10-01 16:13   ` Stephen Warren
2012-10-01 16:13     ` Stephen Warren
2012-10-01 17:56     ` Rob Herring
2012-10-01 17:56       ` Rob Herring
2012-10-01 18:33       ` Stephen Warren
2012-10-01 18:39         ` Jon Loeliger
2012-10-01 18:39           ` Jon Loeliger
2012-10-09 21:16           ` Stephen Warren
2012-10-09 21:16             ` Stephen Warren
2012-10-09 23:20             ` Mitch Bradley
2012-10-09 23:20               ` Mitch Bradley
2012-10-10  0:04               ` Scott Wood
2012-10-10  0:04                 ` Scott Wood
2012-10-10  4:43                 ` Warner Losh
2012-10-10  7:24                   ` David Gibson
2012-10-10 14:41                     ` Warner Losh
2012-10-10 14:41                       ` Warner Losh
2012-10-10 23:06                       ` David Gibson
2012-10-10 15:16                     ` Stephen Warren
2012-10-10 15:33                       ` Rob Herring
2012-10-10 16:19                         ` Stephen Warren
2012-10-10 17:18                           ` Rob Herring
2012-10-10 18:42                             ` Stephen Warren
2012-10-10 23:16                         ` David Gibson
2012-10-10 23:16                           ` David Gibson
2012-10-11  1:42                           ` Mitch Bradley
2012-10-11  5:11                             ` David Gibson
2012-10-11  5:11                               ` David Gibson
2012-10-10 23:09                       ` David Gibson
2012-10-10 23:09                         ` David Gibson
2012-10-10 15:15                 ` Stephen Warren [this message]
2012-10-10 15:15                   ` Stephen Warren
2012-10-10 16:09                   ` Scott Wood
2012-10-10 16:09                     ` Scott Wood
2012-10-10 16:22                     ` Stephen Warren
2012-10-10 23:18                       ` David Gibson
2012-10-12 17:24                         ` Stephen Warren
2012-10-13  6:24                           ` David Gibson
2012-10-13  6:24                             ` David Gibson
2012-10-13 13:42                             ` Segher Boessenkool
2012-10-13 13:42                               ` Segher Boessenkool
2012-10-14  0:16                               ` David Gibson
2012-10-14  0:16                                 ` David Gibson
2012-10-10 17:09             ` Rob Herring
2012-10-10 18:23               ` Mitch Bradley
2012-10-10 18:23                 ` Mitch Bradley
2012-10-10 18:45                 ` Stephen Warren
2012-10-10 18:45                   ` Stephen Warren
2012-10-10 18:56                   ` Mitch Bradley
2012-10-10 18:56                     ` Mitch Bradley
2012-10-11  0:14                     ` David Gibson
2012-10-10 23:54                   ` David Gibson
2012-10-10 18:40               ` Stephen Warren
2012-10-10 18:52                 ` Mitch Bradley
2012-10-10 18:52                   ` Mitch Bradley
2012-10-01 18:02   ` Jon Loeliger
2012-10-01 18:02     ` Jon Loeliger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50759105.2000406@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.cz \
    --cc=scottwood@freescale.com \
    --cc=swarren@nvidia.com \
    --cc=wmb@firmworks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.