[PATCH weston v2 8/8] terminal: Silence maybe-uninitialized warning

Quentin Glidic sardemff7+wayland at sardemff7.net
Sun Jul 10 09:00:57 UTC 2016


From: Quentin Glidic <sardemff7+git at sardemff7.net>

clients/terminal.c: In function 'redraw_handler':
clients/terminal.c:213:28: warning: 'machine.unicode' may be used
uninitialized in this function [-Wmaybe-uninitialized]
  struct utf8_state_machine machine;
                            ^~~~~~~

clients/terminal.c: In function 'handle_char':
clients/terminal.c:213:28: warning: 'machine.unicode' may be used
uninitialized in this function [-Wmaybe-uninitialized]

Warning produced by GCC 5.3 and 6.1, with -O3.

Signed-off-by: Quentin Glidic <sardemff7+git at sardemff7.net>
---

You have to look at the file directly to completely understand this one.
Not sure that is the value to return in this case, but at least it
silences the warning.

 clients/terminal.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/clients/terminal.c b/clients/terminal.c
index 100ef3c..f8bb128 100644
--- a/clients/terminal.c
+++ b/clients/terminal.c
@@ -124,6 +124,7 @@ init_state_machine(struct utf8_state_machine *machine)
 	machine->state = utf8state_start;
 	machine->len = 0;
 	machine->s.ch = 0;
+	machine->unicode = 0;
 }
 
 static enum utf8_state
-- 
2.9.0



More information about the wayland-devel mailing list