[v2] Add __nl_item to <sys/_types.h> and use it

Message ID 20180824072115.32262-1-sebastian.huber@embedded-brains.de
State New
Headers show
Series
  • [v2] Add __nl_item to <sys/_types.h> and use it
Related show

Commit Message

Sebastian Huber Aug. 24, 2018, 7:21 a.m.
Add __nl_item to <sys/_types.h> for FreeBSD compatibility.  Use it in
<langinfo.h> and the Cygwin <nl_types.h>.  Make the enum __nl_item in
<langinfo.h> anonymous.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>

---
 newlib/libc/include/langinfo.h   | 7 +++----
 newlib/libc/include/sys/_types.h | 1 +
 winsup/cygwin/include/nl_types.h | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

-- 
2.13.7

Comments

Corinna Vinschen Aug. 24, 2018, 11:34 a.m. | #1
On Aug 24 09:21, Sebastian Huber wrote:
> Add __nl_item to <sys/_types.h> for FreeBSD compatibility.  Use it in

> <langinfo.h> and the Cygwin <nl_types.h>.  Make the enum __nl_item in

> <langinfo.h> anonymous.


Looks good, please push.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

Patch

diff --git a/newlib/libc/include/langinfo.h b/newlib/libc/include/langinfo.h
index 458b92565..d2b7a031c 100644
--- a/newlib/libc/include/langinfo.h
+++ b/newlib/libc/include/langinfo.h
@@ -29,19 +29,18 @@ 
 #ifndef _LANGINFO_H_
 #define	_LANGINFO_H_
 
-#include <newlib.h>
-#include <sys/config.h>
 #include <sys/cdefs.h>
+#include <sys/_types.h>
 #if __POSIX_VISIBLE >= 200809
 #include <xlocale.h>
 #endif
 
 #ifndef _NL_ITEM_DECLARED
-typedef int nl_item;
+typedef __nl_item nl_item;
 #define _NL_ITEM_DECLARED
 #endif
 
-enum __nl_item
+enum
 {
   /* POSIX and BSD defined items have to stick to the original values
      to maintain backward compatibility. */
diff --git a/newlib/libc/include/sys/_types.h b/newlib/libc/include/sys/_types.h
index d8e8c0b52..fc10531d5 100644
--- a/newlib/libc/include/sys/_types.h
+++ b/newlib/libc/include/sys/_types.h
@@ -210,6 +210,7 @@  typedef	__uint8_t	__sa_family_t;
 typedef	__uint32_t	__socklen_t;
 #endif
 
+typedef	int		__nl_item;
 typedef	unsigned short	__nlink_t;
 typedef	long		__suseconds_t;	/* microseconds (signed) */
 typedef	unsigned long	__useconds_t;	/* microseconds (unsigned) */
diff --git a/winsup/cygwin/include/nl_types.h b/winsup/cygwin/include/nl_types.h
index b9c06f6c3..c57cfef0b 100644
--- a/winsup/cygwin/include/nl_types.h
+++ b/winsup/cygwin/include/nl_types.h
@@ -87,7 +87,7 @@  typedef struct __nl_cat_d {
 
 
 #ifndef _NL_ITEM_DECLARED
-typedef int nl_item;
+typedef __nl_item nl_item;
 #define _NL_ITEM_DECLARED
 #endif