From nobody Tue Nov 11 20:53:32 2025 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=1565365411; cv=none; d=zoho.com; s=zohoarc; b=KA74M5iH9wgAhVxmyu6zGjlvyZQgY5cb3/QoCIRsR2wcEjUsxvQuPDyys9g4GJY2yN3ItFuBMBCRLroMQyjhqqBDSbCwo1a2q4vSPV5OY4PFVNEIOPpmMkLJivP/lX+mIM2/+IZeNV/8YSduj7vwBwsAxGM4XjXuJ3uAxZ1nug8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565365411; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=leHpSxHzVUfQCq35SXdIhrfSJv5bGUxlfMEN59fKGs8=; b=Hmz2GZY66IO0XblRkA6TVDrVm7V8Y0WfuH4uJ0jAAfj7cRGHCUGhnSn7zC8YAO7GNBcYFyL9kP+v32iMhUA/qyjjSxJESKCnjDHWe26J3PKTIJZ6lNLQB+qhNiUNcCIaJD41MGTx1GSfDp1csZ2cg9CvaiiUVxekX/9RwFCXKb0= 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 156536541150310.53205708901794; Fri, 9 Aug 2019 08:43:31 -0700 (PDT) Received: from localhost ([::1]:60284 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hw73A-0002Hj-Nj for importer@patchew.org; Fri, 09 Aug 2019 11:43:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50813) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hw71p-0000eR-5y for qemu-devel@nongnu.org; Fri, 09 Aug 2019 11:42:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hw71n-0008Ur-Lj for qemu-devel@nongnu.org; Fri, 09 Aug 2019 11:42:05 -0400 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]:42660) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hw71l-0008RA-LP for qemu-devel@nongnu.org; Fri, 09 Aug 2019 11:42:03 -0400 Received: by mail-pl1-x644.google.com with SMTP id ay6so45162176plb.9 for ; Fri, 09 Aug 2019 08:41:59 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id 67sm80452179pfd.177.2019.08.09.08.41.57 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 09 Aug 2019 08:41:57 -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; bh=leHpSxHzVUfQCq35SXdIhrfSJv5bGUxlfMEN59fKGs8=; b=R+x9JWNGRCUyPT9qY3gVRkx/94Jp2YtcuNACFzBuhhxhqF95so80+Jb8LzC7mqvsLE PC1JIijvAdAWGOxKse6YwXT0dF8oVgKkcY4NyvZYiY9uV7qkFrkRJh6qZcs7DHqC/Hrw DZohBIcvGacA/E0rBf7QTEmwaq9UQlQEF7IYM/eUVmlgtqPtgnV2gPIu+UZsGPtIQ3HT +iZ27v7taX0V46y2bXnJWuseXxxFPGoozjGC3faiJmbLMWbH9eGtJ6tMM1X2qCp2ii7x +AWyzWzDTHpxRPIEDUXvlKn5rPoOeMXZeDR332BiSIOBsgiC2Y4k3d862xbmCtgufaJk clnQ== 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; bh=leHpSxHzVUfQCq35SXdIhrfSJv5bGUxlfMEN59fKGs8=; b=XACmY2iLAFVN/3uIEf8A7vIXA4zTlWCtRy3BP/e8mBWf7AtV2vPM9+7UUF8wAwsJ1l ULOE5n5KZooI4mll3UW+Tcb8EQ5fgApV2E5K23edVbVQv+/Dc/jYprJ2qiyboMAslb63 4tfJ0uEjnyCR6naaY6CNXqtCnFWPTnzxYDHjt+prUSjtwIbn9sJ+9Ph1+k3cfvOXHa4n B38AEkfRdlP0/TJ8w6XrypVKUOTGHm7GOXga+dOkifUd2umm1SzmYeR3epHCjn/9pkf3 6xv/zZPwCF2FaX7Fj9yT6FGsd5LWUzxN3aSGKgsxy1XjHWcG070bJZxpl1qGUpPjRZcw 2PqQ== X-Gm-Message-State: APjAAAWp9oP7yaL16o5vrlTWsd26P8ULuwLNKHkV1UgJgHNsoS1uhcRM Q6jxaAfZaM3fgDFZGW79qVYl0OW0bgI= X-Google-Smtp-Source: APXvYqz1hWfeknIiwUhlO6H8PJ7tvLD522TuqQjZPZ6xJ7ttkaVOB/zgqj9VJzjJKHTm+8JMBJDKxA== X-Received: by 2002:a17:902:7d86:: with SMTP id a6mr19609862plm.199.1565365318747; Fri, 09 Aug 2019 08:41:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 9 Aug 2019 08:41:52 -0700 Message-Id: <20190809154153.31763-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190809154153.31763-1-richard.henderson@linaro.org> References: <20190809154153.31763-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::644 Subject: [Qemu-devel] [PATCH 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, Alistair.Francis@wdc.com, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, philmd@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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. Signed-off-by: Richard Henderson Reviewed-by: Alistair Francis Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- scripts/decodetree.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/scripts/decodetree.py b/scripts/decodetree.py index a2490aeb74..f02c8acca1 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 ' @@ -485,12 +486,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)) @@ -1191,6 +1194,7 @@ def main(): global insnmask global decode_function global variablewidth + global anyextern =20 decode_scope =3D 'static ' =20 @@ -1251,6 +1255,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: @@ -1262,6 +1279,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