[git] GCRYPT - branch, master, updated. libgcrypt-1.8.1-21-g621f5c4

Andreas Metzler ametzler at bebt.de
Sat Nov 11 12:49:16 CET 2017


[resent, gmane gateway seems to have swallowed the original post]

by NIIBE Yutaka <cvs at cvs.gnupg.org> wrote:
[...]
>     Fix secmem test for machine with larger page.

>     * tests/t-secmem.c (main): Detect page size and setup chunk size.
>     * src/secmem.c (init_pool): Simplify the expression.
[...]
> +# if defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE)
> +  pgsize_val = sysconf (_SC_PAGESIZE);
> +# elif defined(HAVE_GETPAGESIZE)
> +  pgsize_val = getpagesize ();
> +# endif
[...]

Thank you.

This causes the following error on mingw:
../../tests/t-secmem.c: In function 'main':
../../tests/t-secmem.c:126:16: warning: implicit declaration of function 'getpagesize' [-Wimplicit-function-declaration]
   pgsize_val = getpagesize ();
                ^~~~~~~~~~~

I have googled  a little bit and found that gnulib's getpagesize.m4
has this comment:
  dnl mingw has getpagesize() in libgcc.a but doesn't declare it.

And indeed it seems to be true, AC_CHECK_FUNCS succeeds but
AC_CHECK_DECLS fails.

cu Andreas


--- a/configure.ac
+++ b/configure.ac
@@ -1737,6 +1737,9 @@ AC_CHECK_FUNCS(strtoul memmove stricmp a
 AC_CHECK_FUNCS(strerror rand mmap getpagesize sysconf waitpid wait4)
 AC_CHECK_FUNCS(gettimeofday getrusage gethrtime clock_gettime syslog)
 AC_CHECK_FUNCS(syscall fcntl ftruncate flockfile)
+dnl Also check whether getpagesize() is declared.
+dnl mingw has getpagesize() in libgcc.a but doesn't declare it.
+AC_CHECK_DECLS([getpagesize])
 
 GNUPG_CHECK_MLOCK
 
--- a/tests/t-secmem.c
+++ b/tests/t-secmem.c
@@ -122,7 +122,7 @@ main (int argc, char **argv)
 
 # if defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE)
   pgsize_val = sysconf (_SC_PAGESIZE);
-# elif defined(HAVE_GETPAGESIZE)
+# elif defined(HAVE_GETPAGESIZE) && HAVE_DECL_GETPAGESIZE
   pgsize_val = getpagesize ();
 # endif
   pgsize = (pgsize_val > 0)? pgsize_val : DEFAULT_PAGE_SIZE;
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -209,6 +209,9 @@ mlock(&i, 4);
     fi
     if test "$ac_cv_func_mlock" = "yes"; then
         AC_CHECK_FUNCS(sysconf getpagesize)
+        dnl Also check whether getpagesize() is declared.
+        dnl mingw has getpagesize() in libgcc.a but doesn't declare it.
+        AC_CHECK_DECLS([getpagesize])
         AC_MSG_CHECKING(whether mlock is broken)
           AC_CACHE_VAL(gnupg_cv_have_broken_mlock,
              AC_TRY_RUN([
@@ -227,7 +230,7 @@ int main()
 
 #if defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE)
     pgsize = sysconf (_SC_PAGESIZE);
-#elif defined (HAVE_GETPAGESIZE)
+#elif defined (HAVE_GETPAGESIZE) && HAVE_DECL_GETPAGESIZE
     pgsize = getpagesize();
 #else
     pgsize = -1;



More information about the Gcrypt-devel mailing list