aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2021-08-30 13:54:45 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2021-08-30 13:58:20 -0400
commit00894ecf4636a242fbd11536acdf50f7891b374a (patch)
tree73326f07f190d5d806912bcbd49d7ed16fe108b2 /gdb
parent685bb4e84bafaa5d9506cdacaf2766638bbbc560 (diff)
downloadbinutils-00894ecf4636a242fbd11536acdf50f7891b374a.zip
binutils-00894ecf4636a242fbd11536acdf50f7891b374a.tar.gz
binutils-00894ecf4636a242fbd11536acdf50f7891b374a.tar.bz2
gdb: fix build error in unittests/parallel-for-selftests.c
We get this error when building GDB on some platforms. I get it using g++-10 on Ubuntu 20.04 (installed using the distro package). It was also reported by John Baldwin, using a clang that uses libc++. CXX unittests/parallel-for-selftests.o cc1plus: warning: command line option '-Wmissing-prototypes' is valid for C/ObjC but not for C++ /home/smarchi/src/binutils-gdb/gdb/unittests/parallel-for-selftests.c: In function 'void selftests::parallel_for::test(int)': /home/smarchi/src/binutils-gdb/gdb/unittests/parallel-for-selftests.c:53:30: error: use of deleted function 'std::atomic<int>::atomic(const std::atomic<int>&)' 53 | std::atomic<int> counter = 0; | ^ In file included from /usr/include/c++/9/future:42, from /home/smarchi/src/binutils-gdb/gdb/../gdbsupport/thread-pool.h:29, from /home/smarchi/src/binutils-gdb/gdb/../gdbsupport/parallel-for.h:26, from /home/smarchi/src/binutils-gdb/gdb/unittests/parallel-for-selftests.c:22: /usr/include/c++/9/atomic:755:7: note: declared here 755 | atomic(const atomic&) = delete; | ^~~~~~ /usr/include/c++/9/atomic:759:17: note: after user-defined conversion: 'constexpr std::atomic<int>::atomic(std::atomic<int>::__integral_type)' 759 | constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { } | ^~~~~~ I haven't dug to know why it does not happen everywhere, but this patch fixes it by using the constructor to initialize the variable, rather than the assignment operator. Change-Id: I6b27958171bf6187f6a875657395fd10441db7e6
Diffstat (limited to 'gdb')
-rw-r--r--gdb/unittests/parallel-for-selftests.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/unittests/parallel-for-selftests.c b/gdb/unittests/parallel-for-selftests.c
index 7f61b70..a2cd472 100644
--- a/gdb/unittests/parallel-for-selftests.c
+++ b/gdb/unittests/parallel-for-selftests.c
@@ -50,7 +50,7 @@ test (int n_threads)
#define NUMBER 10000
- std::atomic<int> counter = 0;
+ std::atomic<int> counter (0);
gdb::parallel_for_each (0, NUMBER,
[&] (int start, int end)
{