Skip to contentSkip to conversation

vl: fix build when configured with no graphic support

PATCH Applied Antony Pavlov 3 participants 6 messages Oct 29, 2013 – Nov 1, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vl: fix build when configured with no graphic support

The following error occurs when building no graphic output support:

vl.c: In function ‘main’:
vl.c:2829:19: error: variable ‘ds’ set but not used [-Werror=unused-but-set-variable]

       DisplayState *ds;
                     ^

cc1: all warnings being treated as errors

To reproduce this issue, just run:

  $ ./configure \
      --disable-curses \
      --disable-sdl \
      --disable-cocoa \
      --disable-gtk \
      --disable-vnc \
      --enable-werror
  $ make vl.o
---
 vl.c | 1 +
 1 file changed, 1 insertion(+)
vl.c +1 -0
index b42ac67..8fbf25e 100644
@@ -4269,6 +4269,7 @@ int main(int argc, char **argv, char **envp)
     /* init local displays */
     switch (display_type) {
     case DT_NOGRAPHIC:
+        (void)ds;
         break;
 #if defined(CONFIG_CURSES)
     case DT_CURSES:
Signature · 1 line
1.8.4.rc3
Reviewed-by on v1 1/1
#1 lore raw

Am 29.10.2013 05:36, schrieb Antony Pavlov:

Quoted 29 lines

The following error occurs when building no graphic output support:

vl.c: In function ‘main’:
vl.c:2829:19: error: variable ‘ds’ set but not used [-Werror=unused-but-set-variable]

       DisplayState *ds;
                     ^

cc1: all warnings being treated as errors

To reproduce this issue, just run:

  $ ./configure \
      --disable-curses \
      --disable-sdl \
      --disable-cocoa \
      --disable-gtk \
      --disable-vnc \
      --enable-werror
  $ make vl.o
---
 vl.c | 1 +
 1 file changed, 1 insertion(+)
vl.c +0 -0
index b42ac67..8fbf25e 100644

vl.c int main(int argc, char **argv, char **envp) · line 4275

Quoted 7 lines
vl.c +1 -0
@@ -4269,6 +4269,7 @@ int main(int argc, char **argv, char **envp)
     /* init local displays */
     switch (display_type) {
     case DT_NOGRAPHIC:
+        (void)ds;
         break;
 #if defined(CONFIG_CURSES)
     case DT_CURSES:
#2 lore raw
In reply to Antony Pavlov

29.10.2013 08:36, Antony Pavlov wrote

Quoted 7 lines

The following error occurs when building no graphic output support:

vl.c: In function ‘main’:
vl.c:2829:19: error: variable ‘ds’ set but not used [-Werror=unused-but-set-variable]

        DisplayState *ds;
                      ^

cc1: all warnings being treated as errors

Thanks, applied to the trivial-patches queue.

While at it, I also added a comment to the line being added, telling what this is all about:

vl.c +1 -0
@@ -4269,6 +4269,7 @@ int main(int argc, char **argv, char **envp)
     /* init local displays */
     switch (display_type) {
     case DT_NOGRAPHIC:
+        (void)ds;      /* avoid warning if no display is configured */
         break;
 #if defined(CONFIG_CURSES)
     case DT_CURSES:

Hopefully it is okay... ;)

/mjt

#3 lore raw
Quoted 2 lines · On Fri, 01 Nov 2013 14:29:24 +0400 Michael Tokarev <[email protected]> wrote:

29.10.2013 08:36, Antony Pavlov wrote

Quoted 1 line

The following error occurs when building no graphic output support:

                                           ^^^^^

Can you plese fix misprint in my git commit message too.

I meant "when building with no graphic output support".

Quoted 26 lines
Quoted 6 lines

vl.c: In function ‘main’:
vl.c:2829:19: error: variable ‘ds’ set but not used [-Werror=unused-but-set-variable]

        DisplayState *ds;
                      ^

cc1: all warnings being treated as errors

Thanks, applied to the trivial-patches queue.

While at it, I also added a comment to the line being added, telling what this is all about:

vl.c +1 -0
@@ -4269,6 +4269,7 @@ int main(int argc, char **argv, char **envp)
      /* init local displays */
      switch (display_type) {
      case DT_NOGRAPHIC:
+        (void)ds;      /* avoid warning if no display is configured */
          break;
  #if defined(CONFIG_CURSES)
      case DT_CURSES:

Hopefully it is okay... ;)

/mjt

Signature · 3 lines
-- 
Best regards,
  Antony Pavlov
#4 lore raw
Quoted 7 lines · Antony Pavlov
Quoted 2 lines · On Fri, 01 Nov 2013 14:29:24 +0400 Michael Tokarev <[email protected]> wrote:

29.10.2013 08:36, Antony Pavlov wrote

Quoted 1 line

The following error occurs when building no graphic output support:

                                            ^^^^^

Can you plese fix misprint in my git commit message too.

Fixed. Thank you for pointing this out.

Quoted 1 line
Quoted 1 line

+ (void)ds; /* avoid warning if no display is configured */

Are you okay with me adding the comment? :)

/mjt

#5 lore raw
Quoted 6 lines · On Fri, 01 Nov 2013 15:18:28 +0400 Michael Tokarev <[email protected]> wrote:
Quoted 5 lines · Antony Pavlov
Quoted 2 lines · On Fri, 01 Nov 2013 14:29:24 +0400 Michael Tokarev <[email protected]> wrote:

29.10.2013 08:36, Antony Pavlov wrote

Quoted 1 line

The following error occurs when building no graphic output support:

Quoted 8 lines
Quoted 2 lines
                                            ^^^^^

Can you plese fix misprint in my git commit message too.

Fixed. Thank you for pointing this out.

Quoted 1 line
Quoted 1 line

+ (void)ds; /* avoid warning if no display is configured */

Are you okay with me adding the comment? :)

IMHO your comment is useful, thanks!

--
Best regards,
  Antony Pavlov