clang copy of limits.h misses NAME_MAX

Hans-Bernhard Bröker HBBroeker@t-online.de
Thu Mar 17 13:12:00 GMT 2016


Hello there,

clang has its own copy of some system headers.  One of those lacks an 
entry that breaks compilation of any program trying to work with 
directories the POSIX way:

$ cat tdirent.c
#include <dirent.h>

void foo(void)
{
         return;
}

$ clang -c tdirent.c
In file included from tdirent.c:1:
In file included from /usr/include/dirent.h:6:
/usr/include/sys/dirent.h:31:15: error: use of undeclared identifier 
'NAME_MAX'
   char d_name[NAME_MAX + 1];
               ^
1 error generated.

The same file compiles just fine with GCC.  The problem turns out to be 
that NAME_MAX is defined in <limits.h> as seen by GCC, but not in the 
same header read by clang.  The culprit is this file:

$ cygcheck -f /usr/lib/clang/3.7.1/include/limits.h
libclang3.7-3.7.1-1


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list