From d66e136bd5ce27addd2efabb8d604b40d754865f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Fri, 23 Jan 2015 10:30:01 +0100 Subject: [PATCH] Fix build with older gcc My commit af1c98e4 broke the build on RHEL-6: vircgrouptest.c: In function 'testCgroupGetPercpuStats': vircgrouptest.c:566: error: nested extern declaration of '_gl_verify_function2' [-Wnested-externs] The only thing that needs checking is that the array size is at least EXPECTED_NCPUS, to prevent access beyond the array. We can ensure the minimum size also by specifying the array size upfront. --- tests/vircgrouptest.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/vircgrouptest.c b/tests/vircgrouptest.c index b65ea3fba5..a455a8101a 100644 --- a/tests/vircgrouptest.c +++ b/tests/vircgrouptest.c @@ -541,7 +541,7 @@ static int testCgroupGetPercpuStats(const void *args ATTRIBUTE_UNUSED) virTypedParameterPtr params = NULL; # define EXPECTED_NCPUS 160 - unsigned long long expected[] = { + unsigned long long expected[EXPECTED_NCPUS] = { 0, 0, 0, 0, 0, 0, 0, 0, 7059492996, 0, 0, 0, 0, 0, 0, 0, 4180532496, 0, 0, 0, 0, 0, 0, 0, @@ -563,7 +563,6 @@ static int testCgroupGetPercpuStats(const void *args ATTRIBUTE_UNUSED) 5683512916, 0, 0, 0, 0, 0, 0, 0, 635751356, 0, 0, 0, 0, 0, 0, 0, }; - verify(ARRAY_CARDINALITY(expected) == EXPECTED_NCPUS); if (VIR_ALLOC_N(params, EXPECTED_NCPUS) < 0) goto cleanup;