From 13d27751ecb30939a6b5d790de738f6ff49f28ed Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 24 Jul 2024 23:53:53 +0200 Subject: [PATCH] Avoid false gethostname_used_without_requesting_gnulib_module_gethostname. * modules/gethostname (configure.ac): Invoke gl_MODULE_INDICATOR. * lib/unistd.in.h (gethostname): Don't define to gethostname_used_without_requesting_gnulib_module_gethostname if the gnulib module 'gethostname' is in use under the same configure.ac. --- ChangeLog | 6 ++++++ lib/unistd.in.h | 6 ++++-- modules/gethostname | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index e874cdc003..b4669045f7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2024-07-24 Bruno Haible + Avoid false gethostname_used_without_requesting_gnulib_module_gethostname. + * modules/gethostname (configure.ac): Invoke gl_MODULE_INDICATOR. + * lib/unistd.in.h (gethostname): Don't define to + gethostname_used_without_requesting_gnulib_module_gethostname if the + gnulib module 'gethostname' is in use under the same configure.ac. + Avoid false error close_used_without_requesting_gnulib_module_close. Reported by Frédéric at . * modules/close (configure.ac): Invoke gl_MODULE_INDICATOR. diff --git a/lib/unistd.in.h b/lib/unistd.in.h index 688988e9e2..9ca377c4df 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -1318,8 +1318,10 @@ _GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len)); # endif _GL_CXXALIASWARN (gethostname); #elif @UNISTD_H_HAVE_WINSOCK2_H@ -# undef gethostname -# define gethostname gethostname_used_without_requesting_gnulib_module_gethostname +# if !GNULIB_GETHOSTNAME +# undef gethostname +# define gethostname gethostname_used_without_requesting_gnulib_module_gethostname +# endif #elif defined GNULIB_POSIXCHECK # undef gethostname # if HAVE_RAW_DECL_GETHOSTNAME diff --git a/modules/gethostname b/modules/gethostname index 94151cd8b0..8523a8e944 100644 --- a/modules/gethostname +++ b/modules/gethostname @@ -20,6 +20,7 @@ AM_COND_IF([GL_COND_OBJ_GETHOSTNAME], [ gl_PREREQ_GETHOSTNAME ]) gl_UNISTD_MODULE_INDICATOR([gethostname]) +gl_MODULE_INDICATOR([gethostname]) Makefile.am: if GL_COND_OBJ_GETHOSTNAME -- 2.39.5