[PATCH 01/17] Enable building with -Wshadow

Tom Tromey tromey@redhat.com
Tue Nov 1 17:43:00 GMT 2011


>>>>> "Andrey" == Andrey Smirnov <andrew.smirnov@gmail.com> writes:

Andrey> On the supr of the moment, while reading Project Ideas page on
Andrey> GDB wiki, I've decided to undertake the task of making
Andrey> compilation with -Wshadow flag possible (seeing how that is a
Andrey> simple task for a person unfamiliar with gdb's code base).

Thanks.

Andrey> So, having configured the code with
Andrey> gcc.gnu.org
Andrey> CFLAGS="-D_BSD_SOURCE -D_POSIX_C_SOURCE=199309L -Wshadow -Werror
Andrey> -ansi" ./configure

I would suggest instead adding -Wshadow to build_warnings in
gdb/configure.ac.  I am not sure whether the other subdirectories in src
are interested in -Wshadow.

Andrey> I rummaged through it and fixed all naming clashes.
Andrey> In the attachment to this letter is a 1st in the series of 17 patches.
Andrey> The majority of the changes is related to fixing -Wshadow caused errors
Andrey> with two or three fixes related to -Werror and -ansi flags.

I don't think we want -ansi, though I am not sure.
I think it would be good to separate out these patches so we can see.

Andrey> - What is the common way(etiquette?) of sending a series patches to this
Andrey>   list? Do I send them all at once or do I wait 'till the end of
Andrey>   discussion about the first one?

You can send them all at once.

However -- I think the best overall approach would be to separate
"pretty obvious" patches from ones that are not as obvious.  I know they
are all just renamings, but I think some forms of shadowing (like purely
within a single function) are much easier to review than others.  Also I
expect some may be contentious, perhaps even the whole project will be.

Andrey> - Does the part of MAINTAINERS file about patches to libiberty,
Andrey>   libdecnumber and intl needing to be sent to GCC still holds true or
Andrey>   should I send them to this list?  Bfd and binutils?

Yes, libdecnumber and libiberty are canonically maintained in GCC.
I don't know if they want -Wshadow or not.

BFD patches should go to binutils.  I also don't know if they want -Wshadow.

Andrey> - In case the patches got applied and building with -Wshadow is working
Andrey>   would it be possible to add aforementioned CFLAGS to the set of
Andrey>   default ones?

The configure.ac change will handle this.

Andrey> P.S. Forgot to mention that I checked for regressions by running
Andrey> 'make check' and, to the best of my knowledge, fixed all that
Andrey> have been cased by my patches.

Thanks.

I suspect you are going to need a copyright assignment in place.  I
think it is maybe a grey area, since the patches are generally
mechanical, but it can't hurt.  Contact me off-list and I will get you
started.

I didn't read this patch yet.  If we need paperwork we might as well
wait for it to be finished.

Tom



More information about the Gdb-patches mailing list