Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Jan 2006 10:18:41 -0800
From:      Jason Evans <jasone@FreeBSD.org>
To:        freebsd-arch@freebsd.org
Subject:   RB_GENERATE macro problem
Message-ID:  <185CB7FA-438D-4D01-B673-2081A6B462CD@FreeBSD.org>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?185CB7FA-438D-4D01-B673-2081A6B462CD>