summaryrefslogtreecommitdiffstats
path: root/newlib/libc
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc')
-rw-r--r--newlib/libc/include/ctype.h5
-rw-r--r--newlib/libc/include/locale.h7
-rw-r--r--newlib/libc/include/string.h5
-rw-r--r--newlib/libc/include/sys/_locale.h12
-rw-r--r--newlib/libc/include/sys/reent.h3
-rw-r--r--newlib/libc/include/time.h10
-rw-r--r--newlib/libc/include/wchar.h5
-rw-r--r--newlib/libc/include/wctype.h9
8 files changed, 35 insertions, 21 deletions
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 <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 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 <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 549d51184..8f4fd2e20 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 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 <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 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 <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 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 <sys/_locale.h>
#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 <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);