From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by sourceware.org (Postfix) with ESMTPS id CAAA93858C2D; Mon, 7 Nov 2022 07:03:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CAAA93858C2D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-x62b.google.com with SMTP id u6so10230788plq.12; Sun, 06 Nov 2022 23:03:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=mBEXPx+8k02y0V6wCny1b0enT+L+7Mc99SalM7cXx40=; b=h42uk3nKAHaCWxzPap2KeFtfcjJhbuObuyGfHocM89PcydVG8rtMzbkDHBejct+lSG 8K+4yjGollWz4ol7gVQiMwrEWQYhyb3V2VZTYN05LJJ/fD1AM1TvjWSdiQKiTgROKFjx KVsf8dI6uhGwVSL3T4zKMQfEAKQyN6y5j7COZgSg2y0KuIrFRIqEUQV/X/GByPWTEEeU ZPbSJrKVTgzQEzlxxmj9CmHJBAoknHe9tmBcxjjBr3EwydqOrr19AE5tKgoaXX2zHrHV KoZ1jhLzFM7X2gC8Vdn0LsPlQSjwti9brd9B9emBi6S/OAy9beZASUgabLj1j2s+VzHJ f1aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mBEXPx+8k02y0V6wCny1b0enT+L+7Mc99SalM7cXx40=; b=v9orU5a5WQXucFhTegDmkTgQpumegGk28DCqaFJF7Hm8Rpo4pS18bR81eHULNHBDDJ 3cFcmnrMBkJH0eA5/Uv/VQIWWw2UuD5HE6nk9kza1h4TVpNdD3n+rgDCM0ZfoNGwu0Fj JqiKiDRDbvpAgX+ERijuCDCK5Nm5icjIC4Kyp+/R4QFRSu2U7gaE2jm/WQJgWdrS4AG5 RLg7wrw8RpdB+6p207cZNK6lbuMQIQ+fgnL6fzARlZwdG4i/qHc8pFmCvn9BkhjEEcmY kp0PGdl3WQSH/CJyHto0IrW0XpFBUP9s4QqjqR9L6iJC03x85ug2cPs7xxAJCj97V/1u E08g== X-Gm-Message-State: ACrzQf3DSOdKPoTIZiIWMV2wblCv8fd/HnzYRRYQvGVqm1rNqhUIe257 ZFI63hYQZ9h9CNuEgF7oTyRyvugMPZErQt53H+nrSR+0aO8= X-Google-Smtp-Source: AMsMyM5XlTCTXOOACL2SjTFSloP8nPCw9dp/9PlwDASCfXcMgaPbEl6JBIP+iUHbWZwOkmQn4hf0OIGNu72YF2ELfoA= X-Received: by 2002:a17:902:8206:b0:187:3c62:5837 with SMTP id x6-20020a170902820600b001873c625837mr700265pln.123.1667804607805; Sun, 06 Nov 2022 23:03:27 -0800 (PST) MIME-Version: 1.0 References: <8f15b063-9ec8-59e0-590b-20e416f68cb4@126.com> <98c69fc7-713f-a09a-8ca7-c3e64bdfd309@126.com> In-Reply-To: <98c69fc7-713f-a09a-8ca7-c3e64bdfd309@126.com> From: Andrew Pinski Date: Sun, 6 Nov 2022 23:03:15 -0800 Message-ID: Subject: Re: why does gccgit require pthread? To: LIU Hao Cc: gcc@gcc.gnu.org, gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Sun, Nov 6, 2022 at 10:51 PM LIU Hao wrote: > > =E5=9C=A8 2022-11-07 12:37, Andrew Pinski =E5=86=99=E9=81=93: > > > > The original code which used pthread was added in GCC 5 way before GCC > > moved to being written in C++11 which was only in the last 3 years. > > pthread_* functions were the best choice at the time (2014) but now > > GCC is written in C++11, I don't see any reason not to move them over > > to using C++11 threading code. > > > > > > Attached is the proposed patch. > > The win32 thread model does not have `std::mutex`; but there is no `pthre= ad_mutex_t` either, so it > does not build either way. Oh, but I would assume it will later on right? Also I think you might need to change some more than you did. That is: -#define INCLUDE_PTHREAD_H #include "system.h" You must likely have a macro, INCLUDE_MUTEX, and define that and include mutex in system.h like it was done for pthread.h. GCC loves to poison identifiers while lexing to make sure those identifiers are not used inside GCC and the include of mutex should be done early. Thanks, Andrew > > Tested bootstrapping GCC on `{i686,x86_64}-w64-mingw32` with languages > `c,lto,c++,fortran,objc,obj-c++` and with the `mcf` thread model; no erro= rs observed. The built > `libgccjit-0.dll` does not have imports from winpthread any more. > > Please review. > > > -- > Best regards, > LIU Hao >