configurator: HAVE_SECTION_START_STOP
[ccan] / ccan / foreach / foreach.h
index 73c4c693ebf7f58297b092f943716d07701f809b..71b4c0282f8e5b561d9c0f607ee8ca67d111d1eb 100644 (file)
@@ -1,3 +1,4 @@
+/* Licensed under LGPLv3+ - see LICENSE file for details */
 #ifndef CCAN_FOREACH_H
 #define CCAN_FOREACH_H
 #include "config.h"
@@ -44,7 +45,7 @@
  */
 #define foreach_ptr(i, ...)                                    \
        for (unsigned _foreach_i                                \
-                    = (((i) = ((const void *[]){ __VA_ARGS__ })[0]), 0); \
+            = (((i) = (void *)((FOREACH_TYPEOF(i)[]){ __VA_ARGS__ })[0]), 0); \
             (i);                                                       \
             (i) = (void *)((FOREACH_TYPEOF(i)[])                       \
                     { __VA_ARGS__, NULL})[++_foreach_i],               \
             (i) = (int[]) { __VA_ARGS__, 0 }[_foreach_iter_inc(&(i))])
 
 #define foreach_ptr(i, ...)                                            \
-       for ((i) = ((FOREACH_TYPEOF(i)[]){ __VA_ARGS__ })[0],           \
+       for ((i) = (void *)((FOREACH_TYPEOF(i)[]){ __VA_ARGS__ })[0],   \
                     _foreach_iter_init(&(i));                          \
             (i);                                                       \
             (i) = (void *)((FOREACH_TYPEOF(i)[]){ __VA_ARGS__, NULL }) \
                     [_foreach_iter_inc(&(i))],                         \
                 _foreach_no_nullval(_foreach_iter(&(i)), i,            \
-                                    ((void *[]){ __VA_ARGS__})))
+                                    ((const void *[]){ __VA_ARGS__})))
 
 void _foreach_iter_init(const void *i);
 unsigned int _foreach_iter(const void *i);