This is the mail archive of the cygwin-cvs@cygwin.com 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]

[newlib-cygwin] Add sys/_locale.h header and fix up headers


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

commit 7156bf842e37fc07009d012c35309c5700f9f7cd
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Mon Jul 25 11:47:36 2016 +0200

    Add sys/_locale.h header and fix up headers
    
    Signed-off by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 newlib/libc/include/ctype.h       |  5 ++---
 newlib/libc/include/locale.h      |  7 +++----
 newlib/libc/include/string.h      |  5 ++---
 newlib/libc/include/sys/_locale.h | 12 ++++++++++++
 newlib/libc/include/sys/reent.h   |  3 ---
 newlib/libc/include/time.h        | 10 ++++++++++
 newlib/libc/include/wchar.h       |  5 ++---
 newlib/libc/include/wctype.h      |  9 ++++-----
 winsup/cygwin/include/monetary.h  | 13 ++++++++++++-
 9 files changed, 47 insertions(+), 22 deletions(-)

diff --git a/newlib/libc/include/ctype.h b/newlib/libc/include/ctype.h
index 3328691..0284c18 100644
--- a/newlib/libc/include/ctype.h
+++ b/newlib/libc/include/ctype.h
@@ -4,9 +4,8 @@
 #include "_ansi.h"
 #include <sys/cdefs.h>
 
-#if __MISC_VISIBLE || __POSIX_VISIBLE >= 200809 || defined (_COMPILING_NEWLIB)
-struct __locale_t;
-typedef struct __locale_t *locale_t;
+#if __POSIX_VISIBLE >= 200809 || __MISC_VISIBLE || defined (_COMPILING_NEWLIB)
+#include <sys/_locale.h>
 #endif
 
 _BEGIN_STD_C
diff --git a/newlib/libc/include/locale.h b/newlib/libc/include/locale.h
index a195c19..f74e9c5 100644
--- a/newlib/libc/include/locale.h
+++ b/newlib/libc/include/locale.h
@@ -21,7 +21,9 @@
 #define LC_TIME     5
 #define LC_MESSAGES 6
 
-#if __POSIX_VISIBLE >= 200809
+#if __POSIX_VISIBLE >= 200809 || defined (_COMPILING_NEWLIB)
+
+#include <sys/_locale.h>
 
 #define LC_ALL_MASK		(1 << LC_ALL)
 #define LC_COLLATE_MASK		(1 << LC_COLLATE)
@@ -33,9 +35,6 @@
 
 #define LC_GLOBAL_LOCALE	((struct __locale_t *) -1)
 
-struct __locale_t;
-typedef struct __locale_t *locale_t;
-
 #endif /* __POSIX_VISIBLE >= 200809 */
 
 _BEGIN_STD_C
diff --git a/newlib/libc/include/string.h b/newlib/libc/include/string.h
index 549d511..8f4fd2e 100644
--- a/newlib/libc/include/string.h
+++ b/newlib/libc/include/string.h
@@ -16,9 +16,8 @@
 #define __need_NULL
 #include <stddef.h>
 
-#if __POSIX_VISIBLE >= 200809 || defined (_COMPILING_NEWLIB)
-struct __locale_t;
-typedef struct __locale_t *locale_t;
+#if __POSIX_VISIBLE >= 200809
+#include <sys/_locale.h>
 #endif
 
 _BEGIN_STD_C
diff --git a/newlib/libc/include/sys/_locale.h b/newlib/libc/include/sys/_locale.h
new file mode 100644
index 0000000..ce6f995
--- /dev/null
+++ b/newlib/libc/include/sys/_locale.h
@@ -0,0 +1,12 @@
+/* Definition of opaque POSIX-1.2008 type locale_t for userspace. */
+
+#ifndef	_SYS__LOCALE_H
+#define _SYS__LOCALE_H
+
+#include <newlib.h>
+#include <sys/config.h>
+
+struct __locale_t;
+typedef struct __locale_t *locale_t;
+
+#endif	/* _SYS__LOCALE_H */
diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h
index bd32320..07abcb4 100644
--- a/newlib/libc/include/sys/reent.h
+++ b/newlib/libc/include/sys/reent.h
@@ -37,9 +37,6 @@ typedef __uint32_t __ULong;
 
 struct _reent;
 
-/* TODO: This structure type isn't defined yet.  It's supposed to be used
-   by locale-specific functions in case a per-thread locale per SUSv4 has
-   been specified. */
 struct __locale_t;
 
 /*
diff --git a/newlib/libc/include/time.h b/newlib/libc/include/time.h
index 698ad61..47ab578 100644
--- a/newlib/libc/include/time.h
+++ b/newlib/libc/include/time.h
@@ -28,6 +28,10 @@
 #include <sys/types.h>
 #include <sys/timespec.h>
 
+#if __POSIX_VISIBLE >= 200809
+#include <sys/_locale.h>
+#endif
+
 _BEGIN_STD_C
 
 struct tm
@@ -63,6 +67,12 @@ size_t	   _EXFUN(strftime, (char *__restrict _s,
 			     size_t _maxsize, const char *__restrict _fmt,
 			     const struct tm *__restrict _t));
 
+#if __POSIX_VISIBLE >= 200809
+extern size_t strftime_l (char *__restrict _s, size_t _maxsize,
+			  const char *__restrict _fmt,
+			  const struct tm *__restrict _t, locale_t _l);
+#endif
+
 char	  *_EXFUN(asctime_r,	(const struct tm *__restrict,
 				 char *__restrict));
 char	  *_EXFUN(ctime_r,	(const time_t *, char *));
diff --git a/newlib/libc/include/wchar.h b/newlib/libc/include/wchar.h
index a03f642..4df60b4 100644
--- a/newlib/libc/include/wchar.h
+++ b/newlib/libc/include/wchar.h
@@ -63,9 +63,8 @@ typedef __gnuc_va_list va_list;
 #endif
 #endif
 
-#if __POSIX_VISIBLE >= 200809 || defined (_COMPILING_NEWLIB)
-struct __locale_t;
-typedef struct __locale_t *locale_t;
+#if __POSIX_VISIBLE >= 200809
+#include <sys/_locale.h>
 #endif
 
 _BEGIN_STD_C
diff --git a/newlib/libc/include/wctype.h b/newlib/libc/include/wctype.h
index 6c2505d..d085374 100644
--- a/newlib/libc/include/wctype.h
+++ b/newlib/libc/include/wctype.h
@@ -7,6 +7,10 @@
 #define __need_wint_t
 #include <stddef.h>
 
+#if __POSIX_VISIBLE >= 200809
+#include <sys/_locale.h>
+#endif
+
 #ifndef WEOF
 # define WEOF ((wint_t)-1)
 #endif
@@ -44,11 +48,6 @@ wint_t	_EXFUN(towlower, (wint_t));
 wctrans_t _EXFUN(wctrans, (const char *));
 wctype_t _EXFUN(wctype, (const char *));
 
-#if __POSIX_VISIBLE >= 200809 || defined (_COMPILING_NEWLIB)
-struct __locale_t;
-typedef struct __locale_t *locale_t;
-#endif
-
 #if __POSIX_VISIBLE >= 200809
 extern int	iswalpha_l (wint_t, locale_t);
 extern int	iswalnum_l (wint_t, locale_t);
diff --git a/winsup/cygwin/include/monetary.h b/winsup/cygwin/include/monetary.h
index 8b525e9..1c3479b 100644
--- a/winsup/cygwin/include/monetary.h
+++ b/winsup/cygwin/include/monetary.h
@@ -31,9 +31,20 @@
 
 #include <sys/cdefs.h>
 #include <sys/types.h>
+#if __POSIX_VISIBLE >= 200809
+#include <sys/_locale.h>
+#endif
 
 __BEGIN_DECLS
-ssize_t	strfmon(char * __restrict, size_t, const char * __restrict, ...);
+
+extern ssize_t strfmon (char * __restrict, size_t, const char * __restrict,
+			...);
+
+#if __POSIX_VISIBLE >= 200809
+extern ssize_t strfmon_l (char * __restrict, size_t, locale_t,
+			  const char * __restrict, ...);
+#endif
+
 __END_DECLS
 
 #endif /* !_MONETARY_H_ */


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