The continuous integration uncovered this problem: A testdir with modules
'bitset' and 'free-posix' fails to build.

In file included from ../../gllib/bitset.h:31:0,
                 from ../../gllib/bitset.c:22:
../../gllib/bitset.c: In function ‘bitset_free’:
../../gllib/bitset/base.h:200:18: error: ‘const struct bitset_vtable’ has no 
member named ‘rpl_free’
  ((SRC)->b.vtable->free ? (SRC)->b.vtable->free (SRC) :(void)0)
                  ^
../../gllib/bitset.c:173:7: note: in expansion of macro ‘BITSET_FREE_’
       BITSET_FREE_ (bset);
       ^
../../gllib/bitset/base.h:200:42: error: ‘const struct bitset_vtable’ has no 
member named ‘rpl_free’
  ((SRC)->b.vtable->free ? (SRC)->b.vtable->free (SRC) :(void)0)
                                          ^
../../gllib/bitset.c:173:7: note: in expansion of macro ‘BITSET_FREE_’
       BITSET_FREE_ (bset);
       ^
../../gllib/bitset.c: In function ‘bitset_obstack_free’:
../../gllib/bitset/base.h:200:18: error: ‘const struct bitset_vtable’ has no 
member named ‘rpl_free’
  ((SRC)->b.vtable->free ? (SRC)->b.vtable->free (SRC) :(void)0)
                  ^
../../gllib/bitset.c:184:5: note: in expansion of macro ‘BITSET_FREE_’
     BITSET_FREE_ (bset);
     ^
../../gllib/bitset/base.h:200:42: error: ‘const struct bitset_vtable’ has no 
member named ‘rpl_free’
  ((SRC)->b.vtable->free ? (SRC)->b.vtable->free (SRC) :(void)0)
                                          ^
../../gllib/bitset.c:184:5: note: in expansion of macro ‘BITSET_FREE_’
     BITSET_FREE_ (bset);
     ^

This patch fixes it.


2020-12-26  Bruno Haible  <br...@clisp.org>

        bitset: Fix conflict with 'free-posix' module.
        * lib/bitset/base.h: Include <stdlib.h>.

diff --git a/lib/bitset/base.h b/lib/bitset/base.h
index fe447c2..ad674ef 100644
--- a/lib/bitset/base.h
+++ b/lib/bitset/base.h
@@ -24,6 +24,7 @@
 #include <limits.h>
 #include <stdbool.h>
 #include <stddef.h>
+#include <stdlib.h>     /* because Gnulib's <stdlib.h> may '#define free ...' 
*/
 #include <string.h> /* ffsl */
 
 #include "attribute.h"


Reply via email to