Tuesday, November 02, 2021

Re: clang 13 and __STDC_NO_ATOMICS__

On 11/2/2021 2:41 PM, Kurt Miller wrote:

> On Nov 1, 2021, at 10:20 PM, Brad Smith <brad@comstyle.com> wrote:
>>
>> On 10/28/2021 8:42 AM, Jeremie Courreges-Anglas wrote:
>>> On Thu, Oct 28 2021, Jeremie Courreges-Anglas <jca@wxcvbn.org> wrote:
>>>> On Thu, Oct 28 2021, Christian Weisgerber <naddy@mips.inka.de> wrote:
>>>>> I ran an amd64 bulk build with base clang updated to LLVM 13.
>>>>>
>>>>> There is substantial fallout. Java appears to be broken and there
>>>>> are numerous failures caused by clang 13 issuing new warnings and
>>>>> ports using -Werror.
>>>>>
>>>>> Failure logs:
>>>>> http://build-failures.rhaalovely.net/amd64-clang/2021-10-27/
>>>>>
>>>>> The final error may be misleading. For instance, devel/libdsm fails
>>>>> with a linker error "undefined reference to pthread_create", but
>>>>> the root cause is -Werror breaking a configure check.
>>>>>
>>>>> Below there's a list of affected ports. Several hundred more weren't
>>>>> built because they depend on something that failed.
>>>>>
>>>>> audio/cmus
>>>> jsg@ pointed out that this new clang defines __STDC_NO_ATOMICS__
>>>> which is most likely wrong. This breaks at least cmus:
>>>>
>>>> http://build-failures.rhaalovely.net/amd64-clang/2021-10-27/audio/cmus.log
>>> Brad, are you sure that this change is 100% correct?
>>> https://github.com/llvm/llvm-project/commit/d8cd7806310c51af912a647a6ca46de62ff13214
>>>
>>> Should we drop the __STDC_NO_ATOMICS__ define?
>> The atomics part was my misunderstanding and is wrong. I have reverted it upstream and will
>> have it merged into 13.
> Thanks for fixing that. Can you explain why __STDC_NO_THREADS__ was retained? I'm
> assuming that's disabling std::thread and related thread support which also seems wrong.

This is for C11 not C++11.

"If the macro constant __STDC_NO_THREADS__(C11) is defined by the
compiler, the
header <threads.h> and all of the names listed here are not provided."

https://en.cppreference.com/w/c/thread

OpenBSD currently does not implement C11 threads, unlike relatively new
FreeBSD,
NetBSD, Solaris, AIX, glibc, musl.

https://svnweb.freebsd.org/base/head/lib/libstdthreads/threads.h
https://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libpthread/threads.h

No comments:

Post a Comment