Jens Rehsack wrote:
> battle of compatibility layers.

Yes, we need C preprocessor macros to avoid conflicts between compatibility
layers.

It's preferable to have this witness macro defined through the .h file.


2020-02-24  Bruno Haible  <br...@clisp.org>

        fcntl: Add witness of gnulib override.
        Reported by Jens Rehsack <s...@netbsd.org> in
        <https://lists.gnu.org/archive/html/bug-gnulib/2020-02/msg00137.html>.
        * lib/fcntl.in.h (GNULIB_defined_rpl_fcntl, GNULIB_defined_fcntl): New
        macros.

diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h
index b2e1e51..0a21c95 100644
--- a/lib/fcntl.in.h
+++ b/lib/fcntl.in.h
@@ -116,9 +116,15 @@ _GL_WARN_ON_USE (creat, "creat is not always POSIX 
compliant - "
 #  endif
 _GL_FUNCDECL_RPL (fcntl, int, (int fd, int action, ...));
 _GL_CXXALIAS_RPL (fcntl, int, (int fd, int action, ...));
+#  if !GNULIB_defined_rpl_fcntl
+#   define GNULIB_defined_rpl_fcntl 1
+#  endif
 # else
 #  if !@HAVE_FCNTL@
 _GL_FUNCDECL_SYS (fcntl, int, (int fd, int action, ...));
+#   if !GNULIB_defined_fcntl
+#    define GNULIB_defined_fcntl 1
+#   endif
 #  endif
 _GL_CXXALIAS_SYS (fcntl, int, (int fd, int action, ...));
 # endif


Reply via email to