diff mbox series

[for-2.10,4/4] bsd-user/main.c: Fix unused variable warning

Message ID 1500395194-21455-5-git-send-email-peter.maydell@linaro.org
State Accepted
Commit e4335180d2b40de8a5027030edbcd89aa6557bbc
Headers show
Series bsd-user: silence warnings on OpenBSD | expand

Commit Message

Peter Maydell July 18, 2017, 4:26 p.m. UTC
On OpenBSD the compiler warns:
bsd-user/main.c:622:21: warning: variable 'sig' set but not used [-Wunused-but-set-variable]

This is because a lot of the signal delivery code is #if-0'd
out as unused. Reshuffle #ifdefs a bit to silence the warning.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

---
 bsd-user/main.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

-- 
2.7.4

Comments

Eric Blake July 18, 2017, 10:01 p.m. UTC | #1
On 07/18/2017 11:26 AM, Peter Maydell wrote:
> On OpenBSD the compiler warns:

> bsd-user/main.c:622:21: warning: variable 'sig' set but not used [-Wunused-but-set-variable]

> 

> This is because a lot of the signal delivery code is #if-0'd

> out as unused. Reshuffle #ifdefs a bit to silence the warning.


Why not just nuke the #if 0 code instead (we can always 'git revert' it
later as a starting point for someone that wants to implement it).

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
Peter Maydell July 19, 2017, 8:19 a.m. UTC | #2
On 18 July 2017 at 23:01, Eric Blake <eblake@redhat.com> wrote:
> On 07/18/2017 11:26 AM, Peter Maydell wrote:

>> On OpenBSD the compiler warns:

>> bsd-user/main.c:622:21: warning: variable 'sig' set but not used [-Wunused-but-set-variable]

>>

>> This is because a lot of the signal delivery code is #if-0'd

>> out as unused. Reshuffle #ifdefs a bit to silence the warning.

>

> Why not just nuke the #if 0 code instead (we can always 'git revert' it

> later as a starting point for someone that wants to implement it).


I went for the minimal change, especially given we know
that the freebsd folks have a big patchset on top of
us fixing a lot of bsd-user code and it didn't seem worth
giving them a more awkward rebase task.

thanks
-- PMM
Thomas Huth July 21, 2017, 11:18 a.m. UTC | #3
On 19.07.2017 10:19, Peter Maydell wrote:
> On 18 July 2017 at 23:01, Eric Blake <eblake@redhat.com> wrote:

>> On 07/18/2017 11:26 AM, Peter Maydell wrote:

>>> On OpenBSD the compiler warns:

>>> bsd-user/main.c:622:21: warning: variable 'sig' set but not used [-Wunused-but-set-variable]

>>>

>>> This is because a lot of the signal delivery code is #if-0'd

>>> out as unused. Reshuffle #ifdefs a bit to silence the warning.

>>

>> Why not just nuke the #if 0 code instead (we can always 'git revert' it

>> later as a starting point for someone that wants to implement it).

> 

> I went for the minimal change, especially given we know

> that the freebsd folks have a big patchset on top of

> us fixing a lot of bsd-user code and it didn't seem worth

> giving them a more awkward rebase task.


That's fair. So FWIW:

Reviewed-by: Thomas Huth <thuth@redhat.com>
Eric Blake July 21, 2017, 12:23 p.m. UTC | #4
On 07/19/2017 03:19 AM, Peter Maydell wrote:
> On 18 July 2017 at 23:01, Eric Blake <eblake@redhat.com> wrote:

>> On 07/18/2017 11:26 AM, Peter Maydell wrote:

>>> On OpenBSD the compiler warns:

>>> bsd-user/main.c:622:21: warning: variable 'sig' set but not used [-Wunused-but-set-variable]

>>>

>>> This is because a lot of the signal delivery code is #if-0'd

>>> out as unused. Reshuffle #ifdefs a bit to silence the warning.

>>

>> Why not just nuke the #if 0 code instead (we can always 'git revert' it

>> later as a starting point for someone that wants to implement it).

> 

> I went for the minimal change, especially given we know

> that the freebsd folks have a big patchset on top of

> us fixing a lot of bsd-user code and it didn't seem worth

> giving them a more awkward rebase task.


Perhaps worth mentioning in the commit message that keeping the #if 0 is
intentional, then. At any rate,

Reviewed-by: Eric Blake <eblake@redhat.com>


-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
Peter Maydell July 21, 2017, 3:25 p.m. UTC | #5
On 21 July 2017 at 13:23, Eric Blake <eblake@redhat.com> wrote:
> On 07/19/2017 03:19 AM, Peter Maydell wrote:

>> On 18 July 2017 at 23:01, Eric Blake <eblake@redhat.com> wrote:

>>> On 07/18/2017 11:26 AM, Peter Maydell wrote:

>>>> On OpenBSD the compiler warns:

>>>> bsd-user/main.c:622:21: warning: variable 'sig' set but not used [-Wunused-but-set-variable]

>>>>

>>>> This is because a lot of the signal delivery code is #if-0'd

>>>> out as unused. Reshuffle #ifdefs a bit to silence the warning.

>>>

>>> Why not just nuke the #if 0 code instead (we can always 'git revert' it

>>> later as a starting point for someone that wants to implement it).

>>

>> I went for the minimal change, especially given we know

>> that the freebsd folks have a big patchset on top of

>> us fixing a lot of bsd-user code and it didn't seem worth

>> giving them a more awkward rebase task.

>

> Perhaps worth mentioning in the commit message that keeping the #if 0 is

> intentional, then. At any rate,

>

> Reviewed-by: Eric Blake <eblake@redhat.com>


Thanks; applied to master with an updated commit message.


-- PMM
diff mbox series

Patch

diff --git a/bsd-user/main.c b/bsd-user/main.c
index fa9c012..501e16f 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -619,9 +619,10 @@  void cpu_loop(CPUSPARCState *env)
             break;
         case EXCP_DEBUG:
             {
-                int sig;
-
-                sig = gdb_handlesig(cs, TARGET_SIGTRAP);
+#if 0
+                int sig =
+#endif
+                gdb_handlesig(cs, TARGET_SIGTRAP);
 #if 0
                 if (sig)
                   {