[PATCH] D148822: [clang][BFloat] Avoid redefining bfloat16_t in arm_neon.h

Dimitry Andric via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 28 08:00:48 PDT 2023


dim added a comment.

In D148822#4305188 <https://reviews.llvm.org/D148822#4305188>, @simonbutcher wrote:

> I can't see anything wrong with this patch and it looks pretty straightforward to me, but is it necessary?
>
> '-Wtypedef-redefinition' is documented as not applying to system headers <https://github.com/llvm/llvm-project/blob/0fc19e222b5b0a86987ab058e0b34bc7014b56b3/clang/lib/Sema/SemaDecl.cpp#L2725>, and I couldn't reproduce the issue unless I changed the headers to not be system headers.

I think this due to the way some parts of FreeBSD get compiled, where we definitely use -Wsystem-headers. It is likely that this warning (which was turned into an error because parts of the tree also get compiled with -Werror) came through because of that. In any case, there is no need to redefine bfloat16_t, at least not here. Another option is to add yet another define like `__bfloat_16_defined` and test for that, but it only makes things uglier.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148822/new/

https://reviews.llvm.org/D148822



More information about the cfe-commits mailing list