diff --git a/newlib/libc/include/ctype.h b/newlib/libc/include/ctype.h index 332869128..0284c18b2 100644 --- a/newlib/libc/include/ctype.h +++ b/newlib/libc/include/ctype.h @@ -4,9 +4,8 @@ #include "_ansi.h" #include -#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 #endif _BEGIN_STD_C diff --git a/newlib/libc/include/locale.h b/newlib/libc/include/locale.h index a195c195e..f74e9c516 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 #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 549d51184..8f4fd2e20 100644 --- a/newlib/libc/include/string.h +++ b/newlib/libc/include/string.h @@ -16,9 +16,8 @@ #define __need_NULL #include -#if __POSIX_VISIBLE >= 200809 || defined (_COMPILING_NEWLIB) -struct __locale_t; -typedef struct __locale_t *locale_t; +#if __POSIX_VISIBLE >= 200809 +#include #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 000000000..ce6f9955c --- /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 +#include + +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 bd32320a6..07abcb428 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 698ad6113..47ab578bc 100644 --- a/newlib/libc/include/time.h +++ b/newlib/libc/include/time.h @@ -28,6 +28,10 @@ #include #include +#if __POSIX_VISIBLE >= 200809 +#include +#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 a03f642de..4df60b4c2 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 #endif _BEGIN_STD_C diff --git a/newlib/libc/include/wctype.h b/newlib/libc/include/wctype.h index 6c2505ddf..d08537411 100644 --- a/newlib/libc/include/wctype.h +++ b/newlib/libc/include/wctype.h @@ -7,6 +7,10 @@ #define __need_wint_t #include +#if __POSIX_VISIBLE >= 200809 +#include +#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 8b525e961..1c3479bd8 100644 --- a/winsup/cygwin/include/monetary.h +++ b/winsup/cygwin/include/monetary.h @@ -31,9 +31,20 @@ #include #include +#if __POSIX_VISIBLE >= 200809 +#include +#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_ */