From f3db8e3c70491442e2747e2dfa8cc3c07b3b40d1 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Mon, 2 Apr 2018 17:17:29 +0000 Subject: [PATCH] Remove HAVE_DIRENT_H. The autoconf manual: "This macro is obsolescent, as all current systems with directory libraries have . New programs need not use this macro." llvm-svn: 328989 --- llvm/cmake/config-ix.cmake | 1 - llvm/include/llvm/Config/config.h.cmake | 4 ---- llvm/lib/Support/Unix/Path.inc | 19 ++----------------- 3 files changed, 2 insertions(+), 22 deletions(-) diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake index 6cbf2ac..a7dc805 100644 --- a/llvm/cmake/config-ix.cmake +++ b/llvm/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/llvm/include/llvm/Config/config.h.cmake b/llvm/include/llvm/Config/config.h.cmake index 3c894d7..bb378fc8 100644 --- a/llvm/include/llvm/Config/config.h.cmake +++ b/llvm/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 header file, and it defines `DIR'. - */ -#cmakedefine HAVE_DIRENT_H ${HAVE_DIRENT_H} - /* Define to 1 if you have the header file. */ #cmakedefine HAVE_DLFCN_H ${HAVE_DLFCN_H} diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc index 1d5e56d..9bd8cca 100644 --- a/llvm/lib/Support/Unix/Path.inc +++ b/llvm/lib/Support/Unix/Path.inc @@ -31,23 +31,8 @@ #ifdef HAVE_SYS_MMAN_H #include #endif -#if HAVE_DIRENT_H -# include -# define NAMLEN(dirent) strlen((dirent)->d_name) -#else -# define dirent direct -# define NAMLEN(dirent) (dirent)->d_namlen -# if HAVE_SYS_NDIR_H -# include -# endif -# if HAVE_SYS_DIR_H -# include -# endif -# if HAVE_NDIR_H -# include -# endif -#endif +#include #include #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); -- 2.7.4