From patchwork Fri Nov 30 09:15:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 152497 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp3423518ljp; Fri, 30 Nov 2018 01:17:16 -0800 (PST) X-Google-Smtp-Source: AFSGD/XPzLffgVNUR+zcEjgEHRV8ewehPx+zjqmUQiKJ4rhu/QDaEvMptII5+O7hfgYOSdw9NEAh X-Received: by 2002:a17:902:4d46:: with SMTP id o6mr4707287plh.302.1543569436350; Fri, 30 Nov 2018 01:17:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543569436; cv=none; d=google.com; s=arc-20160816; b=CFGwQVhKYoZpvnOHWAkGRG6UeEw76Fp/fjb25Pgna0XQfrY1jZF5MuCE8Yx3JTRoD2 fhH/EDV/ocsDrMUK+nIr4RtmAI0zUva05CKfaw/XmjEYBW1DzNcDJZj20YoMRtZ6xxAX GUSJyKzR1v2v0HQ6BBId9nOUEll8zsaI1LLckg36H5NtaC/ywVfF372KLx+4FOLQYJRc mCBr8bdk4uOp+YT2NpwEhiIA83zX5SY0siFqaBXfXoE6KhRY8Wvd18kLS6xahQKCnwM2 B0rUGY+9Spe11GAXUX1n2yP7wrTIg7hsUxjwhkVj+xKpfKcq0qb+qmLUwFmB1WtmYBnI b3qQ== 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=xOuNyYoeaMcUn6Nixk1WwcdLtHqFZIy2LdfvliI/DuY=; b=lDIYdsBgOsf+r0aXZrZCCEGHPOmBqfhZ1h3hCy2EkvSNivq8IGgzzhpkjIymNlXgqO FAuEpt/D1NDNEQ+RJLDQUv4zXoI9nSX3/wR5Qa33l246oguON2Uh9kZvikpkjrICxI1j /TUOhEqfWi/FevH3S+EIUM6dYaaTN+W116Z//aGoy5+1apDCYEypQi45zj2t21A0b6oQ LfFBc4CDiipRMyv5VMULk3UFGiQR9Dqg23Q2qnlLbPQNXDwEJkW6a9O1O1LaYCgwf5qp iDiwfuI5BLny6LYi309SEcX91UaTKwfYrItrXFFzAIoVwJRjFVeHUwDMn3dSrcaWSj1f lXtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=lcq0zH6o; 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 n8si4830817plk.9.2018.11.30.01.17.16; Fri, 30 Nov 2018 01:17:16 -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=lcq0zH6o; 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 S1726637AbeK3UZt (ORCPT + 32 others); Fri, 30 Nov 2018 15:25:49 -0500 Received: from conuserg-09.nifty.com ([210.131.2.76]:52877 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726467AbeK3UZs (ORCPT ); Fri, 30 Nov 2018 15:25:48 -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 wAU9GEad028692; Fri, 30 Nov 2018 18:16:17 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com wAU9GEad028692 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1543569377; bh=xOuNyYoeaMcUn6Nixk1WwcdLtHqFZIy2LdfvliI/DuY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lcq0zH6oPO1KNNfYQIiLDFpxW7Usq4ldhYEYaDEsYi49Wj0uydojspOBCSXwUDjSb okrAQIBtQdNHnnWa7PnqP1rBkr9iuSjxl9WK8h0lpsIK4ml2iBJzZMPYQGtS2mYuOt HWXzI12TVWV+wiPerNA5mtpt5JuDnHvjq6rpdZqGZn0tGOAxxbTiNUCRVI4/w9tyaW OGAkdwkhN3IQlaB72mwRy07s5+S9UKERMSNB9jpl4EgFH+X6Ub5hPFzkUPonJ0Peda /AwcoR9/lX3Kph8KSOHPTxQCI98CX9hH8rv4THhevz36hUjK3AfmV3Jc40b8fdk0yA iYWhEJ+dmNoGA== 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 4/5] kconfig: remove S_OTHER symbol type and correct dependency tracking Date: Fri, 30 Nov 2018 18:15:51 +0900 Message-Id: <1543569352-4899-4-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 S_OTHER type could be set only when conf_read_simple() is reading include/config/auto.conf file. For example, CONFIG_FOO=y exists in include/config/auto.conf but it is missing from the currently parsed Kconfig files, sym_lookup() allocates a new symbol, and sets its type to S_OTHER. Strangely, it will be set to S_STRING by conf_set_sym_val() a few lines below while it is obviously bool or tristate type. On the other hand, when CONFIG_BAR="bar" is being dropped from include/config/auto.conf, its type remains S_OTHER. Because for_all_symbols() omits S_OTHER symbols, conf_touch_deps() misses to touch include/config/bar.h This behavior has been a pretty mystery for me, and digging the git histroy did not help. At least, touching depfiles is broken for string type symbols. I removed S_OTHER entirely, and reimplemented it more simply. If CONFIG_FOO was visible in the previous syncconfig, but is missing now, what we want to do is quite simple; just call conf_touch_dep() to touch include/config/foo.h instead of allocating a new symbol data. Signed-off-by: Masahiro Yamada --- scripts/kconfig/confdata.c | 33 ++++++++++++++------------------- scripts/kconfig/expr.h | 4 ++-- scripts/kconfig/symbol.c | 3 --- 3 files changed, 16 insertions(+), 24 deletions(-) -- 2.7.4 diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 7263b83..800fb16 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -227,14 +227,6 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) conf_warning("symbol value '%s' invalid for %s", p, sym->name); return 1; - case S_OTHER: - if (*p != '"') { - for (p2 = p; *p2 && !isspace(*p2); p2++) - ; - sym->type = S_STRING; - goto done; - } - /* fall through */ case S_STRING: if (*p++ != '"') break; @@ -253,7 +245,6 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) /* fall through */ case S_INT: case S_HEX: - done: if (sym_string_valid(sym, p)) { sym->def[def].val = xstrdup(p); sym->flags |= def_flags; @@ -434,17 +425,22 @@ int conf_read_simple(const char *name, int def) if (*p2 == '\r') *p2 = 0; } - if (def == S_DEF_USER) { - sym = sym_find(line + strlen(CONFIG_)); - if (!sym) { + + sym = sym_find(line + strlen(CONFIG_)); + if (!sym) { + if (def == S_DEF_AUTO) + /* + * Reading from include/config/auto.conf + * If CONFIG_FOO previously existed in + * auto.conf but it is missing now, + * include/config/foo.h must be touched. + */ + conf_touch_dep(line + strlen(CONFIG_)); + else sym_add_change_count(1); - continue; - } - } else { - sym = sym_lookup(line + strlen(CONFIG_), 0); - if (sym->type == S_UNKNOWN) - sym->type = S_OTHER; + continue; } + if (sym->flags & def_flags) { conf_warning("override: reassigning to symbol %s", sym->name); } @@ -710,7 +706,6 @@ static void conf_write_symbol(FILE *fp, struct symbol *sym, const char *str; switch (sym->type) { - case S_OTHER: case S_UNKNOWN: break; case S_STRING: diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h index 7c329e1..2b7e222 100644 --- a/scripts/kconfig/expr.h +++ b/scripts/kconfig/expr.h @@ -62,7 +62,7 @@ struct symbol_value { }; enum symbol_type { - S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING, S_OTHER + S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING }; /* enum values are used as index to symbol.def[] */ @@ -131,7 +131,7 @@ struct symbol { struct expr_value implied; }; -#define for_all_symbols(i, sym) for (i = 0; i < SYMBOL_HASHSIZE; i++) for (sym = symbol_hash[i]; sym; sym = sym->next) if (sym->type != S_OTHER) +#define for_all_symbols(i, sym) for (i = 0; i < SYMBOL_HASHSIZE; i++) for (sym = symbol_hash[i]; sym; sym = sym->next) #define SYMBOL_CONST 0x0001 /* symbol is const */ #define SYMBOL_CHECK 0x0008 /* used during dependency checking */ diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index 703b9b8..2e6bf36 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -61,8 +61,6 @@ const char *sym_type_name(enum symbol_type type) return "string"; case S_UNKNOWN: return "unknown"; - case S_OTHER: - break; } return "???"; } @@ -757,7 +755,6 @@ const char *sym_get_string_default(struct symbol *sym) return str; case S_STRING: return str; - case S_OTHER: case S_UNKNOWN: break; }