Patchwork vl: fix compilation without SDL

login
register
mail settings
Submitter Vincent Stehlé
Date June 14, 2013, 6:12 p.m.
Message ID <1371233548-19925-1-git-send-email-vincent.stehle@freescale.com>
Download mbox | patch
Permalink /patch/251481/
State New
Headers show

Comments

Vincent Stehlé - June 14, 2013, 6:12 p.m.
Fix the following error, which happens when CONFIG_SDL is not defined:

  vl.c: In function ‘main’:
  vl.c:3528:17: error: ‘no_frame’ undeclared (first use in this function)
  vl.c:3528:17: note: each undeclared identifier is reported only once for each function it appears in

Protect code accessing no_frame and while at it, protect even more code related
to alt_grab and ctrl_grab.

Signed-off-by: Vincent Stehlé <vincent.stehle@freescale.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>
---
 vl.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
Stefan Weil - June 14, 2013, 6:32 p.m.
Am 14.06.2013 20:12, schrieb Vincent Stehlé:
> Fix the following error, which happens when CONFIG_SDL is not defined:
>
>   vl.c: In function ‘main’:
>   vl.c:3528:17: error: ‘no_frame’ undeclared (first use in this function)
>   vl.c:3528:17: note: each undeclared identifier is reported only once for each function it appears in

This problem was recently introduced by commit
047d4e151dd462915786a4fddc12f774d0028af5
(Unbreak -no-quit for GTK, validate SDL options).

Your patch makes SDL command line options which
were allowed until now invalid, so it's the wrong
kind of fix.

Declaring no_frame unconditionally would be a better
solution.

Regards
Stefan Weil





> Protect code accessing no_frame and while at it, protect even more code related
> to alt_grab and ctrl_grab.
>
> Signed-off-by: Vincent Stehlé <vincent.stehle@freescale.com>
> Cc: Anthony Liguori <aliguori@us.ibm.com>
> ---
>  vl.c |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/vl.c b/vl.c
> index 9f8fd6e..67de399 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -229,8 +229,10 @@ int nb_option_roms;
>  int semihosting_enabled = 0;
>  int old_param = 0;
>  const char *qemu_name;
> +#ifdef CONFIG_SDL
>  int alt_grab = 0;
>  int ctrl_grab = 0;
> +#endif
>  unsigned int nb_prom_envs = 0;
>  const char *prom_envs[MAX_PROM_ENVS];
>  int boot_menu;
> @@ -3524,6 +3526,7 @@ int main(int argc, char **argv, char **envp)
>              case QEMU_OPTION_full_screen:
>                  full_screen = 1;
>                  break;
> +#ifdef CONFIG_SDL
>              case QEMU_OPTION_no_frame:
>                  no_frame = 1;
>                  break;
> @@ -3533,6 +3536,7 @@ int main(int argc, char **argv, char **envp)
>              case QEMU_OPTION_ctrl_grab:
>                  ctrl_grab = 1;
>                  break;
> +#endif
>              case QEMU_OPTION_no_quit:
>                  no_quit = 1;
>                  break;
> @@ -4080,11 +4084,12 @@ int main(int argc, char **argv, char **envp)
>          display_type = DT_NONE;
>  #endif
>      }
> -
> +#ifdef CONFIG_SDL
>      if ((no_frame || alt_grab || ctrl_grab) && display_type != DT_SDL) {
>          fprintf(stderr, "-no-frame, -alt-grab and -ctrl-grab are only valid "
>                          "for SDL, ignoring option\n");
>      }
> +#endif
>      if (no_quit && (display_type != DT_GTK && display_type != DT_SDL)) {
>          fprintf(stderr, "-no-quit is only valid for GTK and SDL, "
>                          "ignoring option\n");

Patch

diff --git a/vl.c b/vl.c
index 9f8fd6e..67de399 100644
--- a/vl.c
+++ b/vl.c
@@ -229,8 +229,10 @@  int nb_option_roms;
 int semihosting_enabled = 0;
 int old_param = 0;
 const char *qemu_name;
+#ifdef CONFIG_SDL
 int alt_grab = 0;
 int ctrl_grab = 0;
+#endif
 unsigned int nb_prom_envs = 0;
 const char *prom_envs[MAX_PROM_ENVS];
 int boot_menu;
@@ -3524,6 +3526,7 @@  int main(int argc, char **argv, char **envp)
             case QEMU_OPTION_full_screen:
                 full_screen = 1;
                 break;
+#ifdef CONFIG_SDL
             case QEMU_OPTION_no_frame:
                 no_frame = 1;
                 break;
@@ -3533,6 +3536,7 @@  int main(int argc, char **argv, char **envp)
             case QEMU_OPTION_ctrl_grab:
                 ctrl_grab = 1;
                 break;
+#endif
             case QEMU_OPTION_no_quit:
                 no_quit = 1;
                 break;
@@ -4080,11 +4084,12 @@  int main(int argc, char **argv, char **envp)
         display_type = DT_NONE;
 #endif
     }
-
+#ifdef CONFIG_SDL
     if ((no_frame || alt_grab || ctrl_grab) && display_type != DT_SDL) {
         fprintf(stderr, "-no-frame, -alt-grab and -ctrl-grab are only valid "
                         "for SDL, ignoring option\n");
     }
+#endif
     if (no_quit && (display_type != DT_GTK && display_type != DT_SDL)) {
         fprintf(stderr, "-no-quit is only valid for GTK and SDL, "
                         "ignoring option\n");