[U-Boot] gcc-4.6 warnings
Mike Frysinger
vapier at gentoo.org
Thu Aug 25 23:58:14 CEST 2011
On Thursday, August 25, 2011 17:44:58 Timur Tabi wrote:
> Mike Frysinger wrote:
> > if we let the optimizer do it instead of the preprocessor, we get better
> > code coverage in the face of different config settings.
>
> Oh, I thought this was some new feature of U-Boot.
>
> Can you give me an example of where DCE could be used to eliminate an
> #ifdef?
a change i talked about but havent yet posted would be to fix debug().
currently it looks more or less like:
#ifdef DEBUG
# define debug(...) printf(...)
#else
# define debug(...)
#endif
this causes people to do things like put local variables only used with
debug() code behind an #ifdef DEBUG in their code otherwise they get unused
variable warnings.
if, instead, we did something like:
#ifdef DEBUG
# define __DEBUG_KNOB 1
#else
# define __DEBUG_KNOB 0
#endif
#define debug(...) do { if (__DEBUG_KNOB) printf(...); } while (0)
the code would always get compiled and checked, but gcc would throw away it at
DCE time, and there would be no unused variable warnings.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110825/31d98c01/attachment.pgp
More information about the U-Boot
mailing list