[pacman-dev] [PATCH] Fix -Wshadow warnings

Dan McGee dpmcgee at gmail.com
Tue Apr 5 01:37:22 EDT 2011


On Sun, Apr 3, 2011 at 6:26 PM, 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>
>> ---
>>
>> 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).
Yes, this is the only place they belong, definitely not in the
Makefile (and only in the libalpm Makefile, why?).

> 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...

I'm not against it, provided:
1. When it is checked in, the compile doesn't break.
2. When someone uses "exotic" compiliers such as icc, gcc 3.x,
whatever Cygwin has, and clang, we don't blow up or make the output
that much worse for them.

-Dan


More information about the pacman-dev mailing list