From patchwork Thu Jun 17 09:31:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 462134 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp281045jae; Thu, 17 Jun 2021 02:57:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyWVxcvMYMDuMfv1ky8+MxttaUZ0ri0GXgyjbpLWKupkywxCOqfGozVPdFVmg2iqS7O3i0L X-Received: by 2002:ac8:12c7:: with SMTP id b7mr4153468qtj.243.1623923826152; Thu, 17 Jun 2021 02:57:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623923826; cv=none; d=google.com; s=arc-20160816; b=uFTYNgGuibWXgBCzGqD8p00pAqAFofWF0Vz8znOlF11l14MrJeTonBzoYim2xrZS8j azjNgI7uTdsLRaDgg+kS5wEzRECzrEaPNnZOP+/f6yLc2cwhQ3sZuJSjjosM0GbG2+DC zL4S9Z+7lfTnc9yf3Suy+oTK/Yosj4FQ2wKGLDPlSSk4FAy1dJLUGpStSsCzaWf19t/P iID6VrWcjDHwbwublogylPXPz/NXQ297ZFWL9iYEpZgES0juQtBH8XyXSlkzWikczQPQ XRNXeAGPXKIVhAhkn+KlFVsbCyFPLOYTY67ihn8TFd1gfe23PFtga4Q9TURWHQ5PAiS/ L2pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=gjriBpMgI0q1a3xgarAd+lYGNkwH88TJaY1pIobYkWM=; b=e1oFVW+iCctSmt4nctAWYcIYr6aBOndB1ic4WjX1FoGanKvdwluqVIW/9F/w7HrLbO d9gBSCB9JgXg/v3fGHoYRpCMv57aAXaokb0McuJ/cGVABMTsTW4WdgoRQvtgIbAsCyDE qUoxOeMINSTI2DeAD30CPnIcy87wT8FmwGBBu+b9oZOCr9h0bA9y8NDroS+6Uj5V5t// mFcCDl0x6e2/sSYznGFYTrA3yEmVgnI2xd1ts5Dv+al644INm9WxCmqRMUZBc/XtKXEE xRgpxnIf9krTpU4Zo4vrHiQOeEYwUnAxI4KTCqpzKMNZL+QO3HKclN37AXtreyBWHB9L lDUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=p+ZYzkJ8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 65si4325084qte.134.2021.06.17.02.57.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Jun 2021 02:57:06 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=p+ZYzkJ8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:58152 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltoll-0006cH-AE for patch@linaro.org; Thu, 17 Jun 2021 05:57:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55382) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltoNa-0003AL-Qf for qemu-devel@nongnu.org; Thu, 17 Jun 2021 05:32:07 -0400 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]:37400) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltoNY-0006Nr-S7 for qemu-devel@nongnu.org; Thu, 17 Jun 2021 05:32:06 -0400 Received: by mail-ed1-x530.google.com with SMTP id b11so3068346edy.4 for ; Thu, 17 Jun 2021 02:32:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gjriBpMgI0q1a3xgarAd+lYGNkwH88TJaY1pIobYkWM=; b=p+ZYzkJ8hnrgYk5Zx6Ki+jpROUbXdkEnteGU23Y3QTyjOc51nXwmKQFmUbqc5sSli6 c9kdJx6vsF6BQRe4JxJIGS0RP3uNjTH8KXMJYjYKib2jySgrjf8FEzzR9R9UuD2LYsxF x1HXvrZb7TymzGDnbqkBbYils5R/nfSJ4W/zEa8lUXGydHdMIXFTjFpxdfxbW8IMnk1i 4ufhS9zPGmaz5fCfOeh1BvJINV3Erxp9J2JMV/VbfoLwKNTx+eB4vMR32mDIkby9zKTc HJRDLJYNskSImrRbMEu+JcQXf71dSIZqDJLIurKe6c11LqyvzuzHBE6t3Ls4g9lgGIaw bMKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=gjriBpMgI0q1a3xgarAd+lYGNkwH88TJaY1pIobYkWM=; b=F11EjkezlUjnqPWZUvazz5CyQIqDRyI61pScwiB6AGSAfAxq65S0+EQQYXLYNYTqlm CNMTFbeAXkYZ4WLU2vdneeIqZa2rjr+BeZOsy950sddETybHbLWQLazJdu42fzF93bg6 62M8tIvnL06U0ykhesMcbpYawhFjgtGEpqYsygVt15D+UzsSiHoiKqUE3+6ZoXdKs+mf iML5SJ27OKtNZUJlU7vI2qHtR+jANx0DqJXJmzSjpi1m5TdSMgIWWJkLRzPrHLQBZFm9 U15zu3cvpMvAPHMH36dW9E5JWT3MZyo6Bq0mU5C/E6uNouQV+LIIBTX/21Tu2TOMIM4J 5MlA== X-Gm-Message-State: AOAM532Wme00Xft8U3SubE082MY7zfY4Jo1eMUZ6kb78hrMaWQIUiWok HbNTCDTD+BTOOrqsKOtNkgMlgNG7p/U= X-Received: by 2002:aa7:cc19:: with SMTP id q25mr5235184edt.56.1623922323547; Thu, 17 Jun 2021 02:32:03 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id m18sm3328140ejx.56.2021.06.17.02.32.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 02:32:03 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 38/45] configure: Use -std=gnu11 Date: Thu, 17 Jun 2021 11:31:27 +0200 Message-Id: <20210617093134.900014-39-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210617093134.900014-1-pbonzini@redhat.com> References: <20210617093134.900014-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=paolo.bonzini@gmail.com; helo=mail-ed1-x530.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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_Benn=C3=A9e?= , Thomas Huth , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth Message-Id: <20210614233143.1221879-2-richard.henderson@linaro.org> Signed-off-by: Paolo Bonzini --- configure | 4 ++-- meson.build | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) -- 2.31.1 diff --git a/configure b/configure index 4478f3889a..ebc016111a 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="$QEMU_CXXFLAGS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS" - CONFIGURE_CXXFLAGS=$(echo "$CONFIGURE_CFLAGS" | sed s/-std=gnu99/-std=gnu++11/) + CONFIGURE_CXXFLAGS=$(echo "$CONFIGURE_CFLAGS" | sed s/-std=gnu11/-std=gnu++11/) for arg in $QEMU_CFLAGS; do case $arg in -Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\ @@ -538,7 +538,7 @@ QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" # Flags that are needed during configure but later taken care of by Meson -CONFIGURE_CFLAGS="-std=gnu99 -Wall" +CONFIGURE_CFLAGS="-std=gnu11 -Wall" CONFIGURE_LDFLAGS= 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: '>=0.55.0', - default_options: ['warning_level=1', 'c_std=gnu99', 'cpp_std=gnu++11', 'b_colorout=auto'] + + default_options: ['warning_level=1', 'c_std=gnu11', 'cpp_std=gnu++11', 'b_colorout=auto'] + (meson.version().version_compare('>=0.56.0') ? [ 'b_staticpic=false' ] : []), version: run_command('head', meson.source_root() / 'VERSION').stdout().strip()) From patchwork Thu Jun 17 09:31:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 462135 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp281988jae; Thu, 17 Jun 2021 02:58:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBQmysKjwMTTtnZKyDkSD5n0/1pAmxw7j438Fgnnk+gJhF1lT5Oz3XPfkNLMPbvWomgoYv X-Received: by 2002:ac8:67d9:: with SMTP id r25mr4221426qtp.111.1623923913756; Thu, 17 Jun 2021 02:58:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623923913; cv=none; d=google.com; s=arc-20160816; b=lvhu80gxcvlYsY0qARmCw4+40h3hHPN4fMbNRABVSX7sC3xyRrUIy2oyZdcTjmDSPW K91nIKz5ve+mNw+I9ybdQbC8jLDBwIgt0OBaoaP7PTEURf4KdqoRVJKtGkHtG4YbbVWy syONhp+WhFcZm6BN2FkfiyyayNPPXT38ln9X3xFxKmsvt3g9srDbBlmYwqqsI85HgeIu /AFg5fuyIfVi9vg1mqavLe7QgmJwMyCJsHvYqWHYIoTcoXZOAV3UPIJ4W9YRczITfMzI Aq5P5gQaJQX4vOw0poiySpHZ9eCljLEPSVI6gYwDGphBvnd09TgCzYc/hCxsYfk5iLte NOsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=wBL1fkSPUK79ExHBJomnE+g34nGDCbvEomLmRGvHvzU=; b=ALWC6G5+l/AWqsPApRBNudmpLpxC31TO8E+AaUkYmqEW65ejvI/aQCAWnZUkDPRwgC ktts5AgXAEV4RGdDWoJ8Ih9glJFTfzZp4mODaG6wZID4f/B0FoKRO1vwnMMEfvbvkV1b 2IkefrRwzoD/0qpUQeEaPf0zVNjjukG1A+kev7ZipFA0qPxh+2jdb8ZSRbEbvNuMvFuz tsoxqW7iMBC3ZMrGz2zwyf2qYAcmTYc/0N7tU/vgZ/3/GVzX1ZQX9gFzdkNu7+nZXduI 9IYgupvVwT1booTFmZ2isaEicst7KeArlpz1OR6MEnqIkfFBykkYfeJzI6TAIyxZtkzq V/lQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=pmGtN9Ce; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e19si1510978qka.178.2021.06.17.02.58.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Jun 2021 02:58:33 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=pmGtN9Ce; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:35954 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltonB-0002C9-4l for patch@linaro.org; Thu, 17 Jun 2021 05:58:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55394) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltoNb-0003Ay-9s for qemu-devel@nongnu.org; Thu, 17 Jun 2021 05:32:07 -0400 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]:35406) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltoNZ-0006Ob-GC for qemu-devel@nongnu.org; Thu, 17 Jun 2021 05:32:06 -0400 Received: by mail-ed1-x530.google.com with SMTP id df12so568673edb.2 for ; Thu, 17 Jun 2021 02:32:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wBL1fkSPUK79ExHBJomnE+g34nGDCbvEomLmRGvHvzU=; b=pmGtN9CeLs+MuzNQms8ZXkK+91w2TTEQ5onBoJ0ygQH9cpDwM9cACJElzoYlqUp2kU sZ1LHj9ZoWvY3ICNWJSybT20uAEo7f/KXluK/tbnCVvPl+iNIY2MxqJBxb2YTOX+V4ZR +XWQvi5EzBqtEG3OvXxxrZ56cTU+46Kse+4K30BPJWTa9DdP8iHjE3/sR/ItsIfjHtN9 dP83FBEcZcw2T8WO/7Jgj/cP2uUalXr5ofbenWBo1v4AtjoB+vCjmBDabZ3LVu6tl+Ew 0e0jhAfHZvD3T16UkOjLymc1EgEYwPKoteKp2BCNt7DVtpn2ERvaAS4A7tQNxhbbBPmb c6Hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=wBL1fkSPUK79ExHBJomnE+g34nGDCbvEomLmRGvHvzU=; b=lpM1wnpW/eAFpBpH8mW1ZZZb4tMxBOURux3SvLZb/66XY9jaMRRLcXoDgzfBJ/D6JZ YjGPtbDvMT9WGj8/4K3yDcCZwvNk5/M8+K3oKVWpT7tZzKQlMMZLMgHu0wynm25ilrwC 32A1idqf8/ksQFXV5l5oKHBw8xlw59NR5N0kPWC3tYxPUHasovaUqzBvjyV4NxNPsBwv VXY21jv/HQSmymnhBYhDqyfLLUUFFZR8pWNT23JBMW6s84EHDYE3wTIuffJDM/KZ6dd3 OVjUZWzeIOjtx7Pn/rVHnwBx6ErOun33cxnpWcUq+1SgFWX2anWFIQFyitbBu1eIy7lw 4FtA== X-Gm-Message-State: AOAM533rTb/j7/cLxQIxuD0Tg/wkMgGN8HqEqQ7sWJwhlfP+qHsWPXOI w9UhZFESdib4er2ULwO/i9ZmRl78mUw= X-Received: by 2002:a05:6402:5244:: with SMTP id t4mr5315829edd.254.1623922324203; Thu, 17 Jun 2021 02:32:04 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id m18sm3328140ejx.56.2021.06.17.02.32.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 02:32:03 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 39/45] softfloat: Use _Generic instead of QEMU_GENERIC Date: Thu, 17 Jun 2021 11:31:28 +0200 Message-Id: <20210617093134.900014-40-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210617093134.900014-1-pbonzini@redhat.com> References: <20210617093134.900014-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=paolo.bonzini@gmail.com; helo=mail-ed1-x530.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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_Benn=C3=A9e?= , Thomas Huth , Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée Reviewed-by: Thomas Huth Message-Id: <20210614233143.1221879-3-richard.henderson@linaro.org> Signed-off-by: Paolo Bonzini --- fpu/softfloat.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) -- 2.31.1 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" #define PARTS_GENERIC_64_128(NAME, P) \ - QEMU_GENERIC(P, (FloatParts128 *, parts128_##NAME), parts64_##NAME) + _Generic((P), FloatParts64 *: parts64_##NAME, \ + FloatParts128 *: parts128_##NAME) #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) #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_status *s, const FloatFmt *f); */ #define FRAC_GENERIC_64_128(NAME, P) \ - QEMU_GENERIC(P, (FloatParts128 *, frac128_##NAME), frac64_##NAME) + _Generic((P), FloatParts64 *: frac64_##NAME, \ + FloatParts128 *: frac128_##NAME) #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) static bool frac64_add(FloatParts64 *r, FloatParts64 *a, FloatParts64 *b) { From patchwork Thu Jun 17 09:31:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 462137 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp284997jae; Thu, 17 Jun 2021 03:02:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrLsjmDRJn1KprQzNnQ7ckWsepcynZXN8TYD09AXx3yDFvMR9yqAM8qTiL27RnuuSLUVi3 X-Received: by 2002:aa7:cd9a:: with SMTP id x26mr5333250edv.185.1623924137010; Thu, 17 Jun 2021 03:02:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623924137; cv=none; d=google.com; s=arc-20160816; b=CrEWzFDMbBHdZXElZoTW1KdK9fdbc1Ltp+orkI8CUjP+mY9ZyGJ53gYQ10elOEmVuu YkIbIZrn6tiljtAq0CULq5rO18TZg6C5ewuKjVbaDZ/jHQ5JnO7TcFXNih8OrPynfjx+ camtN/PujA7pZX22RtwgvWQ42cpBaKKVmMyLRzqVHRQ+soSs8u4L/wjw2L8lQH7W3McF xtI5/uJK2n8G12G2ZKEeSzzFHr8dp9GFH8BV210n25ODO+LRTcl+mIkjqucWqBMto3Hl axekhVPc+JzLeIo6TcMQxZ33kkfNpk254XwHF/xxmDJM6IofpILkB0PeehMOu9JsY0e+ xIIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=JC6jDpOW9MIOT5eEE0twrZyJmHuq2x22gNqBjt+axpw=; b=zLHUfV2svXUn5Vri7IFwfjbkuRjKDPo1xf3fzpoB+0HfEdTCA0paedBgiis4gH8ycA RKubqwIvVrueWD90ZUfSImVrsmX0p3g+SKO0akPAMofWrILuBlN6iS5yExuGqgmkm5c4 AHm85Rc0A+AirV9xjOmNcuGs8wYnXk00GKM1Fco7f4uutOepwd+B/0k5UUw73dq3vRXP nh+uHS/aKQoe3qOOEPjcDECLid47vbYo0UOg4Hia9M/cK227YVLPPlkwaHDXTLMBHxDA kO0lF1AOgEVh6cp4k34a46uHkiGW4B76Hn/dvc7iesY1DxxBMwMtxKgG7XMVX1XWRj9R qLbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=qLtioOA0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z22si2416809edc.56.2021.06.17.03.02.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Jun 2021 03:02:17 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=qLtioOA0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:44522 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltoql-0007wC-Qd for patch@linaro.org; Thu, 17 Jun 2021 06:02:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55402) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltoNb-0003CD-MX for qemu-devel@nongnu.org; Thu, 17 Jun 2021 05:32:07 -0400 Received: from mail-ed1-x52a.google.com ([2a00:1450:4864:20::52a]:42512) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltoNa-0006P0-24 for qemu-devel@nongnu.org; Thu, 17 Jun 2021 05:32:07 -0400 Received: by mail-ed1-x52a.google.com with SMTP id i13so3039290edb.9 for ; Thu, 17 Jun 2021 02:32:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JC6jDpOW9MIOT5eEE0twrZyJmHuq2x22gNqBjt+axpw=; b=qLtioOA0pDI271G52lPzyTkwUH5MTzpzevMcTlWT2+KT2rfJ13gcHMI/9cWdJ5puau 3QoHPuULjmHjQPR2JE1FAmK9Dj24kCHEiU8hrHuibfVxIFMKYO4WiJpgCsiMEdYE3V1F QWXfGNWVCaaa4sQkjYtdSEk+l1aTqLAlyuXZyQwkmhlPJuenk0FGVtV8SJgYTQ1rYII1 +Av4cSZXH+b/zAHpUp/+gkmYmp3xH07tF8HYAeLrzzbg1YUZBSyFPflSph8XRx1YobRs 70WHVcXTKgixrV/nkCyiSTg0BW5YZAs76BafC3j5MC8f/qAbvRQadqg1ecNkDlm5/cZT bzmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=JC6jDpOW9MIOT5eEE0twrZyJmHuq2x22gNqBjt+axpw=; b=B8ZIIFQbJS6hwzKK5JXeFTrSSU208CEYWn6x67xHCnemHwTVbK1Rn/0gt4cm3szl7E b0tqFQeQjl8ETjGbiprsEBmdW/rd0YrpQVt7nQzPuAYsr79beoz3HQVXz9Gt2pNKTj/J BB+hshKcV+E76XxExHBeHlejjSJr9MX7aCZUCWdV0AVgUljeIpBAkJ7nwX1gRLqRUpx/ ujx2p3aBU82P+fCIPhdn5LbUGqWy5r3FG2dfVKgGIQDQWua3tQvlKv1QZujEoEUDPU29 bht+hj1wr8O5OmrKplhrRpvHKG6z6Se+TJ+0Fap9laFVqZXDn1LJFer+E3GgBkvANAEP ETng== X-Gm-Message-State: AOAM530sY8xt8fWUR5vbsfRbrqm8cF4x57h/PPx/SouaaIYLNCVZLTae QpnwCt7sTf15mo3pTuHMDp4HnFwXjgA= X-Received: by 2002:a05:6402:2706:: with SMTP id y6mr2205053edd.330.1623922324882; Thu, 17 Jun 2021 02:32:04 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id m18sm3328140ejx.56.2021.06.17.02.32.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 02:32:04 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 40/45] util: Use real functions for thread-posix QemuRecMutex Date: Thu, 17 Jun 2021 11:31:29 +0200 Message-Id: <20210617093134.900014-41-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210617093134.900014-1-pbonzini@redhat.com> References: <20210617093134.900014-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52a; envelope-from=paolo.bonzini@gmail.com; helo=mail-ed1-x52a.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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_Benn=C3=A9e?= , Thomas Huth , Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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: Alex Bennée Reviewed-by: Thomas Huth Message-Id: <20210614233143.1221879-4-richard.henderson@linaro.org> Signed-off-by: Paolo Bonzini --- 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(-) -- 2.31.1 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 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 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; }; -void qemu_rec_mutex_destroy(QemuRecMutex *mutex); -void qemu_rec_mutex_lock_impl(QemuRecMutex *mutex, const char *file, int line); -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 line); void qemu_mutex_unlock_impl(QemuMutex *mutex, const char *file, const int line); +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 line); +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); } -/* 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); 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 = true; } +void qemu_rec_mutex_destroy(QemuRecMutex *mutex) +{ + qemu_mutex_destroy(mutex); +} + +void qemu_rec_mutex_lock_impl(QemuRecMutex *mutex, const char *file, int line) +{ + 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; From patchwork Thu Jun 17 09:31:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 462139 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp295805jae; Thu, 17 Jun 2021 03:15:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZkIywAFnRF3qGwNQoARQTkeaCaqrTrq2eiSP3ByNfVGv8vFxvzw+/DJIymHMUZy0qgub6 X-Received: by 2002:a67:ff14:: with SMTP id v20mr3629820vsp.16.1623924938795; Thu, 17 Jun 2021 03:15:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623924938; cv=none; d=google.com; s=arc-20160816; b=Ec5YKg71kD5rFE3f4T34afRxCBsIq4KJ7HmSibtQHE3Atjx1ognb7y3Jzmh7T/dMi8 onvteJhOBwNgy5Lw9dqChSVQDiDtvJPo2aHDcDF+OZkidn0bleQ8nZ6nSYkZ790v5/Fj w6eB1/ra408EDKMCYudqv0d+jniOYJjrAkdTR+jX86TPcqf0U5PQS5KsX0GNSGe+vmOk vLXjJNHmR5MzycBEMnEAckROUiaLYmu8y3T6SQIdrsaxc1S1ZXLX5u4cWRyXluvEAY7E xcF2kBtxqKZpTwNe2J8mrIczdB3P4+arHfl/3KG/gbJsKyRelV+s6WaYUTQVKKOZoo+T gCSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Y56nUWEYX1Cg83SkEbZbhuCRN/h8u6OlN8CrNOsG72o=; b=a3yu8LDQ6WyBnu9mV9GZLS0uJFIvqFNaZy1oJeuP0yBjfYJmcydeHfeCmDBCV39+Pv 0XfKbBSAvRnjjgTGHsOL/kO87HLEFReki5mIS1WHf1gGwYepClfBAP4EFbUCoSB+hGhN 4LWoc2M1c+/a9cPmF42+kM2dLIOwJGuXz0igYhv+7ZxyAEuHd8EwjxRYsQDTkPgf/3Ro //MrRRkUsAefxJ+lfVIPCCqwJyb5Oh6qCfKimr23Y+1A4RYINZooV+sDeuHc8V90GRwT v6/frLOsE62kGncjPJUo5ZYXSMZ48CTMJF/I1BRjSyZ0ZkGLdWDn/F9oXa8VYx2L0+TW x5KQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=M8dceNHH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q2si4314896uas.242.2021.06.17.03.15.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Jun 2021 03:15:38 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=M8dceNHH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:54874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltp3i-0000P6-8V for patch@linaro.org; Thu, 17 Jun 2021 06:15:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55418) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltoNc-0003Dx-IC for qemu-devel@nongnu.org; Thu, 17 Jun 2021 05:32:08 -0400 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]:37396) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltoNa-0006Pa-SX for qemu-devel@nongnu.org; Thu, 17 Jun 2021 05:32:08 -0400 Received: by mail-ed1-x52b.google.com with SMTP id b11so3068468edy.4 for ; Thu, 17 Jun 2021 02:32:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Y56nUWEYX1Cg83SkEbZbhuCRN/h8u6OlN8CrNOsG72o=; b=M8dceNHHdIEU8fVkaSXqQyVKz/ejMeXciudm5NGt71cDEcd3RKPgahB+nnDDxQ/bdi 1NwZdWINQGN7uwzhja22qCJWZu/Rv3qos9zTZzbeljeahkbYiwNpNO1Q49H5Jo0HvcJZ soaoKsiLAUp+sqae9raoCkjiCRFSTA226D+crEHdFgvijhTKl2eqwThVAiL6hfBQ0Tu6 MGtGZ/iC4lwInKI2Com9u6LVVzbNxYLG5M7hUl5unHSVS+GFvY//IgCvyqy6GcVlIAmp KXy7IBHrxwpfhcJ3gDEDaDtLQn1LvPVGyYuLe7nxa4uH3UvaehLTcdTGiIvvoxkdp2zI RFXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Y56nUWEYX1Cg83SkEbZbhuCRN/h8u6OlN8CrNOsG72o=; b=WMspPYx+A5ifoipTig2C1OlZesR/OOp1Qa+h9v/MHL7kBeqK75C81mBsXiE/OL1WdD HBUn7i6u2B/IwbJ+0QmL3z9wSGqG2QOBjUrsRYU0hW0jT5Vp55cmAis8q3oUe+WdqqP6 l3eBmGO8rtdzG1oYx/KY7w5Hlm5PhAGuZutt9xYGLgDWXR7BlF2u++Wsn1uAh6Z3llpb iKKJ+iF/2DWHgEjsylOjAvkAQXvHmDe7yiwM6mLr9BEzjMf/6OTNN3pyiSBmNsaOvwNv ebvegZJmSz7bRJk/i28eFWXqc4dSSqFJ65xeR4TlGzGXkj627yjFD0EEX+DzkXgFVRL3 K9lQ== X-Gm-Message-State: AOAM530DofGsDtl9xka5F2RHxRehsRO7TKX7K1HymBfhvpHNBR41HX3+ qd3GoHebT4vcqbk+uZf33GC6laKupzI= X-Received: by 2002:a05:6402:35cc:: with SMTP id z12mr5298937edc.45.1623922325530; Thu, 17 Jun 2021 02:32:05 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id m18sm3328140ejx.56.2021.06.17.02.32.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 02:32:05 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 41/45] util: Pass file+line to qemu_rec_mutex_unlock_impl Date: Thu, 17 Jun 2021 11:31:30 +0200 Message-Id: <20210617093134.900014-42-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210617093134.900014-1-pbonzini@redhat.com> References: <20210617093134.900014-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52b; envelope-from=paolo.bonzini@gmail.com; helo=mail-ed1-x52b.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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_Benn=C3=A9e?= , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20210614233143.1221879-5-richard.henderson@linaro.org> Signed-off-by: Paolo Bonzini --- include/qemu/thread.h | 10 +++++++++- util/qemu-thread-posix.c | 4 ++-- util/qemu-thread-win32.c | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) -- 2.31.1 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 line); 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); 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__) +#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)(QemuRecMutex *mutex) return qemu_rec_mutex_trylock(mutex); } +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); 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, const char *file, int line) return qemu_mutex_trylock_impl(mutex, file, line); } -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); } 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, const char *file, int line) return !TryEnterCriticalSection(&mutex->lock); } -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); From patchwork Thu Jun 17 09:31:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 462132 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp276865jae; Thu, 17 Jun 2021 02:50:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0FDZxF+WDQzLHAAEpkxkDb+oSlMOELR6L+XcWXBez+wb50wdc/qhCSuk5peaa56gGfhTp X-Received: by 2002:a02:c88a:: with SMTP id m10mr3848045jao.136.1623923411787; Thu, 17 Jun 2021 02:50:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623923411; cv=none; d=google.com; s=arc-20160816; b=bwU2jTd77eNCtcsAM2OpXIzHEmhwHapLWT4iiuaMmawRtwqdSTfokuV4UnKwob4Lk6 Or77KHUONcwUMf2HPC595qrOHMDxlxK75x9lD+fyfkE7NpbNUV5/zWHk3v5E9gOwF50N 0QayD7U/G7egG96YLpLu4M26PGh+Spmq2xJnRDhNAAHCpwjfa8X9pkH4krJem+wplvfs QqrYHHKUDzY/azx2dK5egCl05P9Jf7BNEFKag01sp1OSPixCOSosvHUoBIgV8L4LGwSI VBytMkdnxoPB455ADMcQWbsS8AmWnhYB/qc3aJqeMopwAAPqwjVUKcgQCD7alB/HphK3 MB/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=JNJr/AA+BlXc1zPZLzRJ8Y7azIDxrXiDPF6G2uWQRjc=; b=y0Ej128YDGr810Mbr54BUyIzqIycM+NUOL98/PVTM4amn0dSmbBw9WoviyPl3/3npC 69/TQlh4D23BofvWws3IY48ykI+N43objlkNu7xSeHOsURvYDkXpsYHo3hByVEJXaqzw Yup6pELSgGTtB9/9fcfsDiO663LnrsfuEK24pcCDon2b8IcrrHyFSnz+iSc9BgHKs5OF cIJKsfqzZmMnTguVl547OWMJvJZPw2D0Oewn52CtV5pEiLO8AK0L8zNsCP0RbMyZfl8h StecztrszR2eYdkIOAXk805jI31V4GMZiW83f1tma3W73YlGebjOVelIEtudtQVQGKQW Uhcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=hEkuoq0t; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id l18si5870312jak.5.2021.06.17.02.50.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Jun 2021 02:50:11 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=hEkuoq0t; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:36738 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltof5-0000LG-0X for patch@linaro.org; Thu, 17 Jun 2021 05:50:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55424) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltoNd-0003EJ-3w for qemu-devel@nongnu.org; Thu, 17 Jun 2021 05:32:10 -0400 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]:40605) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltoNb-0006Q3-Ec for qemu-devel@nongnu.org; Thu, 17 Jun 2021 05:32:08 -0400 Received: by mail-ej1-x630.google.com with SMTP id my49so8697533ejc.7 for ; Thu, 17 Jun 2021 02:32:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JNJr/AA+BlXc1zPZLzRJ8Y7azIDxrXiDPF6G2uWQRjc=; b=hEkuoq0tnrqsRmZtsbEJNE6inmjPOnQS34lWm2RdrqkF9aBR9NUjW/aDSmhPhitmkW jXttsQa0lUVesQIuhDoQzLdId64d0Z3Evexpzh7KKGp9Dsg6s9uqv4UHNQzVwTSamVFP DpvEvzUQkSWHa98fZxxIlRRZOK+MwKs6k5gqzv9QlPltrayKTWN82gUscBcorll8Ck9N ukWx4lMtHZ9PdyiPUjFLkf2OWrm4L5zTa13xWK3T1XHEtCpfcsW3s0XUiL1Jn8CLD1/x vViEP2jYwkP6eHQzv6vbYEe5nYW2ia/cDXY55+qvQnRuHMye1o0D9fAb5hcgjRT4zX3q VDMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=JNJr/AA+BlXc1zPZLzRJ8Y7azIDxrXiDPF6G2uWQRjc=; b=fK5ZvBIy7QCy5En+/O9SxxZNdxFXpe8iIgCOG50sOXrpJnStk0zaBMuiWuzk6rdQvA Qr8WfUXOYe4xpQ7NQEwtoNSvfWcF74Q5fy5AttcFNy3Iyv0HAYdJiMb4N0bcMu0Bv1cy 7JXBpizDTwiTTsk6USvhLF9Sh76uXVHCwmt3bZ+LRA5IW8YqDpA4n7zA6M2UFnoDa998 +sXB3OwACjGNkB8EsvRqLgD8nBXuimtxMYL8rslm7Pv7zJ+Txyf0l7m5E6WWncS94A1S dYRSfeHbibYdYHumCV12IORf7enBQiFEHUC7bSkCRildTwUeqZuqKq+MrB8xK4PSjtz0 LTFg== X-Gm-Message-State: AOAM532KSBMUOHRlEgte5orFyrNJW1EWApbRj/p2Jb0FuGkwp3St9iTD bMwtLvdQkJSw9hVIxetKvZdP7W+Pmp8= X-Received: by 2002:a17:907:1c9e:: with SMTP id nb30mr4278702ejc.0.1623922326208; Thu, 17 Jun 2021 02:32:06 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id m18sm3328140ejx.56.2021.06.17.02.32.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 02:32:05 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 42/45] util: Use unique type for QemuRecMutex in thread-posix.h Date: Thu, 17 Jun 2021 11:31:31 +0200 Message-Id: <20210617093134.900014-43-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210617093134.900014-1-pbonzini@redhat.com> References: <20210617093134.900014-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::630; envelope-from=paolo.bonzini@gmail.com; helo=mail-ej1-x630.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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_Benn=C3=A9e?= , Thomas Huth , Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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: Alex Bennée Reviewed-by: Thomas Huth Message-Id: <20210614233143.1221879-6-richard.henderson@linaro.org> Signed-off-by: Paolo Bonzini --- include/qemu/thread-posix.h | 10 ++++++++-- util/qemu-thread-posix.c | 12 ++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) -- 2.31.1 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 -typedef QemuMutex QemuRecMutex; - struct QemuMutex { pthread_mutex_t lock; #ifdef CONFIG_DEBUG_MUTEX @@ -15,6 +13,14 @@ struct QemuMutex { bool initialized; }; +/* + * 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) pthread_mutexattr_init(&attr); pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); - err = pthread_mutex_init(&mutex->lock, &attr); + err = pthread_mutex_init(&mutex->m.lock, &attr); pthread_mutexattr_destroy(&attr); if (err) { error_exit(err, __func__); } - mutex->initialized = true; + mutex->m.initialized = true; } void qemu_rec_mutex_destroy(QemuRecMutex *mutex) { - qemu_mutex_destroy(mutex); + qemu_mutex_destroy(&mutex->m); } void qemu_rec_mutex_lock_impl(QemuRecMutex *mutex, const char *file, int line) { - qemu_mutex_lock_impl(mutex, file, line); + qemu_mutex_lock_impl(&mutex->m, file, line); } 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); } 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); } void qemu_cond_init(QemuCond *cond) From patchwork Thu Jun 17 09:31:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 462138 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp287930jae; Thu, 17 Jun 2021 03:05:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0Jf3sYtwN8jqzTqWj5SQvrAtwscO13tAhDmE/DhzM2mnhcyVGqd99l5WDJbPQOq/YjiX/ X-Received: by 2002:a05:6102:a38:: with SMTP id 24mr2598221vsb.53.1623924352684; Thu, 17 Jun 2021 03:05:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623924352; cv=none; d=google.com; s=arc-20160816; b=jeVpkXPKph3dTnRDZW8xYSbo7AThphW9ax2wYrnk9qoYBoN/qMmc+4Hw3ATQ+uiWO2 jEMD5FKYG08+Qy4c1pnscF2BDNT0TwkkQqauDpqDQ3Fuq1utJ77NRTmde64UgmZs/ZBw rCO1XAbm2vD5AO/k7NWuEv88xjcjIO8jDWtDcJv48yRxvxcAU4lOfMLCH+9GdXatDTQR HfuUxBlIEXJ78KnnO+iVxJI+9uN02PLAmmablMiq9cvJPUowfaHQVfV0jDm5/+kP+y0f Xu44ddSwG+LTJpgIGymnfIpuv5cZFt9Ti7/+cJ9cjAbiYBmTSm5AMV5W3jbQyyncroqs njYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=xNQYL3e/qOseQC5VO9f224envW8cvgsN2R0SpAwLVbk=; b=jpb22FXmPlj8vb7mvSbIRaz8J5MmI4T3GJsbinpaLgEsrILw7Mkgh3q633a9Fe/EEq 2kqDyrjoeIFF0FzRHSlpHsHb9QirLyhzlTXMAQRFNRJSQXNEy4J4FnxXiQkuUcnROAvK hKQOsoEpfv/40X+16kIXk5RR18s/VwUD8KyJL1RWy29a7WLxPzgoYjUYrW6ccDGZYGL7 51pd7wEFguyJuwWjsSjosXEWhlnwyOxXyRjSV+h3YiaTeqfVPP/rY2p8I7loWBWCHbNt Feski5eWTMhoKP9keXXk7iBh1yAR/gErjIda9a6QYjh80Xzjksbx5KMn1cLLvUMVR1Bm zoUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=OjAj1GuO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s26si3427683uaq.237.2021.06.17.03.05.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Jun 2021 03:05:52 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=OjAj1GuO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:53188 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltouF-0005Jj-W1 for patch@linaro.org; Thu, 17 Jun 2021 06:05:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55446) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltoNf-0003Fr-00 for qemu-devel@nongnu.org; Thu, 17 Jun 2021 05:32:11 -0400 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]:33425) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltoNc-0006RS-8e for qemu-devel@nongnu.org; Thu, 17 Jun 2021 05:32:09 -0400 Received: by mail-ej1-x634.google.com with SMTP id g20so8826890ejt.0 for ; Thu, 17 Jun 2021 02:32:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xNQYL3e/qOseQC5VO9f224envW8cvgsN2R0SpAwLVbk=; b=OjAj1GuOTJ6Yp1FgleT7b4Jeq69OVbocUmu4HzW4sVfhNszU4p4KT1R+86QaiYMclw T9qUe4nStfUjMwExmPrgc59Gy2gw+iSI9gVhdHVKkpBCPSX26wrnmheYCH8836DUSQTZ hnEfwA8jD0RuV5yS1C9XLeGa0dCGUWSQ9GkgG5uqVO32AT1su4Xzgu74IXjYH/QJD7jr Y6LIxLMHIJWFywxv030oyX86t06szGbtTpvSXf/DFSKlFzlD+crjLDcpNSeyj1JjVKap UmIg7yvxSFFDZ/tvUclHAI67omwywswlGP8PSmQgXFI3zdfxDcGKN/Rc0CXkL60DsiaU Ka6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=xNQYL3e/qOseQC5VO9f224envW8cvgsN2R0SpAwLVbk=; b=tg776WiErbHjiuQVghWcT9xqrhsilYyIoiOPpaDUhzoeVzdqJVZeqV6m7KHPNTZV7C YyIgmSKNGRa0gDZ6CHVTDnmcAfMimnH2lUzBaLvY33HhvzZh13iZqMtSjwixuzRbD3sQ YxgTLPu6ngDlDz9U1N0rzCtZ4/l7j7jm2BQ14676mmWMoYq1uO9mnzxoqX5NcvZfd9N/ JFtRHeNXK/5JstgxuTSA5d1wOebV/e/zKEj13Gx88XSn6AM/jAQwackMZ8G8DmONJpRz fedNYY2i7yCOxugRdA9/PH9S6NEKD56rQV6oMVtosgW+0vz6tMAXdvGrCvuWihSoDic/ baBw== X-Gm-Message-State: AOAM531PqCZlaDjBqi37vdxCg5wQueNJ2wsSiS6R/V/Bs1DdsnZSLeeU Cs7/YkV7kvWOrJMo9Lb17HoOqy6Q/GE= X-Received: by 2002:a17:906:eb17:: with SMTP id mb23mr4269825ejb.239.1623922326921; Thu, 17 Jun 2021 02:32:06 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id m18sm3328140ejx.56.2021.06.17.02.32.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 02:32:06 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 43/45] include/qemu/lockable: Use _Generic instead of QEMU_GENERIC Date: Thu, 17 Jun 2021 11:31:32 +0200 Message-Id: <20210617093134.900014-44-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210617093134.900014-1-pbonzini@redhat.com> References: <20210617093134.900014-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::634; envelope-from=paolo.bonzini@gmail.com; helo=mail-ej1-x634.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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_Benn=C3=A9e?= , Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 Reviewed-by: Alex Bennée Tested-by: Alex Bennée Message-Id: <20210614233143.1221879-7-richard.henderson@linaro.org> Signed-off-by: Paolo Bonzini --- include/qemu/lockable.h | 90 +++++++++++++++++++---------------------- 1 file changed, 41 insertions(+), 49 deletions(-) -- 2.31.1 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; }; -/* This function gives an error if an invalid, non-NULL pointer type is passed - * 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; } -/* 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 != NULL) { + qemu_build_not_reached(); + } + return NULL; +} -#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 = (x), \ - .lock = QEMU_LOCK_FUNC(x), \ - .unlock = QEMU_UNLOCK_FUNC(x), \ +#define QML_OBJ_(x, name) (&(QemuLockable) { \ + .object = (x), \ + .lock = (QemuLockUnlockFunc *) qemu_ ## name ## _lock, \ + .unlock = (QemuLockUnlockFunc *) qemu_ ## name ## _unlock \ }) -/* QEMU_MAKE_LOCKABLE - Make a polymorphic QemuLockable +/** + * QEMU_MAKE_LOCKABLE - Make a polymorphic QemuLockable * - * @x: a lock object (currently one of QemuMutex, QemuRecMutex, CoMutex, QemuSpin). + * @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, QemuSpin). + * 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)) static inline void qemu_lockable_lock(QemuLockable *x) { From patchwork Thu Jun 17 09:31:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 462136 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp282497jae; Thu, 17 Jun 2021 02:59:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZhcuh7px47rb5Xvd7L2hW2JOB4M07OGlSEbtpChM3DGeg0TcjmBChXp2lIBNRN9lEWIUb X-Received: by 2002:ae9:e912:: with SMTP id x18mr2958206qkf.495.1623923959801; Thu, 17 Jun 2021 02:59:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623923959; cv=none; d=google.com; s=arc-20160816; b=veb8gPqr7K46mO1JmLHsEV9eDbv6e3QI6S9Zzn5SRS0EcJEIcxgXVGPI9UrnTnIZ0x P1BLOdNdCvKKZATyKJD0kJl0Wc0BN8u1fcs1TDGZ736GTxHkog9ukP4p1E/Errtx6dnR Z8r45lSd2ejq+NqW3VLvj6TJW/zoXZfi+YrG/Ts3LEVy+u3vgmGk6xPpp76uOK0kJxyo BPSVYqsmtvl172TPeNPAj7XFtD2wku3iVNhqzwRMwXOHms4Qb/Ya0Mdq31PjUvwroQiG j0ELgpZsCvoSjklBPRBAqHtH9sLqgwn9NEkT5tCS7KUvD1R/QFXIqtLdNfHXmPHkYsju 4VXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=w/ZDHFj/sj/zgSbYdluGkx019Z0PuVQHSdt6mo9xSR4=; b=rebzvXupiDpssobVyk26OsuE0pduUTPRgSY+hPuT5UDfWRdIOwzKMRMM029/NeLH9E jfOnZn16bzgKPeUaKkAF5P/lS3cUT0E0/yqtCJ07vdUtWrLgBG5pDJrye6HQHykunSR6 J9mCpSpn+mCXgHpU8bxJr8dG42Aa2fw9aZEnoV/yX4yh7MNuljfVCxFyUxoG+68dFWin S5d0r3LBLd0eQg5IfRrY93ja0OJxf692xSIgIV2m/NPmS4wvvdI8WTjui56/djuePoVM 4QpUecWoKoy56JDNuqCVKkzpQ202N7USTTWfnWsqJ8pUsGDfh/DK16NPXg/JhFrX5Ww+ 5FFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="MrXphbJ/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h18si1791497qka.118.2021.06.17.02.59.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Jun 2021 02:59:19 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="MrXphbJ/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:38494 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltonv-0003u9-8H for patch@linaro.org; Thu, 17 Jun 2021 05:59:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55444) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltoNe-0003Fl-Vc for qemu-devel@nongnu.org; Thu, 17 Jun 2021 05:32:11 -0400 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]:38905) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltoNc-0006Rx-SZ for qemu-devel@nongnu.org; Thu, 17 Jun 2021 05:32:10 -0400 Received: by mail-ed1-x52c.google.com with SMTP id t7so3048386edd.5 for ; Thu, 17 Jun 2021 02:32:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=w/ZDHFj/sj/zgSbYdluGkx019Z0PuVQHSdt6mo9xSR4=; b=MrXphbJ/KQ/joNv3lsNS+yXiCVYhwrhLx7EMEn7Vn5FnZDoEJYaGcdhq2EdPGPtiKo DmV+fRLDkrI8LUVLV4h4pNq1QdIiuV1G+i6NAxp0BF3GFi3oBWM+C9COjQIzhxwWV0kI IWJfbjiESS9MP4TpyxKLD/V+DQqkLEf2B8LNpLvRkitvIUkDGsozkxC363lg0goGjZcD WR65MTwpPYBQhavnWIQmyGE0Z2Zcu6c5zm4HM6SBnrewFOx0hRqeEGUwc7urmIqlSfm8 U9vTwYTUU6sTK53VpMUzpBOWAmtKzHBjKHKzJroeBTofmvw8e4gdO4cCnMNXkS7zcaCw 1fdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=w/ZDHFj/sj/zgSbYdluGkx019Z0PuVQHSdt6mo9xSR4=; b=ta+od7WrDDBMs6WESGz6bwYPRJhLBoAmsY3Ig2cBRrRVJsbw930EeGRGFhZEs58iBR s7uj6NQWM4SUJ8sEzlprR/IOK3i6aTqg12IibL7HZ30KAv+v87r4I5ndOdnoo740wX6a rl81jNLQ3lWqujuDfBb/J97xX3OpICcI7Pr7/0NPkObwpQM8fj+jWfdKOOlsZf7z7npV rJe8Cb80W9Dyn1e+YCv7B2Mvb5rUrhA/w/i/r8eMYnaWz+PGeD1ZwogEyH8PCQ4L0Xbd DHNuseUZ/s6hHO+StfOgafTNC8Z28QyKtU4A8aIFu2mG75pmY0OQUFAPGJvwwIHJSpko OdoQ== X-Gm-Message-State: AOAM530h7hFLzWOY9LTrKo2GpwXX1N55NTtFZdLN8HrIXpdoO+Dfocnt 5Ox0WDkZV2+crBGZ3HdmAQ1hVqNaaYw= X-Received: by 2002:a05:6402:4255:: with SMTP id g21mr5252335edb.103.1623922327685; Thu, 17 Jun 2021 02:32:07 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id m18sm3328140ejx.56.2021.06.17.02.32.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 02:32:07 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 44/45] qemu/compiler: Remove QEMU_GENERIC Date: Thu, 17 Jun 2021 11:31:33 +0200 Message-Id: <20210617093134.900014-45-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210617093134.900014-1-pbonzini@redhat.com> References: <20210617093134.900014-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52c; envelope-from=paolo.bonzini@gmail.com; helo=mail-ed1-x52c.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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_Benn=C3=A9e?= , Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson All previous users now use C11 _Generic. Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée Message-Id: <20210614233143.1221879-8-richard.henderson@linaro.org> Signed-off-by: Paolo Bonzini --- include/qemu/compiler.h | 40 ---------------------------------------- 1 file changed, 40 deletions(-) -- 2.31.1 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 -/* 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_then), \ - 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() * From patchwork Thu Jun 17 09:31:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 462133 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp278346jae; Thu, 17 Jun 2021 02:52:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTHNLDQEToyAsFU46/+l6pT/b+95QY0WLhZZIzaZMw5lBIZoJGOka12bKZD5TcDfofioEM X-Received: by 2002:a05:6214:f22:: with SMTP id iw2mr4975549qvb.27.1623923557117; Thu, 17 Jun 2021 02:52:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623923557; cv=none; d=google.com; s=arc-20160816; b=MVsAR/k0Bpl4Y53bvrWtTtALvGNZs2Bd2BkHZ8R/rmao33tRArmYVvAMdnBdjmDtMw ysWWzmy1l8+L93gNvwVZLeoGaGWOQYa1TVKcBpxLF7SGO8NyxsUW9PyQ2YPe+a0YECsM zZzywrMO5cV8tyeuUfks1xGoFaSoD4wV72YOODL+PMFNuifDd+fPzYlUHmI9ZYUgI2iQ zWMF6qTea9cQYJ0egz4SzD/6m5ZQhLEnQXvCgZxhkJN8OVyQ1s1BD2Mpb0aEDjtiiDcF lte8OUxRZx+2nSHXyfXZDAxV6N7a7OUb2Tp7tZYtN38Z+STA3ayBYMJJJLvY9JHKeAVw pi2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Ih1xddWmyW9WnFhSZ9eRiE6DF/hMjeq/MCb4afEYuBY=; b=0BFGvlRY5tl5sq2XgefbvXw5Z454RDrKqCdymW1tNO13M6VXZPZeEhJCeSNYLkoB/P 0TygjA8GhImijFx+nr7Hskf/kKue8FxwPKTrrF+nP2lv0eOrV5yjEQXS5hlXNmSTuyzA 0XqDijU+/ofhFiApTXyNRi3y6Q4fwujSGIQLY4ddTW/cbGpui5otfMOa6jDVArPuDpPc nmnTKUZCgVr/v61exD25Yre5gJ6p7Pyz0NptWWO42ofdZAs6gRGLygudXDgQZ24ztw7r WGvVy1Wy9Dq3Sgeikp9Ald2qPhj0/ah2oTfGnkxQgLy248sHrqhqcSErAtF0sujW0aej SdEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="IK2Zaum/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s184si1999281qkc.70.2021.06.17.02.52.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Jun 2021 02:52:37 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="IK2Zaum/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:43572 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltohQ-00057a-Il for patch@linaro.org; Thu, 17 Jun 2021 05:52:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55460) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltoNg-0003IB-Md for qemu-devel@nongnu.org; Thu, 17 Jun 2021 05:32:12 -0400 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]:44941) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltoNe-0006S6-Mo for qemu-devel@nongnu.org; Thu, 17 Jun 2021 05:32:12 -0400 Received: by mail-ej1-x633.google.com with SMTP id gt18so8690176ejc.11 for ; Thu, 17 Jun 2021 02:32:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ih1xddWmyW9WnFhSZ9eRiE6DF/hMjeq/MCb4afEYuBY=; b=IK2Zaum/1R3bz4w0YCSAYB1xPl3BAL3bv/jzV/qr8GZ3e4GgqE1zFA+fsl10B1hWGL tyomFaEfRxoL/69R0kBFbX2cZ7w0PMGJh7fp2Z54hiEqnsofE/ME1xDnrXrxzHkDJ8qc BcENH/nGv4RYXmLwM83vA9sGKvAi/J+/6SV96uvDT/lpnwV65rGqOlypkIrqm7oAxgG9 GNpJhDJirvH5H+mz8oR8DgqaTftGMDMzgx1d0ej4DHyUB7Puq1fTJgUYNQnAunOuHFw6 smwogOsW+8O1V6LKX/cxO21w/LdCXuYfLchIOP9noJE/3Am/um9jug/JK95boZwuklTt elpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Ih1xddWmyW9WnFhSZ9eRiE6DF/hMjeq/MCb4afEYuBY=; b=nROjfuTyg6q29o7epfxzUqqAJqnGGCynl0sSjHsx+6DUFnHPf4e0fabib72/UN0Nm5 YLuPlrQSmujwVYXN9a5ljm2vlsKLKv2Y85eiWvZawKSx2xwNWe7yDecZUSBZf1mgylkM XaQpJtJ1KxfjvGUvjTH/AcAjpN8VtuzY0QvnDtOuINBElI9qx8TEDE19a5scp7MIWDJ7 kNl/KUPC6alxhs34AkL/zkEy2WS+uPNQTK+qgh9ljlSnnnTs2dfxw/nYM5a3KJtgs+Go fCghkGgK5l1wIlHB7nIK4hjiwWtYDUuNlfGmbU8OyDcb4SN4yVFejcc4FS+GdjW4T6w5 soiw== X-Gm-Message-State: AOAM531DqT3YDViZw3pjl36+rOCA0L0JKCwPErK1S0vdzGLjg8r2gqRV wNyX/4y8T4RsMK4df9ctqx1Ov2ky25U= X-Received: by 2002:a17:906:670c:: with SMTP id a12mr4118558ejp.249.1623922328333; Thu, 17 Jun 2021 02:32:08 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id m18sm3328140ejx.56.2021.06.17.02.32.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 02:32:08 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 45/45] configure: Remove probe for _Static_assert Date: Thu, 17 Jun 2021 11:31:34 +0200 Message-Id: <20210617093134.900014-46-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210617093134.900014-1-pbonzini@redhat.com> References: <20210617093134.900014-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::633; envelope-from=paolo.bonzini@gmail.com; helo=mail-ej1-x633.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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_Benn=C3=A9e?= , Thomas Huth , Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson _Static_assert is part of C11, which is now required. Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée Reviewed-by: Thomas Huth Message-Id: <20210614233143.1221879-9-richard.henderson@linaro.org> Signed-off-by: Paolo Bonzini --- configure | 18 ------------------ include/qemu/compiler.h | 11 ----------- 2 files changed, 29 deletions(-) -- 2.31.1 diff --git a/configure b/configure index ebc016111a..262ab71802 100755 --- a/configure +++ b/configure @@ -5090,20 +5090,6 @@ if compile_prog "" "" ; then have_sysmacros=yes fi -########################################## -# check for _Static_assert() - -have_static_assert=no -cat > $TMPC << EOF -_Static_assert(1, "success"); -int main(void) { - return 0; -} -EOF -if compile_prog "" "" ; then - have_static_assert=yes -fi - ########################################## # check for utmpx.h, it is missing e.g. on OpenBSD @@ -6035,10 +6021,6 @@ if test "$have_sysmacros" = "yes" ; then echo "CONFIG_SYSMACROS=y" >> $config_host_mak fi -if test "$have_static_assert" = "yes" ; then - echo "CONFIG_STATIC_ASSERT=y" >> $config_host_mak -fi - if test "$have_utmpx" = "yes" ; then echo "HAVE_UTMPX=y" >> $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; \ } -/* 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 #define QEMU_BUILD_BUG_ON(x) QEMU_BUILD_BUG_MSG(x, "not expecting: " #x)