[PULL] button mapping fix and unconstify patches

Keith Packard keithp at keithp.com
Mon Feb 10 15:57:11 PST 2014


Gaetan Nadon <memsize at videotron.ca> writes:

Ok, except for -Wshadow, these are all legitimate warnings (and a few
actual bugs!) that we should fix. I would love for someone to explain
why my build doesn't generate the useful warnings and why Gaedon's
compiler is generating the -Wshadow ones...

Thanks, Gaedon!

>      I have a total of 238 warnings.
>       199 -Wshadow

All of these are badly named libc/libm functions:

        y0
        y1
        gamma
        index
        remainder
        
I am not seeing any -Wshadow warnings between functions and local
variables. This example:

        double z1;

        double y1(double x) { return 0; }

        void foo (void) {
        	int z1 = 0;
        	int y1 = 0;
        }

Generates a single warning for me:

        $ cc -Wshadow -c foo.c

        foo.c: In function ‘foo’:
        foo.c:6:6: warning: declaration of ‘z1’ shadows a global declaration [-Wshadow]
          int z1 = 0;
              ^
        foo.c:1:8: warning: shadowed declaration is here [-Wshadow]
         double z1;
                ^

What version of gcc are you using? And, what compiler flags do you end
up with?

        $ gcc --version
        gcc (Debian 4.8.2-14) 4.8.2

        $ make V=1
        gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../include -DHAVE_DIX_CONFIG_H -Wall -Wpointer-arith -Wmissing-declarations -Wformat=2 -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wbad-function-cast -Wold-style-definition -Wdeclaration-after-statement -Wunused -Wuninitialized -Wshadow -Wmissing-noreturn -Wmissing-format-attribute -Wredundant-decls -Wlogical-op -Werror=implicit -Werror=nonnull -Werror=init-self -Werror=main -Werror=missing-braces -Werror=sequence-point -Werror=return-type -Werror=trigraphs -Werror=array-bounds -Werror=write-strings -Werror=address -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast -fno-strict-aliasing -fno-strict-aliasing -D_BSD_SOURCE -DHAS_FCHOWN -DHAS_STICKY_DIR_BIT -I/local/xorg/include -I/local/xorg/include/pixman-1 -I/local/xorg/include/X11/dri -I/local/xorg/include/libdrm -I/usr/include/freetype2 -I../include -I../include -I../Xext -I../composite -I../damageext -I../xfixes -I../Xi -I../mi -I../miext/sync -I../miext/shadow -I../miext/damage -I../render -I../randr -I../fb -I../dbe -I../present -fvisibility=hidden -O2 -g -MT mitrap.lo -MD -MP -MF .deps/mitrap.Tpo -c mitrap.c  -fPIC -DPIC -o .libs/mitrap.o

We need to get the compiler to stop emiting these warnings as it's just
not reasonable to require that local variables not have the name 'y1' or
'index'. I'm very resistant to asserting that these are bugs in the X
server code; how can we make your compiler work like mine? Is it just
that you need a newer version of gcc? Or is it that gcc running in
64-bit mode is different?

>        35 -Wunused-result

28 from test/signal-logging.c, 5 legit bugs in os, 2 bugs in
xkmread.c. Why am I not seeing these? I cannot get gcc to emit these warnings...

The signal-logging one is trivial to fix (just assert that fgets returns
non-NULL). The bugs in os and xkbread should also be fairly easy to fix,
if I could make gcc tell me about them.

>         2 -Wpointer-arith

64-bit compiler bug in the test code.

>         1 -Wformat

test/hashtabletest.c format bug

>         1 -Wunused-function

That's bswap_CARD64, the only warning I'm getting at present

-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 810 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20140210/98422eb0/attachment.pgp>


More information about the xorg-devel mailing list