[PATCH] add <sys/dir.h>

Eric Blake eblake@redhat.com
Wed Aug 11 14:41:00 GMT 2010


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.

-- 
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://sourceware.org/pipermail/newlib/attachments/20100811/dc89fc1e/attachment.sig>


More information about the Newlib mailing list