From patchwork Mon Aug 19 15:17:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 171645 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3129562ily; Mon, 19 Aug 2019 08:19:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqxmyGBkUHIlom22BfmKw8tMf/yTf2OhJfB3NE+emkOD6+Gr0GUid+emEHiitqIQ8SbD/E8y X-Received: by 2002:ac8:d02:: with SMTP id q2mr21153196qti.289.1566227989854; Mon, 19 Aug 2019 08:19:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566227989; cv=none; d=google.com; s=arc-20160816; b=zsE93y6Q3CpQnUorgFRVxPX5ZAWve4lHaAc00RqB+/a9gid6LG2JIqZpAM7LehpIBI MBjSm9K3/Q/OLtahl+p0aBgVq81lhkQD/J1v8wabO3mbltsD+JeN7gedkwqHj7qIjmP2 NHFe3fHX28o8QjZQf5HfwashAS5u+DofrgnTZpVjddHFRelc47VkrA8E/pkGC+miyweW ROEUgvs201kCqa4eHTSs2vcBcxO/7FSQ+2ndt8k7gqhR9uCTD5dPxU3x6a/S9izpLq7R 1UOZ3QJCv131hv3nfMOYhKlttoAvPlQrHOrDE0/FDZGV9sV24ROik/y47sckdQSaDPhx qEpg== 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:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=kcQQwhe8tbvIkqlEv04wiqdNqDeAeBEJXEVRAMnwP74=; b=0GhJwRcp82MIABQxQ7Bv3kOpka2ijvWuTufn9usXT28pj4XWe9NQEyUv1T5sUtugDg GBlxOPG6qzlciwYzUGYClS7ihiefczO1JOYfC7j3SvZ+Xk5LfnR3vsUCyTmJ3gTk9uyh 4QA4kmKHXE/+/c+kkGiMq4kysmlI6ifu94wDFPMptabGD0q1Zy6uyvf8npFuXesdG8ZH lqXKcwf1z4hsVZB7F6aUkhEMb/LHy9QWI7pyOexSZdP+v8G7cKOmoVhlzANCGVl1sot9 waRZtKJVVkxBjm21gbPgyhhiGYpmaSqWHuji2anyTjxgCankMHWNGUB4SfJTIm0lOSH9 IPIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=oOzgaKQv; 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 194si8579887qkj.71.2019.08.19.08.19.49 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 19 Aug 2019 08:19:49 -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=oOzgaKQv; 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]:54268 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hzjRl-0002Yt-1W for patch@linaro.org; Mon, 19 Aug 2019 11:19:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53023) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hzjPy-0002Uv-45 for qemu-devel@nongnu.org; Mon, 19 Aug 2019 11:17:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hzjPw-0002WZ-P6 for qemu-devel@nongnu.org; Mon, 19 Aug 2019 11:17:58 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]:33699) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hzjPw-0002RC-HE for qemu-devel@nongnu.org; Mon, 19 Aug 2019 11:17:56 -0400 Received: by mail-pl1-x629.google.com with SMTP id go14so1115905plb.0 for ; Mon, 19 Aug 2019 08:17:48 -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=kcQQwhe8tbvIkqlEv04wiqdNqDeAeBEJXEVRAMnwP74=; b=oOzgaKQvX9pX/pHo6fX2nRrnGGPWGfe1iUDvPjg+1Kl2hE2p834EWd1J4syElgmY3h qk7LBj12kFb9hxgtpBcwF9agEJ6jut9pECh4IjyKszOsLrpDSEZnmnz9krH0ngRrT85c dlgsyh5nxj44XprDhOUtGuMoByKVvVkM1P59b3SIuHQE0SgJNnusCC5MImBMOoc4Dnr9 ihiYft2gltHWjaZJfarlh0WukArNCt9nBNbnP9iyuePd3G9wMMwZAULX/retuIhLyIBq caEna1GOpggAFfh5ker2q+7iA9imJY7XONJ8PXD/NDEkTdbVUufbkRSmUwJM1zmcHWm4 lhDA== 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=kcQQwhe8tbvIkqlEv04wiqdNqDeAeBEJXEVRAMnwP74=; b=iX8Ux+BoR8H0ZzQ+v0Xjwu3t3s70LsX1S1xCJK0fIStU8QHHVepLAtcAvpNrgW4GYa FBXCHX1RqRmunOwOUkXMebYXXFpYEJ42Q1Qet90MUdBcrO3Iths7+gYB9fwJ+hPG0K6D /eAzmDSGv+Jx58BahHh84fw/gnQhZf9naDJjvcQrxjp+v0IYJOLFOn8W+P0VUELSxDWL xyTqitOn7CbpBE0JLDV5SSX8BaZ4qYS8Piq1Idm9qqM3pxQMOwE23cg0DquOJxRU+yWb ePfm/npwvHtozWalqEwB8i799d1+LTyoaVPdPYzwIztjLtShqkGdMtA5mYVYYox8h/7N 8XoA== X-Gm-Message-State: APjAAAVFFwHK60xEeP72uCbmQZ80kfB4YyVbfXlUf7xdQya2wCU9wM7a 9LUZeBXAeXV46E5wZBJTxiJhXBloFSc= X-Received: by 2002:a17:902:834c:: with SMTP id z12mr9134007pln.8.1566227867525; Mon, 19 Aug 2019 08:17:47 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id r27sm21020406pgn.25.2019.08.19.08.17.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 08:17:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 19 Aug 2019 08:17:42 -0700 Message-Id: <20190819151743.17267-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190819151743.17267-1-richard.henderson@linaro.org> References: <20190819151743.17267-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::629 Subject: [Qemu-devel] [PULL 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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é Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Alistair Francis Suggested-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- scripts/decodetree.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) -- 2.17.1 diff --git a/scripts/decodetree.py b/scripts/decodetree.py index f6f7368774..d8c59cab60 100755 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -33,6 +33,7 @@ arguments = {} formats = {} patterns = [] allpatterns = [] +anyextern = False translate_prefix = 'trans' translate_scope = '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 flds = [] extern = False for t in toks: if re_fullmatch('!extern', t): extern = True + anyextern = 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 decode_scope = 'static ' @@ -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_* functions, + # 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 = {} for i in allpatterns: if i.name in out_pats: @@ -1259,6 +1276,11 @@ def main(): out_pats[i.name] = i output('\n') + if anyextern: + output("#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE\n", + "# pragma GCC diagnostic pop\n", + "#endif\n\n") + for n in sorted(formats.keys()): f = formats[n] f.output_extract()