From patchwork Sun Dec 5 06:29:25 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Lacombe X-Patchwork-Id: 380621 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oB56a4Pv015857 for ; Sun, 5 Dec 2010 06:36:05 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752263Ab0LEGgD (ORCPT ); Sun, 5 Dec 2010 01:36:03 -0500 Received: from mail-gx0-f180.google.com ([209.85.161.180]:58930 "EHLO mail-gx0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751481Ab0LEGgC (ORCPT ); Sun, 5 Dec 2010 01:36:02 -0500 Received: by gxk19 with SMTP id 19so5952339gxk.11 for ; Sat, 04 Dec 2010 22:36:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=YJf1wUTozlqxR8bXM1KDPFbB9t3o8+DTWHr2sv1Zz3M=; b=G40wDu68WDboLaHHDTUMpoYtQUgItAzJv9yJiDDW91L/EqhugEG+BadlwiihOxWJ8t jKVxIPST8TrdeRNezzsZCOjNAA2d4S4f3aQfg8l4PhDQ0w2sEanDxocGJnOPe0rpcq3q QvV3rS2fSrE7odTv+HZOhQjF/2+DVxMM6KBzg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=Xxn46wqZj38wedCksO2BkmOKuQaNf2xBCThVj9IHgZEVrojRSTMz2v0Hh/7nkUzrTv H2OU/MBWL1N3R3uW9TAtFJkCQvKKxAFZ5z7W2xwq7RWLwU68tw4Zh/xy1DngZSEshqf8 KZ7eJiYw30pItuqD9N7Cn6Lva27b1X2fzQ9iM= Received: by 10.90.60.8 with SMTP id i8mr2575879aga.45.1291530617746; Sat, 04 Dec 2010 22:30:17 -0800 (PST) Received: from localhost.localdomain (75-119-248-218.dsl.teksavvy.com [75.119.248.218]) by mx.google.com with ESMTPS id q8sm2269930yhg.1.2010.12.04.22.30.16 (version=SSLv3 cipher=RC4-MD5); Sat, 04 Dec 2010 22:30:17 -0800 (PST) From: Arnaud Lacombe To: linux-kbuild@vger.kernel.org Cc: Arnaud Lacombe Subject: [PATCH 2/5] kconfig: add more S_INT and S_HEX consistency checks Date: Sun, 5 Dec 2010 01:29:25 -0500 Message-Id: <1291530566-23531-2-git-send-email-lacombar@gmail.com> X-Mailer: git-send-email 1.7.2.30.gc37d7.dirty In-Reply-To: <1291530566-23531-1-git-send-email-lacombar@gmail.com> References: <1291530566-23531-1-git-send-email-lacombar@gmail.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Sun, 05 Dec 2010 06:36:05 +0000 (UTC) diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index 7e83aef..8a8bc9b 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -183,7 +183,7 @@ void menu_add_option(int token, char *arg) } } -static int menu_range_valid_sym(struct symbol *sym, struct symbol *sym2) +static int menu_validate_number(struct symbol *sym, struct symbol *sym2) { return sym2->type == S_INT || sym2->type == S_HEX || (sym2->type == S_UNKNOWN && sym_string_valid(sym, sym2->name)); @@ -201,6 +201,15 @@ static void sym_check_prop(struct symbol *sym) prop_warn(prop, "default for config symbol '%s'" " must be a single symbol", sym->name); + if (prop->expr->type != E_SYMBOL) + break; + sym2 = prop_get_symbol(prop); + if (sym->type == S_HEX || sym->type == S_INT) { + if (!menu_validate_number(sym, sym2)) + prop_warn(prop, + "'%s': number is invalid", + sym->name); + } break; case P_SELECT: sym2 = prop_get_symbol(prop); @@ -220,8 +229,8 @@ static void sym_check_prop(struct symbol *sym) if (sym->type != S_INT && sym->type != S_HEX) prop_warn(prop, "range is only allowed " "for int or hex symbols"); - if (!menu_range_valid_sym(sym, prop->expr->left.sym) || - !menu_range_valid_sym(sym, prop->expr->right.sym)) + if (!menu_validate_number(sym, prop->expr->left.sym) || + !menu_validate_number(sym, prop->expr->right.sym)) prop_warn(prop, "range is invalid"); break; default: