Summary: | clang error builtin-requires-header on pthread_create on powerpc64 | ||||||
---|---|---|---|---|---|---|---|
Product: | Base System | Reporter: | Alfredo Dal'Ava Junior <alfredo> | ||||
Component: | threads | Assignee: | freebsd-threads (Nobody) <threads> | ||||
Status: | New --- | ||||||
Severity: | Affects Some People | CC: | jrtc27, theraven, toolchain | ||||
Priority: | --- | ||||||
Version: | CURRENT | ||||||
Hardware: | Any | ||||||
OS: | Any | ||||||
Attachments: |
|
Description
Alfredo Dal'Ava Junior
![]() ![]() I confirmed this affects other platforms, so a new patch was added to: https://reviews.freebsd.org/D19236 Does this affect users, or is it part of the FreeBSD build? We have a number of problems because the base system build uses `-Wsystem-headers` and so clang reports a lot of things that it shouldn't, because it treats the system headers as if they aren't system headers. If this is only a problem for the FreeBSD build itself, then I'd recommend against patching the header and instead fix the build system (we add `-Wno-system-headers` elsewhere to work around this). (In reply to David Chisnall from comment #2) It shows up for users using the system header if they pass -Wsystem-headers, but otherwise not. The problem is that *any* declaration of pthread_create will trigger this warning, since GetBuiltinType will return {} with Error = GE_Missing_type due to the fact that its type is "" in Builtins.def, and it only works normally because the warning gets suppressed for system headers. I think the correct thing to do is to give it the proper type, which I'm working on at the moment (Clang now has syntax for function types within intrinsic type strings with a recursive parse call so you can express function pointers; it just also needs to learn about pthread(_attr)_t). (In reply to James Clarke from comment #3) https://reviews.llvm.org/D58531 fixes this for me. It will still warn if the declaration is of the wrong type, but no longer warns if the declaration matches the expected type. This makes it behave like the other builtins declared in system headers. (In reply to James Clarke from comment #4) I still see other issues regarding conflicting headers during build. For ports devel/llvm*, currently it does have a patch that removes conflicting headers, so it's "fixed". For those using llvm from upstream, I use this as workaround: cd <path where llvm is installed>/lib/clang/9.0.0/include/ mkdir bkp mv float.h intrin.h inttypes.h iso646.h limits.h stdalign.h stdarg.h stdatomic.h stdbool.h stddef.h stdint.h stdnoreturn.h tgmath.h unwind.h varargs.h bkp/ |