qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 01/22] softmmu: split off vl.c:main() into ma


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH v3 01/22] softmmu: split off vl.c:main() into main.c
Date: Thu, 19 Sep 2019 11:03:15 +0100
User-agent: Mutt/1.12.1 (2019-06-15)

On Wed, Sep 18, 2019 at 11:19:28PM +0000, Oleinik, Alexander wrote:
> diff --git a/vl.c b/vl.c
> index 630f5c5e9c..327510c81f 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -36,18 +36,6 @@
>  #include "sysemu/seccomp.h"
>  #include "sysemu/tcg.h"
>  
> -#ifdef CONFIG_SDL
> -#if defined(__APPLE__) || defined(main)
> -#include <SDL.h>
> -int qemu_main(int argc, char **argv, char **envp);
> -int main(int argc, char **argv)
> -{
> -    return qemu_main(argc, argv, NULL);
> -}
> -#undef main
> -#define main qemu_main
> -#endif
> -#endif /* CONFIG_SDL */
>  
>  #ifdef CONFIG_COCOA
>  #undef main

This looks suspicious.  Should the #ifdef CONFIG_COCOA be moved into
main.c?

> @@ -1794,7 +1782,7 @@ static bool main_loop_should_exit(void)
>      return false;
>  }
>  
> -static void main_loop(void)
> +void main_loop(void)
>  {
>  #ifdef CONFIG_PROFILER
>      int64_t ti;
> @@ -2869,7 +2857,7 @@ static void user_register_global_props(void)
>                        global_init_func, NULL, NULL);
>  }
>  
> -int main(int argc, char **argv, char **envp)
> +int qemu_init(int argc, char **argv, char **envp)

The return value is confusing.  0 = success, >0 error exit code, but the
function may also invoke exit(0) to terminate successfully.

It's simpler to make this function void and invoke exit(3) directly.

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]