Include "xlocale.h", not <xlocale.h>.

Message ID 20190611174322.31962-1-michael.haubenwallner@ssi-schaefer.com
State New
Headers show
Series
  • Include "xlocale.h", not <xlocale.h>.
Related show

Commit Message

Michael Haubenwallner June 11, 2019, 5:43 p.m.
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.
---
 newlib/libc/include/ctype.h      | 2 +-
 newlib/libc/include/inttypes.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/time.h       | 2 +-
 newlib/libc/include/wchar.h      | 2 +-
 newlib/libc/include/wctype.h     | 2 +-
 winsup/cygwin/include/monetary.h | 2 +-
 11 files changed, 11 insertions(+), 11 deletions(-)

-- 
2.21.0

Comments

Corinna Vinschen June 12, 2019, 8:05 a.m. | #1
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.


Thoughts?


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat
Michael Haubenwallner June 12, 2019, 8:27 a.m. | #2
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!

Thanks!
/haubi/
Michael Haubenwallner June 13, 2019, 7:51 a.m. | #3
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/
From a5b1cb940a41709e26d3d450db7182cc8b456099 Mon Sep 17 00:00:00 2001
From: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>

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
Corinna Vinschen June 13, 2019, 11 a.m. | #4
On Jun 13 09:51, Michael Haubenwallner wrote:
> 

> 

> 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...


Thanks, I already have a patch.  I was just waiting if Yaakov
has some input.  He provided the original patch.

Yaakov?  Any input?


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat
Yaakov Selkowitz June 13, 2019, 11 p.m. | #5
On Wed, 2019-06-12 at 10:05 +0200, 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.


I concur, please proceed.  Any packages which still expect <xlocale.h>
should have a patch in Fedora by now.

-- 
Yaakov Selkowitz
Senior Software Engineer - Platform Enablement
Red Hat, Inc.
Corinna Vinschen June 14, 2019, 8:05 a.m. | #6
On Jun 13 19:00, Yaakov Selkowitz wrote:
> On Wed, 2019-06-12 at 10:05 +0200, 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.

> 

> I concur, please proceed.  Any packages which still expect <xlocale.h>

> should have a patch in Fedora by now.


Thank you, done.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

Patch

diff --git a/newlib/libc/include/ctype.h b/newlib/libc/include/ctype.h
index 1cee6953b..562683a70 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 "xlocale.h"
 #endif
 
 _BEGIN_STD_C
diff --git a/newlib/libc/include/inttypes.h b/newlib/libc/include/inttypes.h
index 694ba8fcf..363d05f6f 100644
--- a/newlib/libc/include/inttypes.h
+++ b/newlib/libc/include/inttypes.h
@@ -22,7 +22,7 @@ 
 #include <stddef.h>
 
 #if __BSD_VISIBLE
-#include <xlocale.h>
+#include "xlocale.h"
 #endif
 
 #define __STRINGIFY(a) #a
diff --git a/newlib/libc/include/langinfo.h b/newlib/libc/include/langinfo.h
index d2b7a031c..75ba4d92f 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 "xlocale.h"
 #endif
 
 #ifndef _NL_ITEM_DECLARED
diff --git a/newlib/libc/include/locale.h b/newlib/libc/include/locale.h
index d11eb00fb..17fa6a736 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 "xlocale.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..aebc15036 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 "xlocale.h"
 #endif
 
 _BEGIN_STD_C
diff --git a/newlib/libc/include/string.h b/newlib/libc/include/string.h
index 04c4d1828..a35a00cc7 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 "xlocale.h"
 #endif
 
 #if __BSD_VISIBLE
diff --git a/newlib/libc/include/strings.h b/newlib/libc/include/strings.h
index 7e2e557e7..29e5f783c 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 "xlocale.h"
 #endif
 
 #ifndef _SIZE_T_DECLARED
diff --git a/newlib/libc/include/time.h b/newlib/libc/include/time.h
index d69d19969..9b67b847b 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 "xlocale.h"
 #endif
 
 _BEGIN_STD_C
diff --git a/newlib/libc/include/wchar.h b/newlib/libc/include/wchar.h
index 9f2441c4f..a3a6698b4 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 "xlocale.h"
 #endif
 
 _BEGIN_STD_C
diff --git a/newlib/libc/include/wctype.h b/newlib/libc/include/wctype.h
index 9b710900d..4e3dc16e4 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 "xlocale.h"
 #endif
 
 #ifndef WEOF
diff --git a/winsup/cygwin/include/monetary.h b/winsup/cygwin/include/monetary.h
index 82a6312bf..4daabce0e 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 "xlocale.h"
 #endif
 
 __BEGIN_DECLS