[RFA 7/8] Use unique_xmalloc_ptr in execute_gdb_command
Pedro Alves
palves@redhat.com
Tue Dec 20 23:56:00 GMT 2016
On 12/20/2016 11:27 PM, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
>
> Pedro> -extern struct cleanup *prevent_dont_repeat (void);
> Pedro> +extern scoped_restore_tmpl<bool> prevent_dont_repeat ();
>
> Probably this should use __attribute__((warn_unused_result)), but that
> isn't wrapped in ansidecl.h (yet) and I don't know offhand what version
> test to use for it. Do you?
Good idea. Looks like it's GCC 3.4. glibc has:
/* If fortification mode, we warn about unused results of certain
function calls which can lead to problems. */
#if __GNUC_PREREQ (3,4)
# define __attribute_warn_unused_result__ \
__attribute__ ((__warn_unused_result__))
# if __USE_FORTIFY_LEVEL > 0
# define __wur __attribute_warn_unused_result__
# endif
#else
# define __attribute_warn_unused_result__ /* empty */
#endif
#ifndef __wur
# define __wur /* Ignore */
#endif
Grepping my F23's system headers I see other hits for GCC 3.4:
/usr/include/lzma.h:237: /* warn_unused_result was added in GCC 3.4. */
/usr/include/llvm/Support/Compiler.h:125:#if __has_attribute(warn_unused_result) || LLVM_GNUC_PREREQ(3, 4, 0)
/usr/include/llvm/Support/Compiler.h:126:#define LLVM_ATTRIBUTE_UNUSED_RESULT __attribute__((__warn_unused_result__))
Thanks,
Pedro Alves
More information about the Gdb-patches
mailing list