llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.23k stars 11.66k forks source link

Compound literal C99 warning #60636

Open tfabric76 opened 1 year ago

tfabric76 commented 1 year ago

When compiling eigen (Clang 14) with AVX enabled, below warning (error) is encountered:

/mnt/c/git/content_analyzer/submodules/eigen/Eigen/src/Core/arch/Default/Half.h:415:9: error: compound literals are a C99-specific feature [-Werror,-Wc99-extensions]
  h.x = _cvtss_sh(ff, 0);

due to this C99 compound literal:

        ^
/usr/lib/llvm-14/lib/clang/14.0.6/include/f16cintrin.h:69:55: note: expanded from macro '_cvtss_sh'
  ((unsigned short)(((__v8hi)__builtin_ia32_vcvtps2ph((__v4sf){a, 0, 0, 0}, \

It seems like this resolves the issue:

        ^
/usr/lib/llvm-14/lib/clang/14.0.6/include/f16cintrin.h:69:55: note: expanded from macro '_cvtss_sh'
  ((unsigned short)(((__v8hi)__builtin_ia32_vcvtps2ph({a, 0, 0, 0}, \
tbaederr commented 1 year ago

And you point is that the warning is wrong?

tfabric76 commented 1 year ago

And you point is that the warning is wrong?

No the warning is correct, but llvm provides the /usr/lib/llvm-14/lib/clang/14.0.6/include/f16cintrin.h So at first maybe your automatic build system does not hit this: /usr/lib/llvm-14/lib/clang/14.0.6/include/f16cintrin.h:69:55

tbaederr commented 1 year ago

Ah, now I get it. Thanks for the explanation.