bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH 6/7] dirent: Redefine dirfd macro as a rpl function always


From: KO Myung-Hun
Subject: [PATCH 6/7] dirent: Redefine dirfd macro as a rpl function always
Date: Tue, 19 Jan 2021 01:40:12 +0900

On OS/2 kLIBC, dirfd is defined as a macro not a function. Because of
this, dirfd is not redefined as rpl function in C++ mode. As a result,
the following error occurs:

-----
./../gllib/dirent.h:689:1: error: 'dirfd' was not declared in this scope; did 
you mean 'gnulib::dirfd'?
  689 | _GL_CXXALIASWARN (dirfd);
      | ^~~~~~~~~~~~~~~~
./../gllib/dirent.h:669:1: note: 'gnulib::dirfd' declared here
  669 | _GL_CXXALIAS_RPL (dirfd, int, (DIR *));
      | ^~~~~~~~~~~~~~~~
-----

* lib/dirent.in.h (dirfd): Redefine dirfd macro as a rpl function always.
---
 lib/dirent.in.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/dirent.in.h b/lib/dirent.in.h
index 2e2c5119a..14ce5b987 100644
--- a/lib/dirent.in.h
+++ b/lib/dirent.in.h
@@ -154,7 +154,8 @@ _GL_WARN_ON_USE (closedir, "closedir is not portable - "
 /* Return the file descriptor associated with the given directory stream,
    or -1 if none exists.  */
 # if @REPLACE_DIRFD@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE) || defined dirfd
+    /* If dirfd is a macro, re-define it as a rpl function always.  */
 #   undef dirfd
 #   define dirfd rpl_dirfd
 #  endif
-- 
2.22.0




reply via email to

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