diff options
author | Pedro Alves <palves@redhat.com> | 2017-10-04 09:55:29 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2017-10-04 10:06:42 +0100 |
commit | a87c142792e4dcbec2bb3825e71f3ace044c2096 (patch) | |
tree | be277a205e9b7504123d6e681c14c95d96c0c192 /gdb/completer.c | |
parent | bc3b087de2401c65c02730d346e8bea4dc0504ae (diff) | |
download | gdb-a87c142792e4dcbec2bb3825e71f3ace044c2096.zip gdb-a87c142792e4dcbec2bb3825e71f3ace044c2096.tar.gz gdb-a87c142792e4dcbec2bb3825e71f3ace044c2096.tar.bz2 |
Add missing-END_CATCH detection/protection (to gdb's TRY/CATCH/END_CATCH)
While we still have cleanups (i.e., make_cleanup & co), we must be
sure to add END_CATCH at the end of a TRY/CATCH/END_CATCH construct.
However, it's currently too easy to miss adding the END_CATCH, because
the code compiles anyway without it. I realized this when I noticed
that another patch I was working on missed several adding END_CATCH in
several new TRY/CATCH uses.
This commit fixes that by making TRY open a new scope that is only
closed by END_CATCH. This way, if you forget to add the END_CATCH,
then compilation fails due to the unbalanced curly braces.
This caught a couple places where we were missing END_CATCH in current
master, also fixed by the patch.
gdb/ChangeLog:
2017-10-04 Pedro Alves <palves@redhat.com>
* cli/cli-cmds.c (complete_command): Add missing END_CATCH.
* common/common-exceptions.h (TRY): Open an outermost scope.
Expand intro comment.
(CATCH): Reindent.
(END_CATCH): Close the outermost scope.
* completer.c (complete_line_internal): Add missing END_CATCH.
Diffstat (limited to 'gdb/completer.c')
-rw-r--r-- | gdb/completer.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/gdb/completer.c b/gdb/completer.c index 3022333..cd0ecc3 100644 --- a/gdb/completer.c +++ b/gdb/completer.c @@ -1447,6 +1447,7 @@ complete_line_internal (completion_tracker &tracker, if (except.error != MAX_COMPLETIONS_REACHED_ERROR) throw_exception (except); } + END_CATCH } /* See completer.h. */ |