<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Jun 10, 2016 at 1:14 PM, Emil Velikov <span dir="ltr"><<a href="mailto:emil.l.velikov@gmail.com" target="_blank">emil.l.velikov@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 10 June 2016 at 20:57, Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>> wrote:<br>
> This reworks the #if guards a bit. When Emil originally wrote them, he<br>
> just guarded everything. However, part of what anv_entrypoints_gen.py<br>
> generates is a hash table for looking up entrypoints based on their name.<br>
> This table *cannot* get out of sync between C and python regardless of<br>
> preprocessor flags. In order to prevent this, this commit makes us use<br>
> void pointers in the dispatch table for those entrypoints which aren't<br>
> available. This means that the dispatch table size and entry order is<br>
> constant and it should never get out-of-sync with the python.<br>
><br>
</span>Double-checking that I've for this right:<br>
So this moves the guard per function and ensures that all entries and<br>
thus the hash table and lookup is always at the same place. Regardless<br>
if we'll ever hit the non-supported platforms' entry points.<br></blockquote><div><br></div><div>Yes, that's correct.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I'm thinking about an alternative solution, not sure if it's going to<br>
work/fly. Forward declare the specific types (in case we're building<br>
w/o said platform) and drop the guards around the functions and don't<br>
change the function signature/return type.<br></blockquote><div><br></div><div>I thought about that. In particular, declaring typedefs that just give you void * instead of a function pointer for the ones we're not using. That would let us make at least some of it less #iffy.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
It should be possible (from a very quick look) since all the platform<br>
specifics arguments are pointers to the specific types.<br>
I think that may be better solution, but regardless if you opt for it or not<br></blockquote><br></div><div class="gmail_quote">I'm all for doing it better, but I'm more for getting it working. i'll push with your ack.<br></div><div class="gmail_quote">--Jason<br></div><br></div></div>