The getpagesize() function should better follow the stated rule for use of 'extern inline'. Otherwise we could get into trouble like for realloc-posix.
2024-11-11 Bruno Haible <br...@clisp.org> getpagesize: Fix use of 'extern inline' (regression 2012-11-20). * lib/unistd.in.h (_GL_GETPAGESIZE_INLINE): New macro. (getpagesize): Use it. * lib/getpagesize.c (_GL_GETPAGESIZE_INLINE): Define. * modules/getpagesize (configure.ac): Compile getpagesize.c also when getpagesize is missing. diff --git a/lib/getpagesize.c b/lib/getpagesize.c index d203155329..dd880a6ca2 100644 --- a/lib/getpagesize.c +++ b/lib/getpagesize.c @@ -20,6 +20,7 @@ #include <config.h> /* Specification. */ +#define _GL_GETPAGESIZE_INLINE _GL_EXTERN_INLINE #include <unistd.h> /* This implementation is only for native Windows systems. */ diff --git a/lib/unistd.in.h b/lib/unistd.in.h index 20b1356fd3..ceb3cb48f1 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -181,6 +181,9 @@ _GL_INLINE_HEADER_BEGIN #ifndef _GL_UNISTD_INLINE # define _GL_UNISTD_INLINE _GL_INLINE #endif +#ifndef _GL_GETPAGESIZE_INLINE +# define _GL_GETPAGESIZE_INLINE _GL_INLINE +#endif /* Hide some function declarations from <winsock2.h>. */ @@ -1478,7 +1481,7 @@ _GL_FUNCDECL_SYS (getpagesize, int, (void), ); # define getpagesize() _gl_getpagesize () # else # if !GNULIB_defined_getpagesize_function -_GL_UNISTD_INLINE int +_GL_GETPAGESIZE_INLINE int getpagesize () { return _gl_getpagesize (); diff --git a/modules/getpagesize b/modules/getpagesize index 7b38fff93b..a883edf067 100644 --- a/modules/getpagesize +++ b/modules/getpagesize @@ -10,7 +10,8 @@ unistd configure.ac: gl_FUNC_GETPAGESIZE -gl_CONDITIONAL([GL_COND_OBJ_GETPAGESIZE], [test $REPLACE_GETPAGESIZE = 1]) +gl_CONDITIONAL([GL_COND_OBJ_GETPAGESIZE], + [test $HAVE_GETPAGESIZE = 0 || test $REPLACE_GETPAGESIZE = 1]) gl_UNISTD_MODULE_INDICATOR([getpagesize]) Makefile.am: