From patchwork Fri Nov 30 09:15:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 152501 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp3423768ljp; Fri, 30 Nov 2018 01:17:31 -0800 (PST) X-Google-Smtp-Source: AFSGD/VSwC5YVhDjUyI+o7bMe4FWSj0FpyPLh8kfyhMVeCFMPNlW5Hn25JUQMyv8nKu48APs29+1 X-Received: by 2002:a62:6d47:: with SMTP id i68mr4835767pfc.185.1543569451386; Fri, 30 Nov 2018 01:17:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543569451; cv=none; d=google.com; s=arc-20160816; b=oOLl3kQutsqd+KhUngLM5yjsz8CSDLcK5UTrOCKbZEkn64yeyYNEQSlyvos2ZMKxNe bGTpE2fxkKWz85h3qkUvhRZihRc3gprAYKB5905dIiwymfFOSzqzG1PW0u/32KjY49B/ kF2eIatSZR6Gg7xBiKrkXvu+dau3rieeDsP0RtTzqpOwVEKrE5kLkIpXWThXQM3JyK1E /spjFe8bkmCzIFLYSF2tx+uS+ilaoG5jizN1y92G7GI4RvFIM8+S73wyQxxmUTxoyzMN dtFcMGCFodsz+PTx1iRuFWnRIdHDQLyNdi9E3kYWWTGY1ZqWc6/UzQd7Vjy9M7gWexmG Vz3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=gzYKmCi7RFLRJbVhrqU0TB39r/78EVYGgl3EJRt3LHA=; b=VRXBccmUMc0sO0rawWs4HLPJUWvcPT7tpsrEVD4uxmoFGnKV6AM1RyrqNAPmR/gNji JCg4xl4O+8AMdCO+7YJecJMtqy/gw1MfS0cdoBBJsiSqaTJ3+7FRWyqmS12GPQ0evTAj 6EM4wcCLIfIOuiIAOwh78Y2Kg/mJa6fFv1wIAV7YGrFO6G3B0p5zkWG9WYSLgAFNaesZ FVxzidgwFWSsPL4V8cuXbAn+FTB6pUvSW9eaJw1b9ZQO7oYBkP22nt/lb+VTdIy/0McE QNYUby8ojBFDuI3JLhFu6t5kT2s1YpjlH1QtvsiS11M510wQ+dbj51bN5VdXrn/Al5lt i76A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=o72pLIlT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v5si4938988plg.318.2018.11.30.01.17.31; Fri, 30 Nov 2018 01:17:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=o72pLIlT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726831AbeK3U0I (ORCPT + 32 others); Fri, 30 Nov 2018 15:26:08 -0500 Received: from conuserg-09.nifty.com ([210.131.2.76]:53045 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726467AbeK3UZx (ORCPT ); Fri, 30 Nov 2018 15:25:53 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id wAU9GEae028692; Fri, 30 Nov 2018 18:16:17 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com wAU9GEae028692 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1543569377; bh=gzYKmCi7RFLRJbVhrqU0TB39r/78EVYGgl3EJRt3LHA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o72pLIlT3hEsKSyRX4sL507cGrtN4IE8mSFLVIfTcleG3s5VOVof1gKNVqSQNktLG n24ORWdy1EUxa1xbG60LGIQeCghPp2/Al8rzDExxTs1sNIAf3pdRE304SPh6KbxO69 VRaFCg5vDTEDBAfmZUbGvloDkizBIPXGTUXQzfROJlrlyDIks8G0zZa5mJqSTd7oR0 Jq64CddIkYgWNWLs6SYdsFNAXp2vnEy/636vV96MiM+yAsgrFhI0quBktqFzzXedoD /OvPqD+J4YSl7uNPCTXUZQUm0p2ZgjGhGyVtydfiWLCgzVM85DxGDnx1GXReM1hvE2 7N3K3ET8HYhBQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Ulf Magnusson , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH 5/5] kconfig: remove k_invalid from expr_parse_string() return type Date: Fri, 30 Nov 2018 18:15:52 +0900 Message-Id: <1543569352-4899-5-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543569352-4899-1-git-send-email-yamada.masahiro@socionext.com> References: <1543569352-4899-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The only possibility of k_invalid being returned was when expr_parse_sting() parsed S_OTHER type symbol. This actually never happened, and this is even clearer since S_OTHER has gone. Clean up unreachable code. Signed-off-by: Masahiro Yamada --- scripts/kconfig/expr.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) -- 2.7.4 diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c index e1a39e9..57ebf71 100644 --- a/scripts/kconfig/expr.c +++ b/scripts/kconfig/expr.c @@ -980,7 +980,6 @@ enum string_value_kind { k_string, k_signed, k_unsigned, - k_invalid }; union string_value { @@ -1011,13 +1010,10 @@ static enum string_value_kind expr_parse_string(const char *str, val->u = strtoull(str, &tail, 16); kind = k_unsigned; break; - case S_STRING: - case S_UNKNOWN: + default: val->s = strtoll(str, &tail, 0); kind = k_signed; break; - default: - return k_invalid; } return !errno && !*tail && tail > str && isxdigit(tail[-1]) ? kind : k_string; @@ -1073,13 +1069,7 @@ tristate expr_calc_value(struct expr *e) if (k1 == k_string || k2 == k_string) res = strcmp(str1, str2); - else if (k1 == k_invalid || k2 == k_invalid) { - if (e->type != E_EQUAL && e->type != E_UNEQUAL) { - printf("Cannot compare \"%s\" and \"%s\"\n", str1, str2); - return no; - } - res = strcmp(str1, str2); - } else if (k1 == k_unsigned || k2 == k_unsigned) + else if (k1 == k_unsigned || k2 == k_unsigned) res = (lval.u > rval.u) - (lval.u < rval.u); else /* if (k1 == k_signed && k2 == k_signed) */ res = (lval.s > rval.s) - (lval.s < rval.s);