[libvirt] [PATCH 2/1] tests: avoid compiler warnings
Daniel Veillard
veillard at redhat.com
Fri Apr 6 03:42:17 UTC 2012
On Thu, Apr 05, 2012 at 08:22:51PM -0600, Eric Blake wrote:
> gcc 4.7 warns about uninitialized struct members
>
> * tests/testutilsqemu.c (testQemuCapsInit): Populate new members.
> * tests/viruritest.c (mymain): Likewise.
> ---
>
> Another warning cleanup, worth pushing at the same time as whichever
> solution we pick for the large stack size.
>
> tests/testutilsqemu.c | 6 +++++-
> tests/viruritest.c | 34 +++++++++++++++++-----------------
> 2 files changed, 22 insertions(+), 18 deletions(-)
>
> diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
> index 8e621fe..8d5a3bf 100644
> --- a/tests/testutilsqemu.c
> +++ b/tests/testutilsqemu.c
> @@ -123,7 +123,11 @@ virCapsPtr testQemuCapsInit(void) {
> 1, /* threads */
> ARRAY_CARDINALITY(host_cpu_features), /* nfeatures */
> ARRAY_CARDINALITY(host_cpu_features), /* nfeatures_max */
> - host_cpu_features /* features */
> + host_cpu_features, /* features */
> + 0, /* ncells */
> + 0, /* ncells_max */
> + NULL, /* cells */
> + 0, /* cells_cpus */
> };
>
> if ((caps = virCapabilitiesNew(host_cpu.arch,
> diff --git a/tests/viruritest.c b/tests/viruritest.c
> index 3570217..c0ab9a1 100644
> --- a/tests/viruritest.c
> +++ b/tests/viruritest.c
> @@ -160,8 +160,8 @@ mymain(void)
> "test", "example.com", 0, "/", query_in, NULL, params)
>
> virURIParam params[] = {
> - { (char*)"name", (char*)"value" },
> - { NULL, NULL },
> + { (char*)"name", (char*)"value", false },
> + { NULL, NULL, false },
> };
>
> TEST_PARSE("test://example.com", "test", "example.com", 0, NULL, NULL, NULL, NULL);
> @@ -172,31 +172,31 @@ mymain(void)
> TEST_PARSE("test://[2001:41c8:1:4fd4::2]:123/system", "test", "2001:41c8:1:4fd4::2", 123, "/system", NULL, NULL, NULL);
>
> virURIParam params1[] = {
> - { (char*)"foo", (char*)"one" },
> - { (char*)"bar", (char*)"two" },
> - { NULL, NULL },
> + { (char*)"foo", (char*)"one", false },
> + { (char*)"bar", (char*)"two", false },
> + { NULL, NULL, false },
> };
> virURIParam params2[] = {
> - { (char*)"foo", (char*)"one" },
> - { (char*)"foo", (char*)"two" },
> - { NULL, NULL },
> + { (char*)"foo", (char*)"one", false },
> + { (char*)"foo", (char*)"two", false },
> + { NULL, NULL, false },
> };
> virURIParam params3[] = {
> - { (char*)"foo", (char*)"&one" },
> - { (char*)"bar", (char*)"&two" },
> - { NULL, NULL },
> + { (char*)"foo", (char*)"&one", false },
> + { (char*)"bar", (char*)"&two", false },
> + { NULL, NULL, false },
> };
> virURIParam params4[] = {
> - { (char*)"foo", (char*)"" },
> - { NULL, NULL },
> + { (char*)"foo", (char*)"", false },
> + { NULL, NULL, false },
> };
> virURIParam params5[] = {
> - { (char*)"foo", (char*)"one two" },
> - { NULL, NULL },
> + { (char*)"foo", (char*)"one two", false },
> + { NULL, NULL, false },
> };
> virURIParam params6[] = {
> - { (char*)"foo", (char*)"one" },
> - { NULL, NULL },
> + { (char*)"foo", (char*)"one", false },
> + { NULL, NULL, false },
> };
>
> TEST_PARAMS("foo=one&bar=two", "", params1);
ACK,
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel at veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
More information about the libvir-list
mailing list