This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2 3/6] Move mkdir_recursive to common/filestuff.c
- From: Simon Marchi <simon dot marchi at ericsson dot com>
- To: Tom Tromey <tom at tromey dot com>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Mon, 29 Oct 2018 16:00:30 +0000
- Subject: Re: [PATCH v2 3/6] Move mkdir_recursive to common/filestuff.c
- References: <20181018223100.20693-1-tom@tromey.com> <20181018223100.20693-4-tom@tromey.com>
On 2018-10-18 6:30 p.m., Tom Tromey wrote:
> This moves mkdir_recursive from dwarf-index-cache.c to
> common/filestuff.c, and also changes it to return a boolean that says
> whether or not it worked.
>
> gdb/ChangeLog
> 2018-10-18 Tom Tromey <tom@tromey.com>
>
> * unittests/mkdir-recursive-selftests.c: New file.
> * Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
> unittests/mkdir-recursive-selftests.c.
> * dwarf-index-cache.c (mkdir_recursive): Move to
> common/filestuff.c.
> (index_cache::store): Check return value of mkdir_recursive.
> (create_dir_and_check, test_mkdir_recursive): Move to new file.
> (_initialize_index_cache): Don't register test.
> * common/filestuff.h (mkdir_recursive): Declare.
> * common/filestuff.c (mkdir_recursive): Move from
> dwarf-index-cache.c. Return bool.
I just stumbled on a build failure caused by this patch, when building for mingw:
CXX unittests/mkdir-recursive-selftests.o
/home/emaisin/src/binutils-gdb/gdb/unittests/mkdir-recursive-selftests.c: In function ‘void selftests::mkdir_recursive::test()’:
/home/emaisin/src/binutils-gdb/gdb/unittests/mkdir-recursive-selftests.c:49:20: error: ‘mkdtemp’ was not declared in this scope
if (mkdtemp (base) == NULL)
^
The function in the original code was guarded by HAVE_MKDTEMP (the register_test
call still is). So I guess the function should be put back in an ifdef, or we
should import the mkdtemp gnulib module (I don't remember why I chose not to do
that).
Simon