Date: Wed, 10 Feb 2021 16:42:02 GMT From: Jessica Clarke <jrtc27@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 01d07b03ef2b - main - localedef: Fix bootstrapping on Ubuntu 16.04 Message-ID: <202102101642.11AGg2JN037463@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=01d07b03ef2b59e70a25cfc4d9e438a7331c5926 commit 01d07b03ef2b59e70a25cfc4d9e438a7331c5926 Author: Jessica Clarke <jrtc27@FreeBSD.org> AuthorDate: 2021-02-10 16:41:35 +0000 Commit: Jessica Clarke <jrtc27@FreeBSD.org> CommitDate: 2021-02-10 16:41:35 +0000 localedef: Fix bootstrapping on Ubuntu 16.04 Glibc's stdlib.h defines various prototypes for GNU extensions that take a locale_t. Newer versions use locale_t directly and include an internal bits/types/locale_t.h in order to get its definition, but older versions include xlocale.h for that, for which our bootstrap version is empty. Moreover it expects to use the glibc-specific __locale_t type. Thus, provide dummy definitions of both types in order to ensure the prototypes don't give any errors, and guard against the header being inadvertently included between the bootstrapping namespace.h and un-namespace.h, where locale_t is #define'd. This header is not used when bootstrapping on FreeBSD and exists solely to stub out glibc's, so this should have no impact on FreeBSD hosts. Reviewed by: arichardson, emaste (comment only) Differential Revision: https://reviews.freebsd.org/D28317 --- usr.bin/localedef/bootstrap/xlocale.h | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/usr.bin/localedef/bootstrap/xlocale.h b/usr.bin/localedef/bootstrap/xlocale.h index 67d1cc4116c6..05629a32f4e3 100644 --- a/usr.bin/localedef/bootstrap/xlocale.h +++ b/usr.bin/localedef/bootstrap/xlocale.h @@ -35,8 +35,21 @@ * * $FreeBSD$ */ + +#pragma once + /* - * This header only exists to avoid pulling in the host xlocale.h from - * the libc-internal headers. This is required since newer Linux GLibc no - * longer includes xlocale.h and older versions include an incompatible header. + * This header only exists to avoid pulling in the host xlocale.h from the + * libc-internal headers. New versions of glibc include bits/types/locale.h + * from stdlib.h and so get their own locale_t (and don't provide xlocale.h), + * but older versions include xlocale.h and expect to have a __locale_t. Thus + * we provide dummy definitions of both so the (unused) prototypes don't give + * errors. */ + +#ifdef locale_t +#error "Dummy xlocale.h included inside bootstrapping namespace context" +#endif + +typedef struct __dummy_host_locale *__locale_t; +typedef __locale_t locale_t;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202102101642.11AGg2JN037463>