[3/10] RFC: remove gdb_dirent.h

Tom Tromey
2012-11-15T19:22:29Z

This patch removes gdb_dirent.h in favor of the corresponding gnulib
module.

Tom

* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add dirent.
* common/gdb_dirent.h: Remove.
* common/linux-osdata.c: Use <dirent.h>.
(NAMELEN): Define.
* config.in: Rebuild.
* configure: Rebuild.
* configure.ac: Don't call AC_HEADER_DIRENT.
* gnulib/aclocal.m4: Update.
* gnulib/configure: Update.
* gnulib/import/Makefile.am: Update.
* gnulib/import/Makefile.in: Update.
* gnulib/import/dirent.in.h: Update.
* gnulib/import/m4/dirent_h.m4: Update.
* gnulib/import/m4/gnulib-cache.m4: Update.
* gnulib/import/m4/gnulib-comp.m4: Update.
* gnulib/import/m4/unistd_h.m4: Update.
* linux-fork.c: Update.
* linux-nat.c: Update.
* nto-procfs.c: Update.
* procfs.c: Update.

* Makefile.in (linux-osdata.o): Don't reference gdb_dirent.h.
* config.in: Rebuild.
* configure: Rebuild.
* configure.ac: Don't call AC_HEADER_DIRENT.
---
gdb/common/gdb_dirent.h | 40 ---
gdb/common/linux-osdata.c | 4 +-
gdb/config.in | 15 -
gdb/configure | 159 ------------
gdb/configure.ac | 1 -
gdb/gdbserver/Makefile.in | 2 +-
gdb/gdbserver/config.in | 15 -
gdb/gdbserver/configure | 159 ------------
gdb/gdbserver/configure.ac | 1 -
gdb/gnulib/aclocal.m4 | 2 +
gdb/gnulib/configure | 465 ++++++++++++++++++++++++++++++++--
gdb/gnulib/import/Makefile.am | 50 ++++-
gdb/gnulib/import/Makefile.in | 215 +++++++++++++++-
gdb/gnulib/import/dirent.in.h | 258 +++++++++++++++++++
gdb/gnulib/import/m4/dirent_h.m4 | 64 +++++
gdb/gnulib/import/m4/gnulib-cache.m4 | 3 +-
gdb/gnulib/import/m4/gnulib-comp.m4 | 5 +
gdb/gnulib/import/m4/unistd_h.m4 | 187 ++++++++++++++
gdb/gnulib/update-gnulib.sh | 2 +-
gdb/linux-fork.c | 2 +-
gdb/linux-nat.c | 2 +-
gdb/nto-procfs.c | 2 +-
gdb/procfs.c | 2 +-
23 files changed, 1223 insertions(+), 432 deletions(-)
delete mode 100644 gdb/common/gdb_dirent.h
create mode 100644 gdb/gnulib/import/dirent.in.h
create mode 100644 gdb/gnulib/import/m4/dirent_h.m4
create mode 100644 gdb/gnulib/import/m4/unistd_h.m4

diff --git a/gdb/common/gdb_dirent.h b/gdb/common/gdb_dirent.h
deleted file mode 100644
index 183dfe4..0000000
--- a/gdb/common/gdb_dirent.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Portable <dirent.h>.
- Copyright (C) 2000, 2002, 2007-2012 Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef GDB_DIRENT_H
-#define GDB_DIRENT_H 1
-
-/* See description of `AC_HEADER_DIRENT' in the Autoconf manual. */
-#ifdef HAVE_DIRENT_H
-# include <dirent.h> /* ARI: dirent.h */
-# define NAMELEN(dirent) strlen ((dirent)->d_name) /* ARI: strlen d_name */
-#else
-# define dirent direct
-# define NAMELEN(dirent) (dirent)->d_namelen /* ARI: d_namelen */
-# ifdef HAVE_SYS_NDIR_H
-# include <sys/ndir.h>
-# endif
-# ifdef HAVE_SYS_DIR_H
-# include <sys/dir.h>
-# endif
-# ifdef HAVE_NDIR_H
-# include <ndir.h>
-# endif
-#endif
-
-#endif /* not GDB_DIRENT_H */
diff --git a/gdb/common/linux-osdata.c b/gdb/common/linux-osdata.c
index afe3e75..0be6ba9 100644
--- a/gdb/common/linux-osdata.c
+++ b/gdb/common/linux-osdata.c
@@ -41,8 +41,10 @@
#include "xml-utils.h"
#include "buffer.h"
#include "gdb_assert.h"
-#include "gdb_dirent.h"
#include "gdb_stat.h"
+#include <dirent.h>
+
+#define NAMELEN(dirent) strlen ((dirent)->d_name)

/* Define PID_T to be a fixed size that is at least as large as pid_t,
so that reading pid values embedded in /proc works
diff --git a/gdb/configure.ac b/gdb/configure.ac
index ac0761e..28291ff 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1071,7 +1071,6 @@ fi
# Checks for header files. #
# ------------------------- #

-AC_HEADER_DIRENT
AC_HEADER_STDC
# elf_hp.h is for HP/UX 64-bit shared library support.
AC_CHECK_HEADERS([nlist.h machine/reg.h poll.h sys/poll.h proc_service.h \
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index fc4fd1d..a44c64e 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -517,7 +517,7 @@ gdb_vecs.o: ../common/gdb_vecs.c $(vec_h) $(gdb_vecs_h) $(host_defs_h)
xml-utils.o: ../common/xml-utils.c $(server_h)
$(CC) -c $(CPPFLAGS) $(INTERNAL_CFLAGS) $<

-linux-osdata.o: ../common/linux-osdata.c $(server_h) $(linux_osdata_h) ../common/gdb_dirent.h
+linux-osdata.o: ../common/linux-osdata.c $(server_h) $(linux_osdata_h)
$(CC) -c $(CPPFLAGS) $(INTERNAL_CFLAGS) $<

ptid.o: ../common/ptid.c $(ptid_h)
diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac
index 2d8a703..9b364ff 100644
--- a/gdb/gdbserver/configure.ac
+++ b/gdb/gdbserver/configure.ac
@@ -36,7 +36,6 @@ AC_PROG_RANLIB
AC_ARG_PROGRAM

AC_HEADER_STDC
-AC_HEADER_DIRENT

AC_FUNC_ALLOCA

diff --git a/gdb/gnulib/update-gnulib.sh b/gdb/gnulib/update-gnulib.sh
index de82463..c9c78d5 100644
--- a/gdb/gnulib/update-gnulib.sh
+++ b/gdb/gnulib/update-gnulib.sh
@@ -29,7 +29,7 @@
# regenerate the various scripts and Makefiles are on the PATH.

# The list of gnulib modules we are importing in GDB.
-IMPORTED_GNULIB_MODULES="fnmatch-gnu inttypes memmem update-copyright string strerror strstr"
+IMPORTED_GNULIB_MODULES="fnmatch-gnu inttypes memmem update-copyright string strerror strstr dirent"

# The gnulib commit ID to use for the update.
GNULIB_COMMIT_SHA1="0dc43482065b697a7e64ac7cc7fba7c848924997"
diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c
index b36bc2c..d46fe84 100644
--- a/gdb/linux-fork.c
+++ b/gdb/linux-fork.c
@@ -33,7 +33,7 @@
#include <sys/ptrace.h>
#include "gdb_wait.h"
#include <sys/param.h>
-#include "gdb_dirent.h"
+#include <dirent.h>
#include <ctype.h>

struct fork_info *fork_list;
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index e39347d..6b868f8 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -53,7 +53,7 @@
#include "event-top.h"
#include <pwd.h>
#include <sys/types.h>
-#include "gdb_dirent.h"
+#include <dirent.h>
#include "xml-support.h"
#include "terminal.h"
#include <sys/vfs.h>
diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
index 5713fac..1c1890e 100644
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -28,7 +28,7 @@
#include <sys/procfs.h>
#include <sys/neutrino.h>
#include <sys/syspage.h>
-#include "gdb_dirent.h"
+#include <dirent.h>
#include <sys/netmgr.h>

#include "exceptions.h"
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 7249bec..3875858 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -90,7 +90,7 @@

#ifdef NEW_PROC_API
#include <sys/types.h>
-#include "gdb_dirent.h" /* opendir/readdir, for listing the LWP's */
+#include <dirent.h> /* opendir/readdir, for listing the LWP's */
#endif

#include <fcntl.h> /* for O_RDONLY */
--
1.7.7.6