tjfontaine/node-addon-layer — pull request #5 by davepacheco (2013-12-13 22:00:47+00:00)
Title: unpack functions and fix warnings

This PR does a few things:

- Adds the ability to unpack a value of type SHIM_TYPE_FUNCTION.
- Fixes a case where unpacking a string wouldn't set the type. I think the intent was to initialize the type lazily, which is fine -- as long as the caller always initialized it to SHIM_TYPE_UNKNOWN to begin with. But they don't necessarily, and you can have a shim_val that thinks it's the wrong type.
- Enables all warnings and makes them errors.
- Fixes a warning about the definition of shim_module_initialize() not matching the declaration. This was tricky because it's used in the definition of the struct that makes up the Node add-on interface, so it's determined by Node that this be a C++ function. But the point of the shim is to allow the add-on to be pure C. The solution used here is to have the C add-on's definition fill in NULL for the pointer, and use an "init" function (that runs when the add-on is dlopen'ed) to fill in the correct value.
- Removes a warning about unused local variables by breaking up the SHIM_PROLOGUE() macro. This one's unsatisfying, but I think it's worth it to compile without warnings.