Re: [PATCH] sim: avoid TRACE redefine warnings

Mike Frysinger
2010-03-15T18:35:24Z

[-- Attachment #1: Type: Text/Plain, Size: 2266 bytes --]

On Monday 15 March 2010 12:49:34 Joel Brobecker wrote:
> > as i mentioned in the first e-mail, "TRACE" is defined on the command
> > line, so any macro named "TRACE" has to be renamed.
>
> I understood why you had to rename the macro. The problem is that
> I'm wondering what this macro is supposed to be used for. It's important
> because I suspect the change that you made might be incorrect, depending
> on the answer to the question above. For instance, I suspect that the
> use of the TRACE macro in that file might be related to
> --enable-sim-traces, and thus renaming TRACE to something else will break
> that.
>
> That's why, IMO, we need to:
> - Understand how --enable-sim-traces work to see if it is related
> to the use of this TRACE macro;
> - Find out how to properly fix your problem;
>
> If you want, I can try doing some digging, but I think it's going to be
> a while before I can get to it, which is why I'm giving you as much info
> as I have (I really do not have much sim experience, but apparently we
> are short in reviewers for the sim code).

i'm not sure how the code today could possibly result in working behavior
regardless of what is done in the autoconf stages. the sim-traces configure
option adds -DTRACE=0 or -DTRACE=1 to the command line. the hw-properties.c
then defines TRACE() after including everything. so there is no chance for
the -DTRACE logic to affect things here -- TRACE is always redefined from a
0/1 value (or anything else) to a macro that expands into nothing.

if i had to divine intention, this is old code that was forgotten in the
HW_TRACE() transition and so the correct fix would be:
- delete the #define TRACE
- change all TRACE call sites to HW_TRACE
- change the non-existent "trace_devices" to "me"
this would have the code style match the rest of hw code in common/.

i didnt go this route originally because the sim/ dir is lacking in
documentation, so i didnt want to break something inadvertently. i'd rather
have someone who knows the code ACK the idea. but if the developer base for
sim/ is as slim as the documentation, i'll be a bit more bold in my proposals
based on my recent sim/ work for the Blackfin processor.
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]