diff options
author | Ciaran Woodward <ciaranwoodward@xmos.com> | 2024-02-06 17:56:07 +0000 |
---|---|---|
committer | Ciaran Woodward <ciaranwoodward@xmos.com> | 2024-02-07 16:08:04 +0000 |
commit | 6fb99666f4bbc79708acb8efb2d80e57de67b80b (patch) | |
tree | da54d6f85d4d63ddd625bcd9abcfed77ecb1db03 /gdb/utils.c | |
parent | c33ea119b1a5cca79f9efc0a6d5603667954358d (diff) | |
download | binutils-6fb99666f4bbc79708acb8efb2d80e57de67b80b.zip binutils-6fb99666f4bbc79708acb8efb2d80e57de67b80b.tar.gz binutils-6fb99666f4bbc79708acb8efb2d80e57de67b80b.tar.bz2 |
Remove use of scoped_restore_tmpl from scoped_restore_warning_hook
The warning_hook_handler function pointer takes va_list as
an argument, which on some platforms (mingw64) includes some
attributes. Attributes get ignored in template arguments.
This led to the compiler warning:
error: ignoring attributes on template argument 'warning_hook_handler' {aka 'void (*)(const char*, char*)'} [-Werror=ignored-attributes]
387 | scoped_restore_tmpl<warning_hook_handler> m_save;
| ^
By manually implementing the save/restore behaviour, rather
than using the helper template, this warning is fixed.
Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/utils.c')
-rw-r--r-- | gdb/utils.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gdb/utils.c b/gdb/utils.c index 702c3f1..a1aeb10 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -145,8 +145,14 @@ get_warning_hook_handler () scoped_restore_warning_hook::scoped_restore_warning_hook (warning_hook_handler new_handler) - : m_save (make_scoped_restore (&warning_hook, new_handler)) + : m_save (warning_hook) { + warning_hook = new_handler; +} + +scoped_restore_warning_hook::~scoped_restore_warning_hook () +{ + warning_hook = m_save; } /* Print a warning message. The first argument STRING is the warning |