From: Pedro Alves Date: Mon, 1 Jul 2013 11:25:43 +0000 (+0000) Subject: Import the "pathmax" gnulib module. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=38ec22075a7298fbe720aeda2b0c611964b67155;p=binutils-gdb.git Import the "pathmax" gnulib module. This imports the "pathmax" gnulib module, making PATH_MAX always available on systems that have the notion of a constant max path limit (i.e., practically everywhere except the Hurd), along with fixing a couple broken systems --- see pathmax.h in the patch. This means we can normalize on PATH_MAX throughout the tree (instead of some places using MAXPATHLEN, or defining fallback constants ourselves). This is the just the importing step. gdb/ 2013-07-01 Pedro Alves * gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add pathmax. * gnulib/Makefile.in (aclocal_m4_deps): Add import/m4/pathmax.m4. * gnulib/aclocal.m4: Regenerate. * gnulib/config.in: Regenerate. * gnulib/configure: Regenerate. * gnulib/import/pathmax.h: New file. * gnulib/import/Makefile.am: Regenerate. * gnulib/import/Makefile.in: Regenerate. * gnulib/import/m4/gnulib-cache.m4: Regenerate. * gnulib/import/m4/gnulib-comp.m4: Regenerate. * gnulib/import/m4/pathmax.m4: New file. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5a21e6b6dd6..2c71fdd7607 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,17 @@ +2013-07-01 Pedro Alves + + * gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add pathmax. + * gnulib/Makefile.in (aclocal_m4_deps): Add import/m4/pathmax.m4. + * gnulib/aclocal.m4: Regenerate. + * gnulib/config.in: Regenerate. + * gnulib/configure: Regenerate. + * gnulib/import/pathmax.h: New file. + * gnulib/import/Makefile.am: Regenerate. + * gnulib/import/Makefile.in: Regenerate. + * gnulib/import/m4/gnulib-cache.m4: Regenerate. + * gnulib/import/m4/gnulib-comp.m4: Regenerate. + * gnulib/import/m4/pathmax.m4: New file. + 2013-07-01 Pedro Alves * configure.ac (GDBINIT): Define, depending on host. diff --git a/gdb/gnulib/Makefile.in b/gdb/gnulib/Makefile.in index 727056c0cab..e3a8cbaf52a 100644 --- a/gdb/gnulib/Makefile.in +++ b/gdb/gnulib/Makefile.in @@ -236,6 +236,7 @@ aclocal_m4_deps = \ import/m4/mmap-anon.m4 \ import/m4/multiarch.m4 \ import/m4/off_t.m4 \ + import/m4/pathmax.m4 \ import/m4/ssize_t.m4 \ import/m4/stdbool.m4 \ import/m4/stddef_h.m4 \ diff --git a/gdb/gnulib/aclocal.m4 b/gdb/gnulib/aclocal.m4 index d98a4bb9853..40fc4409bb2 100644 --- a/gdb/gnulib/aclocal.m4 +++ b/gdb/gnulib/aclocal.m4 @@ -1049,6 +1049,7 @@ m4_include([import/m4/memmem.m4]) m4_include([import/m4/mmap-anon.m4]) m4_include([import/m4/multiarch.m4]) m4_include([import/m4/off_t.m4]) +m4_include([import/m4/pathmax.m4]) m4_include([import/m4/ssize_t.m4]) m4_include([import/m4/stdbool.m4]) m4_include([import/m4/stddef_h.m4]) diff --git a/gdb/gnulib/config.in b/gdb/gnulib/config.in index 9104de192dd..66b2e3be55a 100644 --- a/gdb/gnulib/config.in +++ b/gdb/gnulib/config.in @@ -784,6 +784,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_MMAN_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PARAM_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H diff --git a/gdb/gnulib/configure b/gdb/gnulib/configure index da0a3480965..fc8a0901f2e 100644 --- a/gdb/gnulib/configure +++ b/gdb/gnulib/configure @@ -3003,6 +3003,7 @@ as_fn_append ac_func_list " mbsinit" as_fn_append ac_func_list " mbrtowc" as_fn_append ac_header_list " sys/mman.h" as_fn_append ac_func_list " mprotect" +as_fn_append ac_header_list " sys/param.h" as_fn_append ac_header_list " features.h" as_fn_append ac_func_list " iswcntrl" # Check that the precious variables saved in the cache have kept the same @@ -4735,6 +4736,7 @@ fi # Code from module memmem: # Code from module memmem-simple: # Code from module multiarch: + # Code from module pathmax: # Code from module snippet/arg-nonnull: # Code from module snippet/c++defs: # Code from module snippet/warn-on-use: @@ -8990,6 +8992,8 @@ $as_echo "$gl_cv_func_memmem_works_always" >&6; } fi : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 $as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } if test "${ac_cv_header_stdbool_h+set}" = set; then : @@ -12896,6 +12900,9 @@ $as_echo "#define GNULIB_TEST_MEMMEM 1" >>confdefs.h + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ssize_t" >&5 $as_echo_n "checking for ssize_t... " >&6; } if test "${gt_cv_ssize_t+set}" = set; then : diff --git a/gdb/gnulib/import/Makefile.am b/gdb/gnulib/import/Makefile.am index ac38ef6c8c3..0c2f424d5fa 100644 --- a/gdb/gnulib/import/Makefile.am +++ b/gdb/gnulib/import/Makefile.am @@ -21,7 +21,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files fnmatch-gnu frexpl inttypes memmem unistd update-copyright +# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files fnmatch-gnu frexpl inttypes memmem pathmax unistd update-copyright AUTOMAKE_OPTIONS = 1.5 gnits @@ -674,6 +674,13 @@ EXTRA_libgnu_a_SOURCES += memmem.c ## end gnulib module memmem-simple +## begin gnulib module pathmax + + +EXTRA_DIST += pathmax.h + +## end gnulib module pathmax + ## begin gnulib module snippet/arg-nonnull # The BUILT_SOURCES created by this Makefile snippet are not used via #include diff --git a/gdb/gnulib/import/Makefile.in b/gdb/gnulib/import/Makefile.in index 0f377478d30..59c1c66d85a 100644 --- a/gdb/gnulib/import/Makefile.in +++ b/gdb/gnulib/import/Makefile.in @@ -36,7 +36,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files fnmatch-gnu frexpl inttypes memmem unistd update-copyright +# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files fnmatch-gnu frexpl inttypes memmem pathmax unistd update-copyright @@ -100,6 +100,7 @@ am__aclocal_m4_deps = $(top_srcdir)/import/m4/00gnulib.m4 \ $(top_srcdir)/import/m4/mmap-anon.m4 \ $(top_srcdir)/import/m4/multiarch.m4 \ $(top_srcdir)/import/m4/off_t.m4 \ + $(top_srcdir)/import/m4/pathmax.m4 \ $(top_srcdir)/import/m4/ssize_t.m4 \ $(top_srcdir)/import/m4/stdbool.m4 \ $(top_srcdir)/import/m4/stddef_h.m4 \ @@ -937,7 +938,7 @@ EXTRA_DIST = m4/gnulib-cache.m4 alloca.c alloca.in.h float.c \ isnanl-nolibm.h isnanl.c config.charset ref-add.sin \ ref-del.sin math.in.h mbrtowc.c mbsinit.c mbsrtowcs-impl.h \ mbsrtowcs-state.c mbsrtowcs.c memchr.c memchr.valgrind \ - memmem.c str-two-way.h \ + memmem.c str-two-way.h pathmax.h \ $(top_srcdir)/import/extra/snippet/arg-nonnull.h \ $(top_srcdir)/import/extra/snippet/c++defs.h \ $(top_srcdir)/import/extra/snippet/warn-on-use.h stdbool.in.h \ diff --git a/gdb/gnulib/import/m4/gnulib-cache.m4 b/gdb/gnulib/import/m4/gnulib-cache.m4 index 9cf71c92761..511df9cdd2f 100644 --- a/gdb/gnulib/import/m4/gnulib-cache.m4 +++ b/gdb/gnulib/import/m4/gnulib-cache.m4 @@ -27,7 +27,7 @@ # Specification in the form of a command-line invocation: -# gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files fnmatch-gnu frexpl inttypes memmem unistd update-copyright +# gnulib-tool --import --dir=. --lib=libgnu --source-base=import --m4-base=import/m4 --doc-base=doc --tests-base=tests --aux-dir=import/extra --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files fnmatch-gnu frexpl inttypes memmem pathmax unistd update-copyright # Specification in the form of a few gnulib-tool.m4 macro invocations: gl_LOCAL_DIR([]) @@ -36,6 +36,7 @@ gl_MODULES([ frexpl inttypes memmem + pathmax unistd update-copyright ]) diff --git a/gdb/gnulib/import/m4/gnulib-comp.m4 b/gdb/gnulib/import/m4/gnulib-comp.m4 index 8f151cbef38..77c1b249e09 100644 --- a/gdb/gnulib/import/m4/gnulib-comp.m4 +++ b/gdb/gnulib/import/m4/gnulib-comp.m4 @@ -66,6 +66,7 @@ AC_DEFUN([gl_EARLY], # Code from module memmem: # Code from module memmem-simple: # Code from module multiarch: + # Code from module pathmax: # Code from module snippet/arg-nonnull: # Code from module snippet/c++defs: # Code from module snippet/warn-on-use: @@ -181,6 +182,7 @@ AC_DEFUN([gl_INIT], fi gl_STRING_MODULE_INDICATOR([memmem]) gl_MULTIARCH + gl_PATHMAX gt_TYPE_SSIZE_T AM_STDBOOL_H gl_STDDEF_H @@ -366,6 +368,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/memchr.c lib/memchr.valgrind lib/memmem.c + lib/pathmax.h lib/ref-add.sin lib/ref-del.sin lib/stdbool.in.h @@ -419,6 +422,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/mmap-anon.m4 m4/multiarch.m4 m4/off_t.m4 + m4/pathmax.m4 m4/ssize_t.m4 m4/stdbool.m4 m4/stddef_h.m4 diff --git a/gdb/gnulib/import/m4/pathmax.m4 b/gdb/gnulib/import/m4/pathmax.m4 new file mode 100644 index 00000000000..011786129e0 --- /dev/null +++ b/gdb/gnulib/import/m4/pathmax.m4 @@ -0,0 +1,42 @@ +# pathmax.m4 serial 10 +dnl Copyright (C) 2002-2003, 2005-2006, 2009-2012 Free Software Foundation, +dnl Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_PATHMAX], +[ + dnl Prerequisites of lib/pathmax.h. + AC_CHECK_HEADERS_ONCE([sys/param.h]) +]) + +# Expands to a piece of C program that defines PATH_MAX in the same way as +# "pathmax.h" will do. +AC_DEFUN([gl_PATHMAX_SNIPPET], [[ +/* Arrange to define PATH_MAX, like "pathmax.h" does. */ +#if HAVE_UNISTD_H +# include +#endif +#include +#if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN +# include +#endif +#if !defined PATH_MAX && defined MAXPATHLEN +# define PATH_MAX MAXPATHLEN +#endif +#ifdef __hpux +# undef PATH_MAX +# define PATH_MAX 1024 +#endif +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +# undef PATH_MAX +# define PATH_MAX 260 +#endif +]]) + +# Prerequisites of gl_PATHMAX_SNIPPET. +AC_DEFUN([gl_PATHMAX_SNIPPET_PREREQ], +[ + AC_CHECK_HEADERS_ONCE([unistd.h sys/param.h]) +]) diff --git a/gdb/gnulib/import/pathmax.h b/gdb/gnulib/import/pathmax.h new file mode 100644 index 00000000000..03db7cb519b --- /dev/null +++ b/gdb/gnulib/import/pathmax.h @@ -0,0 +1,83 @@ +/* Define PATH_MAX somehow. Requires sys/types.h. + Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2012 Free Software + Foundation, Inc. + + 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, 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 . */ + +#ifndef _PATHMAX_H +# define _PATHMAX_H + +/* POSIX:2008 defines PATH_MAX to be the maximum number of bytes in a filename, + including the terminating NUL byte. + + PATH_MAX is not defined on systems which have no limit on filename length, + such as GNU/Hurd. + + This file does *not* define PATH_MAX always. Programs that use this file + can handle the GNU/Hurd case in several ways: + - Either with a package-wide handling, or with a per-file handling, + - Either through a + #ifdef PATH_MAX + or through a fallback like + #ifndef PATH_MAX + # define PATH_MAX 8192 + #endif + or through a fallback like + #ifndef PATH_MAX + # define PATH_MAX pathconf ("/", _PC_PATH_MAX) + #endif + */ + +# include + +# include + +# ifndef _POSIX_PATH_MAX +# define _POSIX_PATH_MAX 256 +# endif + +/* Don't include sys/param.h if it already has been. */ +# if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN +# include +# endif + +# if !defined PATH_MAX && defined MAXPATHLEN +# define PATH_MAX MAXPATHLEN +# endif + +# ifdef __hpux +/* On HP-UX, PATH_MAX designates the maximum number of bytes in a filename, + *not* including the terminating NUL byte, and is set to 1023. + Additionally, when _XOPEN_SOURCE is defined to 500 or more, PATH_MAX is + not defined at all any more. */ +# undef PATH_MAX +# define PATH_MAX 1024 +# endif + +# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +/* The page "Naming Files, Paths, and Namespaces" on msdn.microsoft.com, + section "Maximum Path Length Limitation", + + explains that the maximum size of a filename, including the terminating + NUL byte, is 260 = 3 + 256 + 1. + This is the same value as + - FILENAME_MAX in , + - _MAX_PATH in , + - MAX_PATH in . + Undefine the original value, because mingw's gets it wrong. */ +# undef PATH_MAX +# define PATH_MAX 260 +# endif + +#endif /* _PATHMAX_H */ diff --git a/gdb/gnulib/update-gnulib.sh b/gdb/gnulib/update-gnulib.sh index 1653ad91046..0b292ba2c07 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 frexpl inttypes memmem update-copyright unistd" +IMPORTED_GNULIB_MODULES="fnmatch-gnu frexpl inttypes memmem update-copyright unistd pathmax" # The gnulib commit ID to use for the update. GNULIB_COMMIT_SHA1="8d5bd1402003bd0153984b138735adf537d960b0"