Testing clang

This PR is trying to collect contribution of fixes to let Caffe tested on Ubuntu with clang untill https://github.com/travis-ci/travis-ci/issues/2320 will let to test Caffe in Travis on OSX.