Backport a few clang fixes

This is a smaller subset of clang related fixes. Should merge better than the larger chunk.
Instead of ```#ifdef __clang__``` shouldn't this really be ```#ifndef __gcc__``` (what ever the real check is)? The reason is we are using a non standard C++ extension of gcc which is the variable length array. That should also break icc or any other C++ compiler we try.