Initialize compiler builtins
commit1af9b3eb920b8c2608baddf74931b8559c08e55b
authorMichael Kruse <pet@meinersbur.de>
Tue, 7 Jul 2015 11:11:13 +0000 (7 13:11 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Tue, 7 Jul 2015 11:24:32 +0000 (7 13:24 +0200)
tree5ec237e3a6e11d9dd03288fc151edd514a31ddab
parent9095ab7a7d2c83b6fe6e8acd229562d47c719e88
Initialize compiler builtins

Clang's builtin function list must be initialized in order to be
recognized. Otherwise they are defined implicitly when encountered.
Implicitly defined functions have a return type of 'int', which might
be incompatible with the expected return type.

This happens for instance when including the mmintrin.h header. The
builtin __builtin_ia32_vec_init_v2si is expected to return a vector
type. Because it is a system header, there is no warning for the
implicitly defined function. Instead, compilation fails with the error
message:

/usr/lib/llvm-3.6/bin/../lib/clang/3.6.0/include/mmintrin.h:46:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Michael Kruse <pet@meinersbur.de>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
pet.cc