From nobody Mon Feb 9 22:19:53 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.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 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1541005171526670.5587803483623; Wed, 31 Oct 2018 09:59:31 -0700 (PDT) Received: from localhost ([::1]:60811 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHtq6-00038r-9t for importer@patchew.org; Wed, 31 Oct 2018 12:59:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56327) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHtkY-0005Xz-8a for qemu-devel@nongnu.org; Wed, 31 Oct 2018 12:53:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHtkV-0008Oo-Jt for qemu-devel@nongnu.org; Wed, 31 Oct 2018 12:53:46 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:51838) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gHtkV-0008FD-6U for qemu-devel@nongnu.org; Wed, 31 Oct 2018 12:53:43 -0400 Received: by mail-wm1-x32e.google.com with SMTP id w7-v6so4784125wmc.1 for ; Wed, 31 Oct 2018 09:53:28 -0700 (PDT) Received: from cloudburst.twiddle.net.twiddle.net (79-69-241-110.dynamic.dsl.as9105.com. [79.69.241.110]) by smtp.gmail.com with ESMTPSA id u5-v6sm7580168wrm.77.2018.10.31.09.53.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 31 Oct 2018 09:53:26 -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=JIUdfi8Wiee3VEFA1DC9zFaD8+pHIsuCf9eAvQVoCks=; b=g6rNW59TEzwIINCPPEP1E1RMyzltgWa3sUAzosuH+nJtWtn+kMQ3GVYCA4LPsIX+HF pvsTIqzEtbqDsssXnzND6T+Yrbp0GGtUCcVo28fXulcQtAtPBbcwRe1RiTrXwtBk3eya qkln/rlwCh5YEUTk70mknRmE+c7Sr9iz8TGVA= 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=JIUdfi8Wiee3VEFA1DC9zFaD8+pHIsuCf9eAvQVoCks=; b=Bfmasa+DkHm8yOS0MF7MXuSEAO3/kkm9Rkppe78vTJoiTtFkcsqG1wUwYdtegnphxf kSLMEtRX7ngsKl42z7RN8FS+N+9819qbLT7oI/l6l8RysJ1gnkC1SxlCAP/EvPpm5rlS Di3TMrfC/uK0uXgjp3IqW+Bv75gEgvDPOqPsc0N7GD5cDBfQgNRvyWe3kVLG2HstBkuy +sYcUCDgJBXQhRz8AfPxPgr56cES9hX1linVhms7UhsvVr4JDNDk2LZ88W7Z1E2sx093 ena6lHKZvbTMb/UkcqxmGI0t2KS76l1Qv917PueaUG1IkjIqy5fDB6TlWUemecWv9ZTL qLLw== X-Gm-Message-State: AGRZ1gJjyxJkpmwYQvIvrbxSKiYslDwMuWL3IMa7ZEdojgsQQXQ2fgyD SVdA0T7erBxKWgSRRqMBrmAP1qEIwQw= X-Google-Smtp-Source: AJdET5f4fK5yigJ+fjgfPosN7f6yd1VvWV8pjOrBKjLrMtJxpG4phqbepnMROhtIfnCvYb8K1gSioQ== X-Received: by 2002:a1c:2846:: with SMTP id o67-v6mr2936882wmo.60.1541004807177; Wed, 31 Oct 2018 09:53:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 31 Oct 2018 16:53:21 +0000 Message-Id: <20181031165321.4422-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181031165321.4422-1-richard.henderson@linaro.org> References: <20181031165321.4422-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::32e Subject: [Qemu-devel] [PULL 3/3] decodetree: Allow multiple input files X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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) While it would be possible to concatenate input files with make, passing the original input files to decodetree.py allows us to generate error messages which allows compilation environments (read: emacs) to next-error to the correct input file. Tested-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Bastian Koppelmann Signed-off-by: Richard Henderson --- scripts/decodetree.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/scripts/decodetree.py b/scripts/decodetree.py index 6670d58cc1..4a3d46e4a7 100755 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -175,15 +175,15 @@ decode_function =3D 'decode' re_ident =3D '[a-zA-Z][a-zA-Z0-9_]*' =20 =20 -def error(lineno, *args): +def error_with_file(file, lineno, *args): """Print an error message from file:line and args and exit.""" global output_file global output_fd =20 if lineno: - r =3D '{0}:{1}: error:'.format(input_file, lineno) + r =3D '{0}:{1}: error:'.format(file, lineno) elif input_file: - r =3D '{0}: error:'.format(input_file) + r =3D '{0}: error:'.format(file) else: r =3D 'error:' for a in args: @@ -195,6 +195,8 @@ def error(lineno, *args): os.remove(output_file) exit(1) =20 +def error(lineno, *args): + error_with_file(input_file, lineno, args) =20 def output(*args): global output_fd @@ -420,6 +422,7 @@ class General: """Common code between instruction formats and instruction patterns""" def __init__(self, name, lineno, base, fixb, fixm, udfm, fldm, flds): self.name =3D name + self.file =3D input_file self.lineno =3D lineno self.base =3D base self.fixedbits =3D fixb @@ -472,7 +475,7 @@ class Pattern(General): global translate_prefix ind =3D str_indent(i) arg =3D self.base.base.name - output(ind, '/* line ', str(self.lineno), ' */\n') + output(ind, '/* ', self.file, ':', str(self.lineno), ' */\n') if not extracted: output(ind, self.base.extract_name(), '(&u.f_', arg, ', insn);= \n') for n, f in self.fields.items(): @@ -920,8 +923,9 @@ def build_tree(pats, outerbits, outermask): if innermask =3D=3D 0: pnames =3D [] for p in pats: - pnames.append(p.name + ':' + str(p.lineno)) - error(pats[0].lineno, 'overlapping patterns:', pnames) + pnames.append(p.name + ':' + p.file + ':' + str(p.lineno)) + error_with_file(pats[0].file, pats[0].lineno, + 'overlapping patterns:', pnames) =20 fullmask =3D outermask | innermask =20 @@ -1012,10 +1016,11 @@ def main(): =20 if len(args) < 1: error(0, 'missing input file') - input_file =3D args[0] - f =3D open(input_file, 'r') - parse_file(f) - f.close() + for filename in args: + input_file =3D filename + f =3D open(filename, 'r') + parse_file(f) + f.close() =20 t =3D build_tree(patterns, 0, 0) prop_format(t) --=20 2.17.2