Backport upstream fixes for latest Clang.

This is required to compile on recent OS Xen.
Merge pull request #2 from metajack/backport-clang-fixes

Backport upstream fixes for latest Clang.