From patchwork Tue Jun 2 23:58:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 187393 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp25179ilo; Tue, 2 Jun 2020 16:59:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRW/bRg6tVGL1VKlQdtybfFtB++gDfjcU49H4gkULa4uhLAA99rEulfu4clKZydNWlJspi X-Received: by 2002:a25:943:: with SMTP id u3mr958795ybm.213.1591142351496; Tue, 02 Jun 2020 16:59:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591142351; cv=none; d=google.com; s=arc-20160816; b=Kr/ylZcEZRrbnmAkdDVlNWQkv//rht2sOxdxppG2/NsC2YqJVzJv/VBvelo9alm/Ye I6e+eb2vG67jjpbUHV3u3uJdX8CX6nd7vy8I/08xMYdKLVC5iI/wxeQwqi0tbjiODkGp HTLRM2Dlj4GZxUAS2rpERsgVpGVzsmEeRDYFQj3faq54YPx9eVG01Dsyq3/JXN5yWTmX r6+EGHAKY3Q5HaRw/2kP5YF2E9JuJNM6Yc1mGeigIgtCt5wZXUWEZK+ykBdFjvfUxagu +S+Xym/yuXFq4T0QidoDR4HK61J9EwZ58xLofMQLPQjrEKP9cAcS8n9FcYe2x1DD8ihL uJQQ== 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=b/XVcjpntbxdGusUz05j9FBinJNgwBz4HL/Wlk1yj2E=; b=RZm7fjrO5qJeN5ie2ZuBFWMKLS5eyb083RGuPhtTcgXRYIMgwYoSrsbVwQUN6xdb4b fuSd0gwncZ4Ij4FkFbEbsB5HCiN4HPkOO1bucoFEqjyfyTuFk1Z2XNefDSkbrf1svZTV S7h+A3cNO11UlXBouSFb3dvTEzAm3Mb6Bpbnt65Xacy/PoTNjsXWg6KQurZZfXoT3ZJQ ScTliyk+9nyJblzdl8Tp3so7V3JvDq33ZVDtrP9wigf/8Y5ZCf5972xmCS1JgjsWv/8S PyM+0LFPsuDU9OYjUtwD/jBmg8wXeMh/3LUBnXRZyWc8HlcPAKbQpXkLwW7apOBQCVp0 c3zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oc0q7LE8; 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 y186si126218ybc.398.2020.06.02.16.59.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Jun 2020 16:59:11 -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=oc0q7LE8; 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]:40640 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jgGoJ-0004hi-0l for patch@linaro.org; Tue, 02 Jun 2020 19:59:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33028) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jgGno-0004gq-2f for qemu-devel@nongnu.org; Tue, 02 Jun 2020 19:58:40 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]:34617) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jgGnn-00023w-BG for qemu-devel@nongnu.org; Tue, 02 Jun 2020 19:58:39 -0400 Received: by mail-pf1-x42a.google.com with SMTP id z64so311547pfb.1 for ; Tue, 02 Jun 2020 16:58:38 -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=b/XVcjpntbxdGusUz05j9FBinJNgwBz4HL/Wlk1yj2E=; b=oc0q7LE8Ir+zgj8P7CjTLNYzDwOGofSquj4cPNWu4X2f55BBwaNOf4x6zIrp2h9W5b JseoxQooDeat3yLtserJmk+8bN3F5E9iRSxtnh9yi1DHGqt7abmk2aWu0wguPxuOUDd4 581QuzwySphwwiinxi62TH/IluBcbojUy4vBS640o+SJvDdJPnNSnUdMFI/BbUBL0cdb vzOsZ4xJ5G+CmtxahUk8h9oTk9GHpTxov95t6ONGAQY0xHt1OUCph30uxMrBSPViTZ1A 5pvl2+TNMeLernxhxksMwzid19YsCx6s1CWzICZSJrtAoFAONyW3acV4y3GRrxxKD7IM 3hhw== 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=b/XVcjpntbxdGusUz05j9FBinJNgwBz4HL/Wlk1yj2E=; b=UC17DxwqfHL8tEOZGg7T/t3sZZhLoZ5FkYSH9COD/Fpq4i8KPkP5KfUYWtptKNw7eT SUeQNo8I3AneRXdI1tH7k9xdCgfSDj+B6eavE9SDrPTWqKJRTN78sOfZlGHJRSu8qKP5 S29zSU/fXUqMRNhYDGbp8yFAJqtG/gsiM4PQsZ6XMykSgmN1dNgm06wIrLMfoaryX3OY o+m991+l8L2lZ8JtqsET80EA7/Vo8AeiGsaJSaFKeIGJVsWf/KlB94G++cHWrwPEDBmI J3oX8yXS+b7jincIrLUHc9k/AiNo8PcZzMTuDeRx3fo/z25yf7QFNevKgIdXtCqekWXc i95A== X-Gm-Message-State: AOAM533fO5OWXOnAqFhFsnFz3TFoXCgJ43iOzICQeBnGPr7KjAsPLBGL ipqpUoBER60ebxp9ZYneO+LofZOHxs0= X-Received: by 2002:a17:90b:4c44:: with SMTP id np4mr1821245pjb.63.1591142317535; Tue, 02 Jun 2020 16:58:37 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id k101sm182201pjb.26.2020.06.02.16.58.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jun 2020 16:58:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 1/8] decodetree: Tidy error_with_file Date: Tue, 2 Jun 2020 16:58:27 -0700 Message-Id: <20200602235834.470345-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200602235834.470345-1-richard.henderson@linaro.org> References: <20200602235834.470345-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42a.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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, philmd@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use proper varargs to print the arguments. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- scripts/decodetree.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) -- 2.25.1 diff --git a/scripts/decodetree.py b/scripts/decodetree.py index f9d204aa36..b559db3086 100755 --- a/scripts/decodetree.py +++ b/scripts/decodetree.py @@ -51,23 +51,27 @@ def error_with_file(file, lineno, *args): global output_file global output_fd + prefix = '' + if file: + prefix += '{0}:'.format(file) if lineno: - r = '{0}:{1}: error:'.format(file, lineno) - elif input_file: - r = '{0}: error:'.format(file) - else: - r = 'error:' - for a in args: - r += ' ' + str(a) - r += '\n' - sys.stderr.write(r) + prefix += '{0}:'.format(lineno) + if prefix: + prefix += ' ' + print(prefix, end='error: ', file=sys.stderr) + print(*args, file=sys.stderr) + if output_file and output_fd: output_fd.close() os.remove(output_file) exit(1) +# end error_with_file + def error(lineno, *args): - error_with_file(input_file, lineno, args) + error_with_file(input_file, lineno, *args) +# end error + def output(*args): global output_fd