public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
From: Yaakov Selkowitz <yselkowitz@sourceware.org>
To: cygwin-cvs@sourceware.org, newlib-cvs@sourceware.org
Subject: [newlib-cygwin] Feature test macros overhaul: dirent.h
Date: Fri, 18 Mar 2016 02:11:00 -0000	[thread overview]
Message-ID: <20160318021102.25885.qmail@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=d2937299fad043fa91cdf7f56eef914558be4077

commit d2937299fad043fa91cdf7f56eef914558be4077
Author: Yaakov Selkowitz <yselkowi@redhat.com>
Date:   Mon Mar 14 16:17:38 2016 -0500

    Feature test macros overhaul: dirent.h
    
    MAXNAMLEN is a BSDism.
    
    Use the proper internal macros instead of !_POSIX_SOURCE.  telldir and
    seekdir are XSI, scandir and alphasort are POSIX.1-2008, and scandirat
    is GNU.
    
    Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>

Diff:
---
 newlib/libc/include/dirent.h       |  3 ++-
 winsup/cygwin/include/sys/dirent.h | 13 ++++++++++---
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/newlib/libc/include/dirent.h b/newlib/libc/include/dirent.h
index 6fefc03..6135b9f 100644
--- a/newlib/libc/include/dirent.h
+++ b/newlib/libc/include/dirent.h
@@ -3,9 +3,10 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
+#include <sys/cdefs.h>
 #include <sys/dirent.h>
 
-#if !defined(MAXNAMLEN) && !defined(_POSIX_SOURCE)
+#if !defined(MAXNAMLEN) && __BSD_VISIBLE
 #define MAXNAMLEN 1024
 #endif
 
diff --git a/winsup/cygwin/include/sys/dirent.h b/winsup/cygwin/include/sys/dirent.h
index 46c34ab..dd02617 100644
--- a/winsup/cygwin/include/sys/dirent.h
+++ b/winsup/cygwin/include/sys/dirent.h
@@ -12,6 +12,7 @@
 #ifndef _SYS_DIRENT_H
 #define _SYS_DIRENT_H
 
+#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <limits.h>
 
@@ -72,22 +73,28 @@ int closedir (DIR *);
 
 int dirfd (DIR *);
 
-#ifndef _POSIX_SOURCE
+#if __MISC_VISIBLE || __XSI_VISIBLE
 #ifndef __INSIDE_CYGWIN__
 long telldir (DIR *);
 void seekdir (DIR *, long loc);
 #endif
+#endif
 
+#if __MISC_VISIBLE || __POSIX_VISIBLE >= 200809
 int scandir (const char *__dir,
 	     struct dirent ***__namelist,
 	     int (*select) (const struct dirent *),
 	     int (*compar) (const struct dirent **, const struct dirent **));
+int alphasort (const struct dirent **__a, const struct dirent **__b);
+#endif
 
+#if __GNU_VISIBLE
 int scandirat (int __dirfd, const char *__dir, struct dirent ***__namelist,
 	       int (*select) (const struct dirent *),
 	       int (*compar) (const struct dirent **, const struct dirent **));
+#endif
 
-int alphasort (const struct dirent **__a, const struct dirent **__b);
+#if __BSD_VISIBLE
 #ifdef _DIRENT_HAVE_D_TYPE
 /* File types for `d_type'.  */
 enum
@@ -116,5 +123,5 @@ enum
 # define IFTODT(mode)		(((mode) & 0170000) >> 12)
 # define DTTOIF(dirtype)        ((dirtype) << 12)
 #endif /* _DIRENT_HAVE_D_TYPE */
-#endif /* _POSIX_SOURCE */
+#endif /* __BSD_VISIBLE */
 #endif /*_SYS_DIRENT_H*/


                 reply	other threads:[~2016-03-18  2:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160318021102.25885.qmail@sourceware.org \
    --to=yselkowitz@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    --cc=newlib-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).