aboutsummaryrefslogtreecommitdiff
path: root/gdb/gnulib/import
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2016-11-15 19:29:14 +0000
committerPedro Alves <palves@redhat.com>2016-11-15 23:22:37 +0000
commit4c62b19fd2e6b81ce7cbb7d01e84c09352ccf224 (patch)
treeee2f17d2ba9c4b6ec945f7fa678366be59ba7421 /gdb/gnulib/import
parent5cc8c7310338224d65aa14c4256d4d7539e0dd45 (diff)
downloadgdb-4c62b19fd2e6b81ce7cbb7d01e84c09352ccf224.zip
gdb-4c62b19fd2e6b81ce7cbb7d01e84c09352ccf224.tar.gz
gdb-4c62b19fd2e6b81ce7cbb7d01e84c09352ccf224.tar.bz2
gdb: update gnulib to pull in C++ namespace support fixes
I've been experimenting with making use of gnulib's C++ namespace support: https://www.gnu.org/software/gnulib/manual/html_node/A-C_002b_002b-namespace-for-gnulib.html That stumbled on a few gnulib issues, which I've fixed upstream: [PATCH] Fix gnulib C++ namespace support and std::frexp https://lists.gnu.org/archive/html/bug-gnulib/2016-11/msg00039.html [PATCH] Fix real-floating argument functions in C++ mode https://lists.gnu.org/archive/html/bug-gnulib/2016-11/msg00049.html [PATCH] Avoid having GNULIB_NAMESPACE::func always inject references to rpl_func https://lists.gnu.org/archive/html/bug-gnulib/2016-11/msg00040.html [PATCH] C++: "#define timeval rpl_timeval" -> typedef in GNULIB_NAMESPACE https://lists.gnu.org/archive/html/bug-gnulib/2016-11/msg00058.html This merge pulls those in. gdb/ChangeLog: 2016-11-15 Pedro Alves <palves@redhat.com> * gnulib/update-gnulib.sh (GNULIB_COMMIT_SHA1): Set to 38237baf99386101934cd93278023aa4ae523ec0. * gnulib/configure, gnulib/config.in: Regenerate. * gnulib/import/Makefile.am: Regenerate. * gnulib/import/Makefile.in: Regenerate. * gnulib/import/canonicalize-lgpl.c: Update. * gnulib/import/extra/snippet/c++defs.h: Update. * gnulib/import/m4/stdint.m4: Update. * gnulib/import/m4/stdlib_h.m4: Update. * gnulib/import/math.in.h: Update. * gnulib/import/stdlib.in.h: Update. * gnulib/import/sys_time.in.h: Update.
Diffstat (limited to 'gdb/gnulib/import')
-rw-r--r--gdb/gnulib/import/Makefile.am1
-rw-r--r--gdb/gnulib/import/Makefile.in2
-rw-r--r--gdb/gnulib/import/canonicalize-lgpl.c10
-rw-r--r--gdb/gnulib/import/extra/snippet/c++defs.h75
-rw-r--r--gdb/gnulib/import/m4/stdint.m411
-rw-r--r--gdb/gnulib/import/m4/stdlib_h.m45
-rw-r--r--gdb/gnulib/import/math.in.h14
-rw-r--r--gdb/gnulib/import/stdlib.in.h15
-rw-r--r--gdb/gnulib/import/sys_time.in.h7
9 files changed, 109 insertions, 31 deletions
diff --git a/gdb/gnulib/import/Makefile.am b/gdb/gnulib/import/Makefile.am
index 6a97d00..baa03a5 100644
--- a/gdb/gnulib/import/Makefile.am
+++ b/gdb/gnulib/import/Makefile.am
@@ -1356,6 +1356,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
-e 's|@''HAVE_POSIX_OPENPT''@|$(HAVE_POSIX_OPENPT)|g' \
-e 's|@''HAVE_PTSNAME''@|$(HAVE_PTSNAME)|g' \
-e 's|@''HAVE_PTSNAME_R''@|$(HAVE_PTSNAME_R)|g' \
+ -e 's|@''HAVE_QSORT_R''@|$(HAVE_QSORT_R)|g' \
-e 's|@''HAVE_RANDOM''@|$(HAVE_RANDOM)|g' \
-e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \
-e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \
diff --git a/gdb/gnulib/import/Makefile.in b/gdb/gnulib/import/Makefile.in
index f647a88..d45d7ea 100644
--- a/gdb/gnulib/import/Makefile.in
+++ b/gdb/gnulib/import/Makefile.in
@@ -801,6 +801,7 @@ HAVE_PTHREAD_SIGMASK = @HAVE_PTHREAD_SIGMASK@
HAVE_PTSNAME = @HAVE_PTSNAME@
HAVE_PTSNAME_R = @HAVE_PTSNAME_R@
HAVE_PWRITE = @HAVE_PWRITE@
+HAVE_QSORT_R = @HAVE_QSORT_R@
HAVE_RAISE = @HAVE_RAISE@
HAVE_RANDOM = @HAVE_RANDOM@
HAVE_RANDOM_H = @HAVE_RANDOM_H@
@@ -2622,6 +2623,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
-e 's|@''HAVE_POSIX_OPENPT''@|$(HAVE_POSIX_OPENPT)|g' \
-e 's|@''HAVE_PTSNAME''@|$(HAVE_PTSNAME)|g' \
-e 's|@''HAVE_PTSNAME_R''@|$(HAVE_PTSNAME_R)|g' \
+ -e 's|@''HAVE_QSORT_R''@|$(HAVE_QSORT_R)|g' \
-e 's|@''HAVE_RANDOM''@|$(HAVE_RANDOM)|g' \
-e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \
-e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \
diff --git a/gdb/gnulib/import/canonicalize-lgpl.c b/gdb/gnulib/import/canonicalize-lgpl.c
index 4a38a46..4b1f6cb 100644
--- a/gdb/gnulib/import/canonicalize-lgpl.c
+++ b/gdb/gnulib/import/canonicalize-lgpl.c
@@ -83,6 +83,11 @@
# define DOUBLE_SLASH_IS_DISTINCT_ROOT 0
#endif
+/* Define this independently so that stdint.h is not a prerequisite. */
+#ifndef SIZE_MAX
+# define SIZE_MAX ((size_t) -1)
+#endif
+
#if !FUNC_REALPATH_WORKS || defined _LIBC
static void
@@ -194,7 +199,6 @@ __realpath (const char *name, char *resolved)
#else
struct stat st;
#endif
- int n;
/* Skip sequence of multiple path-separators. */
while (ISSLASH (*start))
@@ -275,6 +279,7 @@ __realpath (const char *name, char *resolved)
{
char *buf;
size_t len;
+ ssize_t n;
if (++num_links > MAXSYMLINKS)
{
@@ -311,7 +316,8 @@ __realpath (const char *name, char *resolved)
}
len = strlen (end);
- if ((long int) (n + len) >= path_max)
+ /* Check that n + len + 1 doesn't overflow and is <= path_max. */
+ if (n >= SIZE_MAX - len || n + len >= path_max)
{
freea (buf);
__set_errno (ENAMETOOLONG);
diff --git a/gdb/gnulib/import/extra/snippet/c++defs.h b/gdb/gnulib/import/extra/snippet/c++defs.h
index 813f2e2..d42ea25 100644
--- a/gdb/gnulib/import/extra/snippet/c++defs.h
+++ b/gdb/gnulib/import/extra/snippet/c++defs.h
@@ -17,6 +17,15 @@
#ifndef _GL_CXXDEFS_H
#define _GL_CXXDEFS_H
+/* Begin/end the GNULIB_NAMESPACE namespace. */
+#if defined __cplusplus && defined GNULIB_NAMESPACE
+# define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
+# define _GL_END_NAMESPACE }
+#else
+# define _GL_BEGIN_NAMESPACE
+# define _GL_END_NAMESPACE
+#endif
+
/* The three most frequent use cases of these macros are:
* For providing a substitute for a function that is missing on some
@@ -111,14 +120,22 @@
that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
Example:
_GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
- */
+
+ Wrapping rpl_func in an object with an inline conversion operator
+ avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
+ actually used in the program. */
#define _GL_CXXALIAS_RPL(func,rettype,parameters) \
_GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
#if defined __cplusplus && defined GNULIB_NAMESPACE
# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
namespace GNULIB_NAMESPACE \
{ \
- rettype (*const func) parameters = ::rpl_func; \
+ static const struct _gl_ ## func ## _wrapper \
+ { \
+ typedef rettype (*type) parameters; \
+ inline type rpl () const { return ::rpl_func; } \
+ inline operator type () const { return rpl (); } \
+ } func = {}; \
} \
_GL_EXTERN_C int _gl_cxxalias_dummy
#else
@@ -135,8 +152,13 @@
# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
namespace GNULIB_NAMESPACE \
{ \
- rettype (*const func) parameters = \
- reinterpret_cast<rettype(*)parameters>(::rpl_func); \
+ static const struct _gl_ ## func ## _wrapper \
+ { \
+ typedef rettype (*type) parameters; \
+ inline type rpl () const \
+ { return reinterpret_cast<type>(::rpl_func); } \
+ inline operator type () const { return rpl (); } \
+ } func = {}; \
} \
_GL_EXTERN_C int _gl_cxxalias_dummy
#else
@@ -150,18 +172,20 @@
is defined.
Example:
_GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
- */
+
+ Wrapping func in an object with an inline conversion operator
+ avoids a reference to func unless GNULIB_NAMESPACE::func is
+ actually used in the program. */
#if defined __cplusplus && defined GNULIB_NAMESPACE
- /* If we were to write
- rettype (*const func) parameters = ::func;
- like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls
- better (remove an indirection through a 'static' pointer variable),
- but then the _GL_CXXALIASWARN macro below would cause a warning not only
- for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */
-# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
- namespace GNULIB_NAMESPACE \
- { \
- static rettype (*func) parameters = ::func; \
+# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
+ namespace GNULIB_NAMESPACE \
+ { \
+ static const struct _gl_ ## func ## _wrapper \
+ { \
+ typedef rettype (*type) parameters; \
+ inline type rpl () const { return ::func; } \
+ inline operator type () const { return rpl (); } \
+ } func = {}; \
} \
_GL_EXTERN_C int _gl_cxxalias_dummy
#else
@@ -178,8 +202,13 @@
# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
namespace GNULIB_NAMESPACE \
{ \
- static rettype (*func) parameters = \
- reinterpret_cast<rettype(*)parameters>(::func); \
+ static const struct _gl_ ## func ## _wrapper \
+ { \
+ typedef rettype (*type) parameters; \
+ inline type rpl () const \
+ { return reinterpret_cast<type>(::func); } \
+ inline operator type () const { return rpl (); }\
+ } func = {}; \
} \
_GL_EXTERN_C int _gl_cxxalias_dummy
#else
@@ -202,9 +231,15 @@
# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
namespace GNULIB_NAMESPACE \
{ \
- static rettype (*func) parameters = \
- reinterpret_cast<rettype(*)parameters>( \
- (rettype2(*)parameters2)(::func)); \
+ static const struct _gl_ ## func ## _wrapper \
+ { \
+ typedef rettype (*type) parameters; \
+ \
+ inline type rpl () const \
+ { return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); }\
+ \
+ inline operator type () const { return rpl (); } \
+ } func = {}; \
} \
_GL_EXTERN_C int _gl_cxxalias_dummy
#else
diff --git a/gdb/gnulib/import/m4/stdint.m4 b/gdb/gnulib/import/m4/stdint.m4
index fa6f103..05b6ab7 100644
--- a/gdb/gnulib/import/m4/stdint.m4
+++ b/gdb/gnulib/import/m4/stdint.m4
@@ -1,4 +1,4 @@
-# stdint.m4 serial 47
+# stdint.m4 serial 48
dnl Copyright (C) 2001-2016 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -154,6 +154,15 @@ uintptr_t h = UINTPTR_MAX;
intmax_t i = INTMAX_MAX;
uintmax_t j = UINTMAX_MAX;
+/* Check that SIZE_MAX has the correct type, if possible. */
+#if 201112 <= __STDC_VERSION__
+int k = _Generic (SIZE_MAX, size_t: 0);
+#elif (2 <= __GNUC__ || defined __IBM__TYPEOF__ \
+ || (0x5110 <= __SUNPRO_C && !__STDC__))
+extern size_t k;
+extern __typeof__ (SIZE_MAX) k;
+#endif
+
#include <limits.h> /* for CHAR_BIT */
#define TYPE_MINIMUM(t) \
((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t)))
diff --git a/gdb/gnulib/import/m4/stdlib_h.m4 b/gdb/gnulib/import/m4/stdlib_h.m4
index 19107c4..3999068 100644
--- a/gdb/gnulib/import/m4/stdlib_h.m4
+++ b/gdb/gnulib/import/m4/stdlib_h.m4
@@ -1,4 +1,4 @@
-# stdlib_h.m4 serial 42
+# stdlib_h.m4 serial 43
dnl Copyright (C) 2007-2016 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -21,7 +21,7 @@ AC_DEFUN([gl_STDLIB_H],
#endif
]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt
initstate initstate_r mkdtemp mkostemp mkostemps mkstemp mkstemps
- posix_openpt ptsname ptsname_r random random_r realpath rpmatch
+ posix_openpt ptsname ptsname_r qsort_r random random_r realpath rpmatch
secure_getenv setenv setstate setstate_r srandom srandom_r
strtod strtoll strtoull unlockpt unsetenv])
])
@@ -85,6 +85,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
HAVE_POSIX_OPENPT=1; AC_SUBST([HAVE_POSIX_OPENPT])
HAVE_PTSNAME=1; AC_SUBST([HAVE_PTSNAME])
HAVE_PTSNAME_R=1; AC_SUBST([HAVE_PTSNAME_R])
+ HAVE_QSORT_R=1; AC_SUBST([HAVE_QSORT_R])
HAVE_RANDOM=1; AC_SUBST([HAVE_RANDOM])
HAVE_RANDOM_H=1; AC_SUBST([HAVE_RANDOM_H])
HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R])
diff --git a/gdb/gnulib/import/math.in.h b/gdb/gnulib/import/math.in.h
index b7a0029..e1dc970 100644
--- a/gdb/gnulib/import/math.in.h
+++ b/gdb/gnulib/import/math.in.h
@@ -63,6 +63,7 @@ _gl_cxx_ ## func ## l (long double l) \
return func (l); \
}
# define _GL_MATH_CXX_REAL_FLOATING_DECL_2(func) \
+_GL_BEGIN_NAMESPACE \
inline int \
func (float f) \
{ \
@@ -77,7 +78,8 @@ inline int \
func (long double l) \
{ \
return _gl_cxx_ ## func ## l (l); \
-}
+} \
+_GL_END_NAMESPACE
#endif
/* Helper macros to define a portability warning for the
@@ -983,7 +985,7 @@ _GL_CXXALIAS_RPL (frexp, double, (double x, int *expptr));
# else
_GL_CXXALIAS_SYS (frexp, double, (double x, int *expptr));
# endif
-_GL_CXXALIASWARN (frexp);
+_GL_CXXALIASWARN1 (frexp, double, (double x, int *expptr));
#elif defined GNULIB_POSIXCHECK
# undef frexp
/* Assume frexp is always declared. */
@@ -2044,7 +2046,7 @@ _GL_EXTERN_C int gl_isfinitel (long double x);
gl_isfinitef (x))
# endif
# ifdef __cplusplus
-# ifdef isfinite
+# if defined isfinite || defined GNULIB_NAMESPACE
_GL_MATH_CXX_REAL_FLOATING_DECL_1 (isfinite)
# undef isfinite
_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isfinite)
@@ -2071,7 +2073,7 @@ _GL_EXTERN_C int gl_isinfl (long double x);
gl_isinff (x))
# endif
# ifdef __cplusplus
-# ifdef isinf
+# if defined isinf || defined GNULIB_NAMESPACE
_GL_MATH_CXX_REAL_FLOATING_DECL_1 (isinf)
# undef isinf
_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isinf)
@@ -2189,7 +2191,7 @@ _GL_EXTERN_C int rpl_isnanl (long double x) _GL_ATTRIBUTE_CONST;
__builtin_isnanf ((float)(x)))
# endif
# ifdef __cplusplus
-# ifdef isnan
+# if defined isnan || defined GNULIB_NAMESPACE
_GL_MATH_CXX_REAL_FLOATING_DECL_1 (isnan)
# undef isnan
_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan)
@@ -2264,7 +2266,7 @@ _GL_EXTERN_C int gl_signbitl (long double arg);
gl_signbitf (x))
# endif
# ifdef __cplusplus
-# ifdef signbit
+# if defined signbit || defined GNULIB_NAMESPACE
_GL_MATH_CXX_REAL_FLOATING_DECL_1 (signbit)
# undef signbit
_GL_MATH_CXX_REAL_FLOATING_DECL_2 (signbit)
diff --git a/gdb/gnulib/import/stdlib.in.h b/gdb/gnulib/import/stdlib.in.h
index 70dc88d..db3253b 100644
--- a/gdb/gnulib/import/stdlib.in.h
+++ b/gdb/gnulib/import/stdlib.in.h
@@ -521,6 +521,9 @@ _GL_CXXALIASWARN (putenv);
#endif
#if @GNULIB_QSORT_R@
+/* Sort an array of NMEMB elements, starting at address BASE, each element
+ occupying SIZE bytes, in ascending order according to the comparison
+ function COMPARE. */
# if @REPLACE_QSORT_R@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef qsort_r
@@ -535,12 +538,24 @@ _GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
void *),
void *arg));
# else
+# if !@HAVE_QSORT_R@
+_GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
+ int (*compare) (void const *, void const *,
+ void *),
+ void *arg) _GL_ARG_NONNULL ((1, 4)));
+# endif
_GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
int (*compare) (void const *, void const *,
void *),
void *arg));
# endif
_GL_CXXALIASWARN (qsort_r);
+#elif defined GNULIB_POSIXCHECK
+# undef qsort_r
+# if HAVE_RAW_DECL_QSORT_R
+_GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - "
+ "use gnulib module qsort_r for portability");
+# endif
#endif
diff --git a/gdb/gnulib/import/sys_time.in.h b/gdb/gnulib/import/sys_time.in.h
index 1623a1d..d535a6a 100644
--- a/gdb/gnulib/import/sys_time.in.h
+++ b/gdb/gnulib/import/sys_time.in.h
@@ -109,6 +109,13 @@ _GL_CXXALIAS_SYS_CAST (gettimeofday, int,
(struct timeval *restrict, void *restrict));
# endif
_GL_CXXALIASWARN (gettimeofday);
+# if defined __cplusplus && defined GNULIB_NAMESPACE
+namespace GNULIB_NAMESPACE {
+ typedef ::timeval
+#undef timeval
+ timeval;
+}
+# endif
#elif defined GNULIB_POSIXCHECK
# undef gettimeofday
# if HAVE_RAW_DECL_GETTIMEOFDAY