From 5df4cba632201687fd8472663138fbeffaa8f315 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Sat, 22 Feb 2020 20:31:54 -0500 Subject: gdb: update gnulib import MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is mostly to get this commit from gnulib: e22cd2677a4b7beacbf30b93bb0559f7b89f96ce Add ‘extern "C"’ to count-one-bits.h etc. ... which fixes this compilation problem I observed with clang++: CXXLD gdb arch/arm-get-next-pcs.o:arm-get-next-pcs.c:function thumb_get_next_pcs_raw(arm_get_next_pcs*): error: undefined reference to 'count_one_bits(unsigned int)' I built-tested on GNU/Linux x86-64 (gcc-9 and clang-9) as well as with the x86_64-w64-mingw32-gcc cross-compiler. gnulib/ChangeLog: * update-gnulib.sh (GNULIB_COMMIT_SHA1): Bump to e22cd2677a4b7beacbf30b93bb0559f7b89f96ce. * Makefile.in, config.in, configure, import/*: Re-generate. --- gnulib/import/glob.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'gnulib/import/glob.c') diff --git a/gnulib/import/glob.c b/gnulib/import/glob.c index 6f57860..f1b20d4 100644 --- a/gnulib/import/glob.c +++ b/gnulib/import/glob.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2019 Free Software Foundation, Inc. +/* Copyright (C) 1991-2020 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -72,6 +72,10 @@ # define __glob glob # define __getlogin_r(buf, len) getlogin_r (buf, len) # define __lstat64(fname, buf) lstat (fname, buf) +# ifdef __MINGW32__ + /* Avoid GCC warning. mingw has an unused __stat64 macro. */ +# undef __stat64 +# endif # define __stat64(fname, buf) stat (fname, buf) # define __fxstatat64(_, d, f, st, flag) fstatat (d, f, st, flag) # define struct_stat64 struct stat @@ -839,10 +843,11 @@ __glob (const char *pattern, int flags, int (*errfunc) (const char *, int), { size_t home_len = strlen (p->pw_dir); size_t rest_len = end_name == NULL ? 0 : strlen (end_name); + /* dirname contains end_name; we can't free it now. */ + char *prev_dirname = + (__glibc_unlikely (malloc_dirname) ? dirname : NULL); char *d; - if (__glibc_unlikely (malloc_dirname)) - free (dirname); malloc_dirname = 0; if (glob_use_alloca (alloca_used, home_len + rest_len + 1)) @@ -853,6 +858,7 @@ __glob (const char *pattern, int flags, int (*errfunc) (const char *, int), dirname = malloc (home_len + rest_len + 1); if (dirname == NULL) { + free (prev_dirname); scratch_buffer_free (&pwtmpbuf); retval = GLOB_NOSPACE; goto out; @@ -864,6 +870,8 @@ __glob (const char *pattern, int flags, int (*errfunc) (const char *, int), d = mempcpy (d, end_name, rest_len); *d = '\0'; + free (prev_dirname); + dirlen = home_len + rest_len; dirname_modified = 1; } -- cgit v1.1