diff options
author | Pedro Alves <palves@redhat.com> | 2016-12-20 19:18:15 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2016-12-20 19:18:15 +0000 |
commit | 9bfe0298332782a9c082fb475bdf8eeeef8cf45e (patch) | |
tree | 39095231b33ec9328274bf369f04a0e56f56612b /gdb | |
parent | ada8ff522ce970e11dae4a3463c899b64e6f5006 (diff) | |
download | gdb-9bfe0298332782a9c082fb475bdf8eeeef8cf45e.zip gdb-9bfe0298332782a9c082fb475bdf8eeeef8cf45e.tar.gz gdb-9bfe0298332782a9c082fb475bdf8eeeef8cf45e.tar.bz2 |
gdb: Fix C and C++03 builds
The readline/sjlj-exceptions fix added an unconditional use of
noexcept, but that's only valid C++11, and 7.12 must build with C and
C++03 too. Fix this by adding a GDB_EXCEPT macro that compiles away
to nothing in C, and to throw() in C++03, which I've confirmed fixes
the original issue just the same as noexcept, with GCC 7 + -std=gnu+03
+ sjlj-exceptions.
gdb/ChangeLog:
2016-12-20 Pedro Alves <palves@redhat.com>
PR gdb/20977
* event-top.c (GDB_NOEXCEPT): Define.
(gdb_rl_callback_read_char_wrapper_noexcept): Use GDB_NOEXCEPT
instead of noexcept and use (void) instead of ().
(gdb_rl_callback_handler): Use GDB_NOEXCEPT instead of noexcept.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/event-top.c | 12 |
2 files changed, 18 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e99025e..0aaae46 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,4 +1,12 @@ 2016-12-20 Pedro Alves <palves@redhat.com> + + PR gdb/20977 + * event-top.c (GDB_NOEXCEPT): Define. + (gdb_rl_callback_read_char_wrapper_noexcept): Use GDB_NOEXCEPT + instead of noexcept and use (void) instead of (). + (gdb_rl_callback_handler): Use GDB_NOEXCEPT instead of noexcept. + +2016-12-20 Pedro Alves <palves@redhat.com> Yao Qi <yao.qi@linaro.org> PR gdb/20977 diff --git a/gdb/event-top.c b/gdb/event-top.c index 3e218ff..7f590a9 100644 --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -73,6 +73,14 @@ static void async_stop_sig (gdb_client_data); #endif static void async_sigterm_handler (gdb_client_data arg); +#ifndef __cplusplus +# define GDB_NOEXCEPT +#elif __cplusplus < 201103L +# define GDB_NOEXCEPT throw () +#else +# define GDB_NOEXCEPT noexcept +#endif + /* Instead of invoking (and waiting for) readline to read the command line and pass it back for processing, we use readline's alternate interface, via callback functions, so that the event loop can react @@ -162,7 +170,7 @@ void (*after_char_processing_hook) (void); (sjlj-based) C++ exceptions. */ static struct gdb_exception -gdb_rl_callback_read_char_wrapper_noexcept () noexcept +gdb_rl_callback_read_char_wrapper_noexcept (void) GDB_NOEXCEPT { struct gdb_exception gdb_expt = exception_none; @@ -203,7 +211,7 @@ gdb_rl_callback_read_char_wrapper (gdb_client_data client_data) (sjlj-based) C++ exceptions. */ static void -gdb_rl_callback_handler (char *rl) noexcept +gdb_rl_callback_handler (char *rl) GDB_NOEXCEPT { struct gdb_exception gdb_rl_expt = exception_none; struct ui *ui = current_ui; |