diff mbox series

[v3] Fix hurd bootstrap after 4c6f92daead

Message ID 20260520114727.2166484-1-adhemerval.zanella@linaro.org
State New
Headers show
Series [v3] Fix hurd bootstrap after 4c6f92daead | expand

Commit Message

Adhemerval Zanella Netto May 20, 2026, 11:47 a.m. UTC
Hurd bootstrap with build-many-glibc.py fails for i686-gnu since
4c6f92daead7aa989ae1b7c67760f81a3550f044:

In file included from zic.c:16:
private.h:849:1: error: static declaration of ‘mempcpy’ follows non-static declaration
  849 | mempcpy(void *restrict s1, void const *restrict s2, size_t n)
      | ^~~~~~~
In file included from ../include/string.h:60,
                 from private.h:222:
../string/string.h:432:14: note: previous declaration of ‘mempcpy’ with type [...]
  432 | extern void *mempcpy (void *__restrict __dest,
      |              ^~~~~~~

The libc-symbols.h already defined some HAVE_*, but timezone files are
built with -D_ISOMAC.  Remove its usage and only define _ and N_
macros if not already defined.

Checked on x86_64-linux-gnu and with a build-many-glibcs.py build for
i686-gnu.
---
 include/libc-symbols.h |  1 +
 timezone/Makefile      |  2 +-
 timezone/private.h     | 16 ++++++++++------
 3 files changed, 12 insertions(+), 7 deletions(-)

Comments

H.J. Lu May 20, 2026, 1:04 p.m. UTC | #1
On Wed, May 20, 2026 at 7:47 PM Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
>
> Hurd bootstrap with build-many-glibc.py fails for i686-gnu since
> 4c6f92daead7aa989ae1b7c67760f81a3550f044:
>
> In file included from zic.c:16:
> private.h:849:1: error: static declaration of ‘mempcpy’ follows non-static declaration
>   849 | mempcpy(void *restrict s1, void const *restrict s2, size_t n)
>       | ^~~~~~~
> In file included from ../include/string.h:60,
>                  from private.h:222:
> ../string/string.h:432:14: note: previous declaration of ‘mempcpy’ with type [...]
>   432 | extern void *mempcpy (void *__restrict __dest,
>       |              ^~~~~~~
>
> The libc-symbols.h already defined some HAVE_*, but timezone files are
> built with -D_ISOMAC.  Remove its usage and only define _ and N_
> macros if not already defined.
>
> Checked on x86_64-linux-gnu and with a build-many-glibcs.py build for
> i686-gnu.
> ---
>  include/libc-symbols.h |  1 +
>  timezone/Makefile      |  2 +-
>  timezone/private.h     | 16 ++++++++++------
>  3 files changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/include/libc-symbols.h b/include/libc-symbols.h
> index 67edb4965e8..6a9f6403ab9 100644
> --- a/include/libc-symbols.h
> +++ b/include/libc-symbols.h
> @@ -113,6 +113,7 @@
>  #define HAVE_LIBINTL_H 1
>  #define HAVE_WCTYPE_H  1
>  #define HAVE_ISWCTYPE  1
> +#define HAVE_MEMPCPY   1
>  #define ENABLE_NLS     1
>
>  /* The symbols in all the user (non-_) macros are C symbols.  */
> diff --git a/timezone/Makefile b/timezone/Makefile
> index 426061737a2..ce9abe6cb2d 100644
> --- a/timezone/Makefile
> +++ b/timezone/Makefile
> @@ -67,7 +67,7 @@ tz-cflags = -DTZDIR='"$(zonedir)"' \
>             -DTZDEFAULT='"$(localtime-file)"' \
>             -DTZDEFRULES='"$(posixrules-file)"' \
>             -DTM_GMTOFF=tm_gmtoff -DTM_ZONE=tm_zone \
> -           -DHAVE_GETTEXT -DUSE_LTZ=0 -D_ISOMAC -DTZ_DOMAIN='"libc"' \
> +           -DHAVE_GETTEXT -DUSE_LTZ=0 -DTZ_DOMAIN='"libc"' \
>             -include $(common-objpfx)config.h $(config-cflags-wno-maybe-uninitialized)
>
>  CFLAGS-zdump.c += $(tz-cflags)
> diff --git a/timezone/private.h b/timezone/private.h
> index ee191b4ec33..1e6db08cb32 100644
> --- a/timezone/private.h
> +++ b/timezone/private.h
> @@ -1071,12 +1071,16 @@ time_t timeoff(struct tm *, long);
>  ** The default is to use gettext if available, and use MSGID otherwise.
>  */
>
> -#if HAVE_GETTEXT
> -# define _(msgid) gettext(msgid)
> -#else /* !HAVE_GETTEXT */
> -# define _(msgid) (msgid)
> -#endif /* !HAVE_GETTEXT */
> -#define N_(msgid) (msgid)
> +#ifndef _
> +# if HAVE_GETTEXT
> +#  define _(msgid) gettext(msgid)
> +# else
> +#  define _(msgid) (msgid)
> +# endif
> +#endif
> +#ifndef N_
> +# define N_(msgid) (msgid)
> +#endif
>
>  #if !defined TZ_DOMAIN && defined HAVE_GETTEXT
>  # define TZ_DOMAIN "tz"
> --
> 2.43.0
>

LGTM.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>

Thanks.
Paul Eggert May 20, 2026, 4:44 p.m. UTC | #2
Thanks, this looks good to me too.

Reviewed-by: Paul Eggert <eggert@cs.ucla.edu>
diff mbox series

Patch

diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 67edb4965e8..6a9f6403ab9 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -113,6 +113,7 @@ 
 #define HAVE_LIBINTL_H	1
 #define HAVE_WCTYPE_H	1
 #define HAVE_ISWCTYPE	1
+#define HAVE_MEMPCPY	1
 #define ENABLE_NLS	1
 
 /* The symbols in all the user (non-_) macros are C symbols.  */
diff --git a/timezone/Makefile b/timezone/Makefile
index 426061737a2..ce9abe6cb2d 100644
--- a/timezone/Makefile
+++ b/timezone/Makefile
@@ -67,7 +67,7 @@  tz-cflags = -DTZDIR='"$(zonedir)"' \
 	    -DTZDEFAULT='"$(localtime-file)"' \
 	    -DTZDEFRULES='"$(posixrules-file)"' \
 	    -DTM_GMTOFF=tm_gmtoff -DTM_ZONE=tm_zone \
-	    -DHAVE_GETTEXT -DUSE_LTZ=0 -D_ISOMAC -DTZ_DOMAIN='"libc"' \
+	    -DHAVE_GETTEXT -DUSE_LTZ=0 -DTZ_DOMAIN='"libc"' \
 	    -include $(common-objpfx)config.h $(config-cflags-wno-maybe-uninitialized)
 
 CFLAGS-zdump.c += $(tz-cflags)
diff --git a/timezone/private.h b/timezone/private.h
index ee191b4ec33..1e6db08cb32 100644
--- a/timezone/private.h
+++ b/timezone/private.h
@@ -1071,12 +1071,16 @@  time_t timeoff(struct tm *, long);
 ** The default is to use gettext if available, and use MSGID otherwise.
 */
 
-#if HAVE_GETTEXT
-# define _(msgid) gettext(msgid)
-#else /* !HAVE_GETTEXT */
-# define _(msgid) (msgid)
-#endif /* !HAVE_GETTEXT */
-#define N_(msgid) (msgid)
+#ifndef _
+# if HAVE_GETTEXT
+#  define _(msgid) gettext(msgid)
+# else
+#  define _(msgid) (msgid)
+# endif
+#endif
+#ifndef N_
+# define N_(msgid) (msgid)
+#endif
 
 #if !defined TZ_DOMAIN && defined HAVE_GETTEXT
 # define TZ_DOMAIN "tz"