Open MPI logo

Hardware Locality Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Hardware Locality Development mailing list

Subject: Re: [hwloc-devel] Compiler warnings
From: Brice Goglin (Brice.Goglin_at_[hidden])
Date: 2012-07-12 08:01:12


Le 12/07/2012 13:35, Jeff Squyres a écrit :
> I silenced some harmless compiler warnings (i.e., the compiler couldn't tell that some variables would always be initialized) in r4610.
>
> I'm getting a few others, though -- could you have a look?
>
> distances.c: In function 'hwloc_distances_set_from_env':
> distances.c:259: warning: '__old_locale' may be used uninitialized in this function
> topology-xml.c: In function 'hwloc_topology_export_xmlbuffer':
> topology-xml.c:882: warning: '__old_locale' may be used uninitialized in this function
> topology-xml.c: In function 'hwloc_topology_export_xml':
> topology-xml.c:857: warning: '__old_locale' may be used uninitialized in this function
>

I saw some similar new compiler warnings with gcc 4.7.x (and I already
fixed them) but I can't get yours with 4.7.1 now. Which compiler do you
have?

The patch should fix them but the compiler shouldn't be that dumb.

Brice

--- include/private/private.h (révision 4610)
+++ include/private/private.h (copie de travail)
@@ -346,7 +346,7 @@
 #ifdef HAVE_XLOCALE_H
 #include "xlocale.h"
 #endif
-#define hwloc_localeswitch_declare locale_t __old_locale, __new_locale
+#define hwloc_localeswitch_declare locale_t __old_locale = (locale_t)0, __new_locale
 #define hwloc_localeswitch_init() do { \
   __new_locale = newlocale(LC_ALL_MASK, "C", (locale_t)0); \
   if (__new_locale != (locale_t)0) \