Made compiler detection more reliable and cleanup clang warnings