tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: in which we present an ugly hack to make sys/queue.h CIRCLEQ work



On 2013-11-20 mrg%eterna.com.au@localhost wrote:

i'm going to commit this soon, but if anyone has more useful hacks or
real fixes, please let me/these lists know and we'll consider them.
+ * If we ever choose to change the ABI of the CIRCLEQ macros, we could fix
+ * this by changing the
  If changing the ABI (or for places where it doesn't matter), please 
consider gcq (in gcq.h, gcq(3)).  Or use part of it (I think the *_TYPED 
macros are drop in replacements for CIRCLEQ).  Also, slhchi is the only 
thing in the tree that uses it and while in theory some third party 
software could use it, I'd assume that in practice anyone who did would 
just copy it, so it wouldn't be a problem to alter the interface some if 
needed.  Also, while I did test it at the time I haven't used it again yet 
so it is possible there are bugs lurking outside of what slhci uses.
  I don't fully understand the strict aliasing rules, but the only thing 
that seems like it might cause trouble is gcq_head(), which is not used 
internally but provided to be able to treat any element as the head for 
iteration purposes (presumably because you don't have a designated head, 
so not CIRCLEQ usage).  It casts a struct to a struct that contains only 
that struct and is used only to cast back.  If that isn't safe, that 
function could just be removed and replaced with an explanation of why it 
isn't safe, however I expect it to be safe because it is never used except 
to cast to the inner type (the head only has a separate type to make it 
hard to accidently mess up the argument order).
-Matt


Home | Main Index | Thread Index | Old Index