Open MPI logo

Hardware Locality Development Mailing List Archives

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

Subject: Re: [hwloc-devel] Attribute unsed not regognized
From: Bert Wesarg (bert.wesarg_at_[hidden])
Date: 2010-03-26 07:33:00


On Fri, Mar 26, 2010 at 11:57, Brice Goglin <Brice.Goglin_at_[hidden]> wrote:
> Bert Wesarg wrote:
>> There is also a problem, that these __hwloc_attributes defines don't
>> get through after install:
>>
>
> Are you using the embedding stuff ? Or only including our headers ?
>
> There's no guarantee that your external application will use the same
> compiler, so unless the embedding stuff re-runs the checks when
> configuring your external applications, there's no easy solution.

Thats true, sadly. I don't use it in the embedded mode. Maybe provide
fallbacks for known gcc compilers. Like this PoC patch:

Index: include/hwloc/config.h.in
===================================================================
--- include/hwloc/config.h.in (revision 1847)
+++ include/hwloc/config.h.in (working copy)
@@ -19,52 +19,34 @@
 # endif
 #endif

-#ifdef HWLOC_HAVE_ATTRIBUTE_UNUSED
-# if HWLOC_HAVE_ATTRIBUTE_UNUSED
-# define __hwloc_attribute_unused __attribute__((__unused__))
-# else
-# define __hwloc_attribute_unused
-# endif
+#define HWLOC_HAVE(what) (defined(HWLOC_HAVE_##what) && HWLOC_HAVE_##what)
+
+#if HWLOC_HAVE(ATTRIBUTE_UNUSED) || defined(__GNUC__)
+# define __hwloc_attribute_unused __attribute__((__unused__))
 #else
 # define __hwloc_attribute_unused
 #endif

-#ifdef HWLOC_HAVE_ATTRIBUTE_MALLOC
-# if HWLOC_HAVE_ATTRIBUTE_MALLOC
-# define __hwloc_attribute_malloc __attribute__((__malloc__))
-# else
-# define __hwloc_attribute_malloc
-# endif
+#if HWLOC_HAVE(ATTRIBUTE_MALLOC)
+# define __hwloc_attribute_malloc __attribute__((__malloc__))
 #else
 # define __hwloc_attribute_malloc
 #endif

-#ifdef HWLOC_HAVE_ATTRIBUTE_CONST
-# if HWLOC_HAVE_ATTRIBUTE_CONST
-# define __hwloc_attribute_const __attribute__((__const__))
-# else
-# define __hwloc_attribute_const
-# endif
+#if HWLOC_HAVE(ATTRIBUTE_CONST) || defined(__GNUC__)
+# define __hwloc_attribute_const __attribute__((__const__))
 #else
 # define __hwloc_attribute_const
 #endif

-#ifdef HWLOC_HAVE_ATTRIBUTE_PURE
-# if HWLOC_HAVE_ATTRIBUTE_PURE
-# define __hwloc_attribute_pure __attribute__((__pure__))
-# else
-# define __hwloc_attribute_pure
-# endif
+#if HWLOC_HAVE(ATTRIBUTE_PURE) || defined(__GNUC__)
+# define __hwloc_attribute_pure __attribute__((__pure__))
 #else
 # define __hwloc_attribute_pure
 #endif

-#ifdef HWLOC_HAVE_ATTRIBUTE_DEPRECATED
-# if HWLOC_HAVE_ATTRIBUTE_DEPRECATED
-# define __hwloc_attribute_deprecated __attribute__((__deprecated__))
-# else
-# define __hwloc_attribute_deprecated
-# endif
+#if HWLOC_HAVE(ATTRIBUTE_DEPRECATED) || defined(__GNUC__)
+# define __hwloc_attribute_deprecated __attribute__((__deprecated__))
 #else
 # define __hwloc_attribute_deprecated
 #endif

Regards,
Bert

>
> Brice
>
> _______________________________________________
> hwloc-devel mailing list
> hwloc-devel_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-devel
>