From nobody Fri Apr 19 03:02:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623808031480194.55576183664425; Tue, 15 Jun 2021 18:47:11 -0700 (PDT) Received: from localhost ([::1]:46778 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltKe6-0005Y1-FP for importer@patchew.org; Tue, 15 Jun 2021 21:47:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55462) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltKTq-0008NU-FH for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:36:34 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]:40493) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltKTo-0005ak-KC for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:36:34 -0400 Received: by mail-pl1-x629.google.com with SMTP id e7so284979plj.7 for ; Tue, 15 Jun 2021 18:36:32 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id o1sm321595pjf.56.2021.06.15.18.36.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 18:36:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GCKAdANmH1Xtpoehzhc4V1D5rmsyIp28yEK3SJRUGT4=; b=lIsbNkz/tbwdbAQAoD4l/RtJs/D5/pBwaQWAOHmAp44xMeNyC1MgNRfK+XToB64giW gfmWSRdb9HULUZCc/r3WU+6eQdMAvBuxZ6DkMP2I4VmYbLxBkP+c7Mg75UShcju80f3z QpZswWTuGH4Rp2qRnQrhz96O673+ZtosQYGFdJ2Ewmv/sNX1Sy6Z391W+PGaimE8zlHq Jj6FRtNNhUijG5kEOhYrtjmxyEiayd7BakE/HOmYGti3UUpegE7Ec9C/2ULAKsp3EzJE nEqlBQDGIVAi3C8RHuKbZrXY9FDLdFU44afeuKRcYJoCBJdVO9yb7GQIqlrNSbSS6Xo6 guLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GCKAdANmH1Xtpoehzhc4V1D5rmsyIp28yEK3SJRUGT4=; b=HgTFpBIR5U2sflXi1nGIXobePNuTR/tkSto6dFBonq00YQcXDlowJEROazfophC/15 RDM+ECIWWneNKo8a+tA27kucGSMZGqg+N6ekPUf8zuPqq5HD6NEPT12FHXePUMJsopML jZLRogiaK7Y84EVKcVnQMFHY19Q8v7B8yv6UsnUtFKPWqVofIf3CEErKe6ocOkJWL7Hs 23ZyDiUvNU1ev4f13qxHZKHiEz9zEn+65EXeHrPQdr2tVMD94Te+0vm8WfJZ+xNi/ivA 0uKpjVPYZQVRXlgZNJh9tbYIi5vG6txC94BbVwjuhvMI+/t6cBAritr5L1cNo1Cek78B c8Ag== X-Gm-Message-State: AOAM531JsJV0sUzbUTCgaNpVupcBv49Hpb1DB/bvAB3VeAgQ8wTI6ggN m6TCPhEZV6j2xe4z78svW0zpuGnCOgQGVg== X-Google-Smtp-Source: ABdhPJwqPVlQY6Nz3VOhEo9EMOcBpoF21UmOxe66xtkidfpP2r++dxnZLGziNoqBTbJj4vKCTYGlqQ== X-Received: by 2002:a17:903:2311:b029:115:29a9:a3ee with SMTP id d17-20020a1709032311b029011529a9a3eemr6799238plh.46.1623807391361; Tue, 15 Jun 2021 18:36:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 1/8] configure: Use -std=gnu11 Date: Tue, 15 Jun 2021 18:36:22 -0700 Message-Id: <20210616013629.1458790-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210616013629.1458790-1-richard.henderson@linaro.org> References: <20210616013629.1458790-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , peter.maydell@linaro.org, Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Now that the minimum gcc version is 7.5, we can use C11. This will allow lots of cleanups to the code, currently hidden behind macros in include/qemu/compiler.h. Signed-off-by: Richard Henderson Reviewed-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Alex Benn=C3=A9e Message-Id: <20210614233143.1221879-2-richard.henderson@linaro.org> --- configure | 4 ++-- meson.build | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 8dcb9965b2..0489864667 100755 --- a/configure +++ b/configure @@ -159,7 +159,7 @@ update_cxxflags() { # options which some versions of GCC's C++ compiler complain about # because they only make sense for C programs. QEMU_CXXFLAGS=3D"$QEMU_CXXFLAGS -D__STDC_LIMIT_MACROS -D__STDC_CONSTAN= T_MACROS -D__STDC_FORMAT_MACROS" - CONFIGURE_CXXFLAGS=3D$(echo "$CONFIGURE_CFLAGS" | sed s/-std=3Dgnu99/-= std=3Dgnu++11/) + CONFIGURE_CXXFLAGS=3D$(echo "$CONFIGURE_CFLAGS" | sed s/-std=3Dgnu11/-= std=3Dgnu++11/) for arg in $QEMU_CFLAGS; do case $arg in -Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\ @@ -538,7 +538,7 @@ QEMU_CFLAGS=3D"-Wstrict-prototypes -Wredundant-decls $Q= EMU_CFLAGS" QEMU_CFLAGS=3D"-D_GNU_SOURCE -D_FILE_OFFSET_BITS=3D64 -D_LARGEFILE_SOURCE = $QEMU_CFLAGS" =20 # Flags that are needed during configure but later taken care of by Meson -CONFIGURE_CFLAGS=3D"-std=3Dgnu99 -Wall" +CONFIGURE_CFLAGS=3D"-std=3Dgnu11 -Wall" CONFIGURE_LDFLAGS=3D =20 =20 diff --git a/meson.build b/meson.build index a2311eda6e..d8a92666fb 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('qemu', ['c'], meson_version: '>=3D0.55.0', - default_options: ['warning_level=3D1', 'c_std=3Dgnu99', 'cpp_std= =3Dgnu++11', 'b_colorout=3Dauto'] + + default_options: ['warning_level=3D1', 'c_std=3Dgnu11', 'cpp_std= =3Dgnu++11', 'b_colorout=3Dauto'] + (meson.version().version_compare('>=3D0.56.0') ? = [ 'b_staticpic=3Dfalse' ] : []), version: run_command('head', meson.source_root() / 'VERSION').stdo= ut().strip()) =20 --=20 2.25.1 From nobody Fri Apr 19 03:02:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1623807498; cv=none; d=zohomail.com; s=zohoarc; b=cJqMIDdNLrmAB5rZGDxWmFIgOb98fXTYLJocQ9/1oikuBAA1gWJdxuj+J5TUM/ttMBLsVGus3vc2Tx9ZuZ4ylQNWhtuIPx5EUUWgPP6ZAaBm2dweQAwK5hopkhLLiBRafgRD6PsOAbW4JJi8RabeitOzMKMD8HLrJegCqPliu8w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623807498; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wj8nbktnS3Cds2QIKMNmDpFap8ymbqZ5pXLd4Gca9Xw=; b=UT9AnJJdUStZGTDwegoNRVfxyAlVZcSQcfYd1eoOE+bitybtrkvlivdmBsZW27LGri5dbWQEjf0SirNxzKwrDr1WWaAejhb3PReTxI60Xs8pC7ja6S0HMOOtUgrkf3F4LWjpI0DUgqjjBjrehrC6Z7nZoBI6NlzPwuNhnN6At4Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 162380749872541.88310126856254; Tue, 15 Jun 2021 18:38:18 -0700 (PDT) Received: from localhost ([::1]:58988 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltKVU-0002mk-Cn for importer@patchew.org; Tue, 15 Jun 2021 21:38:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55486) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltKTr-0008Pw-EF for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:36:35 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]:35336) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltKTp-0005bM-9A for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:36:35 -0400 Received: by mail-pj1-x102b.google.com with SMTP id fy24-20020a17090b0218b029016c5a59021fso3013059pjb.0 for ; Tue, 15 Jun 2021 18:36:32 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id o1sm321595pjf.56.2021.06.15.18.36.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 18:36:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wj8nbktnS3Cds2QIKMNmDpFap8ymbqZ5pXLd4Gca9Xw=; b=gvmw9isz6VXpNdcl0Qe+pNodDzBX8QNL2bWGXfx/4x66MVXIzhp4HM0UKGCb16RxV2 PIyKSW7wwpm/J+z1fZeNYCZp0xGc4h95x+nDC9Qz4dHzZug6ZmulJFo+xUoWuXVPUKu5 Bmc4OXF/rrqX6LVPkRERESY+U15rT9gMNFTkWx+Ju/HZFpTiLshUyU4c+chJ08q/v2hu nPI/abLEJEX9rkBAUYBVp+tVzQaAdUj04Xt/BmKo+ts3zf+V5ShtWGTe9Ef66v51Dp0j A9jlJV5d9dlgQim9q1j7Gxf54OaXmmer9B9IfNUUQJd/Kt5YPb39URP+F+yLY+JlMtdb 3aIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wj8nbktnS3Cds2QIKMNmDpFap8ymbqZ5pXLd4Gca9Xw=; b=eZgzabsUnkYdelDXc1K6rjK/pl+2dyOLwfOnbhjMK+7Twf22HU9EU4qhcWQ18U8eZ0 m6i4fHKbDA0UR0x31INbqTsIL8fb+yAvCkwz6EwnSsFrWgA8EAMJSvLh8440EVRqnrqw Un6BeZZtkYwEDHeuD4Vu1zG0ImlzLhCet2JYylhTOlBEVRQXbceyld0DwyEw5ICO2o0R O9YRXBKJjljkgprH8NgfEb7nui9apEykztQvuNQUDMrhGQwzyWaTS9i8Jp2tn5/WFppl EN5oGTxJ2vAxPegskF8ca7hvs11azmlTl8A5S+5w9mwGJRu3XxSYELHRhMUrkkdrKdzz BTSQ== X-Gm-Message-State: AOAM533fIdDmpTxZWAtSG59AvGH6FCo9unLcG83n6uUquPExTSMi+lTg X9/Dd7rhpYQVSEmGuBJV5fAR0tsFeO5M7A== X-Google-Smtp-Source: ABdhPJxK76ukNUEuU2J241qxA1NYhvkf7nfn4StHl78FXlZuCZeiLX0DdonLQdVbMBpaSbvdmueRgw== X-Received: by 2002:a17:90b:1489:: with SMTP id js9mr2171321pjb.227.1623807391881; Tue, 15 Jun 2021 18:36:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 2/8] softfloat: Use _Generic instead of QEMU_GENERIC Date: Tue, 15 Jun 2021 18:36:23 -0700 Message-Id: <20210616013629.1458790-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210616013629.1458790-1-richard.henderson@linaro.org> References: <20210616013629.1458790-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Thomas Huth , =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Signed-off-by: Richard Henderson Reviewed-by: Thomas Huth Reviewed-by: Alex Benn=C3=A9e Message-Id: <20210614233143.1221879-3-richard.henderson@linaro.org> --- fpu/softfloat.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 4d0160fe9c..6e769f990c 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -686,11 +686,13 @@ static float128 float128_pack_raw(const FloatParts128= *p) #include "softfloat-specialize.c.inc" =20 #define PARTS_GENERIC_64_128(NAME, P) \ - QEMU_GENERIC(P, (FloatParts128 *, parts128_##NAME), parts64_##NAME) + _Generic((P), FloatParts64 *: parts64_##NAME, \ + FloatParts128 *: parts128_##NAME) =20 #define PARTS_GENERIC_64_128_256(NAME, P) \ - QEMU_GENERIC(P, (FloatParts256 *, parts256_##NAME), \ - (FloatParts128 *, parts128_##NAME), parts64_##NAME) + _Generic((P), FloatParts64 *: parts64_##NAME, \ + FloatParts128 *: parts128_##NAME, \ + FloatParts256 *: parts256_##NAME) =20 #define parts_default_nan(P, S) PARTS_GENERIC_64_128(default_nan, P)(P,= S) #define parts_silence_nan(P, S) PARTS_GENERIC_64_128(silence_nan, P)(P,= S) @@ -892,11 +894,13 @@ static void parts128_log2(FloatParts128 *a, float_sta= tus *s, const FloatFmt *f); */ =20 #define FRAC_GENERIC_64_128(NAME, P) \ - QEMU_GENERIC(P, (FloatParts128 *, frac128_##NAME), frac64_##NAME) + _Generic((P), FloatParts64 *: frac64_##NAME, \ + FloatParts128 *: frac128_##NAME) =20 #define FRAC_GENERIC_64_128_256(NAME, P) \ - QEMU_GENERIC(P, (FloatParts256 *, frac256_##NAME), \ - (FloatParts128 *, frac128_##NAME), frac64_##NAME) + _Generic((P), FloatParts64 *: frac64_##NAME, \ + FloatParts128 *: frac128_##NAME, \ + FloatParts256 *: frac256_##NAME) =20 static bool frac64_add(FloatParts64 *r, FloatParts64 *a, FloatParts64 *b) { --=20 2.25.1 From nobody Fri Apr 19 03:02:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1623808031; cv=none; d=zohomail.com; s=zohoarc; b=FsDX6cJ8/r5ariCWnTYXrPeUDwitOzvJ+gpamBhydAEkKCOHvCNzwtWq61HwUeNQZsnTkjHgzHbzJNU8D9CGpeixAPN8obpmdHDnNI61n6QvNJ1O9ZlrWSndTDqxYrnwKratN8ZkA12oO6Zk/DIleui4EipcP27IrM6vDVAxAuI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623808031; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=v2Q2PinTVeLpRWK/d/K2BOFcE5jaaej7n/lf1RcDS40=; b=h9vb9F2LDfG/TqGTLBzKFC1jz+paMbb0vYQZL3zw3r/u1Hh7+9gaSEM7ifoQoOP+wGI+5Ak4kX3dETpHd1y6a/6cut0IdMlgyWv8XGhm+5zzMsOvvi3iA8RdpnrB/w21tyq8+q0LyCqCPFjZfq3tJcnQG0elnb8Turcmt83mhuY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623808031399514.1624349781928; Tue, 15 Jun 2021 18:47:11 -0700 (PDT) Received: from localhost ([::1]:46770 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltKe6-0005Xg-Co for importer@patchew.org; Tue, 15 Jun 2021 21:47:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55518) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltKTs-0008SU-Ti for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:36:37 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]:44807) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltKTp-0005bz-PS for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:36:36 -0400 Received: by mail-pj1-x102b.google.com with SMTP id i11-20020a17090a2acbb029016f0cce7c3fso564202pjg.3 for ; Tue, 15 Jun 2021 18:36:33 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id o1sm321595pjf.56.2021.06.15.18.36.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 18:36:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=v2Q2PinTVeLpRWK/d/K2BOFcE5jaaej7n/lf1RcDS40=; b=LGkk6uSfiF4MCnhFmtSFU0MzFPsQDe8MGWudr80w2QoSOLScfH+e3Oh6oHuiSbfzWj 0dLxTg1BuliJOJpcxvBJcDeUffpVu6nqwUDbiboPiSioph5bDCPqWAnpsmhsskROyYAK YgWsjU/vjTarFv5+LFYN5hS8D9YoWX01vfzFe7r+zbeib/OINbsR/cLAr+Ls3b2FPngE F/GYj679lcPsVnwW6St8K3Z0Mx+8NZHGpX0oJAulLfVMZiLstp8aafMVe9DYESnVagqw Wz5EMlhSIEtwR9RDvo24uApEOqaG1/l90tnlV5cunhJV0h73KZ8RaEt5+71UAElY9Sl6 J8jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=v2Q2PinTVeLpRWK/d/K2BOFcE5jaaej7n/lf1RcDS40=; b=mSqvoZ74toG/fOauT9GkjU9ml0UNNE+kN7ktZ18N4GPru8/Ap0tD7yxMrCzFAC56qy 1HNKAZSuk4Y3k+NxFgV5IV1WNjMPYjvCCdFy7kRxDZoixvTTby9DEdJZKvwhW6VpCKRm PJJUws07SPI2zKPM7tIda0eTbj23D53+tH1eK7qMT59c75VoLHMF/VBv7uNPoeHvN8lP 9PRhVFtpNEcmJHXhf6o+SmhqIP4wEfhWYgJ6ibDrGh9T6lB0Df0Z5KAcYHzS67ZvuATh 59qlqcObQ44G/+jF41dxrQE8Ul75lOFUr0VrkWVF6vZXHBhbFuAqPZ1myya04WaA4B2N 8PEg== X-Gm-Message-State: AOAM531Ji7gCl7U2gXIePlNKDmJu9MVEtaLNOXRAWi9G6Iv9VDs+x/TV cPpmA+ucX5WZNIWaKVpmFK/HMHNLByVrqQ== X-Google-Smtp-Source: ABdhPJwmNJzI6p51BowQtlvgqkFYpW20iBL8/pbBH97tYmhuWG8j2OMWJeDZASGY+XLmbrqclvIwcw== X-Received: by 2002:a17:902:f283:b029:10d:e7f3:725 with SMTP id k3-20020a170902f283b029010de7f30725mr5210996plc.45.1623807392547; Tue, 15 Jun 2021 18:36:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 3/8] util: Use real functions for thread-posix QemuRecMutex Date: Tue, 15 Jun 2021 18:36:24 -0700 Message-Id: <20210616013629.1458790-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210616013629.1458790-1-richard.henderson@linaro.org> References: <20210616013629.1458790-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Thomas Huth , =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Move the declarations from thread-win32.h into thread.h and remove the macro redirection from thread-posix.h. This will be required by following cleanups. Signed-off-by: Richard Henderson Reviewed-by: Thomas Huth Reviewed-by: Alex Benn=C3=A9e Message-Id: <20210614233143.1221879-4-richard.henderson@linaro.org> --- include/qemu/thread-posix.h | 4 ---- include/qemu/thread-win32.h | 6 ------ include/qemu/thread.h | 9 ++++++--- util/qemu-thread-posix.c | 20 ++++++++++++++++++++ 4 files changed, 26 insertions(+), 13 deletions(-) diff --git a/include/qemu/thread-posix.h b/include/qemu/thread-posix.h index c903525062..cf8bc90468 100644 --- a/include/qemu/thread-posix.h +++ b/include/qemu/thread-posix.h @@ -5,10 +5,6 @@ #include =20 typedef QemuMutex QemuRecMutex; -#define qemu_rec_mutex_destroy qemu_mutex_destroy -#define qemu_rec_mutex_lock_impl qemu_mutex_lock_impl -#define qemu_rec_mutex_trylock_impl qemu_mutex_trylock_impl -#define qemu_rec_mutex_unlock qemu_mutex_unlock =20 struct QemuMutex { pthread_mutex_t lock; diff --git a/include/qemu/thread-win32.h b/include/qemu/thread-win32.h index d0a1a9597e..d95af4498f 100644 --- a/include/qemu/thread-win32.h +++ b/include/qemu/thread-win32.h @@ -18,12 +18,6 @@ struct QemuRecMutex { bool initialized; }; =20 -void qemu_rec_mutex_destroy(QemuRecMutex *mutex); -void qemu_rec_mutex_lock_impl(QemuRecMutex *mutex, const char *file, int l= ine); -int qemu_rec_mutex_trylock_impl(QemuRecMutex *mutex, const char *file, - int line); -void qemu_rec_mutex_unlock(QemuRecMutex *mutex); - struct QemuCond { CONDITION_VARIABLE var; bool initialized; diff --git a/include/qemu/thread.h b/include/qemu/thread.h index 5435763184..2c0d85f3bc 100644 --- a/include/qemu/thread.h +++ b/include/qemu/thread.h @@ -28,6 +28,12 @@ int qemu_mutex_trylock_impl(QemuMutex *mutex, const char= *file, const int line); void qemu_mutex_lock_impl(QemuMutex *mutex, const char *file, const int li= ne); void qemu_mutex_unlock_impl(QemuMutex *mutex, const char *file, const int = line); =20 +void qemu_rec_mutex_init(QemuRecMutex *mutex); +void qemu_rec_mutex_destroy(QemuRecMutex *mutex); +void qemu_rec_mutex_lock_impl(QemuRecMutex *mutex, const char *file, int l= ine); +int qemu_rec_mutex_trylock_impl(QemuRecMutex *mutex, const char *file, int= line); +void qemu_rec_mutex_unlock(QemuRecMutex *mutex); + typedef void (*QemuMutexLockFunc)(QemuMutex *m, const char *f, int l); typedef int (*QemuMutexTrylockFunc)(QemuMutex *m, const char *f, int l); typedef void (*QemuRecMutexLockFunc)(QemuRecMutex *m, const char *f, int l= ); @@ -129,9 +135,6 @@ static inline int (qemu_rec_mutex_trylock)(QemuRecMutex= *mutex) return qemu_rec_mutex_trylock(mutex); } =20 -/* Prototypes for other functions are in thread-posix.h/thread-win32.h. */ -void qemu_rec_mutex_init(QemuRecMutex *mutex); - void qemu_cond_init(QemuCond *cond); void qemu_cond_destroy(QemuCond *cond); =20 diff --git a/util/qemu-thread-posix.c b/util/qemu-thread-posix.c index dcff5e7c5d..8e2b6653f5 100644 --- a/util/qemu-thread-posix.c +++ b/util/qemu-thread-posix.c @@ -124,6 +124,26 @@ void qemu_rec_mutex_init(QemuRecMutex *mutex) mutex->initialized =3D true; } =20 +void qemu_rec_mutex_destroy(QemuRecMutex *mutex) +{ + qemu_mutex_destroy(mutex); +} + +void qemu_rec_mutex_lock_impl(QemuRecMutex *mutex, const char *file, int l= ine) +{ + qemu_mutex_lock_impl(mutex, file, line); +} + +int qemu_rec_mutex_trylock_impl(QemuRecMutex *mutex, const char *file, int= line) +{ + return qemu_mutex_trylock_impl(mutex, file, line); +} + +void qemu_rec_mutex_unlock(QemuRecMutex *mutex) +{ + qemu_mutex_unlock(mutex); +} + void qemu_cond_init(QemuCond *cond) { int err; --=20 2.25.1 From nobody Fri Apr 19 03:02:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623807877365204.86904857999298; Tue, 15 Jun 2021 18:44:37 -0700 (PDT) Received: from localhost ([::1]:39194 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltKba-0000Ku-Cd for importer@patchew.org; Tue, 15 Jun 2021 21:44:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55508) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltKTs-0008RT-DR for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:36:36 -0400 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]:33440) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltKTq-0005c9-KU for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:36:36 -0400 Received: by mail-pj1-x1030.google.com with SMTP id k22-20020a17090aef16b0290163512accedso2775284pjz.0 for ; Tue, 15 Jun 2021 18:36:34 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id o1sm321595pjf.56.2021.06.15.18.36.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 18:36:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cCqC17CoPwFaX7KxGxIz9kq2bVuynqUQa02RlRXcupY=; b=xAJbAXqKg7S+v++P0gxg5u5wPPlL+G3Tz4FCHy5B7XauHJoClw9Iwxr0FUMECUpIis h+Qqao07B+iYTNRLgg21dA2Vr1MKqzDz/epmA2Zn6mpRRLXzJlDHkCn+s/KdhmQtmAxf PzSvTE67b6U55avin/xa9AyPmAhm1wfrSMYRe5vWCr0kgUOvqsriPKqhDEPNNNwQhyqg vsv3R0adxyeUxkgNIjA03dvags8ahi0oBl3jWBFX0TeE3z05Rdl3VrUv2FqOK4FAfuho hwFN05fbVyrMjxw5K3Z6i0x0P4CgyW+mqOj4Zmq/EI3/ZBlA1Xhl5Px+EyBRpficbdle YxaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cCqC17CoPwFaX7KxGxIz9kq2bVuynqUQa02RlRXcupY=; b=jKrRi86ztziaT3tUdXbS9XOUEL/C+I1VQHsSankodniCIFkRoPnmZO/5mslgt0bVo/ acv5REd/ibW/8gVWSw373lBMHiuYKgrqGfDMD4q7in+dfyeB94AwH1eeviHleKSflHy0 NMi1LFr0UimCz9ttPYBp4bkFY2Bbf4fHFW7nSWdZvUb29e4Dpy8KflLGYLIaIA7XaK1X RVF2WeyCP5y5jNETizczFciAS74lPiuuRLVQ9VErt47/hxLVBaHji+52MnI/LbkcLk6p 8ljcaZIAY118aqyKKFpFvPyro2GdGBI40LpjckqGWLPboyBtCOuuAbVXMyJgau8jLIq1 O+Tw== X-Gm-Message-State: AOAM533uQEUVx91SVyiohmfbiaI7qBHjsgonwRjeu2CEYToLvWqdo5Ip xEdwHQ2oguKYeWoeIeUXNQA7RKZcTUQI0w== X-Google-Smtp-Source: ABdhPJyxOjOe+leImQ7Y1CQghWVP7xX4IkTQ5VPmrzSP6tKP0J4m2Hy5KQ5tAYqPLnkgkz1WaQ463Q== X-Received: by 2002:a17:903:2308:b029:110:41c3:70b0 with SMTP id d8-20020a1709032308b029011041c370b0mr6874646plh.32.1623807393149; Tue, 15 Jun 2021 18:36:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 4/8] util: Pass file+line to qemu_rec_mutex_unlock_impl Date: Tue, 15 Jun 2021 18:36:25 -0700 Message-Id: <20210616013629.1458790-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210616013629.1458790-1-richard.henderson@linaro.org> References: <20210616013629.1458790-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1030.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , peter.maydell@linaro.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Create macros for file+line expansion in qemu_rec_mutex_unlock like we have for qemu_mutex_unlock. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Alex Benn=C3=A9e Message-Id: <20210614233143.1221879-5-richard.henderson@linaro.org> --- include/qemu/thread.h | 10 +++++++++- util/qemu-thread-posix.c | 4 ++-- util/qemu-thread-win32.c | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/qemu/thread.h b/include/qemu/thread.h index 2c0d85f3bc..460568d67d 100644 --- a/include/qemu/thread.h +++ b/include/qemu/thread.h @@ -32,7 +32,7 @@ void qemu_rec_mutex_init(QemuRecMutex *mutex); void qemu_rec_mutex_destroy(QemuRecMutex *mutex); void qemu_rec_mutex_lock_impl(QemuRecMutex *mutex, const char *file, int l= ine); int qemu_rec_mutex_trylock_impl(QemuRecMutex *mutex, const char *file, int= line); -void qemu_rec_mutex_unlock(QemuRecMutex *mutex); +void qemu_rec_mutex_unlock_impl(QemuRecMutex *mutex, const char *file, int= line); =20 typedef void (*QemuMutexLockFunc)(QemuMutex *m, const char *f, int l); typedef int (*QemuMutexTrylockFunc)(QemuMutex *m, const char *f, int l); @@ -110,6 +110,9 @@ extern QemuCondTimedWaitFunc qemu_cond_timedwait_func; #define qemu_mutex_unlock(mutex) \ qemu_mutex_unlock_impl(mutex, __FILE__, __LINE__) =20 +#define qemu_rec_mutex_unlock(mutex) \ + qemu_rec_mutex_unlock_impl(mutex, __FILE__, __LINE__) + static inline void (qemu_mutex_lock)(QemuMutex *mutex) { qemu_mutex_lock(mutex); @@ -135,6 +138,11 @@ static inline int (qemu_rec_mutex_trylock)(QemuRecMute= x *mutex) return qemu_rec_mutex_trylock(mutex); } =20 +static inline void (qemu_rec_mutex_unlock)(QemuRecMutex *mutex) +{ + qemu_rec_mutex_unlock(mutex); +} + void qemu_cond_init(QemuCond *cond); void qemu_cond_destroy(QemuCond *cond); =20 diff --git a/util/qemu-thread-posix.c b/util/qemu-thread-posix.c index 8e2b6653f5..d990826ed8 100644 --- a/util/qemu-thread-posix.c +++ b/util/qemu-thread-posix.c @@ -139,9 +139,9 @@ int qemu_rec_mutex_trylock_impl(QemuRecMutex *mutex, co= nst char *file, int line) return qemu_mutex_trylock_impl(mutex, file, line); } =20 -void qemu_rec_mutex_unlock(QemuRecMutex *mutex) +void qemu_rec_mutex_unlock_impl(QemuRecMutex *mutex, const char *file, int= line) { - qemu_mutex_unlock(mutex); + qemu_mutex_unlock_impl(mutex, file, line); } =20 void qemu_cond_init(QemuCond *cond) diff --git a/util/qemu-thread-win32.c b/util/qemu-thread-win32.c index cb5aa2018c..52eb19f351 100644 --- a/util/qemu-thread-win32.c +++ b/util/qemu-thread-win32.c @@ -105,7 +105,7 @@ int qemu_rec_mutex_trylock_impl(QemuRecMutex *mutex, co= nst char *file, int line) return !TryEnterCriticalSection(&mutex->lock); } =20 -void qemu_rec_mutex_unlock(QemuRecMutex *mutex) +void qemu_rec_mutex_unlock_impl(QemuRecMutex *mutex, const char *file, int= line) { assert(mutex->initialized); LeaveCriticalSection(&mutex->lock); --=20 2.25.1 From nobody Fri Apr 19 03:02:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1623808036; cv=none; d=zohomail.com; s=zohoarc; b=IeGEtdiicGl0voO3HKr45rMkWXkXBFBdqZdEVmeMseUwUpHRHjKXdtHtuoLbNherIRmfJ6+zXZbM0IOXQiPL3tlOvbMZAPDLwoR7YWmQAqKj8l0mdUiLye/wLmnVNsE0tyvycnGf6UsySwVONaEV7/Unx9pk8NKL/nIudvaI9YM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623808036; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=g/EtpcVEQvR+xKHuSj5BLnH+yGHBoGGI8vPUI0hS6/Q=; b=Qzr533HkpB7EVccHl2BRDEPBQu0xwzQaiK2ilt4KHZUAg9wymfjAUHiyWbDaAF3tT/tVTAdZytfXPAmcDsE6HzwwzNLmQQV46xwhO3RCkConFROlOOHztSvvBj3CkkiwC3Ihz3i3ghZft92Nws4ozo0e1giQihi9eohe3+iyvE8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623808036531328.2561960603856; Tue, 15 Jun 2021 18:47:16 -0700 (PDT) Received: from localhost ([::1]:47252 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltKeB-0005qF-IO for importer@patchew.org; Tue, 15 Jun 2021 21:47:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55554) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltKTw-0000Ej-Hu for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:36:40 -0400 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]:47007) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltKTr-0005cq-18 for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:36:40 -0400 Received: by mail-pg1-x532.google.com with SMTP id n12so593528pgs.13 for ; Tue, 15 Jun 2021 18:36:34 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id o1sm321595pjf.56.2021.06.15.18.36.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 18:36:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=g/EtpcVEQvR+xKHuSj5BLnH+yGHBoGGI8vPUI0hS6/Q=; b=DDO4tPut9QtIhmX3hAF9slNPBHWt1we64LOXJYHf5he2Y38yLADZ2OQg10/nbWEf0b WgPMYiitpli78lKj0rm4TV6rkqcpOelZd6YFAQWu4sDezik2rhe3oMe+VzLhoM83qVBw oYD65XLFkmWwamYx2jJPTzN3dG9fj+M3B9i2s3VVhKcm3JWZz9Dpf5FNuW/AN2/tjlPT 5HJeX7vbHyq8eiOxIKXVW39jQ8oo4Q2L/kyw+LJrozl1M8o0w6HUf65qKkZOVMaBy5Pg urO0G6RKZgK6mOyPUtUCBKx5SKuGz+5LHvTLhYMov27wSNeFp4Fil+m+WQ0OaKHXfCd1 Va3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=g/EtpcVEQvR+xKHuSj5BLnH+yGHBoGGI8vPUI0hS6/Q=; b=i9TES2PB1KSIxjOxrOow5zMA/wwZWkU6YYOhFMce29nL1j0nsaPkx3j/EsUv+s19Jp L13Zv6VpIlXaI6SKR8oNwC3p2pgoW5ympVVqFooDxOZDYSe46OTi7TjJyM6Pk18Gu2Kt XK+4IDgW7KoXTMRAEsSRkLP8W276iMZmUZyD4vEik/5Dr1FZKC9gTwxmG5BHuaBGpRin WAjdANcggNcboqaV9wGS8MR0ySXrVRE3GA7jviItLm5wyhTIuFqqzTadlyYv3zt/jxjh PJrOGQnPDu0GIhOINfozsIN6g0EeQlCNL34Qyq0FMiS/4RRSrJFTZCijIv7guLENiJLx C8Jw== X-Gm-Message-State: AOAM531hZB77ut4Z8wgoLNWdaUDzXhq9isUv2i5GN34ttTnBIjNUjY90 LnadIH9KA0bPnEljweJdz6faL5t+csZjfQ== X-Google-Smtp-Source: ABdhPJwEhiH+XEh0Hnl7RKuUpJhMZpxbqN/48dEFYSZIPVgn2Be01A+I4WbHjfH1szgDvybTuJt35Q== X-Received: by 2002:a05:6a00:248a:b029:2f7:218b:3845 with SMTP id c10-20020a056a00248ab02902f7218b3845mr6781964pfv.12.1623807393750; Tue, 15 Jun 2021 18:36:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 5/8] util: Use unique type for QemuRecMutex in thread-posix.h Date: Tue, 15 Jun 2021 18:36:26 -0700 Message-Id: <20210616013629.1458790-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210616013629.1458790-1-richard.henderson@linaro.org> References: <20210616013629.1458790-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::532; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x532.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Thomas Huth , =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) We will shortly convert lockable.h to _Generic, and we cannot have two compatible types in the same expansion. Wrap QemuMutex in a struct, and unwrap in qemu-thread-posix.c. Signed-off-by: Richard Henderson Reviewed-by: Thomas Huth Reviewed-by: Alex Benn=C3=A9e Message-Id: <20210614233143.1221879-6-richard.henderson@linaro.org> --- include/qemu/thread-posix.h | 10 ++++++++-- util/qemu-thread-posix.c | 12 ++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/include/qemu/thread-posix.h b/include/qemu/thread-posix.h index cf8bc90468..b792e6ef37 100644 --- a/include/qemu/thread-posix.h +++ b/include/qemu/thread-posix.h @@ -4,8 +4,6 @@ #include #include =20 -typedef QemuMutex QemuRecMutex; - struct QemuMutex { pthread_mutex_t lock; #ifdef CONFIG_DEBUG_MUTEX @@ -15,6 +13,14 @@ struct QemuMutex { bool initialized; }; =20 +/* + * QemuRecMutex cannot be a typedef of QemuMutex lest we have two + * compatible cases in _Generic. See qemu/lockable.h. + */ +typedef struct QemuRecMutex { + QemuMutex m; +} QemuRecMutex; + struct QemuCond { pthread_cond_t cond; bool initialized; diff --git a/util/qemu-thread-posix.c b/util/qemu-thread-posix.c index d990826ed8..fd9d714038 100644 --- a/util/qemu-thread-posix.c +++ b/util/qemu-thread-posix.c @@ -116,32 +116,32 @@ void qemu_rec_mutex_init(QemuRecMutex *mutex) =20 pthread_mutexattr_init(&attr); pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); - err =3D pthread_mutex_init(&mutex->lock, &attr); + err =3D pthread_mutex_init(&mutex->m.lock, &attr); pthread_mutexattr_destroy(&attr); if (err) { error_exit(err, __func__); } - mutex->initialized =3D true; + mutex->m.initialized =3D true; } =20 void qemu_rec_mutex_destroy(QemuRecMutex *mutex) { - qemu_mutex_destroy(mutex); + qemu_mutex_destroy(&mutex->m); } =20 void qemu_rec_mutex_lock_impl(QemuRecMutex *mutex, const char *file, int l= ine) { - qemu_mutex_lock_impl(mutex, file, line); + qemu_mutex_lock_impl(&mutex->m, file, line); } =20 int qemu_rec_mutex_trylock_impl(QemuRecMutex *mutex, const char *file, int= line) { - return qemu_mutex_trylock_impl(mutex, file, line); + return qemu_mutex_trylock_impl(&mutex->m, file, line); } =20 void qemu_rec_mutex_unlock_impl(QemuRecMutex *mutex, const char *file, int= line) { - qemu_mutex_unlock_impl(mutex, file, line); + qemu_mutex_unlock_impl(&mutex->m, file, line); } =20 void qemu_cond_init(QemuCond *cond) --=20 2.25.1 From nobody Fri Apr 19 03:02:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1623807885; cv=none; d=zohomail.com; s=zohoarc; b=CYiEU0t9HUZLnvKSdwvHszLee8cmeDi82Q9m5CTthhBLRj3ZdvIpfdfe8BqVTcPcUtvtvMJXq/Zbjk4BHkot+Rp06ECVpQBUThJ3V/pmZYIjL8kFmULR6sD5qkt2LtuFENZFUSvNAUp2eUsA9wddrY/4tG7IvZpbulvAMFKFfOk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623807885; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ubpKT84c0CDe5YC8xIT/jR9IicZ4W7L/Hmhh3sXO2Cc=; b=YUSrdRX1O2EeLu1hVXjZuRc6GegawbftKk88M0IpFR9Dt/iGMVKdRODkhwvWK0wziXDFj6qSeSKQLQu4aj5l+U/Il0wPRszJGkob+CHt/wEuX2mTUYzycdCXOQSJrcvQaZvxBg7MxxR+NixwK2MVTNEjRYUgYw0Xwp4GWgh+i8M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623807885782368.1463235193364; Tue, 15 Jun 2021 18:44:45 -0700 (PDT) Received: from localhost ([::1]:39812 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltKbh-0000ld-L6 for importer@patchew.org; Tue, 15 Jun 2021 21:44:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55540) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltKTt-0008VZ-Qp for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:36:37 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]:43896) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltKTr-0005d4-MG for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:36:37 -0400 Received: by mail-pl1-x632.google.com with SMTP id v12so278804plo.10 for ; Tue, 15 Jun 2021 18:36:35 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id o1sm321595pjf.56.2021.06.15.18.36.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 18:36:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ubpKT84c0CDe5YC8xIT/jR9IicZ4W7L/Hmhh3sXO2Cc=; b=ILFtozxev9FMNR5wDAoFKHVkXjZRBp6i2Do8mXlIpcPmGX53Nbrdz8uH6RU7LZGU00 FiXzViB36Wp0FrZ1cV4oxAjMa3mGFFZAOKPlcDl+S7LjKlNzqUJKTADL+DJ8m4ofJJlG Ugj/GqohX/8wSS+NeauEOggsZCyzt/nOWzawrrFmAO0t4hJMnvjbOaXJAUpHEh7Zpzdn 1ZujnVSqiQ2VCScqTDFhPOtDg1gTl0UFg7O5V97vglDNL8zrINLT8o574oH21VYYSVw8 HnAIH8Kik/67PxOfF7BkQkMzs6WRNMOH7nM8d78TYV1NHJlXuvAEoau/Yv/5k8P13VPX 1spg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ubpKT84c0CDe5YC8xIT/jR9IicZ4W7L/Hmhh3sXO2Cc=; b=CYZblGARvr257QWjjnmass2ZxxPOJNfk2384dIXT6cBdAgLmDVVuVAPPx0C00tvp/B Hisczx8xFF0V4EIfW09rEOpAbhkGbazyhRmvAtyMv6JUfRCGPrav5whRNOLaHZ1W5hJR TzYx8rrzJ7fA9umPXZhebo1mxtNbZH4r38KqqUfHKI/8rrLFMwNpPLQE71ypMjWmVlI1 2usbm39WIxQp3Ltb0KTkCbhg4AuIKWfC+hA23he6BboExWeTHG8LN/crfAu+n2PmCaj8 Hty+sSlwk5HaOSDdyfVyaY5jV9gdPC8y+DHruZq6gX4AMcD01iJ3f5giSFST/nqfyZfc 7byw== X-Gm-Message-State: AOAM533+kbclZTwee1ua5avML9fe0x0LXXdquMNwvr2nbZBQeJhTQC+w 6o9fHlqT0KdElU8N9wkB1gC4S2TJaied5g== X-Google-Smtp-Source: ABdhPJwvwnMED2JB8nvuRskfK8TzlIb8QD2aZq6Q917MHrMbFpMawtb/7d4eBO7z9f8CvFRxAAiKTg== X-Received: by 2002:a17:902:a70c:b029:118:7b47:e5bf with SMTP id w12-20020a170902a70cb02901187b47e5bfmr6444952plq.9.1623807394346; Tue, 15 Jun 2021 18:36:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 6/8] include/qemu/lockable: Use _Generic instead of QEMU_GENERIC Date: Tue, 15 Jun 2021 18:36:27 -0700 Message-Id: <20210616013629.1458790-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210616013629.1458790-1-richard.henderson@linaro.org> References: <20210616013629.1458790-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x632.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) This is both more and less complicated than our expansion using __builtin_choose_expr and __builtin_types_compatible_p. The expansion through QEMU_MAKE_LOCKABLE_ doesn't work because we're not emumerating all of the types within the same _Generic, which results in errors about unhandled cases. We must also handle void* explicitly, so that the NULL constant can be used. Signed-off-by: Richard Henderson Tested-by: Alex Benn=C3=A9e Reviewed-by: Alex Benn=C3=A9e Message-Id: <20210614233143.1221879-7-richard.henderson@linaro.org> --- include/qemu/lockable.h | 90 +++++++++++++++++++---------------------- 1 file changed, 41 insertions(+), 49 deletions(-) diff --git a/include/qemu/lockable.h b/include/qemu/lockable.h index b620023141..86db7cb04c 100644 --- a/include/qemu/lockable.h +++ b/include/qemu/lockable.h @@ -24,79 +24,71 @@ struct QemuLockable { QemuLockUnlockFunc *unlock; }; =20 -/* This function gives an error if an invalid, non-NULL pointer type is pa= ssed - * to QEMU_MAKE_LOCKABLE. For optimized builds, we can rely on dead-code = elimination - * from the compiler, and give the errors already at link time. - */ -#if defined(__OPTIMIZE__) && !defined(__SANITIZE_ADDRESS__) -void unknown_lock_type(void *); -#else -static inline void unknown_lock_type(void *unused) -{ - abort(); -} -#endif - static inline __attribute__((__always_inline__)) QemuLockable * qemu_make_lockable(void *x, QemuLockable *lockable) { - /* We cannot test this in a macro, otherwise we get compiler + /* + * We cannot test this in a macro, otherwise we get compiler * warnings like "the address of 'm' will always evaluate as 'true'". */ return x ? lockable : NULL; } =20 -/* Auxiliary macros to simplify QEMU_MAKE_LOCABLE. */ -#define QEMU_LOCK_FUNC(x) ((QemuLockUnlockFunc *) \ - QEMU_GENERIC(x, \ - (QemuMutex *, qemu_mutex_lock), \ - (QemuRecMutex *, qemu_rec_mutex_lock), \ - (CoMutex *, qemu_co_mutex_lock), \ - (QemuSpin *, qemu_spin_lock), \ - unknown_lock_type)) +static inline __attribute__((__always_inline__)) QemuLockable * +qemu_null_lockable(void *x) +{ + if (x !=3D NULL) { + qemu_build_not_reached(); + } + return NULL; +} =20 -#define QEMU_UNLOCK_FUNC(x) ((QemuLockUnlockFunc *) \ - QEMU_GENERIC(x, \ - (QemuMutex *, qemu_mutex_unlock), \ - (QemuRecMutex *, qemu_rec_mutex_unlock), \ - (CoMutex *, qemu_co_mutex_unlock), \ - (QemuSpin *, qemu_spin_unlock), \ - unknown_lock_type)) - -/* In C, compound literals have the lifetime of an automatic variable. +/* + * In C, compound literals have the lifetime of an automatic variable. * In C++ it would be different, but then C++ wouldn't need QemuLockable * either... */ -#define QEMU_MAKE_LOCKABLE_(x) (&(QemuLockable) { \ - .object =3D (x), \ - .lock =3D QEMU_LOCK_FUNC(x), \ - .unlock =3D QEMU_UNLOCK_FUNC(x), \ +#define QML_OBJ_(x, name) (&(QemuLockable) { \ + .object =3D (x), \ + .lock =3D (QemuLockUnlockFunc *) qemu_ ## name ## _lock, \ + .unlock =3D (QemuLockUnlockFunc *) qemu_ ## name ## _unlock \ }) =20 -/* QEMU_MAKE_LOCKABLE - Make a polymorphic QemuLockable +/** + * QEMU_MAKE_LOCKABLE - Make a polymorphic QemuLockable * - * @x: a lock object (currently one of QemuMutex, QemuRecMutex, CoMutex, Q= emuSpin). + * @x: a lock object (currently one of QemuMutex, QemuRecMutex, + * CoMutex, QemuSpin). * * Returns a QemuLockable object that can be passed around * to a function that can operate with locks of any kind, or * NULL if @x is %NULL. - */ -#define QEMU_MAKE_LOCKABLE(x) \ - QEMU_GENERIC(x, \ - (QemuLockable *, (x)), \ - qemu_make_lockable((x), QEMU_MAKE_LOCKABLE_(x))) - -/* QEMU_MAKE_LOCKABLE_NONNULL - Make a polymorphic QemuLockable * - * @x: a lock object (currently one of QemuMutex, QemuRecMutex, CoMutex, Q= emuSpin). + * Note the special case for void *, so that we may pass "NULL". + */ +#define QEMU_MAKE_LOCKABLE(x) \ + _Generic((x), QemuLockable *: (x), \ + void *: qemu_null_lockable(x), \ + QemuMutex *: qemu_make_lockable(x, QML_OBJ_(x, mutex)), \ + QemuRecMutex *: qemu_make_lockable(x, QML_OBJ_(x, rec_mutex))= , \ + CoMutex *: qemu_make_lockable(x, QML_OBJ_(x, co_mutex)), \ + QemuSpin *: qemu_make_lockable(x, QML_OBJ_(x, spin))) + +/** + * QEMU_MAKE_LOCKABLE_NONNULL - Make a polymorphic QemuLockable + * + * @x: a lock object (currently one of QemuMutex, QemuRecMutex, + * CoMutex, QemuSpin). * * Returns a QemuLockable object that can be passed around * to a function that can operate with locks of any kind. */ -#define QEMU_MAKE_LOCKABLE_NONNULL(x) \ - QEMU_GENERIC(x, \ - (QemuLockable *, (x)), \ - QEMU_MAKE_LOCKABLE_(x)) +#define QEMU_MAKE_LOCKABLE_NONNULL(x) \ + _Generic((x), QemuLockable *: (x), \ + QemuMutex *: QML_OBJ_(x, mutex), \ + QemuRecMutex *: QML_OBJ_(x, rec_mutex), \ + CoMutex *: QML_OBJ_(x, co_mutex), \ + QemuSpin *: QML_OBJ_(x, spin)) =20 static inline void qemu_lockable_lock(QemuLockable *x) { --=20 2.25.1 From nobody Fri Apr 19 03:02:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1623807877; cv=none; d=zohomail.com; s=zohoarc; b=TCnVTzyF+go5DSk8NEKQbd4mzql8LZMyXvZ4sLnwfzd5ZJ8PoZ3iWAutmhzOojZ3CfseYBzllUFgFrYnUmkYboz6wXeZGUkv/gktZXOWPNSCHhi6N7tUDSZOuEFj+FQ175l1sK1bV73hxUrOakIzdfD5WIkB6SNT161xXLnRdrU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623807877; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=AQdvWRX1hZO0Z1j1TwBSyfUR2Ola+BhQ1+6mdvjTZu8=; b=f2JqQQu1JJZz6W9qCSMVrn3mGajfQqLd5SVAP/GnEc8wwizJQvi9QaA+ilRr+YUyDjFFvDR51qGMWz//r12vkL+C7Er0bRDw5yQTAg8AFnbFq6E5IRIL0JRLCOfYs4F1Rccw9ZVMqFMbdUWSjkugVrR/SW7vZzfrNfnl36c2XAg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623807877784820.7259380617885; Tue, 15 Jun 2021 18:44:37 -0700 (PDT) Received: from localhost ([::1]:39180 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltKba-0000KV-FB for importer@patchew.org; Tue, 15 Jun 2021 21:44:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55542) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltKTu-0008WP-1e for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:36:38 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]:42913) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltKTs-0005dm-8w for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:36:37 -0400 Received: by mail-pf1-x42e.google.com with SMTP id s14so857531pfd.9 for ; Tue, 15 Jun 2021 18:36:35 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id o1sm321595pjf.56.2021.06.15.18.36.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 18:36:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AQdvWRX1hZO0Z1j1TwBSyfUR2Ola+BhQ1+6mdvjTZu8=; b=vPOQ4kblqHHKFJFGhsoJ+34RHM+LE0OI1Rc/YOuVIbBRlsWBS83oSnESr46+HWtDr9 QDCejuyic5MOZ76vzAR4IkIG585sOGmdXpQOsU7/F2e6r1CQS2gBoML9wiHPsSYgGmvO kB8C++9oAHLZyw3BrebegUneTn0X33zzSB5U3RtGVVfEyfGdE9HXiRJvJ1b5OO8Ai2TC NTm10oe4/cXW4dqIyvZpS/f4aEAGy0EE7UkJVRhxs+SImnPqUKXvQcK8gc0tIV0slMGr hW7KXKwG3BIRpkRXcgw6Y7zMquqxg3ZBKMt42QnjzVUdG9RRQ06sfb3/0chSre4oQh+G 9scg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AQdvWRX1hZO0Z1j1TwBSyfUR2Ola+BhQ1+6mdvjTZu8=; b=AT4yUyG4EPO+CG15R4lQSol5uuwhdwoZta8d62f+C6JuNcqQedXURkZ8DNfV3cgOnW lt/KIXhRvs5Nf8yMdJ+4J23pjI8/WCFtMb1gnsdm+vYni5QkGR3nZ34L44BKvnaYVhF5 0ZcewQ7VxdacC9r3oZO8pVLnv+pY/IrXB9ONbPR8seSUoR+jpK4GkL+wc5e34E8ZKj4Y 7FfwgUQBeDWVm7xBpiddziXrjYwupJgDYLWNdQiv6LGT5Dfu95kGblSFbwm4FtKohM2n f2gi6r31zUvfmYMwxzeDzYjNW+3dDEejKLUsk4r1HMcuhv0x6cmQE5HklTlbIGiQEx5q BhTA== X-Gm-Message-State: AOAM532p2yoEuBGlctIMQYXl6MHmAYywxBMLI5XAON5yo+Mu4RcNJ9yJ 8KAal6hOju29ZjtxSQMyAjZtkuUJ6T4mKQ== X-Google-Smtp-Source: ABdhPJw2j4H+CVHGwj6iy/rW7tCKE3h/DLz4eAgCr/DJ7tKJQVHpl8J8fLIWg9rxboKrWu6Rna7dSw== X-Received: by 2002:a05:6a00:1a41:b029:2ef:9721:879e with SMTP id h1-20020a056a001a41b02902ef9721879emr7126393pfv.74.1623807394992; Tue, 15 Jun 2021 18:36:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 7/8] qemu/compiler: Remove QEMU_GENERIC Date: Tue, 15 Jun 2021 18:36:28 -0700 Message-Id: <20210616013629.1458790-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210616013629.1458790-1-richard.henderson@linaro.org> References: <20210616013629.1458790-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) All previous users now use C11 _Generic. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e Message-Id: <20210614233143.1221879-8-richard.henderson@linaro.org> --- include/qemu/compiler.h | 40 ---------------------------------------- 1 file changed, 40 deletions(-) diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h index 091c45248b..5766d61589 100644 --- a/include/qemu/compiler.h +++ b/include/qemu/compiler.h @@ -173,46 +173,6 @@ #define QEMU_ALWAYS_INLINE #endif =20 -/* Implement C11 _Generic via GCC builtins. Example: - * - * QEMU_GENERIC(x, (float, sinf), (long double, sinl), sin) (x) - * - * The first argument is the discriminator. The last is the default value. - * The middle ones are tuples in "(type, expansion)" format. - */ - -/* First, find out the number of generic cases. */ -#define QEMU_GENERIC(x, ...) \ - QEMU_GENERIC_(typeof(x), __VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) - -/* There will be extra arguments, but they are not used. */ -#define QEMU_GENERIC_(x, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, count, ..= .) \ - QEMU_GENERIC##count(x, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) - -/* Two more helper macros, this time to extract items from a parenthesized - * list. - */ -#define QEMU_FIRST_(a, b) a -#define QEMU_SECOND_(a, b) b - -/* ... and a final one for the common part of the "recursion". */ -#define QEMU_GENERIC_IF(x, type_then, else_) = \ - __builtin_choose_expr(__builtin_types_compatible_p(x, = \ - QEMU_FIRST_ type_th= en), \ - QEMU_SECOND_ type_then, else_) - -/* CPP poor man's "recursion". */ -#define QEMU_GENERIC1(x, a0, ...) (a0) -#define QEMU_GENERIC2(x, a0, ...) QEMU_GENERIC_IF(x, a0, QEMU_GENERIC1(x, = __VA_ARGS__)) -#define QEMU_GENERIC3(x, a0, ...) QEMU_GENERIC_IF(x, a0, QEMU_GENERIC2(x, = __VA_ARGS__)) -#define QEMU_GENERIC4(x, a0, ...) QEMU_GENERIC_IF(x, a0, QEMU_GENERIC3(x, = __VA_ARGS__)) -#define QEMU_GENERIC5(x, a0, ...) QEMU_GENERIC_IF(x, a0, QEMU_GENERIC4(x, = __VA_ARGS__)) -#define QEMU_GENERIC6(x, a0, ...) QEMU_GENERIC_IF(x, a0, QEMU_GENERIC5(x, = __VA_ARGS__)) -#define QEMU_GENERIC7(x, a0, ...) QEMU_GENERIC_IF(x, a0, QEMU_GENERIC6(x, = __VA_ARGS__)) -#define QEMU_GENERIC8(x, a0, ...) QEMU_GENERIC_IF(x, a0, QEMU_GENERIC7(x, = __VA_ARGS__)) -#define QEMU_GENERIC9(x, a0, ...) QEMU_GENERIC_IF(x, a0, QEMU_GENERIC8(x, = __VA_ARGS__)) -#define QEMU_GENERIC10(x, a0, ...) QEMU_GENERIC_IF(x, a0, QEMU_GENERIC9(x,= __VA_ARGS__)) - /** * qemu_build_not_reached() * --=20 2.25.1 From nobody Fri Apr 19 03:02:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1623808139; cv=none; d=zohomail.com; s=zohoarc; b=PbCf6wFrhOrlq9BHFEjsB4uiony4ol+gEYjVbXnowqiMZcTbqvVGixl4+MbIA1qGMCYNfE9iNSpE95N9gUasyaggZKwbmoy4F617R64yyoPxXTKE7Gabv6gmLgs06oYPItLWazq8cfPsENxYIm7mVwfmzM0bO4fK9nGrM+vR3Rc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623808139; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=M9vjtLHy6m1PbkLSF2g+4J6tC1qxnHFOGNf/C4UBGU0=; b=cG6O+Ib1e+ky6prYuiF1V+dpSDyrxx1pdl/dKuDXUP0RJSmi9vxS7XhWwNd7t17Ivlxqdh41xALUHQKQdYPpuwAJUgg5mtcjpzjHapwDTYnFcpL2RQG2NpSpXE0c4jOMPmAZ91nWVAg+q2U8H/uJZEjsXwugP/oZr9DT+h+54YE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623808139899864.5982568117136; Tue, 15 Jun 2021 18:48:59 -0700 (PDT) Received: from localhost ([::1]:52516 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltKfq-00010l-UM for importer@patchew.org; Tue, 15 Jun 2021 21:48:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55544) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltKTu-00006b-GO for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:36:38 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]:41859) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltKTs-0005dr-Sn for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:36:38 -0400 Received: by mail-pl1-x62f.google.com with SMTP id e1so281813plh.8 for ; Tue, 15 Jun 2021 18:36:36 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id o1sm321595pjf.56.2021.06.15.18.36.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 18:36:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=M9vjtLHy6m1PbkLSF2g+4J6tC1qxnHFOGNf/C4UBGU0=; b=HiGvT2TjEp2vf9dV17IYfQK/UC/Z6PvhO7O9F0xtpbdR7amfP2rune7Quzc9yOEOzA wi+1RPmh0FHuRHCW1aXkz2XxmhkAu4pizVH/1Sy8o+kgCEbDMFjVuNl2CrEXDNvNl9Wq Eg+JWR+0VBmaUhmctJLsHvTOC7l0lKj4HScOVS1CroHZ+zHe2wMrFE+aOGLOFYtXeTs4 Reu1nRiGvC3xkugJRLhGre9aOZzyKQJPd4al9RJ5m2mNHuzlBth2RwJ8j0PbMbwNCTyU +RJ5w8bKGgWt9QG4heMdn6bFsSi2F8/JsCn4Gsa3MULxzB9lsUYv20cGgMbzFVcpnHfM dAXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=M9vjtLHy6m1PbkLSF2g+4J6tC1qxnHFOGNf/C4UBGU0=; b=VR/x3euM0cIbXOXe53cC8x6z81iJJGz5605UMTjIWny417I4dJdzcyMJZ3A9uqQcSZ P0dNtdToZlBCuWdmubMIoN/XQHcGEZvuF6jygLDyZXUR5INIDCoYwmu3eswDH6DwOEZt 317r2uihJ7MZEWtQkV4PRg2C+ZGuyUZQce62GwsxYdMi1vmoygb4UX7buMDKBAHW5Q5l 6Lc+AVsID+Mwtug6gm7JPkFrrekoPiE0wMWRbkiNO1KOitQ/JQ/yuLkDKERK5YM2pbgR N1Ra6HP4rnl68C94gMn7AAazc0/N6KylhwczKmkcCFkrehu55l3w5ODn9itt0zY7fjzF 20Hg== X-Gm-Message-State: AOAM5334UHbeyUrgzEs4OlWqS0Mhkruerzgxj3J7Fci2TA+F2JjRpmBv opFx/WiK3Ik8xr1uf5BF8BozMczZRHMT0w== X-Google-Smtp-Source: ABdhPJxeDsIvMdJY1tummVvPFiaO9nk24a5N1xHACodDhATgzO+5oJsYWSdE0/WMXp889deBP8mDXQ== X-Received: by 2002:a17:902:8645:b029:fd:25ef:3df7 with SMTP id y5-20020a1709028645b02900fd25ef3df7mr7038343plt.48.1623807395604; Tue, 15 Jun 2021 18:36:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 8/8] configure: Remove probe for _Static_assert Date: Tue, 15 Jun 2021 18:36:29 -0700 Message-Id: <20210616013629.1458790-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210616013629.1458790-1-richard.henderson@linaro.org> References: <20210616013629.1458790-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Thomas Huth , =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) _Static_assert is part of C11, which is now required. Signed-off-by: Richard Henderson Reviewed-by: Thomas Huth Reviewed-by: Alex Benn=C3=A9e Message-Id: <20210614233143.1221879-9-richard.henderson@linaro.org> --- configure | 18 ------------------ include/qemu/compiler.h | 11 ----------- 2 files changed, 29 deletions(-) diff --git a/configure b/configure index 0489864667..debd50c085 100755 --- a/configure +++ b/configure @@ -5090,20 +5090,6 @@ if compile_prog "" "" ; then have_sysmacros=3Dyes fi =20 -########################################## -# check for _Static_assert() - -have_static_assert=3Dno -cat > $TMPC << EOF -_Static_assert(1, "success"); -int main(void) { - return 0; -} -EOF -if compile_prog "" "" ; then - have_static_assert=3Dyes -fi - ########################################## # check for utmpx.h, it is missing e.g. on OpenBSD =20 @@ -6035,10 +6021,6 @@ if test "$have_sysmacros" =3D "yes" ; then echo "CONFIG_SYSMACROS=3Dy" >> $config_host_mak fi =20 -if test "$have_static_assert" =3D "yes" ; then - echo "CONFIG_STATIC_ASSERT=3Dy" >> $config_host_mak -fi - if test "$have_utmpx" =3D "yes" ; then echo "HAVE_UTMPX=3Dy" >> $config_host_mak fi diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h index 5766d61589..3baa5e3790 100644 --- a/include/qemu/compiler.h +++ b/include/qemu/compiler.h @@ -72,18 +72,7 @@ int:(x) ? -1 : 1; \ } =20 -/* QEMU_BUILD_BUG_MSG() emits the message given if _Static_assert is - * supported; otherwise, it will be omitted from the compiler error - * message (but as it remains present in the source code, it can still - * be useful when debugging). */ -#if defined(CONFIG_STATIC_ASSERT) #define QEMU_BUILD_BUG_MSG(x, msg) _Static_assert(!(x), msg) -#elif defined(__COUNTER__) -#define QEMU_BUILD_BUG_MSG(x, msg) typedef QEMU_BUILD_BUG_ON_STRUCT(x) \ - glue(qemu_build_bug_on__, __COUNTER__) __attribute__((unused)) -#else -#define QEMU_BUILD_BUG_MSG(x, msg) -#endif =20 #define QEMU_BUILD_BUG_ON(x) QEMU_BUILD_BUG_MSG(x, "not expecting: " #x) =20 --=20 2.25.1