From 5b115ea9392ca30ce5f0bbeb18389ea9aaea7421 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 21 Mar 2011 13:12:46 +1030 Subject: [PATCH] foreach: fix HAVE_FOR_LOOP_DECLARATION case. --- ccan/foreach/_info | 2 +- ccan/foreach/foreach.c | 2 +- ccan/foreach/foreach.h | 2 +- ccan/foreach/test/run-nested.c | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ccan/foreach/_info b/ccan/foreach/_info index c49a9525..11f1b732 100644 --- a/ccan/foreach/_info +++ b/ccan/foreach/_info @@ -1,6 +1,6 @@ +#include "config.h" #include #include -#include "config.h" /** * foreach - macro for simple iteration of arrays diff --git a/ccan/foreach/foreach.c b/ccan/foreach/foreach.c index a18842b0..70040ee9 100644 --- a/ccan/foreach/foreach.c +++ b/ccan/foreach/foreach.c @@ -1,5 +1,5 @@ -#if !HAVE_COMPOUND_LITERALS || !HAVE_FOR_LOOP_DECLARATION #include +#if !HAVE_COMPOUND_LITERALS || !HAVE_FOR_LOOP_DECLARATION #include #include #include diff --git a/ccan/foreach/foreach.h b/ccan/foreach/foreach.h index 16471894..c7e878f8 100644 --- a/ccan/foreach/foreach.h +++ b/ccan/foreach/foreach.h @@ -46,7 +46,7 @@ for (unsigned _foreach_i = (unsigned long)((i) = (val), 0); \ (i); \ (i) = ((FOREACH_TYPEOF(val)[]){(val), __VA_ARGS__, NULL}) \ - [++_foreach_i]) \ + [++_foreach_i], \ _foreach_no_nullval(_foreach_i, i, \ ((void *[]){ val, __VA_ARGS__}))) #else /* !HAVE_FOR_LOOP_DECLARATION */ diff --git a/ccan/foreach/test/run-nested.c b/ccan/foreach/test/run-nested.c index 13ab4667..b54fbbe0 100644 --- a/ccan/foreach/test/run-nested.c +++ b/ccan/foreach/test/run-nested.c @@ -2,6 +2,7 @@ #include #include #include +#include #include static int test_int_recursion(unsigned int level) -- 2.39.2