On Fri, Mar 26, 2010 at 11:57, Brice Goglin <brice.gog...@inria.fr> 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-de...@open-mpi.org
> http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-devel
>

Reply via email to