[RFA 7/8] Use unique_xmalloc_ptr in execute_gdb_command

Tom Tromey tom@tromey.com
Thu Dec 22 14:50:00 GMT 2016


>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Tom> Probably this should use __attribute__((warn_unused_result)), but that
Tom> isn't wrapped in ansidecl.h (yet) and I don't know offhand what version
Tom> test to use for it.  Do you?

Pedro> Good idea.  Looks like it's GCC 3.4.

This turns out not to work :(

FWIW in addition to the ATTRIBUTE_WARN_UNUSED_RESULT patch, I also had
to patch gdb's configure script to add -Wunused-result, as -Wunused
turns this off.

The g++ bug is known:

    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38172

It looks like the accepted fix upstream to use the C++17 [[nodiscard]]
attribute; not sure if we can use that somehow.

Meanwhile I'm going to drop this part of my patch.

Tom



More information about the Gdb-patches mailing list