RB_GENERATE macro problem

Jason Evans jasone at FreeBSD.org
Tue Jan 17 10:18:45 PST 2006


Andrey Chernov pointed out that jemalloc has several public symbols  
that should be static.  Among the offending symbols are those  
generated by the RB_GENERATE macro in sys/tree.h.  RB_GENERATE  
provides no mechanism for making the generated functions static, so  
I'd like to create new interfaces: RB_PROTOTYPE_STATIC and  
RB_GENERATE_STATIC.  This does not introduce any incompatibilities,  
as far as I know.    There is a complete patch at:

http://people.freebsd.org/~jasone/patches/RB_static.diff

In short, this patch does the following:

--------
#define	RB_GENERATE(name, type, field, cmp)			\
	RB_GENERATE_INTERNAL(name, type, field, cmp,)
#define	RB_GENERATE_STATIC(name, type, field, cmp)		\
	RB_GENERATE_INTERNAL(name, type, field, cmp, static)
#define RB_GENERATE_INTERNAL(name, type, field, cmp, attr)	\
attr void							\
name##_RB_INSERT_COLOR(struct name *head, struct type *elm)	\
[...]
--------

Does anyone have any reservations about this change, or suggestions  
for a better method?

Thanks,
Jason



More information about the freebsd-arch mailing list