From patchwork Sun Feb 28 23:47:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 1445369 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=a/qTuU+t; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dpg7F13nKz9sRR for ; Mon, 1 Mar 2021 10:47:53 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DD76481F8F; Mon, 1 Mar 2021 00:47:41 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="a/qTuU+t"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B128081FB7; Mon, 1 Mar 2021 00:47:35 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-qt1-x82a.google.com (mail-qt1-x82a.google.com [IPv6:2607:f8b0:4864:20::82a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E26E481C7C for ; Mon, 1 Mar 2021 00:47:31 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=seanga2@gmail.com Received: by mail-qt1-x82a.google.com with SMTP id 18so8203087qty.3 for ; Sun, 28 Feb 2021 15:47:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uscSA0O0kwYxpMg/tN3yVzw8ePMfxQQLAHTE4fi65nA=; b=a/qTuU+tPxch/u4ZSBWVb7wsFM0Gi646XVkMZUDfboazqDHfog1Z0LWkmBxmSnH/qf AYCIRMxg9e1HJ/erUbxNlbMD20qh22n0Uxjtdg7oRvOkCsWAdBMOdyC8541h8vQ7ITF7 hELG/008EYAXwwh/sH1s2wHCb/5xD4kFunmDBb9fskaX2rDyxz7sTwFnebxq5Ls9zLrp dcKoUP6xJ+h65Xye3MG7nalumuAl08Eps1ne6lzydKOVwnVC1dcfvKDACSQgb5Kpe6xK iU3ePDy88fgiwkHI8UjBKiIHZQRn8WfwEypmyL280gU64wR6Wy5vkNVwfSd6NMgL/Usx QqxA== 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=uscSA0O0kwYxpMg/tN3yVzw8ePMfxQQLAHTE4fi65nA=; b=FwSm+b2NBWMrNK2gO6NWBS09VL85utIhuu7A52ObzMolIK7K0ftiRD2nXPjl0p40OZ OaovmwhamuboPQkiNaQp05ytoXXAjDFwkAfMvL6eb4sbtrBP5JHeiVUf99OMVHRpvRy/ Qz4W+c7SlTlQS/BdI2xhJ07u15F6/RJ6BNN3cqje7NIxDaFGk9VcujINnqszqzY8ohtC 8zkCrnSfPgPh76CrFf4bDTY7chX0vLtPyQLVQpjiAXrB3WCLqyfzSyvexd/Y/LHJWOlG JVytS8gR2vudW+QqkHo1OtPcFR+AEN6+N1Pw3JE2mGxhudR+v+oTxYwJ6nqbQs57ecGu pGrA== X-Gm-Message-State: AOAM530Ko5ldjzeWJWPb10h3o4BxFK5arQbkmDMsf6VNDBOZBz7keUXw 31abQ2LmVAgII2kkzEaGTJvFZ8+2BNDL1Q== X-Google-Smtp-Source: ABdhPJx4TZhQgg2XQ55tr+ZgF1LiwrrEERPeoD4IkZqb8m3NHE4+dN6wZmFT41k8/QpzijCie7MuUQ== X-Received: by 2002:ac8:5987:: with SMTP id e7mr7881373qte.168.1614556050622; Sun, 28 Feb 2021 15:47:30 -0800 (PST) Received: from godwin.fios-router.home (pool-108-51-35-162.washdc.fios.verizon.net. [108.51.35.162]) by smtp.gmail.com with ESMTPSA id n136sm7424527qke.123.2021.02.28.15.47.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Feb 2021 15:47:30 -0800 (PST) From: Sean Anderson To: u-boot@lists.denx.de, Tom Rini Cc: Simon Glass , Heinrich Schuchardt , Sean Anderson , Patrick Delaunay , Rasmus Villemoes Subject: [PATCH 1/5] hush: Print syntax error line with DEBUG_SHELL Date: Sun, 28 Feb 2021 18:47:14 -0500 Message-Id: <20210228234718.1208376-2-seanga2@gmail.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210228234718.1208376-1-seanga2@gmail.com> References: <20210228234718.1208376-1-seanga2@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean This prints the filename (rather useless) and line (very useful) whenever a syntax error occurs if DEBUG_SHELL is enabled. Signed-off-by: Sean Anderson --- common/cli_hush.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/common/cli_hush.c b/common/cli_hush.c index 1b9bef64b6..83329763c6 100644 --- a/common/cli_hush.c +++ b/common/cli_hush.c @@ -372,15 +372,17 @@ static inline void debug_printf(const char *format, ...) { } #endif #define final_printf debug_printf -#ifdef __U_BOOT__ +#ifdef DEBUG_SHELL +static void __syntax(char *file, int line) +{ + error_msg("syntax error %s:%d\n", file, line); +} + +#define syntax_err() __syntax(__FILE__, __LINE__) +#else static void syntax_err(void) { printf("syntax error\n"); } -#else -static void __syntax(char *file, int line) { - error_msg("syntax error %s:%d", file, line); -} -#define syntax() __syntax(__FILE__, __LINE__) #endif #ifdef __U_BOOT__