After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 710497 - Compile error: shadowing global declaration
Compile error: shadowing global declaration
Status: RESOLVED FIXED
Product: NetworkManager
Classification: Platform
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: Thomas Haller
NetworkManager maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2013-10-19 08:42 UTC by Luca Bruno
Modified: 2013-10-23 14:13 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Luca Bruno 2013-10-19 08:42:48 UTC
I'm building networkmanager, outside jhbuild, using gcc gcc version 4.6.4 (Debian 4.6.4-2) and I get the following:

  CC       nm-linux-platform.lo
platform/nm-linux-platform.c: In function 'link_is_software':
platform/nm-linux-platform.c:508:37: error: declaration of 'link' shadows a global declaration [-Werror=shadow]
platform/nm-linux-platform.c: In function 'link_supports_vlans':
platform/nm-linux-platform.c:1649:6: error: declaration of 'index' shadows a global declaration [-Werror=shadow]
cc1: all warnings being treated as errors
make[4]: *** [nm-linux-platform.lo] Error 1
Comment 1 Pavel Simerda 2013-10-19 16:11:46 UTC
I guess you know you can use CFLAGS=-Wno-error to work around that (maybe there's also some configure magic for that).

I'll come back to it later. Just for reference (or if someone's quicker than me):

* Rename "link" into "device"
* Rename "index" to "ifindex"
Comment 2 Thomas Haller 2013-10-22 18:11:54 UTC
Hi,

Fix pushed to master:

http://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=c67f978df09cbf25c3c9e2fae6003f291c7aa184&context=12


btw, the '-Wshadow' warning does not get triggered for me using gcc-4.7 or gcc-4.8. Maybe this warning is ignored because of -Wno-system-headers. Note also the change in gcc-4.8 regarding -Wshadow in http://gcc.gnu.org/gcc-4.8/changes.html.
Comment 3 Pavel Simerda 2013-10-23 13:54:17 UTC
Hi Thomas,

please always reassign issues to yourself when you fix that instead of someone, so that ownership of closed bugs can be tracked as well. I did that for you in this case.

(In reply to comment #2)
> Maybe this warning is ignored because of -Wno-system-headers.

I always wondered why the behavior differs e.g. between distributions (even when the release of GCC was the same). Is it possible to modify NetworkManager's configure.ac so that the build warning behavior is more consistent accross distributions?
Comment 4 Thomas Haller 2013-10-23 14:13:19 UTC
(In reply to comment #3)
Hi

> please always reassign issues to yourself when you fix that instead of someone,
> so that ownership of closed bugs can be tracked as well. I did that for you in
> this case.

Ok!



> (In reply to comment #2)
> I always wondered why the behavior differs e.g. between distributions (even
> when the release of GCC was the same). Is it possible to modify
> NetworkManager's configure.ac so that the build warning behavior is more
> consistent accross distributions?

There was a build error with a compiler/system that was a *bit* uncommon, so it slipped by, but got fixed quick enough.

I don't see issues that need to be addressed here. It might happen occasionally, but then we just fix it (if such a thing happens more often, we might reconsider this).

But what do you suggest?