From 11d7dd3357997616427e22969ea8a929f5db59c9 Mon Sep 17 00:00:00 2001 From: Tiezhu Yang Date: Thu, 14 Apr 2022 10:37:30 +0800 Subject: gdb: fix build errors in gdbsupport/thread-pool.h used with old gcc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When I build gdb with gcc 8.3, there exist the following build errors, rename the typedef to task_t to fix them. CXX thread-pool.o In file included from /home/loongson/gdb.git/gdbsupport/thread-pool.cc:21: /home/loongson/gdb.git/gdbsupport/../gdbsupport/thread-pool.h: In member function ‘std::future gdb::thread_pool::post_task(std::function&&)’: /home/loongson/gdb.git/gdbsupport/../gdbsupport/thread-pool.h:69:44: error: declaration of ‘task’ shadows a previous local [-Werror=shadow=local] std::packaged_task task (std::move (func)); ^~~~ /home/loongson/gdb.git/gdbsupport/../gdbsupport/thread-pool.h:102:39: note: shadowed declaration is here typedef std::packaged_task task; ^~~~ /home/loongson/gdb.git/gdbsupport/../gdbsupport/thread-pool.h: In member function ‘std::future<_Res> gdb::thread_pool::post_task(std::function&&)’: /home/loongson/gdb.git/gdbsupport/../gdbsupport/thread-pool.h:80:41: error: declaration of ‘task’ shadows a previous local [-Werror=shadow=local] std::packaged_task task (std::move (func)); ^~~~ /home/loongson/gdb.git/gdbsupport/../gdbsupport/thread-pool.h:102:39: note: shadowed declaration is here typedef std::packaged_task task; ^~~~ Signed-off-by: Tiezhu Yang --- gdbsupport/thread-pool.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gdbsupport/thread-pool.h') diff --git a/gdbsupport/thread-pool.h b/gdbsupport/thread-pool.h index 3243346..5e203fd 100644 --- a/gdbsupport/thread-pool.h +++ b/gdbsupport/thread-pool.h @@ -99,13 +99,13 @@ private: size_t m_thread_count = 0; /* A convenience typedef for the type of a task. */ - typedef std::packaged_task task; + typedef std::packaged_task task_t; /* The tasks that have not been processed yet. An optional is used to represent a task. If the optional is empty, then this means that the receiving thread should terminate. If the optional is non-empty, then it is an actual task to evaluate. */ - std::queue> m_tasks; + std::queue> m_tasks; /* A condition variable and mutex that are used for communication between the main thread and the worker threads. */ -- cgit v1.1