Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

thread:370:65: error: operator '||' has no right operand #46105

Closed
pkubaj opened this issue Jul 17, 2020 · 1 comment
Closed

thread:370:65: error: operator '||' has no right operand #46105

pkubaj opened this issue Jul 17, 2020 · 1 comment
Labels
bugzilla Issues migrated from bugzilla libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Comments

@pkubaj
Copy link
Contributor

pkubaj commented Jul 17, 2020

Bugzilla Link 46760
Resolution FIXED
Resolved on Sep 20, 2021 13:17
Version 10.0
OS FreeBSD
Blocks #44654
CC @ldionne,@mclow
Fixed by commit(s) 9f4022f

Extended Description

FreeBSD head, powerpc64 elfv2, LLVM 10.0.1-rc2-0-g77d76b71d7d

When compiling software that includes thread, using GCC 10.1.0 and libc++, I'm getting:
/usr/include/c++/v1/thread:370:65: error: operator '||' has no right operand
370 | #if defined(_LIBCPP_COMPILER_GCC) && (powerpc || POWERPC)

The reason is that POWERPC is undefined on FreeBSD. The proper way for this ifdef would be:
Index: contrib/llvm-project/libcxx/include/thread

--- contrib/llvm-project/libcxx/include/thread (revision 363109)
+++ contrib/llvm-project/libcxx/include/thread (working copy)
@@ -367,7 +367,7 @@
using namespace chrono;
if (__d > duration<_Rep, _Period>::zero())
{
-#if defined(_LIBCPP_COMPILER_GCC) && (powerpc || POWERPC)
+#if defined(_LIBCPP_COMPILER_GCC) && (defined(powerpc) || defined(POWERPC))
// GCC's long double const folding is incomplete for IBM128 long doubles.
_LIBCPP_CONSTEXPR duration _Max = nanoseconds::max();
#else

@ldionne
Copy link
Member

ldionne commented Sep 20, 2021

I believe this was fixed by

commit 9f4022f
Author: Joerg Sonnenberger joerg@bec.de
Date: Thu Feb 18 15:15:53 2021 +0100

[libc++] Avoid <climits> dependency in <thread>

The standard guarantees sleep durations of 2^63-1 nanoseconds to work.
Instead of depending on INT64_MAX or ULONGLONG_MAX to exist via the
header pollution, fold the constant directly. That has the additional
positive side effect that it avoids long double arithmetic bugs in GCC.

Differential Revision: https://reviews.llvm.org/D99516

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

No branches or pull requests

2 participants