mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* 2.5.73 compile warnings
@ 2003-06-30 15:13 Margit Schubert-While
  2003-06-30 16:03 ` Andries Brouwer
  0 siblings, 1 reply; 4+ messages in thread
From: Margit Schubert-While @ 2003-06-30 15:13 UTC (permalink / raw)
  To: linux-kernel

2.5.73 + latest cset
GCC 3.3

kernel/suspend.c:294:2: warning: #warning This might be broken. We need to 
somehow wait for data to reach the disk

drivers/char/vt_ioctl.c: In function `do_kdsk_ioctl':
drivers/char/vt_ioctl.c:85: warning: comparison is always false due to 
limited range of data type
drivers/char/vt_ioctl.c:85: warning: comparison is always false due to 
limited range of data type
drivers/char/vt_ioctl.c: In function `do_kdgkb_ioctl':
drivers/char/vt_ioctl.c:211: warning: comparison is always false due to 
limited range of data type

drivers/char/keyboard.c: In function `k_fn':
drivers/char/keyboard.c:665: warning: comparison is always true due to 
limited range of data type

drivers/pnp/isapnp/core.c: In function `isapnp_next_rdp':
drivers/pnp/isapnp/core.c:263: warning: `check_region' is deprecated 
(declared at include/linux/ioport.h:116)


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

* Re: 2.5.73 compile warnings
  2003-06-30 15:13 2.5.73 compile warnings Margit Schubert-While
@ 2003-06-30 16:03 ` Andries Brouwer
  2003-06-30 20:27   ` Adrian Bunk
  0 siblings, 1 reply; 4+ messages in thread
From: Andries Brouwer @ 2003-06-30 16:03 UTC (permalink / raw)
  To: Margit Schubert-While; +Cc: linux-kernel

On Mon, Jun 30, 2003 at 05:13:05PM +0200, Margit Schubert-While wrote:
> 2.5.73 + latest cset
> GCC 3.3
> 
> drivers/char/vt_ioctl.c: In function `do_kdsk_ioctl':
> drivers/char/vt_ioctl.c:85: warning: comparison is always false due to 
> limited range of data type
> drivers/char/vt_ioctl.c:85: warning: comparison is always false due to 
> limited range of data type
> drivers/char/vt_ioctl.c: In function `do_kdgkb_ioctl':
> drivers/char/vt_ioctl.c:211: warning: comparison is always false due to 
> limited range of data type
> 
> drivers/char/keyboard.c: In function `k_fn':
> drivers/char/keyboard.c:665: warning: comparison is always true due to 
> limited range of data type

These are checks of the "cannot happen" type, where "cannot happen"
can be seen by the compiler, so that it can optimize the tests away.

As it is now, correctness of the code can be seen locally.
If the tests are removed, a human reader must look up the values
of these constants to conclude that the code is correct.


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

* Re: 2.5.73 compile warnings
  2003-06-30 16:03 ` Andries Brouwer
@ 2003-06-30 20:27   ` Adrian Bunk
  0 siblings, 0 replies; 4+ messages in thread
From: Adrian Bunk @ 2003-06-30 20:27 UTC (permalink / raw)
  To: Andries Brouwer; +Cc: Margit Schubert-While, linux-kernel

On Mon, Jun 30, 2003 at 06:03:19PM +0200, Andries Brouwer wrote:
> On Mon, Jun 30, 2003 at 05:13:05PM +0200, Margit Schubert-While wrote:
> > 2.5.73 + latest cset
> > GCC 3.3
> > 
> > drivers/char/vt_ioctl.c: In function `do_kdsk_ioctl':
> > drivers/char/vt_ioctl.c:85: warning: comparison is always false due to 
> > limited range of data type
> > drivers/char/vt_ioctl.c:85: warning: comparison is always false due to 
> > limited range of data type
> > drivers/char/vt_ioctl.c: In function `do_kdgkb_ioctl':
> > drivers/char/vt_ioctl.c:211: warning: comparison is always false due to 
> > limited range of data type
> > 
> > drivers/char/keyboard.c: In function `k_fn':
> > drivers/char/keyboard.c:665: warning: comparison is always true due to 
> > limited range of data type
> 
> These are checks of the "cannot happen" type, where "cannot happen"
> can be seen by the compiler, so that it can optimize the tests away.
> 
> As it is now, correctness of the code can be seen locally.
> If the tests are removed, a human reader must look up the values
> of these constants to conclude that the code is correct.

There are cases where a comparison is only on 32 bit architectures 
always true/false (if longs are involved).

There are cases where a #define is set that might be set differently
under certain circumstances:

<--  snip  -->

#define MAX_VALUE 10000

u8 tmp;

if (tmp > MAX_VALUE)
    return -ESOMEERROR;

<--  snip  -->


These are cases where the warning is just noise. But this new warning 
already found several bugs, there are several places where I sent 
patches for things like:

<--  snip  -->

u8 i;

for (i = 0; i <= 0xFF; i++)
    do_something;

<--  snip  -->


In these cases the warning found an actual bug.


Is there any way to tell gcc to disable such warnings locally?


cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


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

* Re: 2.5.73 compile warnings
@ 2003-07-01  7:30 Margit Schubert-While
  0 siblings, 0 replies; 4+ messages in thread
From: Margit Schubert-While @ 2003-07-01  7:30 UTC (permalink / raw)
  To: linux-kernel

As long as the coding is correct, I'm OK with the warnings.
Kudos to the developers/maintainers that 2.5 compiles so cleanly.
2.4 is another story. See my mail from yesterday titled
2.4.22pre2 + cset1040 compile erros/warnings.
There are hundreds of warnings (and 4 errors) which should be
checked.

Margit


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

end of thread, other threads:[~2003-07-01  7:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-30 15:13 2.5.73 compile warnings Margit Schubert-While
2003-06-30 16:03 ` Andries Brouwer
2003-06-30 20:27   ` Adrian Bunk
2003-07-01  7:30 Margit Schubert-While

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®