From nobody Tue Feb 10 20:47:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1566110553; cv=none; d=zoho.com; s=zohoarc; b=fGIj1irfme+4NDMXmRgOmwOvABiFBXRVsUdxeGBuw9jBBNidH5fi7tS+muCdgY/sjeym8gXNdQcfZwgrD1Lp3L2AeOTxkX8P/GZILsF8ACjVwBGCZLycjcT1HScze0Dfxxl1fY3lVOfDb8EPqE3LgXErRzDZ3X2qiHlITvNHSkM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566110553; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=tKxbBo5PP5QzWeZGavSTCFjk6sHISgddhsvvpM6xVYM=; b=ZlBA+K2Z4H18VUx14hHSRdsGD7JZRuf4I5acXEnrZORXMwZ7GirweD4fUEg222ow7zqC7jX+fF4DKSCuL/BWHqZT1h8HwnL8qQIPF/TvT8krB6XZrwNaW8GRMI6Fa7N9txvaXjfHMdY+afZYCnkp6jYPzkwZdGbMmhc/FrOZpO8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1566110553875579.7933359936641; Sat, 17 Aug 2019 23:42:33 -0700 (PDT) Received: from localhost ([::1]:39494 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hzEtc-0008HE-SX for importer@patchew.org; Sun, 18 Aug 2019 02:42:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36401) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hzErG-00056P-K3 for qemu-devel@nongnu.org; Sun, 18 Aug 2019 02:40:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hzErF-0000kZ-EB for qemu-devel@nongnu.org; Sun, 18 Aug 2019 02:40:06 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:44391) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hzErF-0000kC-8K for qemu-devel@nongnu.org; Sun, 18 Aug 2019 02:40:05 -0400 Received: by mail-wr1-x429.google.com with SMTP id p17so5409153wrf.11 for ; Sat, 17 Aug 2019 23:40:05 -0700 (PDT) Received: from cloudburst.Home ([2a02:c7f:a69:1700:8897:9507:94c2:b98d]) by smtp.gmail.com with ESMTPSA id r5sm9015435wmh.35.2019.08.17.23.40.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Aug 2019 23:40:03 -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=tKxbBo5PP5QzWeZGavSTCFjk6sHISgddhsvvpM6xVYM=; b=QrWWzm8EiDh7WQPpLMtGfaJRXKnuIwFPVtvShtsqBBwHC/LXMWst5dTO5QoQMxIBMo rBG/GwsyU6BdjbVRZbphzqiU/N556v97REuB7Vms8OxweRc6DQO9R0Pwwm617wHM+Jd2 lPFNSAMmJHGcXDxx1eI5ONHTPmuwmdvASQOd41oedznlBgtMtLvFPLk9CbfjIU2uU0GY o6+EUuzMMEPPIeKm2UqOPUeB5SyBp6I3Kvmim73WljLny4YbM3iJuztqICrz6nVJJR9g OudK3nUmfhxHR++7NEFUwPeZUBVHG5/simi/kAE1lCnFUdha0KtEXEvVubyJQR+AY8tx xpVg== 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=tKxbBo5PP5QzWeZGavSTCFjk6sHISgddhsvvpM6xVYM=; b=HKoNQVd37wb8uJBLmkMpo21biaH8yVJBeFJ/6VKGy/BQdY+CrrK++T3k51Lwn2Ttgs liCqosHPLr4RQVouon3oElv0Ukr1WF+1P7Fglzd5bjQCG0iRpcAPFygkN4lHoU2fUiu0 /EjlArgYXn3Krz04lUoCzoixvmyGXDh6Yt+DJ6m+m8TvOzAA0y7g+Fg7Amx9XcTdQX3Q 5tNR5QK9YcI2iiaUUFAEX5yfeApimGXwpM1/GD4Wj181jor4SaV7UuTfclwH47Jq4c5S VBn2L/4dRsXq6rxvwPyvBC4mjLTBNUpq5dZ7U6pLuPz6WXqQFtBYgEndwDIZpFEh54u2 8dLw== X-Gm-Message-State: APjAAAXdbeZ50F0uYTxlB71vUz5t+Nx80+s+3IPuKKZYuOEnGoaHw3wn Ymtn+iGfd/EXyvx5svvjTkFdxVDgc+U= X-Google-Smtp-Source: APXvYqwlnW5SbHvBJqzGlM7UvEMDw0ERmMLcm6sEC/ZUjipCz0jmkM1lTZNqtGvCwsO36saAc1buoQ== X-Received: by 2002:adf:8bd8:: with SMTP id w24mr19589296wra.273.1566110404020; Sat, 17 Aug 2019 23:40:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sun, 18 Aug 2019 07:39:58 +0100 Message-Id: <20190818063959.14533-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190818063959.14533-1-richard.henderson@linaro.org> References: <20190818063959.14533-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::429 Subject: [Qemu-devel] [PATCH v2 2/3] decodetree: Suppress redundant declaration warnings 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 Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) We can tell that a decodetree input file is "secondary" when it uses an argument set marked "!extern". This indicates that at least one of the insn translation functions will have already been declared by the "primary" input file, but given only the secondary we cannot tell which. Avoid redundant declaration warnings by suppressing them with pragmas. Tested-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Alistair Francis Suggested-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- scripts/decodetree.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/scripts/decodetree.py b/scripts/decodetree.py index 31e2f04ecb..12c1cd0ddb 100755 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -33,6 +33,7 @@ arguments =3D {} formats =3D {} patterns =3D [] allpatterns =3D [] +anyextern =3D False =20 translate_prefix =3D 'trans' translate_scope =3D 'static ' @@ -482,12 +483,14 @@ def parse_arguments(lineno, name, toks): """Parse one argument set from TOKS at LINENO""" global arguments global re_ident + global anyextern =20 flds =3D [] extern =3D False for t in toks: if re_fullmatch('!extern', t): extern =3D True + anyextern =3D True continue if not re_fullmatch(re_ident, t): error(lineno, 'invalid argument set token "{0}"'.format(t)) @@ -1188,6 +1191,7 @@ def main(): global insnmask global decode_function global variablewidth + global anyextern =20 decode_scope =3D 'static ' =20 @@ -1248,6 +1252,19 @@ def main(): # A single translate function can be invoked for different patterns. # Make sure that the argument sets are the same, and declare the # function only once. + # + # If we're sharing formats, we're likely also sharing trans_* function= s, + # but we can't tell which ones. Prevent issues from the compiler by + # suppressing redundant declaration warnings. + if anyextern: + output("#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE\n", + "# pragma GCC diagnostic push\n", + "# pragma GCC diagnostic ignored \"-Wredundant-decls\"\n", + "# ifdef __clang__\n" + "# pragma GCC diagnostic ignored \"-Wtypedef-redefinition\= "\n", + "# endif\n", + "#endif\n\n") + out_pats =3D {} for i in allpatterns: if i.name in out_pats: @@ -1259,6 +1276,11 @@ def main(): out_pats[i.name] =3D i output('\n') =20 + if anyextern: + output("#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE\n", + "# pragma GCC diagnostic pop\n", + "#endif\n\n") + for n in sorted(formats.keys()): f =3D formats[n] f.output_extract() --=20 2.17.1