From 915ef8b18e28e6418216a582067b9fbdd6395e6a Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Thu, 19 Nov 2015 14:32:53 +0000 Subject: [C++] remote.c: Avoid enum arithmetic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: src/gdb/remote.c: In function ‘void remote_unpush_target()’: src/gdb/remote.c:4610:45: error: invalid conversion from ‘int’ to ‘strata’ [-fpermissive] pop_all_targets_above (process_stratum - 1); ^ In file included from src/gdb/inferior.h:38:0, from src/gdb/remote.c:25: src/gdb/target.h:2299:13: error: initializing argument 1 of ‘void pop_all_targets_above(strata)’ [-fpermissive] extern void pop_all_targets_above (enum strata above_stratum); ^ I used to carry a patch in the C++ branch that just did: - pop_all_targets_above (process_stratum - 1); + pop_all_targets_above ((enum strata) (process_stratum - 1)); But then thought that maybe adding a routine that does exactly what we need results in clearer code. This is the result. gdb/ChangeLog: 2015-11-19 Pedro Alves * remote.c (remote_unpush_target): Use pop_all_targets_at_and_above instead of pop_all_targets_above. * target.c (unpush_target_and_assert): New function, factored out from ... (pop_all_targets_above): ... here. (pop_all_targets_at_and_above): New function. * target.h (pop_all_targets_at_and_above): Declare. --- gdb/remote.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gdb/remote.c') diff --git a/gdb/remote.c b/gdb/remote.c index fed397af..6c86ab2 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -4607,7 +4607,7 @@ remote_query_supported (void) static void remote_unpush_target (void) { - pop_all_targets_above (process_stratum - 1); + pop_all_targets_at_and_above (process_stratum); } static void -- cgit v1.1