tools/ocaml: Fix build error with CentOS 7
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 10 Sep 2019 14:04:55 +0000 (15:04 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 10 Sep 2019 14:28:55 +0000 (15:28 +0100)
commit2cf41696950719fae260c05d47fb0c7548a990e1
tree34d878a890c1e1a9ba275f590bae6c6b7493be4b
parent7fb0e134f8c67f78470c15ec2a5e99dfa8c4a49b
tools/ocaml: Fix build error with CentOS 7

gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28) complains:

  xenctrl_stubs.c: In function 'stub_xc_domain_create':
  xenctrl_stubs.c:216:28: error: 'val' may be used uninitialized
                          in this function [-Werror=maybe-uninitialized]
     cfg.arch.emulation_flags = ocaml_list_to_c_bitmap
                              ^
  xenctrl_stubs.c:198:12: error: 'val' may be used uninitialized
                          in this function [-Werror=maybe-uninitialized]
    cfg.flags = ocaml_list_to_c_bitmap
              ^
  cc1: all warnings being treated as errors

GCC doesn't point at the correct piece of code, but the diagnostic text is
correct, and can occur when the list is empty. Initialise val to 0.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Christian Lindig <christian.lindig@citrix.com>
tools/ocaml/libs/xc/xenctrl_stubs.c