This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: clang copy of limits.h misses NAME_MAX


On Thu, Mar 17, 2016 at 3:11 PM, Hans-Bernhard BrÃker
<> wrote:
> 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
>   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

clangs limits.h has:

#if __STDC_HOSTED__ && __has_include_next(<limits.h>)
#include_next <limits.h>

So it does depend on system's own limits.h which should have this
definition. And cygwin's /usr/include/limits.h does have NAME_MAX
defined but show its being hidden. Checking the preprocessed source
file might help to see why.


Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]