diff options
author | Tom de Vries <tdevries@suse.de> | 2020-07-28 15:07:44 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2020-07-28 15:07:44 +0200 |
commit | 866b34a12df543caae10dd5a8de988e40ee012cd (patch) | |
tree | d3358331c7dd50ac7e5183eb03326b737105c932 /gdbsupport/ChangeLog | |
parent | d70f978b44aafc22d87c0e72d0875008c3d9e311 (diff) | |
download | gdb-866b34a12df543caae10dd5a8de988e40ee012cd.zip gdb-866b34a12df543caae10dd5a8de988e40ee012cd.tar.gz gdb-866b34a12df543caae10dd5a8de988e40ee012cd.tar.bz2 |
[gdb/build] Fix Wmaybe-uninitialized in gdb_optional.h
When building with CFLAGS/CXXFLAGS="-O2 -g -Wall", we run into:
...
In file included from src/gdb/exceptions.h:23,
from src/gdb/utils.h:24,
from src/gdb/defs.h:630,
from src/gdb/record-btrace.c:22:
src/gdb/ui-out.h: In function 'void btrace_insn_history(ui_out*, \
const btrace_thread_info*, const btrace_insn_iterator*, \
const btrace_insn_iterator*, gdb_disassembly_flags)':
src/gdb/ui-out.h:352:18: warning: \
'asm_list.ui_out_emit_type<ui_out_type_list>::m_uiout' may be used \
uninitialized in this function [-Wmaybe-uninitialized]
352 | m_uiout->end (Type);
| ~~~~~~~~~~~~~^~~~~~
src/gdb/record-btrace.c:795:35: note: \
'asm_list.ui_out_emit_type<ui_out_type_list>::m_uiout' was declared here
795 | gdb::optional<ui_out_emit_list> asm_list;
| ^~~~~~~~
...
This is reported as PR gcc/80635 - "[8/9/10/11 regression] std::optional and
bogus -Wmaybe-uninitialized warning".
Silence the warning by using the workaround suggested here (
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635#c53 ):
...
union
{
struct { } m_dummy;
T m_item;
+ volatile char dont_use; // Silences -Wmaybe-uninitialized warning.
};
...
Build on x86_64-linux.
gdbsupport/ChangeLog:
2020-07-28 Tom de Vries <tdevries@suse.de>
PR build/26281
* gdb_optional.h (class optional): Add volatile member to union
contaning m_dummy and m_item.
Diffstat (limited to 'gdbsupport/ChangeLog')
-rw-r--r-- | gdbsupport/ChangeLog | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gdbsupport/ChangeLog b/gdbsupport/ChangeLog index 6b555cb..45c2ce7 100644 --- a/gdbsupport/ChangeLog +++ b/gdbsupport/ChangeLog @@ -1,3 +1,9 @@ +2020-07-28 Tom de Vries <tdevries@suse.de> + + PR build/26281 + * gdb_optional.h (class optional): Add volatile member to union + contaning m_dummy and m_item. + 2020-07-17 Andrew Burgess <andrew.burgess@embecosm.com> * tdesc.h (struct target_desc_deleter): Moved here |