This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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: [PATCH] add <sys/dir.h>


On Aug 11 08:22, Eric Blake wrote:
> On 08/10/2010 10:14 PM, Yaakov (Cygwin/X) wrote:
> > The predecessor of POSIX.1 <dirent.h> and struct dirent was 4.2 BSD's
> > <sys/dir.h> and struct direct[1].  glibc[2] and the BSDs[3][4][5] still
> > provide the old-style header for compatibility.
> > 
> > Patch attached.
> 
> > +#ifdef __cplusplus
> > +extern "C" {
> > +#endif
> > +
> > +#include <dirent.h>
> > +
> > +#define direct dirent
> > +
> > +#ifdef __cplusplus
> > +}
> 
> Ouch - this is broken.  You should _never_ need to #include a system
> header inside C++ guards.
> 
> <dirent.h> should be providing the C++ guards.  If it is, this instance
> in <sys/dir.h> is redundant; if it isn't, then <dirent.h> needs fixing.
> 
> /me goes to check...
> Hmm - <dirent.h> _is_ providing C++ guards, but then it includes
> <sys/dirent.h> inside guards.  Which means <sys/dirent.h> needs fixing too.

Why?  An application should never include sys/dirent.h directly, right?


Corinna

-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat


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