summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2018-04-02 17:17:29 +0000
committerNico Weber <nicolasweber@gmx.de>2018-04-02 17:17:29 +0000
commitb96411e42907531d9f0364ce9f90ccae365dcaf8 (patch)
tree5b8ae50df03388f42322ed428bf30e3943a07e93
parent6c25c75a694f78e93a2b5b3e4f36d49a9dbc6fe6 (diff)
Remove HAVE_DIRENT_H.
The autoconf manual: "This macro is obsolescent, as all current systems with directory libraries have <dirent.h>. New programs need not use this macro." git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328989 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--cmake/config-ix.cmake1
-rw-r--r--include/llvm/Config/config.h.cmake4
-rw-r--r--lib/Support/Unix/Path.inc19
3 files changed, 2 insertions, 22 deletions
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
index 6cbf2ace95b..a7dc805ee27 100644
--- a/cmake/config-ix.cmake
+++ b/cmake/config-ix.cmake
@@ -26,7 +26,6 @@ if( CMAKE_SYSTEM MATCHES "FreeBSD-9.2-RELEASE" AND
endif()
# include checks
-check_include_file(dirent.h HAVE_DIRENT_H)
check_include_file(dlfcn.h HAVE_DLFCN_H)
check_include_file(errno.h HAVE_ERRNO_H)
check_include_file(fcntl.h HAVE_FCNTL_H)
diff --git a/include/llvm/Config/config.h.cmake b/include/llvm/Config/config.h.cmake
index 3c894d78869..bb378fc8b3b 100644
--- a/include/llvm/Config/config.h.cmake
+++ b/include/llvm/Config/config.h.cmake
@@ -43,10 +43,6 @@
/* Define to 1 if you have the DIA SDK installed, and to 0 if you don't. */
#cmakedefine01 LLVM_ENABLE_DIA_SDK
-/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
- */
-#cmakedefine HAVE_DIRENT_H ${HAVE_DIRENT_H}
-
/* Define to 1 if you have the <dlfcn.h> header file. */
#cmakedefine HAVE_DLFCN_H ${HAVE_DLFCN_H}
diff --git a/lib/Support/Unix/Path.inc b/lib/Support/Unix/Path.inc
index 1d5e56dc3cf..9bd8cca3738 100644
--- a/lib/Support/Unix/Path.inc
+++ b/lib/Support/Unix/Path.inc
@@ -31,23 +31,8 @@
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif
-#if HAVE_DIRENT_H
-# include <dirent.h>
-# define NAMLEN(dirent) strlen((dirent)->d_name)
-#else
-# define dirent direct
-# define NAMLEN(dirent) (dirent)->d_namlen
-# if HAVE_SYS_NDIR_H
-# include <sys/ndir.h>
-# endif
-# if HAVE_SYS_DIR_H
-# include <sys/dir.h>
-# endif
-# if HAVE_NDIR_H
-# include <ndir.h>
-# endif
-#endif
+#include <dirent.h>
#include <pwd.h>
#ifdef __APPLE__
@@ -704,7 +689,7 @@ std::error_code detail::directory_iterator_increment(detail::DirIterState &it) {
if (cur_dir == nullptr && errno != 0) {
return std::error_code(errno, std::generic_category());
} else if (cur_dir != nullptr) {
- StringRef name(cur_dir->d_name, NAMLEN(cur_dir));
+ StringRef name(cur_dir->d_name);
if ((name.size() == 1 && name[0] == '.') ||
(name.size() == 2 && name[0] == '.' && name[1] == '.'))
return directory_iterator_increment(it);