ratpoison-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RP] [PATCH] silence warnings


From: Bernhard R. Link
Subject: [RP] [PATCH] silence warnings
Date: Tue, 28 Apr 2009 11:38:38 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

Attached patch silences some warnings. All are harmless but having them
silent makes it easier to spot similar ones and makes lives easier for
people with the habit of giving many -W things in CFLAGS.

Types of warnings this fixes:

* shadowed symbols: often variables are names after global variables or
system functions. While being totally harmless in itself, this can cause
one to miss issues when moving code around.
(things like variables called "dup", "index" or (ratpoison-specific)
 "command" or "gv").

* unsigned char vs char pointers
(there is always the danger of actually inserting new ones by this,
but I think the changes in the patch only make things better).

* unused parameters
functions that are given as callbacks or into function pointers often
do not use all their parameters which gcc complains about in -Wunused
which is enables by default in -Wextra. Against this this adds an
UNUSED macro that tells gcc to shut up.
(special case in linkedlist.*, here the patch replaces the prefetch with
and gcc builtin on newer gccs).

* "uninitialized" variable
glibc has an inline strtok_r, which causes due to some gcc bug to
some uninitialized value warning. As the "= NULL" hides nothing here,
I just added it.

* empty if or else branches
as PRINT_DEBUG is sometimes empty, gcc warns about empty if and else
braches. With some { } that stops (though other compilers might warn
more). But I think this way it is "safest" to have no ugly effects
(not that the danger was more than insignificant before)...

If requested, I can also supply only a subset of those.

Hochachtungsvoll,
        Bernhard R. Link

Attachment: silencewarnings.diff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]