qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Akihiko Odaki <akihiko.odaki@gmail.com>
To: marcandre.lureau@redhat.com, qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Peter Maydell" <peter.maydell@linaro.org>
Subject: Re: [PATCH 31/32] RFC: Simplify softmmu/main.c
Date: Thu, 24 Mar 2022 05:56:19 +0900	[thread overview]
Message-ID: <93d39976-324e-de23-f4bb-12e8d6c98323@gmail.com> (raw)
In-Reply-To: <20220323155743.1585078-32-marcandre.lureau@redhat.com>

Reviewed-by: Akihiko Odaki <akihiko.odaki@gmail.com>

On 2022/03/24 0:57, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Move qemu_main() declaration to a new header.
> 
> Simplify main.c since both cocoa & sdl cannot be enabled together.
> 
> (there might be some small conflict with the RFC patch "cocoa: run qemu_init
> in the main thread", but the two look like they could be used together
> to improve the code)
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>   include/qemu-common.h |  5 -----
>   include/qemu-main.h   |  6 ++++++
>   softmmu/main.c        | 25 +++++++++----------------
>   ui/cocoa.m            |  1 +
>   4 files changed, 16 insertions(+), 21 deletions(-)
>   create mode 100644 include/qemu-main.h
> 
> diff --git a/include/qemu-common.h b/include/qemu-common.h
> index 65483f70d4fe..0498acd16b78 100644
> --- a/include/qemu-common.h
> +++ b/include/qemu-common.h
> @@ -19,9 +19,4 @@
>       "See <https://qemu.org/contribute/report-a-bug> for how to report bugs.\n" \
>       "More information on the QEMU project at <https://qemu.org>."
>   
> -/* main function, renamed */
> -#if defined(CONFIG_COCOA)
> -int qemu_main(int argc, char **argv, char **envp);
> -#endif
> -
>   #endif
> diff --git a/include/qemu-main.h b/include/qemu-main.h
> new file mode 100644
> index 000000000000..74d670bbf9a7
> --- /dev/null
> +++ b/include/qemu-main.h
> @@ -0,0 +1,6 @@
> +#ifndef QEMU_MAIN_H
> +#define QEMU_MAIN_H
> +
> +int qemu_main(int argc, char **argv, char **envp);
> +
> +#endif /* QEMU_MAIN_H */
> diff --git a/softmmu/main.c b/softmmu/main.c
> index 639c67ff4893..c00432ff098e 100644
> --- a/softmmu/main.c
> +++ b/softmmu/main.c
> @@ -23,28 +23,14 @@
>    */
>   
>   #include "qemu/osdep.h"
> -#include "qemu-common.h"
> +#include "qemu-main.h"
>   #include "sysemu/sysemu.h"
>   
>   #ifdef CONFIG_SDL
> -#if defined(__APPLE__) || defined(main)
>   #include <SDL.h>
> -static 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
> -#define main qemu_main
> -#endif /* CONFIG_COCOA */
>   
> -int main(int argc, char **argv, char **envp)
> +int qemu_main(int argc, char **argv, char **envp)
>   {
>       qemu_init(argc, argv, envp);
>       qemu_main_loop();
> @@ -52,3 +38,10 @@ int main(int argc, char **argv, char **envp)
>   
>       return 0;
>   }
> +
> +#ifndef CONFIG_COCOA
> +int main(int argc, char **argv)
> +{
> +    return qemu_main(argc, argv, NULL);
> +}
> +#endif
> diff --git a/ui/cocoa.m b/ui/cocoa.m
> index cb6e7c41dc6f..e566372b8f73 100644
> --- a/ui/cocoa.m
> +++ b/ui/cocoa.m
> @@ -28,6 +28,7 @@
>   #include <crt_externs.h>
>   
>   #include "qemu-common.h"
> +#include "qemu-main.h"
>   #include "ui/clipboard.h"
>   #include "ui/console.h"
>   #include "ui/input.h"



  reply	other threads:[~2022-03-23 20:57 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-23 15:57 [PATCH 00/32] Misc cleanups marcandre.lureau
2022-03-23 15:57 ` [PATCH 01/32] meson: use chardev_ss dependencies marcandre.lureau
2022-03-23 15:57 ` [PATCH 02/32] meson: add util dependency for oslib-posix on freebsd marcandre.lureau
2022-03-23 15:57 ` [PATCH 03/32] meson: remove unneeded py3 marcandre.lureau
2022-03-23 15:57 ` [PATCH 04/32] meson: remove test-qdev-global-props dependency on testqapi marcandre.lureau
2022-03-23 15:57 ` [PATCH 05/32] char: move qemu_openpty_raw from util/ to char/ marcandre.lureau
2022-03-23 15:57 ` [PATCH 06/32] Replace config-time define HOST_WORDS_BIGENDIAN marcandre.lureau
2022-03-23 17:10   ` Richard Henderson
2022-03-23 17:16   ` Richard Henderson
2022-03-23 15:57 ` [PATCH 07/32] Replace TARGET_WORDS_BIGENDIAN marcandre.lureau
2022-03-23 17:12   ` Richard Henderson
2022-03-23 15:57 ` [PATCH 08/32] osdep: poison {HOST,TARGET}_WORDS_BIGENDIAN marcandre.lureau
2022-03-23 17:14   ` Richard Henderson
2022-03-23 15:57 ` [PATCH 09/32] include/qapi: add g_autoptr support for qobject types marcandre.lureau
2022-03-23 18:11   ` Richard Henderson
2022-03-24 16:00   ` Markus Armbruster
2022-03-23 15:57 ` [PATCH 10/32] tests: replace free_all() usage with g_auto marcandre.lureau
2022-03-23 18:13   ` Richard Henderson
2022-03-23 15:57 ` [PATCH 11/32] Replace qemu_real_host_page variables with inlined functions marcandre.lureau
2022-03-25  8:34   ` Juan Quintela
2022-03-23 15:57 ` [PATCH 12/32] qga: replace deprecated g_get_current_time() marcandre.lureau
2022-04-06 14:53   ` Damien Hedde
2022-04-07  5:46   ` Markus Armbruster
2022-04-07 11:19     ` Marc-André Lureau
2022-03-23 15:57 ` [PATCH 13/32] error-report: replace deprecated g_get_current_time() with glib >= 2.62 marcandre.lureau
2022-04-06  9:07   ` Markus Armbruster
2022-04-06  9:35     ` Marc-André Lureau
2022-04-06  9:40       ` Marc-André Lureau
2022-04-06 10:38         ` Markus Armbruster
2022-03-23 15:57 ` [PATCH 14/32] util: rename qemu-error.c to match its header name marcandre.lureau
2022-03-23 18:23   ` Richard Henderson
2022-04-07  5:49   ` Markus Armbruster
2022-03-23 15:57 ` [PATCH 15/32] error-report: use error_printf() for program prefix marcandre.lureau
2022-04-07  5:50   ` Markus Armbruster
2022-03-23 15:57 ` [PATCH 16/32] include: move TFR to osdep.h marcandre.lureau
2022-03-23 15:57 ` [PATCH 17/32] include: move qemu_write_full() declaration " marcandre.lureau
2022-03-23 15:57 ` [PATCH 18/32] include: move qemu_pipe() " marcandre.lureau
2022-03-23 15:57 ` [PATCH 19/32] include: move coroutine IO functions to coroutine.h marcandre.lureau
2022-03-23 15:57 ` [PATCH 20/32] include: move dump_in_progress() to runstate.h marcandre.lureau
2022-04-06  8:45   ` Markus Armbruster
2022-03-23 15:57 ` [PATCH 21/32] include: move C/util-related declarations to cutils.h marcandre.lureau
2022-03-23 15:57 ` [PATCH 22/32] include: move cpu_exec* declarations to cpu-common.h marcandre.lureau
2022-03-23 15:57 ` [PATCH 23/32] include: move target page bits declaration to page-vary.h marcandre.lureau
2022-03-23 18:29   ` Richard Henderson
2022-03-23 15:57 ` [PATCH 24/32] include: move progress API to qemu-progress.h marcandre.lureau
2022-03-23 18:30   ` Richard Henderson
2022-03-23 15:57 ` [PATCH 25/32] include: move qemu_get_vm_name() to sysemu.h marcandre.lureau
2022-03-23 15:57 ` [PATCH 26/32] include: move os_*() to os-foo.h marcandre.lureau
2022-03-23 18:31   ` Richard Henderson
2022-03-23 21:11   ` Philippe Mathieu-Daudé
2022-03-23 15:57 ` [PATCH 27/32] include: move page_size_init() to include/hw/core/cpu.h marcandre.lureau
2022-03-23 15:57 ` [PATCH 28/32] Move CPU softfloat unions to cpu-float.h marcandre.lureau
2022-03-25  8:16   ` Juan Quintela
2022-03-23 15:57 ` [PATCH 29/32] Move fcntl_setfl() to oslib-posix marcandre.lureau
2022-03-23 18:34   ` Richard Henderson
2022-03-23 15:57 ` [PATCH 30/32] qga: remove explicit environ argument from exec/spawn marcandre.lureau
2022-03-23 18:36   ` Richard Henderson
2022-03-23 15:57 ` [PATCH 31/32] RFC: Simplify softmmu/main.c marcandre.lureau
2022-03-23 20:56   ` Akihiko Odaki [this message]
2022-03-24  7:51   ` Paolo Bonzini
2022-04-20  7:57     ` Marc-André Lureau
2022-04-20 10:48       ` Akihiko Odaki
2022-03-23 15:57 ` [PATCH 32/32] Remove qemu-common.h include from most units marcandre.lureau
2022-04-05 15:02   ` Ani Sinha
2022-04-06 10:45     ` Markus Armbruster
2022-04-06 11:14       ` Peter Maydell
2022-04-05 15:24   ` Warner Losh
2022-03-24  9:26 ` [PATCH 00/32] Misc cleanups Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=93d39976-324e-de23-f4bb-12e8d6c98323@gmail.com \
    --to=akihiko.odaki@gmail.com \
    --cc=f4bug@amsat.org \
    --cc=kraxel@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).