Ralph,

ok, let me clarify my point :

tolower() is invoked in :
opal/mca/hwloc/hwloc191/hwloc/src/misc.c
and ctype.h is already #include'd in this file

tolower() is also invoked in :
opal/mca/hwloc/hwloc191/hwloc/include/private/misc.h
*only* if HWLOC_HAVE_DECL_STRNCASECMP is not #define'd :

static __hwloc_inline int hwloc_strncasecmp(const char *s1, const char
*s2, size_t n)
{
#ifdef HWLOC_HAVE_DECL_STRNCASECMP
  return strncasecmp(s1, s2, n);
#else
  while (n) {
    char c1 = tolower(*s1), c2 = tolower(*s2);
    if (!c1 || !c2 || c1 != c2)
      return c1-c2;
    n--; s1++; s2++;
  }
  return 0;
#endif
}

my point was that on your CentOS box, HWLOC_HAVE_DECL_STRNCASECMP
*should* have been #define'd by configure,
even if you are using intel or clang 3.2 compiler.

Cheers,

Gilles

On 2014/09/09 11:47, Ralph Castain wrote:
> I'll have to let Brice comment on the config change. All I can say is that 
> "tolower" on my CentOS box is defined in <ctype.h>, and that has to be 
> included in the misc.h header.
>
>
> On Sep 8, 2014, at 5:49 PM, Gilles Gouaillardet 
> <gilles.gouaillar...@iferc.org> wrote:
>
>> Ralph and Brice,
>>
>> i noted Ralph commited r32685 in order to fix a problem with Intel
>> compilers.
>> The very similar issue occurs with clang 3.2 (gcc and clang 3.4 are ok
>> for me)
>>
>> imho, the root cause is in the hwloc configure.
>> in this case, configure fails to detect strncasecmp is part of the C
>> include files.
>>
>> in order to achieve this, the conftest.1.c program is compiled and a
>> failure means that
>> strncasecmp is supported since it is declared in some C include files.
>>
>> gcc and clang 3.4 both fail to compile this program :
>>
>> $ gcc -c /tmp/conftest.1.c ; echo $?
>> /tmp/conftest.1.c:592: warning: data definition has no type or storage class
>> /tmp/conftest.1.c:592: error: conflicting types for ‘strncasecmp’
>> 1
>>
>> $ clang --version
>> clang version 3.4 (tags/RELEASE_34/final)
>> Target: x86_64-redhat-linux-gnu
>> Thread model: posix
>> $ clang -c /tmp/conftest.1.c ; echo $?
>> /tmp/conftest.1.c:592:8: warning: type specifier missing, defaults to 'int'
>> [-Wimplicit-int]
>> strncasecmp(int,long,int,long,int,long,int,long,int,long);
>> ^~~~~~~~~~~
>> /tmp/conftest.1.c:592:8: error: conflicting types for 'strncasecmp'
>> /usr/include/string.h:540:12: note: previous declaration is here
>> extern int strncasecmp (__const char *__s1, __const char *__s2, size_t __n)
>> ^
>> /tmp/conftest.1.c:596:19: error: too many arguments to function call,
>> expected
>> 3, have 10
>> strncasecmp(1,2,3,4,5,6,7,8,9,10);
>> ~~~~~~~~~~~ ^~~~~~~~~~~~~~
>> 1 warning and 2 errors generated.
>> 1
>>
>>
>> but clang 3.2 and icc simply issue a warning and no error :
>>
>> $ clang --version
>> clang version 3.2 (tags/RELEASE_32/final)
>> Target: x86_64-unknown-linux-gnu
>> Thread model: posix
>> $ clang -c /tmp/conftest.1.c ; echo $?
>> /tmp/conftest.1.c:592:8: warning: type specifier missing, defaults to 'int'
>> [-Wimplicit-int]
>> strncasecmp(int,long,int,long,int,long,int,long,int,long);
>> ^~~~~~~~~~~
>> /tmp/conftest.1.c:592:8: warning: incompatible redeclaration of library
>> function
>> 'strncasecmp'
>> /usr/include/string.h:540:12: note: 'strncasecmp' is a builtin with type
>> 'int
>> (const char *, const char *, size_t)'
>> extern int strncasecmp (__const char *__s1, __const char *__s2, size_t __n)
>> ^
>> 2 warnings generated.
>> 0
>>
>> $ icc -c conftest.1.c ; echo $?
>> conftest.1.c(592): warning #77: this declaration has no storage class or
>> type specifier
>> strncasecmp(int,long,int,long,int,long,int,long,int,long);
>> ^
>>
>> conftest.1.c(592): warning #147: declaration is incompatible with "int
>> strncasecmp(const char *, const char *, size_t={unsigned long})"
>> (declared at line 540 of "/usr/include/string.h")
>> strncasecmp(int,long,int,long,int,long,int,long,int,long);
>> ^
>>
>> 0
>>
>>
>> the attached hwloc_config.patch is used in order to make the test
>> program slightly different (conftest.2.c) and it does fail with all the
>> compilers.
>>
>>
>> that being said, r32685 might not be reversed since in the case
>> strncasecmp is not supported by the system (i do not even know if such
>> os exist)
>> ctype.h must be #include'd in order to get the prototype of the
>> tolower() function.
>>
>>
>> could you please review the hwloc_config.patch and comment ?
>>
>> Cheers,
>>
>> Gilles
>> <conftest.1.c><hwloc_config.patch><conftest.2.c>_______________________________________________
>> devel mailing list
>> de...@open-mpi.org
>> Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/devel
>> Link to this post: 
>> http://www.open-mpi.org/community/lists/devel/2014/09/15775.php
> _______________________________________________
> devel mailing list
> de...@open-mpi.org
> Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/devel
> Link to this post: 
> http://www.open-mpi.org/community/lists/devel/2014/09/15776.php

Reply via email to