From 6fb99666f4bbc79708acb8efb2d80e57de67b80b Mon Sep 17 00:00:00 2001 From: Ciaran Woodward Date: Tue, 6 Feb 2024 17:56:07 +0000 Subject: 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 m_save; | ^ By manually implementing the save/restore behaviour, rather than using the helper template, this warning is fixed. Approved-By: Tom Tromey --- gdb/utils.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'gdb/utils.h') diff --git a/gdb/utils.h b/gdb/utils.h index 7487590..2acd1fc 100644 --- a/gdb/utils.h +++ b/gdb/utils.h @@ -383,8 +383,15 @@ class scoped_restore_warning_hook public: explicit scoped_restore_warning_hook (warning_hook_handler new_handler); + ~scoped_restore_warning_hook (); + private: - scoped_restore_tmpl m_save; + scoped_restore_warning_hook (const scoped_restore_warning_hook &other) + = delete; + scoped_restore_warning_hook &operator= (const scoped_restore_warning_hook &) + = delete; + + warning_hook_handler m_save; }; /* Return the current warning handler. */ -- cgit v1.1