On 10/21/2009 04:44 PM, Samuel Thibault wrote:
> Pavan Balaji, le Wed 21 Oct 2009 16:40:42 -0500, a écrit :
>>> Please read this thread:
>>>
>>> http://www.open-mpi.org/community/lists/hwloc-devel/2009/09/0054.php
>> Thanks. Is the only issue to not use AC_C_RESTRICT that of conflicting
>> name space?
> 
> Not only, it's also that you never know in advance which compiler will
> be used while including hwloc.h, and thus what _that_ compiler will
> support, thus the dynamic discovery.

I'm not sure I understand the problem here. Let me illustrate what I
mean. Suppose you are using gcc to compile hwloc and suncc to compile
some application using hwloc. Let's say gcc uses __restrict and suncc
uses _Restrict (I didn't check what these compilers use; these are just
for illustration).

hwloc configure.in will have --

AX_PREFIX_CONFIG_H([include/hwloc_config.h], [hwloc])
AC_C_RESTRICT

Suppose you compiled hwloc with gcc, you'll get the following in your
new config file --

/* Note the hwloc_ prefix added by the AX_PREFIX_CONFIG_H macro */
#define hwloc_restrict __restrict

Now, if the application is using suncc, and it tries to find what
spelling for restrict it needs to use, it'll come up with --

#define restrict _Restrict

These do not conflict at all; hwloc will use its definition of restrict
and the application will use its. Why is this a problem?

 -- Pavan

-- 
Pavan Balaji
http://www.mcs.anl.gov/~balaji

Reply via email to