KhronosGroup/webcl-validator — pull request #85 by eras (2014-01-23 09:36:54+00:00)
Title: Use std::tr1::shared_ptr; implement wrapping of remaining pointer-using builtins; use functions instead of macros for clamping

This pull-request is of three consecutive branches: erkkise/use_tr1_shared_ptr, erkkise/atomics and erkkise/functions_for_macros.

erkkise/use_tr1_shared_ptr:

Use shared ptr from tr1 to keep code compiling on c++03 -based compilers (still the default for clang).

erkkise/atomics:

Implement atomics and remaining mathematics functions involving pointers (fract, frexp, modf, lgamma_r, remquo). This is implemented using the same mechanism as the wrapping of vload and vstore by providing a general wrapper for any function that takes exactly one pointer to one value.

erkkise/functions_for_macros:

Replaced generation of clamping and checking macros with functions. This overcomes the problem of side-effectful expressions being evaluated multiple times.

Instead of passing type as an argument to the macro, each different type gets its own function. The name of the type is embedded into the name of the clamping/checking function by using a new function WebCLConfiguration::getIdentifierOfString which is a mangling function of sorts. The function makes sure the user is not able to introduce collisions for types that are named differently.