All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] gcc-4.6 warnings
@ 2011-08-24 18:29 Kumar Gala
  2011-08-24 18:47 ` Mike Frysinger
  2011-08-24 19:05 ` Wolfgang Denk
  0 siblings, 2 replies; 13+ messages in thread
From: Kumar Gala @ 2011-08-24 18:29 UTC (permalink / raw)
  To: u-boot

We get a bunch of warnings like this with gcc-4.6.x:

e1000.c:4334:3: warning: variable 'x' set but not used [-Wunused-but-set-variable]

Are we get with adding -Wunused-but-set-variable so they don't show up?

- k

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] gcc-4.6 warnings
  2011-08-24 18:29 [U-Boot] gcc-4.6 warnings Kumar Gala
@ 2011-08-24 18:47 ` Mike Frysinger
  2011-08-24 19:05 ` Wolfgang Denk
  1 sibling, 0 replies; 13+ messages in thread
From: Mike Frysinger @ 2011-08-24 18:47 UTC (permalink / raw)
  To: u-boot

On Wednesday, August 24, 2011 14:29:43 Kumar Gala wrote:
> We get a bunch of warnings like this with gcc-4.6.x:
> 
> e1000.c:4334:3: warning: variable 'x' set but not used
> [-Wunused-but-set-variable]
> 
> Are we get with adding -Wunused-but-set-variable so they don't show up?

in general, i like this new warning as it tends to catch variables that are 
dead.  i wonder why the e1000 driver has this indirection in the first place.  
simply calling readl() without using the return value shouldnt cause warnings 
or DCE ...
-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/20110824/730b29df/attachment.pgp 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] gcc-4.6 warnings
  2011-08-24 18:29 [U-Boot] gcc-4.6 warnings Kumar Gala
  2011-08-24 18:47 ` Mike Frysinger
@ 2011-08-24 19:05 ` Wolfgang Denk
  2011-08-25  4:39   ` Kumar Gala
  1 sibling, 1 reply; 13+ messages in thread
From: Wolfgang Denk @ 2011-08-24 19:05 UTC (permalink / raw)
  To: u-boot

Dear Kumar Gala,

In message <3AA0E5B6-7E38-4CB0-94E2-F7BBA9A100FA@kernel.crashing.org> you wrote:
> We get a bunch of warnings like this with gcc-4.6.x:
> 
> e1000.c:4334:3: warning: variable 'x' set but not used [-Wunused-but-set-variable]
> 
> Are we get with adding -Wunused-but-set-variable so they don't show up?

If the variable is not used, why don't we remove it, then?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
C makes it easy for you to shoot yourself in the foot. C++ makes that
harder, but when you do, it blows away your whole leg.
                                                 -- Bjarne Stroustrup

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] gcc-4.6 warnings
  2011-08-24 19:05 ` Wolfgang Denk
@ 2011-08-25  4:39   ` Kumar Gala
  2011-08-25  5:52     ` Wolfgang Denk
  0 siblings, 1 reply; 13+ messages in thread
From: Kumar Gala @ 2011-08-25  4:39 UTC (permalink / raw)
  To: u-boot


On Aug 24, 2011, at 2:05 PM, Wolfgang Denk wrote:

> Dear Kumar Gala,
> 
> In message <3AA0E5B6-7E38-4CB0-94E2-F7BBA9A100FA@kernel.crashing.org> you wrote:
>> We get a bunch of warnings like this with gcc-4.6.x:
>> 
>> e1000.c:4334:3: warning: variable 'x' set but not used [-Wunused-but-set-variable]
>> 
>> Are we get with adding -Wunused-but-set-variable so they don't show up?
> 
> If the variable is not used, why don't we remove it, then?

In the vast number of cases it because of some #ifdef case not be defined in the given build.

- k

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] gcc-4.6 warnings
  2011-08-25  4:39   ` Kumar Gala
@ 2011-08-25  5:52     ` Wolfgang Denk
  2011-08-25 14:27       ` Kumar Gala
  0 siblings, 1 reply; 13+ messages in thread
From: Wolfgang Denk @ 2011-08-25  5:52 UTC (permalink / raw)
  To: u-boot

Dear Kumar Gala,

In message <348935C0-0C2D-4A7A-8ABE-9D09E2904B26@kernel.crashing.org> you wrote:
> 
> > If the variable is not used, why don't we remove it, then?
> 
> In the vast number of cases it because of some #ifdef case not be
> defined in the given build.

well, that's the reason for the warnings showing up, it isn't the
reason why we cannot fix these?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"I used to think that the brain was the most wonderful  organ  in  my
body. Then I realized who was telling me this."        - Emo Phillips

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] gcc-4.6 warnings
  2011-08-25  5:52     ` Wolfgang Denk
@ 2011-08-25 14:27       ` Kumar Gala
  2011-08-25 14:51         ` Mike Frysinger
  2011-08-25 20:39         ` Wolfgang Denk
  0 siblings, 2 replies; 13+ messages in thread
From: Kumar Gala @ 2011-08-25 14:27 UTC (permalink / raw)
  To: u-boot


On Aug 25, 2011, at 12:52 AM, Wolfgang Denk wrote:

> Dear Kumar Gala,
> 
> In message <348935C0-0C2D-4A7A-8ABE-9D09E2904B26@kernel.crashing.org> you wrote:
>> 
>>> If the variable is not used, why don't we remove it, then?
>> 
>> In the vast number of cases it because of some #ifdef case not be
>> defined in the given build.
> 
> well, that's the reason for the warnings showing up, it isn't the
> reason why we cannot fix these?

:), Thus my query if we really wanted to try and fix them by adding more #ifdef's or live with that as an acceptable thing to do.

- k

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] gcc-4.6 warnings
  2011-08-25 14:27       ` Kumar Gala
@ 2011-08-25 14:51         ` Mike Frysinger
  2011-08-25 19:50           ` Tabi Timur-B04825
  2011-08-25 20:39         ` Wolfgang Denk
  1 sibling, 1 reply; 13+ messages in thread
From: Mike Frysinger @ 2011-08-25 14:51 UTC (permalink / raw)
  To: u-boot

On Thursday, August 25, 2011 10:27:42 Kumar Gala wrote:
> On Aug 25, 2011, at 12:52 AM, Wolfgang Denk wrote:
> > Kumar Gala wrote:
> >>> If the variable is not used, why don't we remove it, then?
> >> 
> >> In the vast number of cases it because of some #ifdef case not be
> >> defined in the given build.
> > 
> > well, that's the reason for the warnings showing up, it isn't the
> > reason why we cannot fix these?
> :
> :), Thus my query if we really wanted to try and fix them by adding more
> :#ifdef's or live with that as an acceptable thing to do.

i feel like some (many?) #ifdef's in the tree could be done without ifdefs (by 
relying on gcc's DCE) thus improving overall code quality
-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/6669ba99/attachment.pgp 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] gcc-4.6 warnings
  2011-08-25 14:51         ` Mike Frysinger
@ 2011-08-25 19:50           ` Tabi Timur-B04825
  2011-08-25 20:27             ` Mike Frysinger
  0 siblings, 1 reply; 13+ messages in thread
From: Tabi Timur-B04825 @ 2011-08-25 19:50 UTC (permalink / raw)
  To: u-boot

On Thu, Aug 25, 2011 at 9:51 AM, Mike Frysinger <vapier@gentoo.org> wrote:

> i feel like some (many?) #ifdef's in the tree could be done without ifdefs (by
> relying on gcc's DCE) thus improving overall code quality

What's DCE?

-- 
Timur Tabi
Linux kernel developer at Freescale

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] gcc-4.6 warnings
  2011-08-25 19:50           ` Tabi Timur-B04825
@ 2011-08-25 20:27             ` Mike Frysinger
  2011-08-25 21:44               ` Timur Tabi
  0 siblings, 1 reply; 13+ messages in thread
From: Mike Frysinger @ 2011-08-25 20:27 UTC (permalink / raw)
  To: u-boot

On Thursday, August 25, 2011 15:50:57 Tabi Timur-B04825 wrote:
> On Thu, Aug 25, 2011 at 9:51 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> > i feel like some (many?) #ifdef's in the tree could be done without
> > ifdefs (by relying on gcc's DCE) thus improving overall code quality
> 
> What's DCE?

dead code elimination
http://en.wikipedia.org/wiki/Dead_code_elimination

if we let the optimizer do it instead of the preprocessor, we get better code 
coverage in the face of different config settings.
-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/dfdcf6e1/attachment.pgp 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] gcc-4.6 warnings
  2011-08-25 14:27       ` Kumar Gala
  2011-08-25 14:51         ` Mike Frysinger
@ 2011-08-25 20:39         ` Wolfgang Denk
  1 sibling, 0 replies; 13+ messages in thread
From: Wolfgang Denk @ 2011-08-25 20:39 UTC (permalink / raw)
  To: u-boot

Dear Kumar Gala,

In message <7056F5B1-AD6C-459E-80F1-8EE436CC781A@kernel.crashing.org> you wrote:
> 
> > well, that's the reason for the warnings showing up, it isn't the
> > reason why we cannot fix these?
>
> :), Thus my query if we really wanted to try and fix them by adding more
> #ifdef's or live with that as an acceptable thing to do.

My experience is that hushing up GCC warnings is not really a good
idea.  First, you will then also fail to see when new code adds such
problems.  Second, there have been cases where warnings in one GCC
version because serious bugs in later versions, so we better fix them.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
It is a good thing for an uneducated man to read books of quotations.
                        - Sir Winston Churchill _My Early Life_ ch. 9

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] gcc-4.6 warnings
  2011-08-25 20:27             ` Mike Frysinger
@ 2011-08-25 21:44               ` Timur Tabi
  2011-08-25 21:45                 ` Timur Tabi
  2011-08-25 21:58                 ` Mike Frysinger
  0 siblings, 2 replies; 13+ messages in thread
From: Timur Tabi @ 2011-08-25 21:44 UTC (permalink / raw)
  To: u-boot

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?

-- 
Timur Tabi
Linux kernel developer at Freescale

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] gcc-4.6 warnings
  2011-08-25 21:44               ` Timur Tabi
@ 2011-08-25 21:45                 ` Timur Tabi
  2011-08-25 21:58                 ` Mike Frysinger
  1 sibling, 0 replies; 13+ messages in thread
From: Timur Tabi @ 2011-08-25 21:45 UTC (permalink / raw)
  To: u-boot

Timur Tabi wrote:
> Oh, I thought this was some new feature of U-Boot.
> 
I meant a new feature of gcc. Ugh.

-- 
Timur Tabi
Linux kernel developer at Freescale

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [U-Boot] gcc-4.6 warnings
  2011-08-25 21:44               ` Timur Tabi
  2011-08-25 21:45                 ` Timur Tabi
@ 2011-08-25 21:58                 ` Mike Frysinger
  1 sibling, 0 replies; 13+ messages in thread
From: Mike Frysinger @ 2011-08-25 21:58 UTC (permalink / raw)
  To: u-boot

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 

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2011-08-25 21:58 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-24 18:29 [U-Boot] gcc-4.6 warnings Kumar Gala
2011-08-24 18:47 ` Mike Frysinger
2011-08-24 19:05 ` Wolfgang Denk
2011-08-25  4:39   ` Kumar Gala
2011-08-25  5:52     ` Wolfgang Denk
2011-08-25 14:27       ` Kumar Gala
2011-08-25 14:51         ` Mike Frysinger
2011-08-25 19:50           ` Tabi Timur-B04825
2011-08-25 20:27             ` Mike Frysinger
2011-08-25 21:44               ` Timur Tabi
2011-08-25 21:45                 ` Timur Tabi
2011-08-25 21:58                 ` Mike Frysinger
2011-08-25 20:39         ` Wolfgang Denk

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.