Re: [PATCH] Include "xlocale.h", not <xlocale.h>.

Michael Haubenwallner <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>

On 6/12/19 10:27 AM, Michael Haubenwallner wrote:
> Hi Corinna,
> 
> On 6/12/19 10:05 AM, Corinna Vinschen wrote:
>> Hi Michael,
>>
>> On Jun 11 19:43, Michael Haubenwallner wrote:
>>> libX11 does provide an <X11/Xlocale.h>, and while building libX11
>>> itself, they add their include/X11 to the compiler's include path.
>>> Now when newlib headers include <xlocale.h> on the case insensitive
>>> file system, the compiler does pick their Xlocale.h.
>>> So we better include "xlocale.h" in newlib headers instead, to prefer
>>> newlib xlocale.h from within newlib headers.
>>
>> Commit 90e35b1eb3df renamed _locale.h to xlocale.h in March 2017 under
>> the assumption that we should provide the locale_t type in the same file
>> as on Linux, FreeBSD, and Darwin.
>>
>> A few weeks later (June 2017), glibc removed the xlocale.h file in favor
>> of bits/types/locale_t.h, which shouldn't be included directly anyway.
>>
>> For reference and the reasoning, see
>> https://sourceware.org/git/?p=glibc.git;a=commit;h=f0be25b6336d
>>
>> Given that glibc and thus Linux stopped providing the non-standard
>> xlocale.h header, I'd favor reverting 90e35b1eb3df.
> 
> Fine with me as well!

And just in case you're waiting for a patch to apply...

/haubi/
0001-Revert-Rename-sys-_locale.h-to-xlocale.h.patch (text/x-patch, 5.7 KB)
From a5b1cb940a41709e26d3d450db7182cc8b456099 Mon Sep 17 00:00:00 2001
From: Michael Haubenwallner <[email protected]>
Date: Thu, 13 Jun 2019 09:43:42 +0200
Subject: [PATCH] Revert "Rename <sys/_locale.h> to <xlocale.h>"

There was a case conflict with <Xlocale.h> from libX11, and <xlocale.h>
is not a standard header anyway.
This reverts commit 90e35b1eb3df4070e68afc5e7060665214d586be.
---
 newlib/libc/include/ctype.h                      | 2 +-
 newlib/libc/include/langinfo.h                   | 2 +-
 newlib/libc/include/locale.h                     | 2 +-
 newlib/libc/include/stdlib.h                     | 2 +-
 newlib/libc/include/string.h                     | 2 +-
 newlib/libc/include/strings.h                    | 2 +-
 newlib/libc/include/{xlocale.h => sys/_locale.h} | 6 +++---
 newlib/libc/include/time.h                       | 2 +-
 newlib/libc/include/wchar.h                      | 2 +-
 newlib/libc/include/wctype.h                     | 2 +-
 winsup/cygwin/include/monetary.h                 | 2 +-
 winsup/doc/new-features.xml                      | 6 ++++++
 12 files changed, 19 insertions(+), 13 deletions(-)
 rename newlib/libc/include/{xlocale.h => sys/_locale.h} (70%)

diff --git a/newlib/libc/include/ctype.h b/newlib/libc/include/ctype.h
index 1cee6953b..a0009af17 100644
--- a/newlib/libc/include/ctype.h
+++ b/newlib/libc/include/ctype.h
@@ -5,7 +5,7 @@
 #include <sys/cdefs.h>
 
 #if __POSIX_VISIBLE >= 200809 || __MISC_VISIBLE || defined (_COMPILING_NEWLIB)
-#include <xlocale.h>
+#include <sys/_locale.h>
 #endif
 
 _BEGIN_STD_C
diff --git a/newlib/libc/include/langinfo.h b/newlib/libc/include/langinfo.h
index d2b7a031c..fcf986cce 100644
--- a/newlib/libc/include/langinfo.h
+++ b/newlib/libc/include/langinfo.h
@@ -32,7 +32,7 @@
 #include <sys/cdefs.h>
 #include <sys/_types.h>
 #if __POSIX_VISIBLE >= 200809
-#include <xlocale.h>
+#include <sys/_locale.h>
 #endif
 
 #ifndef _NL_ITEM_DECLARED
diff --git a/newlib/libc/include/locale.h b/newlib/libc/include/locale.h
index d11eb00fb..8abb8db92 100644
--- a/newlib/libc/include/locale.h
+++ b/newlib/libc/include/locale.h
@@ -23,7 +23,7 @@
 
 #if __POSIX_VISIBLE >= 200809 || defined (_COMPILING_NEWLIB)
 
-#include <xlocale.h>
+#include <sys/_locale.h>
 
 #define LC_ALL_MASK		(1 << LC_ALL)
 #define LC_COLLATE_MASK		(1 << LC_COLLATE)
diff --git a/newlib/libc/include/stdlib.h b/newlib/libc/include/stdlib.h
index 933d181e1..15b349440 100644
--- a/newlib/libc/include/stdlib.h
+++ b/newlib/libc/include/stdlib.h
@@ -27,7 +27,7 @@
 #endif
 
 #if __GNU_VISIBLE
-#include <xlocale.h>
+#include <sys/_locale.h>
 #endif
 
 _BEGIN_STD_C
diff --git a/newlib/libc/include/string.h b/newlib/libc/include/string.h
index 04c4d1828..60e837bc0 100644
--- a/newlib/libc/include/string.h
+++ b/newlib/libc/include/string.h
@@ -17,7 +17,7 @@
 #include <stddef.h>
 
 #if __POSIX_VISIBLE >= 200809
-#include <xlocale.h>
+#include <sys/_locale.h>
 #endif
 
 #if __BSD_VISIBLE
diff --git a/newlib/libc/include/strings.h b/newlib/libc/include/strings.h
index 7e2e557e7..f0f7ee137 100644
--- a/newlib/libc/include/strings.h
+++ b/newlib/libc/include/strings.h
@@ -33,7 +33,7 @@
 #include <sys/_types.h>
 
 #if __POSIX_VISIBLE >= 200809
-#include <xlocale.h>
+#include <sys/_locale.h>
 #endif
 
 #ifndef _SIZE_T_DECLARED
diff --git a/newlib/libc/include/xlocale.h b/newlib/libc/include/sys/_locale.h
similarity index 70%
rename from newlib/libc/include/xlocale.h
rename to newlib/libc/include/sys/_locale.h
index f9554269c..ce6f9955c 100644
--- a/newlib/libc/include/xlocale.h
+++ b/newlib/libc/include/sys/_locale.h
@@ -1,7 +1,7 @@
 /* Definition of opaque POSIX-1.2008 type locale_t for userspace. */
 
-#ifndef	_XLOCALE_H
-#define _XLOCALE_H
+#ifndef	_SYS__LOCALE_H
+#define _SYS__LOCALE_H
 
 #include <newlib.h>
 #include <sys/config.h>
@@ -9,4 +9,4 @@
 struct __locale_t;
 typedef struct __locale_t *locale_t;
 
-#endif	/* _XLOCALE_H */
+#endif	/* _SYS__LOCALE_H */
diff --git a/newlib/libc/include/time.h b/newlib/libc/include/time.h
index d69d19969..3031590b4 100644
--- a/newlib/libc/include/time.h
+++ b/newlib/libc/include/time.h
@@ -29,7 +29,7 @@
 #include <sys/timespec.h>
 
 #if __POSIX_VISIBLE >= 200809
-#include <xlocale.h>
+#include <sys/_locale.h>
 #endif
 
 _BEGIN_STD_C
diff --git a/newlib/libc/include/wchar.h b/newlib/libc/include/wchar.h
index 9f2441c4f..c04a6510e 100644
--- a/newlib/libc/include/wchar.h
+++ b/newlib/libc/include/wchar.h
@@ -64,7 +64,7 @@ typedef __gnuc_va_list va_list;
 #endif
 
 #if __POSIX_VISIBLE >= 200809
-#include <xlocale.h>
+#include <sys/_locale.h>
 #endif
 
 _BEGIN_STD_C
diff --git a/newlib/libc/include/wctype.h b/newlib/libc/include/wctype.h
index 9b710900d..e5452bfc3 100644
--- a/newlib/libc/include/wctype.h
+++ b/newlib/libc/include/wctype.h
@@ -8,7 +8,7 @@
 #include <stddef.h>
 
 #if __POSIX_VISIBLE >= 200809
-#include <xlocale.h>
+#include <sys/_locale.h>
 #endif
 
 #ifndef WEOF
diff --git a/winsup/cygwin/include/monetary.h b/winsup/cygwin/include/monetary.h
index 82a6312bf..1c3479bd8 100644
--- a/winsup/cygwin/include/monetary.h
+++ b/winsup/cygwin/include/monetary.h
@@ -32,7 +32,7 @@
 #include <sys/cdefs.h>
 #include <sys/types.h>
 #if __POSIX_VISIBLE >= 200809
-#include <xlocale.h>
+#include <sys/_locale.h>
 #endif
 
 __BEGIN_DECLS
diff --git a/winsup/doc/new-features.xml b/winsup/doc/new-features.xml
index 1ce011e3b..5f0d9482d 100644
--- a/winsup/doc/new-features.xml
+++ b/winsup/doc/new-features.xml
@@ -8,6 +8,12 @@
 
 <itemizedlist mark="bullet">
 
+<listitem><para>
+The rename of the internal &lt;sys/_locale.h&gt; header to &lt;xlocale.h&gt;
+was reverted to avoid the case conflict with &lt;Xlocale.h&gt; from libX11,
+and for not being a standard header anyway.
+</para></listitem>
+
 <listitem><para>
 FIFOs can now be opened multiple times for writing.
 </para></listitem>
-- 
2.19.2
signature.asc (application/pgp-signature, 981 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQKSBAEBCgB9FiEEY4PJ0Y//u+XgtVrKscWEirl385IFAl0CAJ9fFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDYz
ODNDOUQxOEZGRkJCRTVFMEI1NUFDQUIxQzU4NDhBQjk3N0YzOTIACgkQscWEirl3
85JunQ/4sNJ2MwaYF0XBoEgNcNogofYH64RWDBrLzyT5qKmOML2024em5xdOSWqE
u5d3DG5/TzWgy37VYOeosQH7YfeUToOHabLLvL7VqUvuPYRS3XhD2wO/RXtdczUE
A1+vxBvNtVsoxS4VGIyuDxhDsM+E11Wof4jXFEFoQcVWkGudvpwjDQv/TMq7pWlI
ZRfaPbnO4S/DdQEGmkCFx1kdHuyuOY4kJe61wnvP95xaIZYVHFrbPzNFCQtxhaX+
83xiWMu2BE/Z3FgAYOTwzFbrb664b08aTz7IkHSW5gOi6Juenz/jZxDlZMGZCWkl
IYCbiuSGsQv25Vbq5AL9756U51lGxT0lcWpy4X2XuV58RXcYQS25XwT//i4DOnQe
qId8xDOacjRMddL3hxTkwehuHj0KJb3w3AlmUsR4zjYHH/DU1e48S8elJdPgz/e8
+YR1/5c1GVXGzAaAZQzzk4B11rnGFt5sb4M0PIZ5GabLtJu0FCz3QKblwzciJlfr
8zKgv6qC4RLS2F90vd64w8p/YdFKf9qEfXbtvFmpQUxin6zqAafii9a+jNv1oCsf
q1ymWnz5ALsGUMAGKaY1dlcGHxHP/g60E8abGm8FOpKK4DlptwVBoEi8HO3rGdyE
NKlKFgjQjxPw9a1iyLGDgbiZYYTAq6v2daY2cv2PiQtnOXK8Dw==
=ID7j
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.