[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fix error when GNULIB_POSIXCHECK is enabled

From: Bruno Haible
Subject: Fix error when GNULIB_POSIXCHECK is enabled
Date: Wed, 18 Nov 2020 02:35:38 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-193-generic; KDE/5.18.0; x86_64; ; )

Compiling a testdir created with

./gnulib-tool --create-testdir --dir=../testdir1 --single-configure 
--with-c++-tests \
  array-list  avltreehash-list avltree-list carray-list linkedhash-list \
  linked-list list rbtreehash-list rbtree-list sublist xlist xsublist list-c++ \
  posixcheck strpbrk

I get this compilation error on most platforms:

-I/media/develdata/devel/inst-x86_64-64/include -Wall  -g -O2 -MT cloexec.o -MD 
-MP -MF .deps/cloexec.Tpo -c -o cloexec.o ../../gllib/cloexec.c
In file included from /usr/include/x86_64-linux-gnu/sys/types.h:219:0,
                 from ./sys/types.h:39,
                 from ./fcntl.h:56,
                 from ../../gllib/cloexec.c:25:
./unistd.h:900:1: error: ‘copy_file_range’ undeclared here (not in a function)
 _GL_WARN_ON_USE (copy_file_range,

This patch fixes it.

2020-11-17  Bruno Haible  <bruno@clisp.org>

        Fix error when GNULIB_POSIXCHECK is enabled (regression 2019-06-04).
        * lib/unistd.in.h (copy_file_range): Don't assume that copy_file_range
        is always declared.
        * m4/unistd_h.m4 (gl_UNISTD_H): Test whether copy_file_range is

diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index efe237f..5cf6f9d 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -397,10 +397,11 @@ _GL_CXXALIAS_SYS (copy_file_range, ssize_t, (int ifd, 
off_t *ipos,
 # endif
 _GL_CXXALIASWARN (copy_file_range);
 #elif defined GNULIB_POSIXCHECK
-/* Assume copy_file_range is always declared.  */
 _GL_WARN_ON_USE (copy_file_range,
                  "copy_file_range is unportable - "
                  "use gnulib module copy_file_range for portability");
+# endif
diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4
index b4734da..07b9158 100644
--- a/m4/unistd_h.m4
+++ b/m4/unistd_h.m4
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 81
+# unistd_h.m4 serial 82
 dnl Copyright (C) 2006-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -41,7 +41,8 @@ AC_DEFUN([gl_UNISTD_H],
 #  include <io.h>
 # endif
-    ]], [access chdir chown dup dup2 dup3 environ euidaccess faccessat fchdir
+    ]], [access chdir chown copy_file_range dup dup2 dup3 environ euidaccess
+    faccessat fchdir
     fchownat fdatasync fsync ftruncate getcwd getdomainname getdtablesize
     getentropy getgroups gethostname getlogin getlogin_r getpagesize getpass
     getusershell setusershell endusershell

reply via email to

[Prev in Thread] Current Thread [Next in Thread]