diff options
author | Pedro Alves <palves@redhat.com> | 2015-02-04 11:05:58 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2015-02-04 11:05:58 +0100 |
commit | 80bd5fab6252d1cdff1ca95096ebe9b3053c8ec3 (patch) | |
tree | 2a815cfddf49d6b5fa2c984dc6721d0a112beb7b /gdb/event-loop.c | |
parent | 23081de0180381317070db296fbe3f587b501ccf (diff) | |
download | gdb-80bd5fab6252d1cdff1ca95096ebe9b3053c8ec3.zip gdb-80bd5fab6252d1cdff1ca95096ebe9b3053c8ec3.tar.gz gdb-80bd5fab6252d1cdff1ca95096ebe9b3053c8ec3.tar.bz2 |
Fix build breakage due to event loop simplification
commit 70b66289 (Simplify event-loop core, remove two-step event
processing) causes a build failure when compiling GDB with gcc/-O2:
gdb/event-loop.c: In function ‘gdb_do_one_event’:
gdb/event-loop.c:296:10: error: ‘res’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
if (res > 0)
^
GCC isn't realizing that event_source_head can never be > 2 and that
therefore 'res' is always initialized in all possible paths. Adding a
default case that internal_error's makes GCC realize that.
Tested on x86_64 Fedora 20.
gdb/ChangeLog:
2015-02-04 Pedro Alves <palves@redhat.com>
Fix build breakage.
* event-loop.c (gdb_do_one_event): Add default switch case.
Diffstat (limited to 'gdb/event-loop.c')
-rw-r--r-- | gdb/event-loop.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gdb/event-loop.c b/gdb/event-loop.c index 7425b3a..a2b41a7 100644 --- a/gdb/event-loop.c +++ b/gdb/event-loop.c @@ -287,6 +287,10 @@ gdb_do_one_event (void) /* Are there any asynchronous event handlers ready? */ res = check_async_event_handlers (); break; + default: + internal_error (__FILE__, __LINE__, + "unexpected event_source_head %d", + event_source_head); } event_source_head++; |