Skip to contentSkip to conversation

Change return type of functions that are named *_exit or *_exitfn in hw/char from int to void

PATCH In review Nutan Shinde 3 participants 5 messages Apr 12, 2016 – Apr 13, 2016 1 message not in the archive

lore
Share & tools
lore
#1 lore raw

PATCH v2 2/5 Change return type of functions that are named *_exit or *_exitfn in hw/char from int to void

In reply to a message not in the archive

This change is required because the return type of exit(error) function is not used.
This patch only has changes for files in hw/char package.

---
 hw/char/sclpconsole-lm.c | 3 +--
 hw/char/sclpconsole.c    | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
hw/char/sclpconsole-lm.c +1 -2
index 7d4ff81..a9a9703 100644
@@ -328,9 +328,8 @@ static int console_init(SCLPEvent *event)
     return 0;
 }
 
-static int console_exit(SCLPEvent *event)
+static console_exit(SCLPEvent *event)
 {
-    return 0;
 }
 
 static void console_reset(DeviceState *dev)
hw/char/sclpconsole.c +1 -2
index 45997ff..d179404 100644
@@ -242,9 +242,8 @@ static void console_reset(DeviceState *dev)
    scon->notify = false;
 }
 
-static int console_exit(SCLPEvent *event)
+static console_exit(SCLPEvent *event)
 {
-    return 0;
 }
 
 static Property console_properties[] = {

--
1.9.1

#2 lore raw

hw/char/sclpconsole-lm.c static int console_init(SCLPEvent *event) · line 333

Quoted 5 lines · Nutan Shinde
hw/char/sclpconsole-lm.c +1 -2
-static int console_exit(SCLPEvent *event)
+static console_exit(SCLPEvent *event)
 {
-    return 0;

This patch doesn't even compile:

CC hw/char/sclpconsole.o
/home/pbonzini/work/upstream/qemu/hw/char/sclpconsole.c:245:8: error: return type defaults to ‘int’ [-Werror=implicit-int]
static console_exit(SCLPEvent *event)

        ^

cc1: all warnings being treated as errors

Paolo

#3 lore raw
Quoted 9 lines · Paolo Bonzini

hw/char/sclpconsole-lm.c static int console_init(SCLPEvent *event) · line 333

Quoted 5 lines · Nutan Shinde
hw/char/sclpconsole-lm.c +1 -2
-static int console_exit(SCLPEvent *event)
+static console_exit(SCLPEvent *event)
 {
-    return 0;

This patch doesn't even compile:

Quoted 5 lines

CC hw/char/sclpconsole.o
/home/pbonzini/work/upstream/qemu/hw/char/sclpconsole.c:245:8: error: return type defaults to ‘int’ [-Werror=implicit-int]
static console_exit(SCLPEvent *event)

        ^

cc1: all warnings being treated as errors

It wouldn't compile even with the missing void inserted:

    hw/char/sclpconsole-lm.c:361:14: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
         ec->exit = console_exit;
                  ^

I gather you're doing this for BiteSizedTasks items

* Look for functions that are named *_exit or *_exitfn in hw/ and that return int. They should all return zero. Make them return void, and remove the checks for the callers.
* Once the above change is done, remove the "Error **" argument from functions named *_unrealize in hw/

Added by Paolo on 2014-12-03. These tasks don't make sense to me. Paolo, can you explain?

Additionally, the commit message titles aren't quite right, the series isn't threaded, and its parts can't be applied with git-am (some MIME crap gets in the way).

Your title lacks a subsystem: prefix and is too long. Better:

hw/char: Change return type of *_exit(), *_exitfn() to void

Please study http://wiki.qemu-project.org/Contribute/SubmitAPatch once more, particularly sections "Write a meaningful commit message", "Use git format-patch", and "Include a meaningful cover letter".

In theory, it is possible to consistently send well-formed patches by hand. In practice, you either use git-send-email or you screw it up. Use git-send-email.

#4 lore raw
Quoted 3 lines · Markus Armbruster

* Look for functions that are named *_exit or *_exitfn in hw/ and that return int. They should all return zero. Make them return void, and remove the checks for the callers.

... and change the exit method to "void fn(void)"

Quoted 2 lines

* Once the above change is done, remove the "Error **" argument from functions named *_unrealize in hw/

... same for the unrealize method.

Quoted 2 lines

Added by Paolo on 2014-12-03. These tasks don't make sense to me. Paolo, can you explain?

The exit functions always return zero, the unrealize functions never touch the Error** argument. So make both of them "void fn(void)" and remove the difference between exit and unrealize.

Paolo

#5 lore raw
Quoted 10 lines · Paolo Bonzini
Quoted 3 lines · Markus Armbruster

* Look for functions that are named *_exit or *_exitfn in hw/ and that return int. They should all return zero. Make them return void, and remove the checks for the callers.

... and change the exit method to "void fn(void)"

Quoted 2 lines

* Once the above change is done, remove the "Error **" argument from functions named *_unrealize in hw/

Quoted 8 lines

... same for the unrealize method.

Quoted 2 lines

Added by Paolo on 2014-12-03. These tasks don't make sense to me. Paolo, can you explain?

The exit functions always return zero, the unrealize functions never touch the Error** argument. So make both of them "void fn(void)" and remove the difference between exit and unrealize.

Got it now, thanks!