[PATCH 00/37] Warning fixes (post 1.15 proposed changes)

Keith Packard keithp at keithp.com
Sun Nov 17 00:01:25 PST 2013


Ok, I was shamed into fixing all of these warnings when someone
watched over my shoulder as I compiled the X server in the Delta lounge in
Narita. I've tried to break them into small patches so they can be
reviewed separately; there shouldn't be any real inter-dependencies.

The only warning I removed from xorg-macros was -Wcast-qual as that
makes it impossible to free a const char * pointer. Casts exist to
work around limitations of the C type system, having it warn when
we're doing that is annoying.

With the X server code base reasonably stable in the run-up to 1.15, I
figured now would be a reasonbly good time to post the changes and
have them ready once 1.15 ships. Yes, I'd love to have them *in* 1.15,
but they do change the ABI/API all over the place, and now is not the
time for that.

The changes break into some large groups:

 1) Handle string constants by declaring lots of stuff as
    'const char *'. We use string constants all over the server,
    and carelessly store them in 'char *' variables. This introduces
    lots of potential for accidentially trying to smash them. I'm
    afraid I didn't actually find any obvious bugs in all of these
    changes though.

 2) Declare debug printf functions as gnu_printf so that we can
    catch format errors. I did find a few mismatching format/value
    codes, so these patches may actually fix something, although only
    debug output...

 3) Unused variables. We've removed the screen argument to a few
    functions, but left the screen variable declared, along with
    other similar changes.

 4) GC ops and funcs are now const pointers in the GC. Several
    drivers were already using const values for these, changing the
    declaration eliminates the warnings there as well as checks to
    make sure we aren't smashing them elsewhere.

There are *still* more warnings when compiling the server, some of
which should be pretty easy to fix. My goal is pretty simple (I think,
at least), once 1.15 ships, I'd like to get these patches merged and
then fix up the remaining warnings and then insist that future changes
not generate any warnings.

-keith


More information about the xorg-devel mailing list