From patchwork Fri Jun 11 23:33:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 458526 Delivered-To: patch@linaro.org Received: by 2002:a17:907:7409:0:0:0:0 with SMTP id gj9csp700287ejc; Fri, 11 Jun 2021 16:35:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAbiNV8H1EwwWdkWFxZE8mgceb0N0SKPTMGvr4SaSWT0KE7eXIPHyG6xyOUOH7Rsjgcg5o X-Received: by 2002:a05:620a:13c9:: with SMTP id g9mr6343572qkl.86.1623454536094; Fri, 11 Jun 2021 16:35:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623454536; cv=none; d=google.com; s=arc-20160816; b=l0/bKWd6CWuwY80sum1m0b5+nDUMkfoczJTBzUp71tn/5cwTuTYTQiY3oyZLiEvlJ8 yOwmZGbi1fo3v7714dIqo4yT/LZCy58dMNxQKHFsWRAlJ9fsrRyo1B1dvOSYyHwbK+Hz EB22CvYoIqesp9kc9sw93AgcYTlaGiUNrjiqCPMV1Z2S6eOcli51S8re3xCqGIjhTwx6 3ljW/ap33qVGJA6n8CVTId2Ie+M42HhtcWxCFVtwwrIcac5Zw0xtq30VhvgJHN83DwGC 9dmDAQVwgyA6dT7Ev/5+nIGBAG5BDJQMuLvqM83OyFekUEbPaFC5noymj+tc28SVI2/m 5UrQ== 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=FOVCmFTpg9+OxYQSRGceFtA/G8JdvxW5xy5Q+eU+6WU=; b=AWGM21VUL0zG8EN4V61mNKjkW5i1Lf70CzfXwDHaFEh55SxyAQ4PFKiPSBrBTdvpSU eYEICzamrsDF7hga7l7mvH1s7USyGT2+vy3vOzYuHqKjFZrgQ43pq/o7cZfn+4FkGrcW Mp2diHmM2oJUU3QZYWYM1HOtPQ2OTmNDGFuNPQu6yL+Oprby7uOYZDgacdCqbL78DrWB aoaEhLGOWwROXoXucTAXFpZWkBXIWcUizzTT5t8TIc6OoRKlVAvIHy9nksB5juRjqwHp HnhLAyfEafKqJAMbvNxPOP7wWxIac1uIuCb0Fzyps0SlHm0IBoWYf5MQa0okkyFYykUH nygQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=izMulYGg; 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=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f1si1804937qvt.211.2021.06.11.16.35.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 Jun 2021 16:35:36 -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=@linaro.org header.s=google header.b=izMulYGg; 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=linaro.org Received: from localhost ([::1]:55100 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrqgZ-0004Td-Do for patch@linaro.org; Fri, 11 Jun 2021 19:35:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46034) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrqey-0004L9-V0 for qemu-devel@nongnu.org; Fri, 11 Jun 2021 19:34:01 -0400 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]:47085) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lrqes-0006Nd-2h for qemu-devel@nongnu.org; Fri, 11 Jun 2021 19:33:56 -0400 Received: by mail-pg1-x52e.google.com with SMTP id n12so3629104pgs.13 for ; Fri, 11 Jun 2021 16:33:49 -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=FOVCmFTpg9+OxYQSRGceFtA/G8JdvxW5xy5Q+eU+6WU=; b=izMulYGgp1oNyqXpXWmdusyZdTFKTVWHVjAXUUwRiNAQ2ryU28UC0tiRlh+qeSZdyb 6OC703/SXmSPbFe3UOTkA7VcSfeAAgHxqwXMd1rxV9H4YxUAwUsg2sjH1WZ2V3Ri6YUW WXPyzNY3IGxHgKN/nmffk+max3BKgbtcwoCy4xnfJnkbyFS6EEO04UdYG5Bl4DyM0MNb UUvYUHIgv7DgJO6hGuod4MfrmTEuIAwSXTE0orhsL3woJM3Mty+xP8qnrOQYNxQYZwlg xoDH2vurJ5hIHoAlyn9sSpvX6/W3PSElt2qAVdU5wQwUiydIFAyOjFi8WOrYhyl10hL2 WCmQ== 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=FOVCmFTpg9+OxYQSRGceFtA/G8JdvxW5xy5Q+eU+6WU=; b=uW461fLFrtjoSAIxrQA3Nv2nV1lHWGqGtHE4AWhctr3SHKAhyZrWUsKsjPsdmzX3nb IpakePidps+ejpNKOQ6t5x27Gmo+/2Yx2CI1Y9CrvFHCM29hWaUILh/AMbpqwyLfvas0 SksAM4uhzi47QSshbNn2oCyB3BViNDjBk5ICkGPWc2VVBSkEJs8hL66m9Mvkfs4U8qYe VfM2zLkem/fFsjJorSPtv1HBSFB+CCJYoLC6us4gCw2l4kLrPoflwSyoDTlsvGA7KsHS acCZxI07wVwGBPJu0yF1V324oE+2EWXSveesFOKq00VZtoP6rOKg3mJK9ZV6w2IY8JfB ik3Q== X-Gm-Message-State: AOAM533Fbe3L1f2/bMdscS3MgGb4xk+IdNu3PRCnrnb7I+w9LepOGH4U /GYSVJ0tymdUH2YMxiM4E/tLWR/LEunahw== X-Received: by 2002:a62:a217:0:b029:2ee:48e1:fd92 with SMTP id m23-20020a62a2170000b02902ee48e1fd92mr10452191pff.55.1623454428724; Fri, 11 Jun 2021 16:33:48 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id m134sm6349606pfd.148.2021.06.11.16.33.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Jun 2021 16:33:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 1/8] configure: Use -std=gnu11 Date: Fri, 11 Jun 2021 16:33:40 -0700 Message-Id: <20210611233347.653129-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210611233347.653129-1-richard.henderson@linaro.org> References: <20210611233347.653129-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52e; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52e.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: pbonzini@redhat.com, thuth@redhat.com, ehabkost@redhat.com, Richard Henderson 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 --- configure | 4 ++-- meson.build | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) -- 2.25.1 Reviewed-by: Thomas Huth 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="$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 d2a9ce91f5..c070cb6aa7 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 Fri Jun 11 23:33:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 458524 Delivered-To: patch@linaro.org Received: by 2002:a17:907:7409:0:0:0:0 with SMTP id gj9csp700265ejc; Fri, 11 Jun 2021 16:35:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQJyJuClFv3Dwr9u3UiNUEpTRMxArSfkzPhpbelUfbqOVKnfo8nPPgXZ3DdZpaWaKvf4Hk X-Received: by 2002:a37:d08:: with SMTP id 8mr6351192qkn.409.1623454532826; Fri, 11 Jun 2021 16:35:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623454532; cv=none; d=google.com; s=arc-20160816; b=fh1TSE86L57GhxL2L44yCHcvMpCw1siWRGQ17lYLfXZO6oCUp/uSgi26XxZ9PvwUIM YnvmqA2pqUUl23mmyK3cX4uvPNsJtJmsuR7HR7ZggE4GyGzMUZv3GZQPOeGsqDLni1ca HwkOqyaBAXabhfqxPPgHKJWl6pMn3kRXgZO6oGE8XFhDFso8jI99Ulwe7kTVgB0i9OAk Tr044SkyZr+qJGvcu3J5wf3L4vFX+JevxuKtVxRN8y8+OIsyWx7uPFDuvV+wPjkXm2f/ oNiiDalq0qpn0zbxD2BzaWyku/j30HBHmW6mwjYgF6Yyl+qduynmCtk3JiXLZZEOpRid nlNw== 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=xx5lp96zsjKDJqIzIsAiA4NHIQLDT9JH68RupV1IPlw=; b=uXRQFTEO3iV+WEAYb5uSbcbaJnDv2LfJb6+n1CJ6GNJx4+qQ8kqYE5mOIWQbo1ttre MucUXou7t1E6+7JVkAUvg4wvbKqKg7OnNs4vBMdwxn73StLrGJQ5pxcD0srd7vvy5zww Olftpxby9yDjFCo1kUMz5VzRvtGnZ0B3liRYgX4l9XZUlrKXVvUHzGnnTNSGCmOgdQn1 aEwhuyg/1CuSHxdXhR+I3REHb3toosT+VN6c3MgXu7dcogfAY9Nja1kvEkfLepCrwUfx llUpVsGZxdR6P5foXcUKzE0LUyOYScnbENeH2ny01j4UCkko63rJ4YR8BNjCC2ZZi6vN EsTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=zp80zVLT; 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=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a17si5824073qvl.223.2021.06.11.16.35.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 Jun 2021 16:35:32 -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=@linaro.org header.s=google header.b=zp80zVLT; 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=linaro.org Received: from localhost ([::1]:54848 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrqgW-0004Ib-48 for patch@linaro.org; Fri, 11 Jun 2021 19:35:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45982) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrqev-0004HJ-Ap for qemu-devel@nongnu.org; Fri, 11 Jun 2021 19:33:53 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]:37883) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lrqes-0006OE-J8 for qemu-devel@nongnu.org; Fri, 11 Jun 2021 19:33:53 -0400 Received: by mail-pg1-x530.google.com with SMTP id t9so3655544pgn.4 for ; Fri, 11 Jun 2021 16:33:50 -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=xx5lp96zsjKDJqIzIsAiA4NHIQLDT9JH68RupV1IPlw=; b=zp80zVLTI2yxIcqQVMPFYfJ0GtXjqsomCwxeXX3g4X6x7nue9IWOGwmplkz9hWi+G0 AtqCvEC4nBPEkC+TEUhmtb7sJxo3BkLhcnERkmAwB8smCWBCXRv75KbQDNLRjJKwU8Rd cUnNQN3KNU9heSDpRyS6GUaM4JO08NDRc8EBde2qEW1I8ZfAiHOTl2VrcHOohYhNcje5 iyumvNAL8XmQEawMGxtvlUOtC4yAvoHTEphPW9H9Lnv1D06kEEMrbWcJkcw9gGZ1G6uz 3rtudgOi4hpBcqea9tvhJf7gkjYYhFJgfM3N/cLO62+M0DMBB9wJxotO8KJ66rea9Yqy a55w== 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=xx5lp96zsjKDJqIzIsAiA4NHIQLDT9JH68RupV1IPlw=; b=eYjTWqeK1gKoEbtFk46+Bt1rJh7IoRdigo054KJxC9m8ZCBTzvbrCMC/JRPB9xHTEE 3aZSYNboDx7OdlycjRgRhjqH4dkyE6HAx+empLzN+0OXzgAgq6CxRbYxg4Uc1sSY4d0R w5BExn3RvRRBfsfOgsWOlcQs4nKO2/RXS7OvmK3mGrWlpbKz2H2dpmLrHwejYQk+83nd wNl4qOyXn//JuL27itjZHC+IGq9X1HMxsds0kbOlae7tvramZwqVNyW5KoARhd3U68wr BdpijIr8ogTy5AfMHjznNR7hTbDaZ0PD2ug8KgIkTsTp2pPwYDexl/BxSJYs8YJd7yI4 k0Ng== X-Gm-Message-State: AOAM533XqeAOFgPRD/E0WG7zC2JT1rfjzYuXOX6rbsIehr1dicSWbC7r RTfdPFTz9S5f/ey5+CYNvliF29Fu17Ultg== X-Received: by 2002:a62:2901:0:b029:28e:ef3d:10d2 with SMTP id p1-20020a6229010000b029028eef3d10d2mr10496083pfp.45.1623454429242; Fri, 11 Jun 2021 16:33:49 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id m134sm6349606pfd.148.2021.06.11.16.33.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Jun 2021 16:33:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 2/8] softfloat: Use _Generic instead of QEMU_GENERIC Date: Fri, 11 Jun 2021 16:33:41 -0700 Message-Id: <20210611233347.653129-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210611233347.653129-1-richard.henderson@linaro.org> References: <20210611233347.653129-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x530.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: pbonzini@redhat.com, thuth@redhat.com, ehabkost@redhat.com, Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Signed-off-by: Richard Henderson --- fpu/softfloat.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) -- 2.25.1 diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 1cb162882b..6f4aea7dee 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 Fri Jun 11 23:33:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 458532 Delivered-To: patch@linaro.org Received: by 2002:a17:907:7409:0:0:0:0 with SMTP id gj9csp704415ejc; Fri, 11 Jun 2021 16:43:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUoQb42KbzCKfUPVxxc6L0x7YFrcjISwKZS9FrrKEtp6gXVDPxsETcCs71JFtmg3rEO8Mr X-Received: by 2002:a05:6638:27a:: with SMTP id x26mr6106153jaq.144.1623454996928; Fri, 11 Jun 2021 16:43:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623454996; cv=none; d=google.com; s=arc-20160816; b=x/O+YPqTcjsAVHzd4Ei6Mm/6QIioXsDOAtyq90SDfjS96FZy9VvHqmbE9WJpkARQK0 QxvzmitV8EoGAz61f+sGoR0wG35t6p5Ovv4sG0g+enlrSRWUhvHyiGHCOnc+cbnE6Zmb BTXloLP4F7OB56AverlicpE2oOCaQKsen0241Hj7lJMbTg6pfJSPR7os0IbUo9V4oh1O lIjxuQPmiUME6FVn8/kU/iV04F8MFV5wssfDKe8AtRZ7QSNl9iFEYGytkSSkyDtZvrzI Nn4N0aQpYI7fhbls6n1pWmK3lQNarwRWeEmGsgvgsIFUE0f4rq/7PcwjXWBoWokZwG8n KXMA== 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=OC0cZyVRPvWMo/VhnD4bd9Z7jMtR0MDDeeQWprN19Gw=; b=hfZ7NtzJ9eM1W1BgYCiDMEFRZHx9jJBtjwZsR2m326EpTwZy8+Bloqx22iEv4AKfWv jYFAQzapCPPEtcagvq+C1fmsNUC0pjkiqcLQf3FvfbxJuvE6vkQdtdDh3BWyLIDZ86kd rRQDGym+9MUZEIlc3yE4PTpSJTM20tMe26EAn04a28WuwoKmBXWB9L8ZO6MstRCukp8/ knBZrDpbmCL2pr6rf2jnA6zSRfgfkmPRBSWWv38P9ojilFCLBvWreiLh9dWJDJyw+mIC EcSSazdbU5am635MrvcFZacJRVrzfgUBIsJP08N26GPRc3PM5+g3qVQSUP9q/1vNA+zV gxBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=uT+H0GOg; 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=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j15si7580724ilo.150.2021.06.11.16.43.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 Jun 2021 16:43:16 -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=@linaro.org header.s=google header.b=uT+H0GOg; 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=linaro.org Received: from localhost ([::1]:48000 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrqo0-0002M1-8X for patch@linaro.org; Fri, 11 Jun 2021 19:43:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46040) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrqf4-0004Md-0C for qemu-devel@nongnu.org; Fri, 11 Jun 2021 19:34:02 -0400 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]:54805) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lrqet-0006PY-At for qemu-devel@nongnu.org; Fri, 11 Jun 2021 19:34:01 -0400 Received: by mail-pj1-x102e.google.com with SMTP id g24so6512991pji.4 for ; Fri, 11 Jun 2021 16:33:50 -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=OC0cZyVRPvWMo/VhnD4bd9Z7jMtR0MDDeeQWprN19Gw=; b=uT+H0GOg7BHQnDF2P9+Nipe3ErUxtHUccckrNMifaiYwWER7NELb1KprlJPG5fvuIz WIalnSx9M0/niwMiVKgebcIr8xqmJxQtjTCUQMtATszYTkevRMN5t2gjnspLAgJvUeyh v+BkErP1eSZ9UHAeqCx3j6PRbR/g+SuwPcam0USuU932eOnHLl1YPwJIUKDuBdeivSeW 9xH2n5QgAMFdOpYMEd0VDd17ejwEgiHXNDyHgGwbWKaghKtoo2uXcHuGjjva93rq93To QvYH2TZWNdCCaw6OOlsaJhTlJQSXgJvpRSITGqSKyxgPLPZn5NEGz+JEtIC1nKctQnrL i1TA== 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=OC0cZyVRPvWMo/VhnD4bd9Z7jMtR0MDDeeQWprN19Gw=; b=WS2WgPWQOhneQxVN6l3LA9qNgYcsX7KcIUOx8XF+6XaYMEndJ2ttQpJ9DaluVTkUSE LefVSG9tU4jOosK0wvwmZtm+JoCxdlyufODiM9nKOxOzgtYO+mXyJTW68IpCUhhmu3/e JQcYKm+tcdqrwqiEvX5xgfdqATezFUP2u79jYCnHwIZlT/wpbRy8Fb6bF94wGiHiff3X 1G0wMBMpAD8UmBgQ9dW3lFX9fOQTP+XLCTiemU3NQSnV8/6jQ63WKXizmaqHMcGGVNoc /dPczfa9MW305lZmQstlaOtYKQ4epaC4WxD1C11RBentQaX3Nh3WY3pLFOHOAoJYOyH2 Vp5A== X-Gm-Message-State: AOAM530/UkkL8WylZmBg7NjgUWTj0pFvZ5Xpa3oYPEX0Q4da5X7bdcUo AmevX36aDGkLNLKLXzlqhRqdGs6tVr9n6w== X-Received: by 2002:a17:90b:46c3:: with SMTP id jx3mr6735079pjb.206.1623454429930; Fri, 11 Jun 2021 16:33:49 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id m134sm6349606pfd.148.2021.06.11.16.33.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Jun 2021 16:33:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 3/8] util: Use real functions for thread-posix QemuRecMutex Date: Fri, 11 Jun 2021 16:33:42 -0700 Message-Id: <20210611233347.653129-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210611233347.653129-1-richard.henderson@linaro.org> References: <20210611233347.653129-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.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: pbonzini@redhat.com, thuth@redhat.com, ehabkost@redhat.com, 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 --- 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.25.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 Fri Jun 11 23:33:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 458525 Delivered-To: patch@linaro.org Received: by 2002:a17:907:7409:0:0:0:0 with SMTP id gj9csp700273ejc; Fri, 11 Jun 2021 16:35:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmwRjMIxWsmMYxs/ii41vVpxINxzscyo1g95o8x0WITqYJQas5Cmf53v7shG9BIv/+CYDF X-Received: by 2002:a5e:c64c:: with SMTP id s12mr4839649ioo.3.1623454533576; Fri, 11 Jun 2021 16:35:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623454533; cv=none; d=google.com; s=arc-20160816; b=ktlvPXuszSX2/owhDXwS0J4o55+0l4oYdYxtYZILuoD89rKRBv9+HMbpzbh1e0esw/ p1Tq+P1PHiw4iwNEx8boQ2113CJFc9E0kP+A77OsMunIRIryyyL8KzC82kNJvq7byrk4 kRYYC8T9QlvB8Lt04qj88Lf+zCiCU1aapmSN8WaQhFyOlNoJCPo3fjho+45Zss5OAkpl 6IrkIcpjcreWCgK21fa5FZUEJYfcV0NmxxAeHi/flUjuhsxBe9NVZsVizRf4LZux2Gus 4y1ryC5NKj7h9nseG/X4vscaC8D7nm/eQxhsyFgIs3hsgV6wAWWRj1DHDi78s+5W9kSa ut5g== 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=QwcLIow8ryYHhtEXT5F43ejpzVNyBb+0Qw4NSoljESU=; b=SLPlm+1CDq3MfuoXNr4Vj8Yuq+KZp6zau/qs/Ig8umku0rvZb/hQI/1d2EuH581aSM QIHEyYt1r8oklErx2vbidosyJ38QNrFEKwRwLm1b5j2D7gKhnNUiaw1VTPWTHdpQMIrc wO2eCcJ1fq00jgPpoo0E6l9r6azmTZ2Yek1nQFRVICGBwZu8ATgWC3/T+E1N0BLdxmiN PUlI1IcnkVxBkCE93jnFVLd/l+ib5PsT3urxx6WW7aSq8C8wydN4IeXlR7zCBXV6DlbD 4W4tBbI4/NF6e7VqtFuilgKe1UnTmuEF47sYMOtS8t/yvrHMgnBZymb7GZFqyPExcrkN 8laA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=GiQxpIHm; 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=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o192si8146280jao.55.2021.06.11.16.35.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 Jun 2021 16:35: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=@linaro.org header.s=google header.b=GiQxpIHm; 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=linaro.org Received: from localhost ([::1]:54924 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrqgW-0004LR-TQ for patch@linaro.org; Fri, 11 Jun 2021 19:35:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46020) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrqex-0004Hr-1B for qemu-devel@nongnu.org; Fri, 11 Jun 2021 19:33:55 -0400 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]:38404) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lrqeu-0006Q6-2v for qemu-devel@nongnu.org; Fri, 11 Jun 2021 19:33:53 -0400 Received: by mail-pg1-x52e.google.com with SMTP id t17so3667574pga.5 for ; Fri, 11 Jun 2021 16:33:51 -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=QwcLIow8ryYHhtEXT5F43ejpzVNyBb+0Qw4NSoljESU=; b=GiQxpIHmT416Vyivq/T1qh334fJp+gTS+XNUzD6HvetHXVKysVv0c00u91HQwgCg0H TksbrN3Efo6RfyLnV6hFRzBYfTJAec8fgJ6WHBltafRTAS+yyh+bDjZEqsJK6tYpcqXB 3iGjG+95pAPZukqPhuFhiwKNsG0Y08Nz8dgpAO1UN7nHQwJSa069o6xQhcUOzUwnTD6V YwU4N+rX8inNLvWLP0/rQZlBOE6P3rJB+vlw06/HDYXxK3Hv2jeI0CJNN5hmr583aW4a 6nbkFPwtLUQE67NHo+QECsG4B0Qz6hStLzVYRCIwBU57Anc4hV4xwEHuZ94ZfKCSJ1yY 2Rfw== 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=QwcLIow8ryYHhtEXT5F43ejpzVNyBb+0Qw4NSoljESU=; b=Hpdk1yN4VmkXEw0fH71ngE2WxljeRCyfopxIdSeUcOY4DMsgI4nXU+ZElRPQspubnA Znf2EbJ7txLnKpcpM2lJQBSdC0gzF3q1NvdGqEvs51+oSL0HgpFxbCDC3qVwvLikqxsl jmWc995/OQEt13oBNhRQJaWvh1XqVUdSajLUVeVSSviQ0k1jvOtglmMxbBxuYP/Q3gOr 6ll/PBHUkVRAaRaIR6W/bYIXIXTr9mOZuST6ESx0EilEZNa6kRuApdLJmdQqEqfD1dNx lmQwOcYdoWE8wQ7B94OhjYhN/4x3U1CslroL5Tkyn0vyKCTHctBRTwlvC83DZ5yGOqX2 7jzA== X-Gm-Message-State: AOAM530cKyK8RiM86lf+Pa+cPE4CxI4i30wETFIFt0sxTqfOp131/Pvg DH9EvtAY/ohS4N7X/lzuPLSVy8SWgaCoCg== X-Received: by 2002:aa7:9f43:0:b029:2f1:c336:8ac8 with SMTP id h3-20020aa79f430000b02902f1c3368ac8mr10697618pfr.11.1623454430679; Fri, 11 Jun 2021 16:33:50 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id m134sm6349606pfd.148.2021.06.11.16.33.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Jun 2021 16:33:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 4/8] util: Pass file+line to qemu_rec_mutex_unlock_impl Date: Fri, 11 Jun 2021 16:33:43 -0700 Message-Id: <20210611233347.653129-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210611233347.653129-1-richard.henderson@linaro.org> References: <20210611233347.653129-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52e; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52e.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: pbonzini@redhat.com, thuth@redhat.com, ehabkost@redhat.com, Richard Henderson 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 --- 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.25.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 Fri Jun 11 23:33:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 458527 Delivered-To: patch@linaro.org Received: by 2002:a17:907:7409:0:0:0:0 with SMTP id gj9csp701334ejc; Fri, 11 Jun 2021 16:37:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlW0oaQqu1d/cGoHyG+4xb93vA4iueZ5du6gMgPmTlogmpClBR093pL+9dC8ihuFWU84ED X-Received: by 2002:aed:2162:: with SMTP id 89mr6277394qtc.182.1623454651509; Fri, 11 Jun 2021 16:37:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623454651; cv=none; d=google.com; s=arc-20160816; b=PVkcYkh+BczzFHMh/mqvLHBJrdvtp5yA3/xK1bq0xc+SfuZkzXNWXQTQfow8rWzVTp 94F0Tmz+ZqRFijM0yfLxE0QsiQPraIRPkMuPANA3I66IyKWLwQybuw1FUOLf+Yv6hTM5 vc1dgyaJw+tq+tOM96HvoCzHbvSsqZ0ABxMll8lejl7DlO+36UJyxtLwlzxbLtfNIp0V 0mCwypDu2S6ia/VzAAnqqcqYVJfGaWl1KIjRy/o2BYIpSYCdOz52nMCguALVL++22oec g2cBdXal3dQLUSqERC7Ruwkq2Tx8fIYlqmEPlx82ln2feIYq0bkPYCiZR2DxdMhyxHce +8lw== 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=z8lCeI6CyIoQ0CotuHE5M+TRtTyS3/YGRMYX2q8e+24=; b=uKx+4kRJ0lytWpGA/CjfXjCImqc0DkGAxL3Vum9v8MwnfmlVJ9Ymz6ylMUs2nn8fP+ Thr9E7+bp1RYfYiZrTJtIRAamriWf1TfXkA4vh3kisQ1X2NwWgRDMrfVFbJ7wcwkkh32 yaZDngWHZlwDMgAwO6tn/jQAHqNSOfRScu1rrf/W0cEchF1Zy9DLqokiJ/67z3m7kzgs lKXgH8Y0aoGeTyROcOy2CjE+qogY3T7CPrZV6hrCZkBX8jYgyyn+AvYyEf5bRM05BcsR Wov/sgxjTu9b9E25xlUJtosvujnuJn7aBpXGXt2gp2700KoZRCvh0n2l9wLRRP7kzqH8 DtBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="kby2S/sp"; 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=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id l23si4672711qkk.182.2021.06.11.16.37.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 Jun 2021 16:37:31 -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=@linaro.org header.s=google header.b="kby2S/sp"; 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=linaro.org Received: from localhost ([::1]:35252 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrqiQ-0001hY-SX for patch@linaro.org; Fri, 11 Jun 2021 19:37:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46032) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrqey-0004Jt-5k for qemu-devel@nongnu.org; Fri, 11 Jun 2021 19:33:56 -0400 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]:45988) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lrqeu-0006QQ-H3 for qemu-devel@nongnu.org; Fri, 11 Jun 2021 19:33:55 -0400 Received: by mail-pg1-x533.google.com with SMTP id q15so3633835pgg.12 for ; Fri, 11 Jun 2021 16:33:52 -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=z8lCeI6CyIoQ0CotuHE5M+TRtTyS3/YGRMYX2q8e+24=; b=kby2S/spQhVox3R8AU7UJp27SrU3Qr5u/xqdVI55zkBDOj+mEfYe3u+z3VchWX0al/ y+cIJREEgWGm3xvS3y0Xml7KFBQJEMqTcGOyDWEgf8w7Y0no00lqkLqJUgYVy+9nieZO gJvVgnDgwIbsweGSM4S9olcBT7jh+mley4QyYFA9rXnhgMiR4ZbyHf/S2ZSe8KwZ5uVY a8UhknRfq5aRz5GUiBvuSEbLs1xfMW/5kYw31YDxLl0ZSdYTKBtYL6xV8n0SE9QSwnkp NEVu4ejUwKWo3vmTIzvMMafeLB9aa34g961zl4LM0nblO/0cT0K5M7TU1jKqJqtFY0Cl bd6A== 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=z8lCeI6CyIoQ0CotuHE5M+TRtTyS3/YGRMYX2q8e+24=; b=mQMaNJqnMfFdy8B5KzWzkcGJZHdZkxaUdEW7jeQoi9Q6V1jqiyUFoyTYZDejAkl6Re fpgJKOnwDnNJ/FmFv2ltKD/6rrNVFvWev6JxxPPZUioNAf1qa5oqlcUis+awnIbbhyVt 3G/b/7GXIjZp5o1CsvJmvg7pzMduOkIHM4jRmJCHRWcidb8QwKwx9OiFppO+oga3Bp8P mbSbjKN4g/4kBOiR6DVRgKYOi4LyRI80mXQZ5jd6Xj41GI96LIXsI57lOdF3dH09uC6B Hi1FxqP5J5Pq424yY25Yk/W1XjfQ5msxvNoFOer8Mda2TfB9dI6pSeZthtUwSI7smdY9 gjOw== X-Gm-Message-State: AOAM533Dzq2BDSFL8CMyRbWdPw744ht18jgsCQuVYgMnTd2K1Pvswx9j CbeV00R4KSbfzYgWQkVCHJXdvBwBRO12kw== X-Received: by 2002:a63:c047:: with SMTP id z7mr5957626pgi.186.1623454431216; Fri, 11 Jun 2021 16:33:51 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id m134sm6349606pfd.148.2021.06.11.16.33.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Jun 2021 16:33:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 5/8] util: Use unique type for QemuRecMutex in thread-posix.h Date: Fri, 11 Jun 2021 16:33:44 -0700 Message-Id: <20210611233347.653129-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210611233347.653129-1-richard.henderson@linaro.org> References: <20210611233347.653129-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::533; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x533.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: pbonzini@redhat.com, thuth@redhat.com, ehabkost@redhat.com, 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 --- include/qemu/thread-posix.h | 10 ++++++++-- util/qemu-thread-posix.c | 12 ++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) -- 2.25.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 Fri Jun 11 23:33:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 458530 Delivered-To: patch@linaro.org Received: by 2002:a17:907:7409:0:0:0:0 with SMTP id gj9csp703134ejc; Fri, 11 Jun 2021 16:40:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGFA0P9YsoaFQ6LWVzkKJ2/tlNd2QkkYn+v2xyz5XOAItDowJNIZgVEnHKBMWRbJGXeg8e X-Received: by 2002:a37:6c03:: with SMTP id h3mr6390399qkc.474.1623454851076; Fri, 11 Jun 2021 16:40:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623454851; cv=none; d=google.com; s=arc-20160816; b=HWt+mHcD70RnXjbyF8se7obmRB0IyL0dQ5tVpfmpv8Pc8YiHEKblOYgkrfz5ptnoxo 8LmYFb1IlANE3PC4byRZ5kzvp4CcAmfQ+w0tXSvTMR5Vo3+lZd8ChMgLGz8iAMAJ717c qbFfE+/ZMpa1FYTtDurNWkEUl9m+H89IABoZqshmTuEf1woQmuRggrDpHOVAHnRrdl1q bUiXJJ+vboeJeZ7Pm59V20nrblirimCTluOr5m4bdVQflshe7U28p04exiaq96vDlxuV 05a1T009tx/f93lJFROu5+WINSrAj+A7W6DcCe0E5pZF8O3KWf1KN52UfBmFfbPW3IhO KgeA== 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=L6RrcWlgVuAFENDyacE0KjBTR0pJOEPr/5/f08fEfIA=; b=W5uwLyVXcSL+3kSQ45ZmGNUnEiciQDtJh8f63WnjeAVJ8Ur86oT5crYf1pt7nzxv5D QYT2KkIWvo5BsXUBS7xufqyz28v+EvuWyb9kKLq571SjVT2ZKb0L2V3eyt/uGyESBW4f SJEXzCBCzwWX5jI2tNwGmCGeWwnG0ee6HQU352l8EPs+59JG5BwuCiYHUoKNmKSBQxBx Qq3toQOGFCDzNAyx4FD2czgAAhV1nfrybKHqIViqlwULypFdFFnmbg+OpqaKNHm+4t2F pao0xlR9tSJERaZZj7GuP1yF4qr7EfIjS8Y+w2ZbmOey26Lw9sDnohN7XLPPoqUXPShW 5f/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=rUKl9EEy; 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=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i7si4965008qkc.237.2021.06.11.16.40.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 Jun 2021 16:40:51 -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=@linaro.org header.s=google header.b=rUKl9EEy; 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=linaro.org Received: from localhost ([::1]:41798 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrqle-0006WZ-C3 for patch@linaro.org; Fri, 11 Jun 2021 19:40:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46036) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrqez-0004LS-8m for qemu-devel@nongnu.org; Fri, 11 Jun 2021 19:34:01 -0400 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]:40870) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lrqev-0006RF-5c for qemu-devel@nongnu.org; Fri, 11 Jun 2021 19:33:57 -0400 Received: by mail-pg1-x52c.google.com with SMTP id j12so3661017pgh.7 for ; Fri, 11 Jun 2021 16:33:52 -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=L6RrcWlgVuAFENDyacE0KjBTR0pJOEPr/5/f08fEfIA=; b=rUKl9EEyXQcfIHb8PvbvYX2P7HOn+W4/XI6f1tQo71ltRby3NKZ9xHWB8CJ5NbNOCq MxUfvQHCI/J039jUSt5Q0EfrDb4URCpKwqu8tHYV+7ErWlOamYdVozarm6v2/SSdVCbq +LXNDf/8hPnT9tKdbDqp/UYugZB37dZ8FhVSP0B2ANvnTUxhsgO6Irv05TCDdGBRJ8Qy IfAok3VPspOkdM9ft+GppkpdCgjOONQ1RoUhJh4sFHLkKwVdoa3gorqyReOaRJ9dFKD0 U/sqwxTk3Cq4Q7PPBeUswF5Kd3XbIBG5uKfvz4TAZPOLXazwKeZ5CMowqKkyk4Bgx18H 5e4g== 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=L6RrcWlgVuAFENDyacE0KjBTR0pJOEPr/5/f08fEfIA=; b=Fkb0TSUJzBW5GQKdJQ4xJZ48BQHMNGZs4szMI096126OUeU3hAILvFAXxo9cxlsQ5t /8A1XkRHEQsBcHG5xwnte+pi4ELvZwZQAnOg0ANFPshuv0ZlNlEuvuF7hbyfOchswOU7 iXsQt32lbj6mdKwdVfyWX/K+IBRHpG7G7cnSXEUrs12XQ9zWCnztSvSRdirR0BALvgZv A5YtU0e53TmbCEHH9yiQ0XFbmh/bWPCRrHlGLOhzuIBzUw+uGmu/dKEYzJ08lqNLOdcx 1h+35tGTKI9znu2i1YJIihiHNziSabjqovHDO4elYgPC04GDZrL8pQdJANYqioXPHXly VOVw== X-Gm-Message-State: AOAM531V5r41u0W7AeQpoe4qJMzwKEWEywk2sOSRxXuVwX73z4+Qjt+s nUK3hcxmsoTT4eIFUY7lBKQLCjUoIAUw3w== X-Received: by 2002:aa7:8119:0:b029:2b5:7e51:274b with SMTP id b25-20020aa781190000b02902b57e51274bmr10651672pfi.32.1623454431728; Fri, 11 Jun 2021 16:33:51 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id m134sm6349606pfd.148.2021.06.11.16.33.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Jun 2021 16:33:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 6/8] include/qemu/lockable: Use _Generic instead of QEMU_GENERIC Date: Fri, 11 Jun 2021 16:33:45 -0700 Message-Id: <20210611233347.653129-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210611233347.653129-1-richard.henderson@linaro.org> References: <20210611233347.653129-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52c; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52c.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: pbonzini@redhat.com, thuth@redhat.com, ehabkost@redhat.com, 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 --- include/qemu/lockable.h | 85 +++++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 42 deletions(-) -- 2.25.1 diff --git a/include/qemu/lockable.h b/include/qemu/lockable.h index b620023141..9118d54200 100644 --- a/include/qemu/lockable.h +++ b/include/qemu/lockable.h @@ -24,19 +24,6 @@ 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) { @@ -46,57 +33,71 @@ qemu_make_lockable(void *x, QemuLockable *lockable) 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)) +/* Auxiliary macros to simplify QEMU_MAKE_LOCABLE. */ +#define QEMU_LOCK_FUNC(x) ((QemuLockUnlockFunc *) \ + _Generic((x), QemuMutex *: qemu_mutex_lock, \ + QemuRecMutex *: qemu_rec_mutex_lock, \ + CoMutex *: qemu_co_mutex_lock, \ + QemuSpin *: qemu_spin_lock)) + +#define QEMU_UNLOCK_FUNC(x) ((QemuLockUnlockFunc *) \ + _Generic((x), QemuMutex *: qemu_mutex_unlock, \ + QemuRecMutex *: qemu_rec_mutex_unlock, \ + CoMutex *: qemu_co_mutex_unlock, \ + QemuSpin *: qemu_spin_unlock)) /* 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 * - * @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. + * + * Note the special case for void *, so that we may pass "NULL". */ -#define QEMU_MAKE_LOCKABLE(x) \ - QEMU_GENERIC(x, \ - (QemuLockable *, (x)), \ - qemu_make_lockable((x), QEMU_MAKE_LOCKABLE_(x))) +#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). + * @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 Fri Jun 11 23:33:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 458528 Delivered-To: patch@linaro.org Received: by 2002:a17:907:7409:0:0:0:0 with SMTP id gj9csp701628ejc; Fri, 11 Jun 2021 16:38:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypWZ7F6M4nHQoccREQ8hoc7uCucUFVVhyuNASz/Z4I55ZHA3DOrGFrynhifSL5aW2jJlcM X-Received: by 2002:ac8:7289:: with SMTP id v9mr6079286qto.282.1623454682996; Fri, 11 Jun 2021 16:38:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623454682; cv=none; d=google.com; s=arc-20160816; b=0cTAhPnLf0f9fWwGkPIzOYbSw8MmAxpFkjdwGH7bj31O3JdriaLFLD9O/i8teogE63 5gNuvcbsffPKPEJIHh1dx72w8G2UINdqE58kOF59I8ONTRB0jaxP/6Qof1Nj2KZDFPM8 JhtN48czwwD0AHUkiEipTPs2+Dcba0cwlQOtdQkotmqi6Jv3KYi3k6M5u7STwAedYrTd sriNlyIF5mjjeDLoRv9w9lkAANSHQj8drMd2S5MPD58OKnk5Kyqw4+kXacPJBpt1LzvB B0wmSaMkeBGpQvWmoC+95CieHR8ADqXS1v7zsSJP7ZnlnmVB1dLIHgPaVevBZVjAAinp BStQ== 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=RxSlL47QCgmK8Iv/OFfxyjnBl/oZ5mr2j/ZWvknI6kU=; b=f1BQNT37cXELcRVlxCCeKFvgekGBi2m9gKoeeY4TUW9otGLYv5dXgDsJGhNHKQs0bN 4UhbbF3+MdBFsHLnMqZCxhlUXE7xyp6TRnwRjMIfiro+1S3IBPSHqh+/KJrcvi8mff1J tlA8REeGSgeOOQaw0h2zvwP5Gz3xhdNfiRbHRFeo7BhRb+nbFt7VEaCR4BQuhodQpsHL kWRs6JQn5C4LaHVE/zPSN0mF+FU/EM0hE2q54Ijjy7HcPgxvBF8B1CdrK/ZqSvIfMBKC soaS+DHCNbGLh0Hww9/USr5tUtMhY/uD36FC2gurxtYeVu0JaAiMjdcbemZGDBNHYOeT PbtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=nxsIGjv9; 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=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b9si5299398qvv.185.2021.06.11.16.38.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 Jun 2021 16:38:02 -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=@linaro.org header.s=google header.b=nxsIGjv9; 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=linaro.org Received: from localhost ([::1]:35188 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrqis-0001f5-Eb for patch@linaro.org; Fri, 11 Jun 2021 19:37:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46022) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrqex-0004IV-Aj for qemu-devel@nongnu.org; Fri, 11 Jun 2021 19:33:55 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:39527) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lrqev-0006Rc-Is for qemu-devel@nongnu.org; Fri, 11 Jun 2021 19:33:55 -0400 Received: by mail-pj1-x1032.google.com with SMTP id w14-20020a17090aea0eb029016e9e0e7983so179152pjy.4 for ; Fri, 11 Jun 2021 16:33:53 -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=RxSlL47QCgmK8Iv/OFfxyjnBl/oZ5mr2j/ZWvknI6kU=; b=nxsIGjv92sdm8ViNINgPIcps2G1dt9JkIDKiyAaCsZGZ9RGvK/C8s2pScqcKGNbyxo dHR2qmJU3vFQ2zT3Pt3uXnIcdufx0YMLRMDfOp4CmBjKjCNEnssMQeJrvYKZp7lg3cpx FmGE5xuW5+9fmBpxQa0SqTeKYG7MPn64ieGywBWK99rJ97UGsxg3binbqC6e5osSwXsZ OyLuIQ36kcrch5CfbDhfIH9O5KeBUVrDma021Iv6UBXhOfiBeftJgLAr98U7w2Br+GsF anVs8AZENYJ3xz751aqqxEPTWP3RDQjZRprIZDcponY0E6dJ0NPJyocI/pqkNn0FMLZx 0ATA== 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=RxSlL47QCgmK8Iv/OFfxyjnBl/oZ5mr2j/ZWvknI6kU=; b=WTKQD4xlbOq7o9VgYeerlh4aXdLCr8vIo7cnLHr9G2mYJxe9iDgmTc+GaBZC0Xc5vm 70QxLstmlDvyWtkjkNP+gopllj9EpT/tKWPjgZ//dyFEMmeQMzc4dbjtNDpB2YB0BHjz EqYPKl6p2DrJ4eD03F3qcGCy5mjHC8Z5ScZsT9sAlPrBHvRTWLcBGb2UoJUOJvOUs1wL CQLi0qxNnkxkAmQUa38ecnG2Jo3GdS9x2VeJJpxNqp+mSDz4w94v+X8EK1dkS/NyjGvf vE5BFmaepq21mfyPeEQDmhxcB99J4X5YcmJdMatgLVsFJz51hb9s9SmkqcdKaSfR98vL w4nw== X-Gm-Message-State: AOAM5311aBEQiREh77sL4aqSy68mgx/L17BMcnxJPNUIXtgUJslbySst qu/5v5K0MHdioGXCbJGOQMuTOWzOn/z9rQ== X-Received: by 2002:a17:90a:bb97:: with SMTP id v23mr6637529pjr.148.1623454432236; Fri, 11 Jun 2021 16:33:52 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id m134sm6349606pfd.148.2021.06.11.16.33.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Jun 2021 16:33:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 7/8] qemu/compiler: Remove QEMU_GENERIC Date: Fri, 11 Jun 2021 16:33:46 -0700 Message-Id: <20210611233347.653129-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210611233347.653129-1-richard.henderson@linaro.org> References: <20210611233347.653129-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.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: pbonzini@redhat.com, thuth@redhat.com, ehabkost@redhat.com, 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 --- include/qemu/compiler.h | 40 ---------------------------------------- 1 file changed, 40 deletions(-) -- 2.25.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 Fri Jun 11 23:33:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 458529 Delivered-To: patch@linaro.org Received: by 2002:a17:907:7409:0:0:0:0 with SMTP id gj9csp702808ejc; Fri, 11 Jun 2021 16:40:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOaak/880gIt9l5Yfye1OEUsxxHKsBJTGggvxbRoRpt8aEF1ZcQZ3Bf0eL+3/bDMIOi49G X-Received: by 2002:a37:b1c3:: with SMTP id a186mr6479918qkf.17.1623454815186; Fri, 11 Jun 2021 16:40:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623454815; cv=none; d=google.com; s=arc-20160816; b=UsGKbjIurkRneTTQiADgnLUBkVfIXXc6l7pXHEdfEPJrkLOajTlHY6WpcfiRjWl8CQ wCG3REVzJ0z/cL8s7zE4wr5qG0T2hPrP5RTEa+/MAM7mLmta3oIoSDdUavN/nXx/5cWM rvzM+Or2aZ4QWS35KrUueG8KmsynY8JaoxJ/ig9QAaO4u85qfbps0roHlK1Or+G6P/bP mWTAVGsLQMf4bVZhej36QSCDa+/lB5ROU0Z0ZY96QTbTtDJcCP1K9JYhGz8h5uHyreI6 LkcBY+zlwUYhBf9q4ljtyIoEKZUDDH7laCrxci+rXLxHrrJLy8DqMZFtTXIxGyn6BXPi Yycw== 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=nRR9KHmD8NhDhTioChPzrmiqVDXgs8pN4GRxP0NDr8Y=; b=m51vkahmPzi69Aj/tiu9QHDwUBME4CNV80YJCJOxWiIwfAfN6V6jpXkzwmBbcQrYGM Jn6z7jlzE0w2CJwmp7+vYWyvAFDBcsRDZ5i22bFi8Xd8+WyIR5AxJpDi3XAlHMS+9WBA NVHqMAJPwQ3vTkoBbrJmOeYS8kfslDnnJ9QK8SyPMFQ+azLmsG3wyUtG3mqSd7msxZxu /GA7N7NZwW16jlKaHzVmADhJjMNQ7w37UvaamrXAkMhZ/122L7wC8bRlA0AV379aJIXe mcR+OB27garF34cDU6feI63tJeUU2NPS8F5FMHxXKShwsQkRvnNHQUwmwP6R2zHAuRjC 9YVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=uRtH4Hic; 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=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g9si5433462qtj.328.2021.06.11.16.40.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 Jun 2021 16:40:15 -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=@linaro.org header.s=google header.b=uRtH4Hic; 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=linaro.org Received: from localhost ([::1]:41740 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrql4-0006Ue-Fr for patch@linaro.org; Fri, 11 Jun 2021 19:40:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46038) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrqf3-0004MC-Ke for qemu-devel@nongnu.org; Fri, 11 Jun 2021 19:34:01 -0400 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]:34729) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lrqew-0006S5-SW for qemu-devel@nongnu.org; Fri, 11 Jun 2021 19:34:01 -0400 Received: by mail-pg1-x52b.google.com with SMTP id l1so3673246pgm.1 for ; Fri, 11 Jun 2021 16:33:53 -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=nRR9KHmD8NhDhTioChPzrmiqVDXgs8pN4GRxP0NDr8Y=; b=uRtH4HicOZmL1KR8gv9QHGbNpJ7clgkqCXaizlmNmkddJ1TeiCJh9LwfOfToVgDp9s Fk6t/8OWyLHT5hT+vXSQpm0bsYtbjV/aBz1Z7pBjuH/VrtLsO0AnGRBomPMC2AhmTQva MJavNS3/VZAB20oJZhsFvjGu6TeqMldneq5x8/5/1Sw1ysoCHCBTHbMfLe4OM13g5dga nYkcmghmcFQitriSJCoUFL5rEoNdDeX9ZMu7GyZoPwYiwzd9kI8YooRXVYWjrCuZALnj ceLZ8RBjK0kNeb2en7vTN7r7slInCqhu57hHCsXA9/DfjtTsPpAi1jdDxJ2gqm6p3dgh 86CA== 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=nRR9KHmD8NhDhTioChPzrmiqVDXgs8pN4GRxP0NDr8Y=; b=DMePmTPQdWfr0ZIY4PjUQ8e+0dyPu4/tliWISvS0B1vQIIy0gIlgPquMk42uBZRDPS UGwnklJ3E+KlLWF2+oA+y0YdiVmcZ00dZfplr5P562K3CM6gJ20LZIjknMNLeeHtmDQj b52UKC/iQ7PgtqXVSRNus1u1zvM+qiCg1MOmNKENp0Ksqcm+b6yrA9OMK1Y6OAFJDoPX U6hc25lK4l6gukWB/0TqVaAy1zc5t1kLPzIYgVAnxOnyZG9xnc1O0roYqCEsLfA+TsSd 1iPXsrwyeJGYKYEoLYivAC/levCiAfNfzIhg4/+6usXOch6Us76lDK+XRiyC3NwZVVwA CDiA== X-Gm-Message-State: AOAM5319aXm6p0C+FqEM69A7WHMItNphECzu/+N0k6ct+4xT02DPE7RL mOaTUWcN2ctPRxwRfs+HdYn6J+5lWyQjkQ== X-Received: by 2002:aa7:8b07:0:b029:2f7:d38e:ff1 with SMTP id f7-20020aa78b070000b02902f7d38e0ff1mr495787pfd.72.1623454432821; Fri, 11 Jun 2021 16:33:52 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id m134sm6349606pfd.148.2021.06.11.16.33.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Jun 2021 16:33:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 8/8] configure: Remove probe for _Static_assert Date: Fri, 11 Jun 2021 16:33:47 -0700 Message-Id: <20210611233347.653129-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210611233347.653129-1-richard.henderson@linaro.org> References: <20210611233347.653129-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52b.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: pbonzini@redhat.com, thuth@redhat.com, ehabkost@redhat.com, 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 --- configure | 18 ------------------ include/qemu/compiler.h | 11 ----------- 2 files changed, 29 deletions(-) -- 2.25.1 diff --git a/configure b/configure index 0489864667..debd50c085 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)