From patchwork Wed Jun 16 01:36:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 461335 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp113952jae; Tue, 15 Jun 2021 18:45:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyszMic5/xbPGz3FxOfxXKDl18OHHphn/93iupHbBzAytXsOCD6a6OzBWOh9rzvs6nsFPeg X-Received: by 2002:ae9:e910:: with SMTP id x16mr2690196qkf.397.1623807956340; Tue, 15 Jun 2021 18:45:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623807956; cv=none; d=google.com; s=arc-20160816; b=KO6b88O3383V0lfpHYSfoh+PKoCjds8OSuZ+/MaUb4BV9RHGp+txcJHd86yaX6TlKx /96Z33XMovf4JZ0gJ2a7GVOSPUSSK4SEN2L926Inuz0jD8lveK9ZYMiXTkZKDZsvrErr GoM36ZFzbbH7R1U6+QyMsf/2QjkUSF7Am0AX4a+WwxgYzrLvVg10TBTdiXF0kvgQMDRn tNvuzb7XJYXSKf1k/oAq3DCdC1dSd2EbWoRm9eFoOOX/5kBY3RdPnrZjzWX4PlPhySpO TAkZU3su59fdVbsbBt+cj9nxYDIesKZzQYvtwZIw75vRtekAia9ukZQMwZPrNzASd3bd QIZw== 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=GCKAdANmH1Xtpoehzhc4V1D5rmsyIp28yEK3SJRUGT4=; b=NIMF4rQGyvXM2mbQL75AVwJRBRlTYudoCak7dfwYO+rhgtLHz00qQptkh2LNIBsYnJ y1CDxZ1nWTF95L83sIl6d4VGnO1jqA7D236Pe4dAEDgnCZRFZTd0fAV7WAtw6GO6/pyH eMQZmOSeCpM4rOGhqiVI6CQ8W9ZcUlPKjMn8G0C9eOxJy2lVWr6eSaV9LPdUEoyuWZ7+ /doVC1WGnohIRptAygINi4MdiYlx/mhduSCgxEeUU0ahD7x1nXOhYtRHzTrDnJ2OirVl IwMAhLMw9SS3E4wyuVvypjQxUb0S/86CM4d4H6/MEZhyTFDNNEyplXbuLmmxTamqsiOa KWFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="lIsbNkz/"; 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 r25si725859qtf.275.2021.06.15.18.45.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Jun 2021 18:45:56 -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="lIsbNkz/"; 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]:43740 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltKct-0003Q2-O7 for patch@linaro.org; Tue, 15 Jun 2021 21:45:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55462) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltKTq-0008NU-FH for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:36:34 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]:40493) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltKTo-0005ak-KC for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:36:34 -0400 Received: by mail-pl1-x629.google.com with SMTP id e7so284979plj.7 for ; Tue, 15 Jun 2021 18:36:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GCKAdANmH1Xtpoehzhc4V1D5rmsyIp28yEK3SJRUGT4=; b=lIsbNkz/tbwdbAQAoD4l/RtJs/D5/pBwaQWAOHmAp44xMeNyC1MgNRfK+XToB64giW gfmWSRdb9HULUZCc/r3WU+6eQdMAvBuxZ6DkMP2I4VmYbLxBkP+c7Mg75UShcju80f3z QpZswWTuGH4Rp2qRnQrhz96O673+ZtosQYGFdJ2Ewmv/sNX1Sy6Z391W+PGaimE8zlHq Jj6FRtNNhUijG5kEOhYrtjmxyEiayd7BakE/HOmYGti3UUpegE7Ec9C/2ULAKsp3EzJE nEqlBQDGIVAi3C8RHuKbZrXY9FDLdFU44afeuKRcYJoCBJdVO9yb7GQIqlrNSbSS6Xo6 guLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GCKAdANmH1Xtpoehzhc4V1D5rmsyIp28yEK3SJRUGT4=; b=HgTFpBIR5U2sflXi1nGIXobePNuTR/tkSto6dFBonq00YQcXDlowJEROazfophC/15 RDM+ECIWWneNKo8a+tA27kucGSMZGqg+N6ekPUf8zuPqq5HD6NEPT12FHXePUMJsopML jZLRogiaK7Y84EVKcVnQMFHY19Q8v7B8yv6UsnUtFKPWqVofIf3CEErKe6ocOkJWL7Hs 23ZyDiUvNU1ev4f13qxHZKHiEz9zEn+65EXeHrPQdr2tVMD94Te+0vm8WfJZ+xNi/ivA 0uKpjVPYZQVRXlgZNJh9tbYIi5vG6txC94BbVwjuhvMI+/t6cBAritr5L1cNo1Cek78B c8Ag== X-Gm-Message-State: AOAM531JsJV0sUzbUTCgaNpVupcBv49Hpb1DB/bvAB3VeAgQ8wTI6ggN m6TCPhEZV6j2xe4z78svW0zpuGnCOgQGVg== X-Received: by 2002:a17:903:2311:b029:115:29a9:a3ee with SMTP id d17-20020a1709032311b029011529a9a3eemr6799238plh.46.1623807391361; Tue, 15 Jun 2021 18:36:31 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id o1sm321595pjf.56.2021.06.15.18.36.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 18:36:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 1/8] configure: Use -std=gnu11 Date: Tue, 15 Jun 2021 18:36:22 -0700 Message-Id: <20210616013629.1458790-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210616013629.1458790-1-richard.henderson@linaro.org> References: <20210616013629.1458790-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , peter.maydell@linaro.org, Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Now that the minimum gcc version is 7.5, we can use C11. This will allow lots of cleanups to the code, currently hidden behind macros in include/qemu/compiler.h. Signed-off-by: Richard Henderson Reviewed-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Alex Bennée Message-Id: <20210614233143.1221879-2-richard.henderson@linaro.org> --- configure | 4 ++-- meson.build | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) -- 2.25.1 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 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 Wed Jun 16 01:36:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 461330 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp109078jae; Tue, 15 Jun 2021 18:36:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZE7bVDftM/YFMOBsA5Etd/rOrQy0KYv/ESy1MZ7B7sNIx3rrTPLTCJJ/Ej8X5UH2oou/M X-Received: by 2002:a92:d902:: with SMTP id s2mr1663778iln.278.1623807418587; Tue, 15 Jun 2021 18:36:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623807418; cv=none; d=google.com; s=arc-20160816; b=LYnEA7ItiLawBT85kSHKx2kMzBcSUcokITqN/82ptuHEKNMnq/6rowndYGg2ENSi1G MBf8eMbakpP2y+JsxyEzytdpAanwHTqef885gqi2qMUBqiAB8jxlqkuZEYvvZ6PHu0pK Hm4MH0bfn6zORzsUWVQGOf2GoBmQAUZf9yi5AuebMu0i0b/2b4yM46B+c37nX4CISoTN hyOP+9jNqGA0yDW3ClwLnAdLHM37vFAwnRjA7PLiD5odOnxksevwaQiGXsXmCEcULUFz kZBdDdjcz4xrOkVilIspEt93bdXtpOsvzpORkgWwuLqybbwQHDPw4EaL1vAvo9GhUIE+ Jzbw== 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=wj8nbktnS3Cds2QIKMNmDpFap8ymbqZ5pXLd4Gca9Xw=; b=JM835ZKqOLlE/u6rxG/5DQWXuDFum6k9Kl1h1w1TTVsp59B42+1wxiKcySNpL/KnnA ODFBZuuoV4fKL+Lgzb33G6JtAl2KwzHlmv80M+ca9CvI7Nj0BkmSX35KzHsflnTp5rcJ MUdlCx5gr+pFh+X8KL+REqjTWrQ3i/lDNHgdFWA6BVpmqHYodMrvjq8U8oksBCPzLGku xfbppSoo8jN/8TsQGJ7JVhN2XofYI8joVy7iUGT8i0qjuL3T2nobgMIqf8q4JZBYqTYo SFKOIH5XFnB8jtH0ci8vNbffA5+wRcIl//3WARQM1fqBp+nv2sS3YFjZgeL9NLXvLSG1 FPPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gvmw9isz; 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=pass (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 v4si946437jan.104.2021.06.15.18.36.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Jun 2021 18:36:58 -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=pass header.i=@linaro.org header.s=google header.b=gvmw9isz; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:55026 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltKUE-0008T6-2p for patch@linaro.org; Tue, 15 Jun 2021 21:36:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55486) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltKTr-0008Pw-EF for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:36:35 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]:35336) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltKTp-0005bM-9A for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:36:35 -0400 Received: by mail-pj1-x102b.google.com with SMTP id fy24-20020a17090b0218b029016c5a59021fso3013059pjb.0 for ; Tue, 15 Jun 2021 18:36:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wj8nbktnS3Cds2QIKMNmDpFap8ymbqZ5pXLd4Gca9Xw=; b=gvmw9isz6VXpNdcl0Qe+pNodDzBX8QNL2bWGXfx/4x66MVXIzhp4HM0UKGCb16RxV2 PIyKSW7wwpm/J+z1fZeNYCZp0xGc4h95x+nDC9Qz4dHzZug6ZmulJFo+xUoWuXVPUKu5 Bmc4OXF/rrqX6LVPkRERESY+U15rT9gMNFTkWx+Ju/HZFpTiLshUyU4c+chJ08q/v2hu nPI/abLEJEX9rkBAUYBVp+tVzQaAdUj04Xt/BmKo+ts3zf+V5ShtWGTe9Ef66v51Dp0j A9jlJV5d9dlgQim9q1j7Gxf54OaXmmer9B9IfNUUQJd/Kt5YPb39URP+F+yLY+JlMtdb 3aIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wj8nbktnS3Cds2QIKMNmDpFap8ymbqZ5pXLd4Gca9Xw=; b=eZgzabsUnkYdelDXc1K6rjK/pl+2dyOLwfOnbhjMK+7Twf22HU9EU4qhcWQ18U8eZ0 m6i4fHKbDA0UR0x31INbqTsIL8fb+yAvCkwz6EwnSsFrWgA8EAMJSvLh8440EVRqnrqw Un6BeZZtkYwEDHeuD4Vu1zG0ImlzLhCet2JYylhTOlBEVRQXbceyld0DwyEw5ICO2o0R O9YRXBKJjljkgprH8NgfEb7nui9apEykztQvuNQUDMrhGQwzyWaTS9i8Jp2tn5/WFppl EN5oGTxJ2vAxPegskF8ca7hvs11azmlTl8A5S+5w9mwGJRu3XxSYELHRhMUrkkdrKdzz BTSQ== X-Gm-Message-State: AOAM533fIdDmpTxZWAtSG59AvGH6FCo9unLcG83n6uUquPExTSMi+lTg X9/Dd7rhpYQVSEmGuBJV5fAR0tsFeO5M7A== X-Received: by 2002:a17:90b:1489:: with SMTP id js9mr2171321pjb.227.1623807391881; Tue, 15 Jun 2021 18:36:31 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id o1sm321595pjf.56.2021.06.15.18.36.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 18:36:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 2/8] softfloat: Use _Generic instead of QEMU_GENERIC Date: Tue, 15 Jun 2021 18:36:23 -0700 Message-Id: <20210616013629.1458790-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210616013629.1458790-1-richard.henderson@linaro.org> References: <20210616013629.1458790-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Thomas Huth , =?utf-8?q?Al?= =?utf-8?q?ex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson Reviewed-by: Thomas Huth Reviewed-by: Alex Bennée Message-Id: <20210614233143.1221879-3-richard.henderson@linaro.org> --- 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 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 Wed Jun 16 01:36:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 461336 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp113950jae; Tue, 15 Jun 2021 18:45:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxblRQ4TREgpBP8UB5JRpm8Fgd0aKnJbvmNJsgPwOVhfDy70LYcN/QSQ3U1blONH3JCZayo X-Received: by 2002:ac8:1483:: with SMTP id l3mr2678359qtj.142.1623807956275; Tue, 15 Jun 2021 18:45:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623807956; cv=none; d=google.com; s=arc-20160816; b=gSKR4aZyaBpgvQP/x+YOZoxsp0TVPPWsY/uPgYCLHknKAwIket8iH1drAJY53tdcyH IYb3k1EZ2WR2CUQH76qjujqo9eAimD4EDTGCD482fvpNdbSSS3Gt0ID0+sTT4W/EIOAW xaXgCh6KvpWO2dd3Ymy8nuo4lFFvp4E/+WF77koof+d3Pn2gkxUghl2N87XkWqRA2MIq 0qyExLd3h1echFVZSSZbAVGhj03kv9y1DRcpQhAJ7cObTO2eWO7i9EXFLPYyhxLVplz+ 8QtC2XOvgl+UHpQ22xmdybzuAjqlcfWdlvLd1/tX7P/UnSke8mu/7oKKICjTwdtk88qP qg1w== 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=v2Q2PinTVeLpRWK/d/K2BOFcE5jaaej7n/lf1RcDS40=; b=tkw9E12IRaqEIxaEog291NkH/GFevdDOYtA91mUfdxZSy9XRDA8Kw1pkpJcJnJUun0 Druzy/57/ohQ6d+jNsf2CiK3csHonpeUiL+O5ZDvqxQWka8iCr2IIC5RU6X2z6Vs+B0p BMvjSLuGkA+RyNIlFmxVrb+tP00uaNXnZwK3zRoNwQMoUm1DUNsoCpthX5jiikgUNCC/ l2W1CZAYIHrRx3VvZKWJKUmikhFAscIOFIG/XIodamAJ+uW3ee1r9M6yRK4HFVDxH1xC vD2BJ8iJBaMvCT0sIJAi7R0W8YYW97N1fZljVAAag0dD5tyqpFGNwgR5r7bAAVwB8LbR ynTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LGkk6uSf; 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=pass (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 f3si561729qtx.82.2021.06.15.18.45.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Jun 2021 18:45:56 -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=pass header.i=@linaro.org header.s=google header.b=LGkk6uSf; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:43732 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltKct-0003Pw-LE for patch@linaro.org; Tue, 15 Jun 2021 21:45:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55518) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltKTs-0008SU-Ti for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:36:37 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]:44807) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltKTp-0005bz-PS for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:36:36 -0400 Received: by mail-pj1-x102b.google.com with SMTP id i11-20020a17090a2acbb029016f0cce7c3fso564202pjg.3 for ; Tue, 15 Jun 2021 18:36:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=v2Q2PinTVeLpRWK/d/K2BOFcE5jaaej7n/lf1RcDS40=; b=LGkk6uSfiF4MCnhFmtSFU0MzFPsQDe8MGWudr80w2QoSOLScfH+e3Oh6oHuiSbfzWj 0dLxTg1BuliJOJpcxvBJcDeUffpVu6nqwUDbiboPiSioph5bDCPqWAnpsmhsskROyYAK YgWsjU/vjTarFv5+LFYN5hS8D9YoWX01vfzFe7r+zbeib/OINbsR/cLAr+Ls3b2FPngE F/GYj679lcPsVnwW6St8K3Z0Mx+8NZHGpX0oJAulLfVMZiLstp8aafMVe9DYESnVagqw Wz5EMlhSIEtwR9RDvo24uApEOqaG1/l90tnlV5cunhJV0h73KZ8RaEt5+71UAElY9Sl6 J8jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=v2Q2PinTVeLpRWK/d/K2BOFcE5jaaej7n/lf1RcDS40=; b=mSqvoZ74toG/fOauT9GkjU9ml0UNNE+kN7ktZ18N4GPru8/Ap0tD7yxMrCzFAC56qy 1HNKAZSuk4Y3k+NxFgV5IV1WNjMPYjvCCdFy7kRxDZoixvTTby9DEdJZKvwhW6VpCKRm PJJUws07SPI2zKPM7tIda0eTbj23D53+tH1eK7qMT59c75VoLHMF/VBv7uNPoeHvN8lP 9PRhVFtpNEcmJHXhf6o+SmhqIP4wEfhWYgJ6ibDrGh9T6lB0Df0Z5KAcYHzS67ZvuATh 59qlqcObQ44G/+jF41dxrQE8Ul75lOFUr0VrkWVF6vZXHBhbFuAqPZ1myya04WaA4B2N 8PEg== X-Gm-Message-State: AOAM531Ji7gCl7U2gXIePlNKDmJu9MVEtaLNOXRAWi9G6Iv9VDs+x/TV cPpmA+ucX5WZNIWaKVpmFK/HMHNLByVrqQ== X-Received: by 2002:a17:902:f283:b029:10d:e7f3:725 with SMTP id k3-20020a170902f283b029010de7f30725mr5210996plc.45.1623807392547; Tue, 15 Jun 2021 18:36:32 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id o1sm321595pjf.56.2021.06.15.18.36.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 18:36:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 3/8] util: Use real functions for thread-posix QemuRecMutex Date: Tue, 15 Jun 2021 18:36:24 -0700 Message-Id: <20210616013629.1458790-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210616013629.1458790-1-richard.henderson@linaro.org> References: <20210616013629.1458790-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Thomas Huth , =?utf-8?q?Al?= =?utf-8?q?ex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Move the declarations from thread-win32.h into thread.h and remove the macro redirection from thread-posix.h. This will be required by following cleanups. Signed-off-by: Richard Henderson Reviewed-by: Thomas Huth Reviewed-by: Alex Bennée Message-Id: <20210614233143.1221879-4-richard.henderson@linaro.org> --- include/qemu/thread-posix.h | 4 ---- include/qemu/thread-win32.h | 6 ------ include/qemu/thread.h | 9 ++++++--- util/qemu-thread-posix.c | 20 ++++++++++++++++++++ 4 files changed, 26 insertions(+), 13 deletions(-) -- 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 Wed Jun 16 01:36:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 461334 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp112373jae; Tue, 15 Jun 2021 18:43:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEqRwaQKRjpT/efdAmTJ4fS4kIpKlBBICUW5XvGN+bZBFterP9b3RF6jpOLpWvDco27/rY X-Received: by 2002:a05:622a:1751:: with SMTP id l17mr2603186qtk.35.1623807802111; Tue, 15 Jun 2021 18:43:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623807802; cv=none; d=google.com; s=arc-20160816; b=A5kH1yOqQukWqYcoFvSLzBaOJGZ6s2BZ438zmzJiwF2Oym/c0rqueVrQs1zO1TJw/9 garpLny/n1oQeirGZ4Rm9lc8PkjBV2kZVHAuyTjj3xowUaF17NM+Sn5AA43VeC21s1bR JRVLPYcx+0Q4OpIT5CQPklltdHT6KnH89nMDqFApvz/4L47e2qjjfpMTBnO7g+hfR40E Gxyjb3PClFjxO4SZEf0VziqRY3ZHyCYF9dqeFV5xcbZdbxrXy1xyYqdHG9M0p4Xn/K22 DdCzdwF5zWHrJchndPI//dhvDEieZr7y1Djr/BQOYOL5D2QNAXh8U5iKqBA8Qs1TzC3R 3XCA== 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=cCqC17CoPwFaX7KxGxIz9kq2bVuynqUQa02RlRXcupY=; b=MFd7JN/nhba/20v1KiyttmF+WDNJFQJO9oHBgEYFnVmkqst8Ca3V3JrGeSRPlzwKTE G9DLukkTD6cSU5aHjTG2MkXbozZM4208SRUe52+88t0ahyWmYF5wuZPZnC5kEbGVdIx4 rKQRSPdJrD3TnSTt39cekSUN4yk1ioYaz36JGhXs96FbQe+J7TvMidGOTPH6+ZjeRiYZ RikwStyQhR0ZdYbOdAAYdij2IQyKPDErR4Wk1zKOUrAYKBzisR5TGNjt5W/Fm26i2Ibv XGM9VtI8epXO/ca+FAJ+3iP5dJSEasgo/pe8qyrKlqCRLohbXw9ax1C2ti94TuGT1Wx1 qR5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=xAJbAXqK; 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 bk17si473936qvb.78.2021.06.15.18.43.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Jun 2021 18:43:22 -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=xAJbAXqK; 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]:35184 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltKaP-0005rX-Gu for patch@linaro.org; Tue, 15 Jun 2021 21:43:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55508) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltKTs-0008RT-DR for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:36:36 -0400 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]:33440) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltKTq-0005c9-KU for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:36:36 -0400 Received: by mail-pj1-x1030.google.com with SMTP id k22-20020a17090aef16b0290163512accedso2775284pjz.0 for ; Tue, 15 Jun 2021 18:36:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cCqC17CoPwFaX7KxGxIz9kq2bVuynqUQa02RlRXcupY=; b=xAJbAXqKg7S+v++P0gxg5u5wPPlL+G3Tz4FCHy5B7XauHJoClw9Iwxr0FUMECUpIis h+Qqao07B+iYTNRLgg21dA2Vr1MKqzDz/epmA2Zn6mpRRLXzJlDHkCn+s/KdhmQtmAxf PzSvTE67b6U55avin/xa9AyPmAhm1wfrSMYRe5vWCr0kgUOvqsriPKqhDEPNNNwQhyqg vsv3R0adxyeUxkgNIjA03dvags8ahi0oBl3jWBFX0TeE3z05Rdl3VrUv2FqOK4FAfuho hwFN05fbVyrMjxw5K3Z6i0x0P4CgyW+mqOj4Zmq/EI3/ZBlA1Xhl5Px+EyBRpficbdle YxaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cCqC17CoPwFaX7KxGxIz9kq2bVuynqUQa02RlRXcupY=; b=jKrRi86ztziaT3tUdXbS9XOUEL/C+I1VQHsSankodniCIFkRoPnmZO/5mslgt0bVo/ acv5REd/ibW/8gVWSw373lBMHiuYKgrqGfDMD4q7in+dfyeB94AwH1eeviHleKSflHy0 NMi1LFr0UimCz9ttPYBp4bkFY2Bbf4fHFW7nSWdZvUb29e4Dpy8KflLGYLIaIA7XaK1X RVF2WeyCP5y5jNETizczFciAS74lPiuuRLVQ9VErt47/hxLVBaHji+52MnI/LbkcLk6p 8ljcaZIAY118aqyKKFpFvPyro2GdGBI40LpjckqGWLPboyBtCOuuAbVXMyJgau8jLIq1 O+Tw== X-Gm-Message-State: AOAM533uQEUVx91SVyiohmfbiaI7qBHjsgonwRjeu2CEYToLvWqdo5Ip xEdwHQ2oguKYeWoeIeUXNQA7RKZcTUQI0w== X-Received: by 2002:a17:903:2308:b029:110:41c3:70b0 with SMTP id d8-20020a1709032308b029011041c370b0mr6874646plh.32.1623807393149; Tue, 15 Jun 2021 18:36:33 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id o1sm321595pjf.56.2021.06.15.18.36.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 18:36:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 4/8] util: Pass file+line to qemu_rec_mutex_unlock_impl Date: Tue, 15 Jun 2021 18:36:25 -0700 Message-Id: <20210616013629.1458790-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210616013629.1458790-1-richard.henderson@linaro.org> References: <20210616013629.1458790-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1030.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Create macros for file+line expansion in qemu_rec_mutex_unlock like we have for qemu_mutex_unlock. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Alex Bennée Message-Id: <20210614233143.1221879-5-richard.henderson@linaro.org> --- include/qemu/thread.h | 10 +++++++++- util/qemu-thread-posix.c | 4 ++-- util/qemu-thread-win32.c | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) -- 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 Wed Jun 16 01:36:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 461337 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp113995jae; Tue, 15 Jun 2021 18:46:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwFzWTJ0G3hSoPK0OdBEXb3sAdjuEfId3GVGsU1WgEGsNotncDeq37oTPMxpaT3HFh4kGY8 X-Received: by 2002:ac8:5b86:: with SMTP id a6mr2644871qta.231.1623807962507; Tue, 15 Jun 2021 18:46:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623807962; cv=none; d=google.com; s=arc-20160816; b=seCgBLxzy++Z0bdsCxXDnrEQgIpYeKcc6kr7lq/lZu1/vD03snutLPdxdEN6P+xeaB Rh4k78+VeHY45pMBhIufmWlBr+UB3MRG7VQ6FkxzquodKOSWqg/GfRRAXsuNw6ukukBF GS6eRku5ZI86+VM78grq4KXLn9csgFypWhdk506bNOhZXXGmnZID5djxQkRvjU+x6KfS ZQNv4/1uNwGqI0oZUkrCi0C59ZnqMkhATPVDKIG/l4LpwIxClPxGwLFucPUMr0AZ0c/8 idSLi8PXPfHHv7Zf0kQezFXtoWxD2RjzWQ+K8VUdjjjJbzFYnWRxyjgXDpx34kKYlXhQ WDSQ== 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=g/EtpcVEQvR+xKHuSj5BLnH+yGHBoGGI8vPUI0hS6/Q=; b=PeIlVjkKVMPiPZlhyUF20hvVboLh+iXZrDjO8RGQNMUIdVfueSA9+RwxWtC15FoDEE j55xqQ0s2FHjmGQV3rysodf9jWiUnxdqW+rtyeeXFKq9exA1yAXnfKqqS1VXlsMcYmZ9 1yBL/jC6zQl68iElsm7Qi5/Rh8oy5O4v6H+U5rh1nbtdKU2j8q6Ionoh1ggXXtrDLS1G 8zmuDUFwKW72ol4Xb700Y4RR9WLOGlhFzL12J9uguJVq5Xn8PUzDOBB4BdSQADetCE+7 65Xhgj2xTnX+IAOY0Vsfd3V6VHqqmHGsZm7HSdRpBaOPY37M9XCCShcplonKbTUf2JoH aa+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DDO4tPut; 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=pass (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 g3si75453qto.156.2021.06.15.18.46.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Jun 2021 18:46: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=pass header.i=@linaro.org header.s=google header.b=DDO4tPut; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:44232 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltKcz-0003lX-TU for patch@linaro.org; Tue, 15 Jun 2021 21:46:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55554) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltKTw-0000Ej-Hu for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:36:40 -0400 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]:47007) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltKTr-0005cq-18 for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:36:40 -0400 Received: by mail-pg1-x532.google.com with SMTP id n12so593528pgs.13 for ; Tue, 15 Jun 2021 18:36:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=g/EtpcVEQvR+xKHuSj5BLnH+yGHBoGGI8vPUI0hS6/Q=; b=DDO4tPut9QtIhmX3hAF9slNPBHWt1we64LOXJYHf5he2Y38yLADZ2OQg10/nbWEf0b WgPMYiitpli78lKj0rm4TV6rkqcpOelZd6YFAQWu4sDezik2rhe3oMe+VzLhoM83qVBw oYD65XLFkmWwamYx2jJPTzN3dG9fj+M3B9i2s3VVhKcm3JWZz9Dpf5FNuW/AN2/tjlPT 5HJeX7vbHyq8eiOxIKXVW39jQ8oo4Q2L/kyw+LJrozl1M8o0w6HUf65qKkZOVMaBy5Pg urO0G6RKZgK6mOyPUtUCBKx5SKuGz+5LHvTLhYMov27wSNeFp4Fil+m+WQ0OaKHXfCd1 Va3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=g/EtpcVEQvR+xKHuSj5BLnH+yGHBoGGI8vPUI0hS6/Q=; b=i9TES2PB1KSIxjOxrOow5zMA/wwZWkU6YYOhFMce29nL1j0nsaPkx3j/EsUv+s19Jp L13Zv6VpIlXaI6SKR8oNwC3p2pgoW5ympVVqFooDxOZDYSe46OTi7TjJyM6Pk18Gu2Kt XK+4IDgW7KoXTMRAEsSRkLP8W276iMZmUZyD4vEik/5Dr1FZKC9gTwxmG5BHuaBGpRin WAjdANcggNcboqaV9wGS8MR0ySXrVRE3GA7jviItLm5wyhTIuFqqzTadlyYv3zt/jxjh PJrOGQnPDu0GIhOINfozsIN6g0EeQlCNL34Qyq0FMiS/4RRSrJFTZCijIv7guLENiJLx C8Jw== X-Gm-Message-State: AOAM531hZB77ut4Z8wgoLNWdaUDzXhq9isUv2i5GN34ttTnBIjNUjY90 LnadIH9KA0bPnEljweJdz6faL5t+csZjfQ== X-Received: by 2002:a05:6a00:248a:b029:2f7:218b:3845 with SMTP id c10-20020a056a00248ab02902f7218b3845mr6781964pfv.12.1623807393750; Tue, 15 Jun 2021 18:36:33 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id o1sm321595pjf.56.2021.06.15.18.36.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 18:36:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 5/8] util: Use unique type for QemuRecMutex in thread-posix.h Date: Tue, 15 Jun 2021 18:36:26 -0700 Message-Id: <20210616013629.1458790-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210616013629.1458790-1-richard.henderson@linaro.org> References: <20210616013629.1458790-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::532; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x532.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Thomas Huth , =?utf-8?q?Al?= =?utf-8?q?ex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We will shortly convert lockable.h to _Generic, and we cannot have two compatible types in the same expansion. Wrap QemuMutex in a struct, and unwrap in qemu-thread-posix.c. Signed-off-by: Richard Henderson Reviewed-by: Thomas Huth Reviewed-by: Alex Bennée Message-Id: <20210614233143.1221879-6-richard.henderson@linaro.org> --- include/qemu/thread-posix.h | 10 ++++++++-- util/qemu-thread-posix.c | 12 ++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) -- 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 Wed Jun 16 01:36:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 461333 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp111445jae; Tue, 15 Jun 2021 18:41:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxudN9NNQ6LzW9hegiNJy8MqQEU6EbcTFXczcORDuJsxBDmHeul2HXzP2slqcNOwAX7aJL8 X-Received: by 2002:a05:622a:1aa4:: with SMTP id s36mr2554158qtc.337.1623807706916; Tue, 15 Jun 2021 18:41:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623807706; cv=none; d=google.com; s=arc-20160816; b=J2iZTR/mNN40w1EX+bcIxPHkbxfHuAnnAEzlPcZu6ncZJVCF9F4Ysd2IJLtIjHvx45 qvkpePmJoZqdhRlLM30NBm8vtNWprYhEjjVM8ujjepsvU1AFebqn6oJAkTHeN6V1z+5V JCqQEqm0nj/Dc322YDWTqkfmIN5ZX1nIhZnE3cxrM2RgE+SHfuqJGV/D4FR3QLXFqKcK x181qDgbK3/31HoepCV7QrPQNAGq2jkhab1APmVdN0iJmlo8oiJjtKzgWur1xaFzWPul Bym8aNMcPE2MVbxDl256EleSBz0LuBcm8uYlqjDpZssBJFFrC+aexyC/Pfnxh0kxYNgY gJJg== 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=ubpKT84c0CDe5YC8xIT/jR9IicZ4W7L/Hmhh3sXO2Cc=; b=fnSOzb85tyONRnlrjh0+A2MFb2Ob4koKQdVX6iuvZUmjiwmyjNZWenV0CaH/lM0Uga 2QtRuiIkWiJB4JSq387PZXsyt2407dPuT1WTZwue0lv29L9XneCdHqKPGiFcQCYxM/Xv mlQnUZ6s7C1pnI4GiYIdv6SKW19EvJaCHcBd6Rsb2JzJ63MXZQ5hiVpIpmbGqwNBRdlu fguXYZCNVSVQJC+1Ri2j0Q/A1uygUrFVlIIP01w1tegJGYNzJA7QMGYC/W4AU/4lkdfH Hj7TpAylMdhAUmFGdtOnX/bqYC+zakK8A5qRuk9civiVIUIqBUnCLx5fya5Wq/4BL0S/ 1/Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ILFtozxe; 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=pass (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 l12si608518qkp.134.2021.06.15.18.41.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Jun 2021 18:41:46 -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=pass header.i=@linaro.org header.s=google header.b=ILFtozxe; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:35848 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltKYs-0006LK-Ah for patch@linaro.org; Tue, 15 Jun 2021 21:41:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55540) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltKTt-0008VZ-Qp for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:36:37 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]:43896) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltKTr-0005d4-MG for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:36:37 -0400 Received: by mail-pl1-x632.google.com with SMTP id v12so278804plo.10 for ; Tue, 15 Jun 2021 18:36:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ubpKT84c0CDe5YC8xIT/jR9IicZ4W7L/Hmhh3sXO2Cc=; b=ILFtozxev9FMNR5wDAoFKHVkXjZRBp6i2Do8mXlIpcPmGX53Nbrdz8uH6RU7LZGU00 FiXzViB36Wp0FrZ1cV4oxAjMa3mGFFZAOKPlcDl+S7LjKlNzqUJKTADL+DJ8m4ofJJlG Ugj/GqohX/8wSS+NeauEOggsZCyzt/nOWzawrrFmAO0t4hJMnvjbOaXJAUpHEh7Zpzdn 1ZujnVSqiQ2VCScqTDFhPOtDg1gTl0UFg7O5V97vglDNL8zrINLT8o574oH21VYYSVw8 HnAIH8Kik/67PxOfF7BkQkMzs6WRNMOH7nM8d78TYV1NHJlXuvAEoau/Yv/5k8P13VPX 1spg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ubpKT84c0CDe5YC8xIT/jR9IicZ4W7L/Hmhh3sXO2Cc=; b=CYZblGARvr257QWjjnmass2ZxxPOJNfk2384dIXT6cBdAgLmDVVuVAPPx0C00tvp/B Hisczx8xFF0V4EIfW09rEOpAbhkGbazyhRmvAtyMv6JUfRCGPrav5whRNOLaHZ1W5hJR TzYx8rrzJ7fA9umPXZhebo1mxtNbZH4r38KqqUfHKI/8rrLFMwNpPLQE71ypMjWmVlI1 2usbm39WIxQp3Ltb0KTkCbhg4AuIKWfC+hA23he6BboExWeTHG8LN/crfAu+n2PmCaj8 Hty+sSlwk5HaOSDdyfVyaY5jV9gdPC8y+DHruZq6gX4AMcD01iJ3f5giSFST/nqfyZfc 7byw== X-Gm-Message-State: AOAM533+kbclZTwee1ua5avML9fe0x0LXXdquMNwvr2nbZBQeJhTQC+w 6o9fHlqT0KdElU8N9wkB1gC4S2TJaied5g== X-Received: by 2002:a17:902:a70c:b029:118:7b47:e5bf with SMTP id w12-20020a170902a70cb02901187b47e5bfmr6444952plq.9.1623807394346; Tue, 15 Jun 2021 18:36:34 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id o1sm321595pjf.56.2021.06.15.18.36.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 18:36:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 6/8] include/qemu/lockable: Use _Generic instead of QEMU_GENERIC Date: Tue, 15 Jun 2021 18:36:27 -0700 Message-Id: <20210616013629.1458790-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210616013629.1458790-1-richard.henderson@linaro.org> References: <20210616013629.1458790-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x632.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This is both more and less complicated than our expansion using __builtin_choose_expr and __builtin_types_compatible_p. The expansion through QEMU_MAKE_LOCKABLE_ doesn't work because we're not emumerating all of the types within the same _Generic, which results in errors about unhandled cases. We must also handle void* explicitly, so that the NULL constant can be used. Signed-off-by: Richard Henderson Tested-by: Alex Bennée Reviewed-by: Alex Bennée Message-Id: <20210614233143.1221879-7-richard.henderson@linaro.org> --- include/qemu/lockable.h | 90 +++++++++++++++++++---------------------- 1 file changed, 41 insertions(+), 49 deletions(-) -- 2.25.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 Wed Jun 16 01:36:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 461332 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp111184jae; Tue, 15 Jun 2021 18:41:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyoQM7rLCKV3l23J6h4Pldd2nHMOUsWCKK7z+vSmbLEhByiDqeE0n/GLh+6AsTJPUXcuq61 X-Received: by 2002:a05:620a:140c:: with SMTP id d12mr2622645qkj.228.1623807673750; Tue, 15 Jun 2021 18:41:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623807673; cv=none; d=google.com; s=arc-20160816; b=QK/Aehsukra2Rjsv7AT32nI9Cl1FTI2YWoNeVqB2yM8OnEL+bOqts8I2bTgzHfZh/m RcZ+xsiapAVIPXiSpEkuaS6Dl84UvtCnosg/WR7Kb2/NVghRNM07uKSvLwoSy/xcElnE gj2OkJA3NYeHmcTTt+pk2CRV6J+HGt+ZTKE6TFWV5V5GrFRGs+gttmXnjijlbPr0Oam1 iRmmuaPFtUVzMIl84OhSAcUYCDguC9FNGpKLrhDg+4ut4A7+NLJtx9Evz0L4o4SPfksQ 955UZ+DLrHH9QImmMvPRxM2gNsgXxTM88Y1iohH9EDLsxsHb41svkqxoxUVpw5PINvDi F9Qg== 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=AQdvWRX1hZO0Z1j1TwBSyfUR2Ola+BhQ1+6mdvjTZu8=; b=MSwmR84VZw4xmNe9glakdti25muMGS0CuA9HHBbhS1JTO3E+/Mshiuz7wcFIunnfAb JiE5ICfDlQatYTAPSitrW2xnrcO2rYiv3qD57sD/oJtVEbk5ovPyuPbmjtFhEZv3IYnk 7N8Fmz2MgYqinVbUS1dsyYAzCrlZ4YgJQAQXD0J0IYUeVKQomK1a3AmBXgvnG0KkjUer 6h1NOyj49lWEhRn0ZP2BlhFpmW2DbzGJ+FBzoYRBaPtxz/L8HjHsPk8CUDlY7NJSbpSB 35gBdVsBOb3x8FYmDkOvsy81ptzft4Y7BMXji3NxGy2zWFAaET/wQnwZ+2WHRdB3vHy7 LXjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vPOQ4kbl; 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=pass (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 c18si570176qtn.98.2021.06.15.18.41.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Jun 2021 18:41:13 -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=pass header.i=@linaro.org header.s=google header.b=vPOQ4kbl; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:35234 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltKYL-0005tV-3u for patch@linaro.org; Tue, 15 Jun 2021 21:41:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55542) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltKTu-0008WP-1e for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:36:38 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]:42913) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltKTs-0005dm-8w for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:36:37 -0400 Received: by mail-pf1-x42e.google.com with SMTP id s14so857531pfd.9 for ; Tue, 15 Jun 2021 18:36:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AQdvWRX1hZO0Z1j1TwBSyfUR2Ola+BhQ1+6mdvjTZu8=; b=vPOQ4kblqHHKFJFGhsoJ+34RHM+LE0OI1Rc/YOuVIbBRlsWBS83oSnESr46+HWtDr9 QDCejuyic5MOZ76vzAR4IkIG585sOGmdXpQOsU7/F2e6r1CQS2gBoML9wiHPsSYgGmvO kB8C++9oAHLZyw3BrebegUneTn0X33zzSB5U3RtGVVfEyfGdE9HXiRJvJ1b5OO8Ai2TC NTm10oe4/cXW4dqIyvZpS/f4aEAGy0EE7UkJVRhxs+SImnPqUKXvQcK8gc0tIV0slMGr hW7KXKwG3BIRpkRXcgw6Y7zMquqxg3ZBKMt42QnjzVUdG9RRQ06sfb3/0chSre4oQh+G 9scg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AQdvWRX1hZO0Z1j1TwBSyfUR2Ola+BhQ1+6mdvjTZu8=; b=AT4yUyG4EPO+CG15R4lQSol5uuwhdwoZta8d62f+C6JuNcqQedXURkZ8DNfV3cgOnW lt/KIXhRvs5Nf8yMdJ+4J23pjI8/WCFtMb1gnsdm+vYni5QkGR3nZ34L44BKvnaYVhF5 0ZcewQ7VxdacC9r3oZO8pVLnv+pY/IrXB9ONbPR8seSUoR+jpK4GkL+wc5e34E8ZKj4Y 7FfwgUQBeDWVm7xBpiddziXrjYwupJgDYLWNdQiv6LGT5Dfu95kGblSFbwm4FtKohM2n f2gi6r31zUvfmYMwxzeDzYjNW+3dDEejKLUsk4r1HMcuhv0x6cmQE5HklTlbIGiQEx5q BhTA== X-Gm-Message-State: AOAM532p2yoEuBGlctIMQYXl6MHmAYywxBMLI5XAON5yo+Mu4RcNJ9yJ 8KAal6hOju29ZjtxSQMyAjZtkuUJ6T4mKQ== X-Received: by 2002:a05:6a00:1a41:b029:2ef:9721:879e with SMTP id h1-20020a056a001a41b02902ef9721879emr7126393pfv.74.1623807394992; Tue, 15 Jun 2021 18:36:34 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id o1sm321595pjf.56.2021.06.15.18.36.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 18:36:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 7/8] qemu/compiler: Remove QEMU_GENERIC Date: Tue, 15 Jun 2021 18:36:28 -0700 Message-Id: <20210616013629.1458790-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210616013629.1458790-1-richard.henderson@linaro.org> References: <20210616013629.1458790-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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> --- 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 Wed Jun 16 01:36:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 461338 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp115305jae; Tue, 15 Jun 2021 18:48:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhLc/KxXrTWuTvKQJ/G4cby9ai9rzPShBS4oLdxYQsGqJvJDHNmsdnNAzj5IvkufUarVMR X-Received: by 2002:a05:622a:454:: with SMTP id o20mr2694350qtx.14.1623808117734; Tue, 15 Jun 2021 18:48:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623808117; cv=none; d=google.com; s=arc-20160816; b=DwQ4a2MkUr2QWBKOcfG0quYH7gwonDw5EoGnmvI+EDStRLD6tqrDbFnzb1pM+bi62T xuUQNCVudBuEJG7GjNq10hPnPSqnpjMd3dXAfsfQcoZTT1mEc3/gIbqpDfLSBvmjG6I8 odjdG1hQCvL3OszKWuQySaSlRixcdlbzkobg6ZvgHxtnOJWBV+uOjhvlKGPvijKIpP1k 9C30zdpNvKql81HMXmWMEqn2CH5OHfNK1spKG/GVcPoDtXfIynCtfudTSa9mL0wZRKEu IowKMzIIxBg1raLqsvZ2FGu9IBRq/WriRH/fwB2MVl6PtzeuhWP3Xxxo03a5qL02ZgiT TwyA== 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=M9vjtLHy6m1PbkLSF2g+4J6tC1qxnHFOGNf/C4UBGU0=; b=X04ZY8urZlQle6ZLQ8EVm0i0T0EtuEmCHb6jVOcqG2v4fCGk9GAj9TKxfvjCG/WtHU x8koo/Yr1ysm2A6jvEi/n8H1NcL5MuuUxEJuF7dNHv7lCwRQvWB4S3LNJz3kKGUjUGn9 FQtgzxN/BAltAJWnX2wgIZt8xRmnGtgsjef/PEfBmiVh2G3fYHFxrp63aAAx0258aqdf XWknbt7eFiHb5vr8pkhzr+FZNvwbjoS9uxpdkfw1yIBR0tKkLq3vKjehq8/i8QGFrpPo voDq0GdmVYE3kIr38SsX5rFzGIje111U87ZxB8K8d7f2SFQpatVl7dTbn3QK4FDpyw9e aspw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HiGvT2Tj; 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=pass (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 z11si526944qkf.137.2021.06.15.18.48.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Jun 2021 18:48: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=pass header.i=@linaro.org header.s=google header.b=HiGvT2Tj; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50182 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltKfV-0007oM-6J for patch@linaro.org; Tue, 15 Jun 2021 21:48:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55544) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltKTu-00006b-GO for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:36:38 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]:41859) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltKTs-0005dr-Sn for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:36:38 -0400 Received: by mail-pl1-x62f.google.com with SMTP id e1so281813plh.8 for ; Tue, 15 Jun 2021 18:36:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=M9vjtLHy6m1PbkLSF2g+4J6tC1qxnHFOGNf/C4UBGU0=; b=HiGvT2TjEp2vf9dV17IYfQK/UC/Z6PvhO7O9F0xtpbdR7amfP2rune7Quzc9yOEOzA wi+1RPmh0FHuRHCW1aXkz2XxmhkAu4pizVH/1Sy8o+kgCEbDMFjVuNl2CrEXDNvNl9Wq Eg+JWR+0VBmaUhmctJLsHvTOC7l0lKj4HScOVS1CroHZ+zHe2wMrFE+aOGLOFYtXeTs4 Reu1nRiGvC3xkugJRLhGre9aOZzyKQJPd4al9RJ5m2mNHuzlBth2RwJ8j0PbMbwNCTyU +RJ5w8bKGgWt9QG4heMdn6bFsSi2F8/JsCn4Gsa3MULxzB9lsUYv20cGgMbzFVcpnHfM dAXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=M9vjtLHy6m1PbkLSF2g+4J6tC1qxnHFOGNf/C4UBGU0=; b=VR/x3euM0cIbXOXe53cC8x6z81iJJGz5605UMTjIWny417I4dJdzcyMJZ3A9uqQcSZ P0dNtdToZlBCuWdmubMIoN/XQHcGEZvuF6jygLDyZXUR5INIDCoYwmu3eswDH6DwOEZt 317r2uihJ7MZEWtQkV4PRg2C+ZGuyUZQce62GwsxYdMi1vmoygb4UX7buMDKBAHW5Q5l 6Lc+AVsID+Mwtug6gm7JPkFrrekoPiE0wMWRbkiNO1KOitQ/JQ/yuLkDKERK5YM2pbgR N1Ra6HP4rnl68C94gMn7AAazc0/N6KylhwczKmkcCFkrehu55l3w5ODn9itt0zY7fjzF 20Hg== X-Gm-Message-State: AOAM5334UHbeyUrgzEs4OlWqS0Mhkruerzgxj3J7Fci2TA+F2JjRpmBv opFx/WiK3Ik8xr1uf5BF8BozMczZRHMT0w== X-Received: by 2002:a17:902:8645:b029:fd:25ef:3df7 with SMTP id y5-20020a1709028645b02900fd25ef3df7mr7038343plt.48.1623807395604; Tue, 15 Jun 2021 18:36:35 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id o1sm321595pjf.56.2021.06.15.18.36.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 18:36:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 8/8] configure: Remove probe for _Static_assert Date: Tue, 15 Jun 2021 18:36:29 -0700 Message-Id: <20210616013629.1458790-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210616013629.1458790-1-richard.henderson@linaro.org> References: <20210616013629.1458790-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Thomas Huth , =?utf-8?q?Al?= =?utf-8?q?ex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" _Static_assert is part of C11, which is now required. Signed-off-by: Richard Henderson Reviewed-by: Thomas Huth Reviewed-by: Alex Bennée Message-Id: <20210614233143.1221879-9-richard.henderson@linaro.org> --- 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)