[pacman-dev] [PATCH] Fix -Wshadow warnings
Sebastian Nowicki
sebnow at gmail.com
Mon Apr 4 04:54:41 EDT 2011
On Mon, Apr 4, 2011 at 7:26 AM, Allan McRae <allan at archlinux.org> wrote:
> On 03/04/11 20:49, Sebastian Nowicki wrote:
>
>> The following have been renamed to avoid shadowing:
>>
>> * conflict.c
>> - filestr -> pkgfilestr
>> - remove -> remove_pkgs
>> * deps.c
>> - index -> pkg_index
>> - remove -> remove_pkgs
>> - time -> epoch
>> * diskspace.c
>> - abort -> should_abort
>> * handle.c
>> - handle -> local_handle / new_handle
>> * package.c
>> - i -> deps
>> * sync.c (alpm)
>> - current -> current_pkg
>> - remove -> remove_pkgs
>> - ret -> gpg_ret
>> - sync -> syncpkg
>> * trans.c
>> - handle -> local_handle
>> * util.c (alpm)
>> - pipe -> pipefh
>> - prefix -> entry_prefix
>> * callback.c
>> - p -> ptr
>> * util.c (pacman)
>> - dup -> p
>>
>> In some instance duplicate declarations were removed.
>>
>> Signed-off-by: Sebastian Nowicki<sebnow at gmail.com>
>> ---
>> This is a follow up for an earlier patch I sent back in December.
>> Apologies for not following up sooner. The feedback was to split the
>> patch up. This is the first patch from the split.
>>
>> The API for alpm_checkdeps is slightly modified (a parameter is
>> renamed). I'm not sure whether this is a backwards incompatible change
>> or not.
>>
>> Sorry for the size, I don't think it can be split up much further
>> without it turning into a dozen patches.
>>
>> This patch was generated against the master branch.
>>
>> lib/libalpm/Makefile.am | 2 +-
>> lib/libalpm/alpm.h | 2 +-
>> lib/libalpm/conflict.c | 8 +++---
>> lib/libalpm/deps.c | 18 ++++++++--------
>> lib/libalpm/diskspace.c | 8 +++---
>> lib/libalpm/dload.c | 6 ++--
>> lib/libalpm/handle.c | 50
>> +++++++++++++++++++++++-----------------------
>> lib/libalpm/package.c | 6 ++--
>> lib/libalpm/sync.c | 37 ++++++++++++++++-----------------
>> lib/libalpm/trans.c | 18 ++++++++--------
>> lib/libalpm/util.c | 20 +++++++++---------
>> src/pacman/Makefile.am | 2 +-
>> src/pacman/callback.c | 10 ++++----
>> src/pacman/query.c | 2 +-
>> src/pacman/sync.c | 4 +--
>> src/pacman/upgrade.c | 1 -
>> src/pacman/util.c | 14 ++++++------
>> 17 files changed, 102 insertions(+), 106 deletions(-)
>>
>> diff --git a/lib/libalpm/Makefile.am b/lib/libalpm/Makefile.am
>> index fb224a5..21f7057 100644
>> --- a/lib/libalpm/Makefile.am
>> +++ b/lib/libalpm/Makefile.am
>> @@ -7,7 +7,7 @@ include_HEADERS = alpm_list.h alpm.h
>>
>> DEFS = -DLOCALEDIR=\"@localedir@\" @DEFS@
>>
>> -AM_CFLAGS = -pedantic -D_GNU_SOURCE
>> +AM_CFLAGS = -pedantic -Wshadow -D_GNU_SOURCE
>>
>
> I have not gone through all of these changes... I think adding extra
> warnings etc should be done in configure.ac and only when --enable-debug
> is specified (as is currently done with stack protector, -Werror etc).
>
> But do we really want to add all these warnings in there? I use all of
> these:
>
> -Wclobbered -Wempty-body -Wfloat-equal -Wignored-qualifiers
> -Wmissing-declarations -Wmissing-parameter-type -Wmissing-prototypes
> -Wold-style-declaration -Woverride-init -Wsign-compare -Wstrict-prototypes
> -Wtype-limits -Wuninitialized
>
> I'm not sure anybody wants that...
>
> Allan
>
>
I wasn't going to add it initially, but thought this would prevent shadowing
sneaking back in again. I don't really mind either way though.
More information about the pacman-dev
mailing list