This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: gdb build problem (gdb/unittests/scoped_mmap-selftests.c)
- From: Steve Ellcey <sellcey at cavium dot com>
- To: Tom Tromey <tom at tromey dot com>
- Cc: gdb-patches <gdb-patches at sourceware dot org>, simon dot marchi at ericsson dot com
- Date: Wed, 08 Aug 2018 10:48:41 -0700
- Subject: Re: gdb build problem (gdb/unittests/scoped_mmap-selftests.c)
- References: <1533742957.31481.2.camel@cavium.com> <87wot092xy.fsf@tromey.com>
- Reply-to: sellcey at cavium dot com
On Wed, 2018-08-08 at 11:35 -0600, Tom Tromey wrote:
>
> I haven't seen this, but IIRC some distros enable _FORTIFY_SOURCE by
> default, which changes which unused-result warnings are emitted.
>
> Does the appended work for you?
>
> I wonder if we should enable _FORTIFY_SOURCE for development builds.
>
> Tom
>
> diff --git a/gdb/unittests/scoped_mmap-selftests.c
> b/gdb/unittests/scoped_mmap-selftests.c
> index d70a56a1862..e9d4afdffc5 100644
> --- a/gdb/unittests/scoped_mmap-selftests.c
> +++ b/gdb/unittests/scoped_mmap-selftests.c
> @@ -91,7 +91,7 @@ test_normal ()
> int fd = mkstemp (filename);
> SELF_CHECK (fd >= 0);
>
> - write (fd, "Hello!", 7);
> + SELF_CHECK (write (fd, "Hello!", 7) == 7);
> close (fd);
>
> gdb::unlinker unlink_test_file (filename);
Yes, this patch fixed the build problem I was having. I was building
on Ubuntu 16.04 so I guess that one of the platforms that enables
_FORTIFY_SOURCE by default.
Steve Ellcey
sellcey@cavium.com