From patchwork Fri Nov 30 09:15:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 152499 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp3423536ljp; Fri, 30 Nov 2018 01:17:17 -0800 (PST) X-Google-Smtp-Source: AFSGD/W8m+nX7eGq2DWZ+9yBqcflToWjOiErpj2zLf3VV5wuewVogOGgCHsdIIQM1+9e6mJtvCyr X-Received: by 2002:a17:902:981:: with SMTP id 1mr4800682pln.142.1543569437074; Fri, 30 Nov 2018 01:17:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543569437; cv=none; d=google.com; s=arc-20160816; b=javN5J/vuNSuOvsngfjrWt2pHqxiF8l5jjs7+/OFRtqo3+NJh0JlLxMhxGzVKNS272 VHz00i5KHN8FR3mhC4d4cHnXkmxnUL/+h8ObUIfIaU0VdzCMifg7N4sm5HAVMHXLGTS/ 0E0wjL46ETmymyeT+dnNcl8pHBDZXo0/ah/1xPUrRDXE8ZUuEmO9fS8h7INb6J728kk2 gqzs438VbgDhzhknwf3g28AONHWEXfqe+jLbm86eeRxwIMchpWr6CSP59AhoZw5r3FJ1 bgDKUuUbrRYMTYLRnD5Qpn3ct3pMWClPaswucLBZlZoUh0MDDM2skk6hITIFVRLEFUKX 6B3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=Ila7IG6OhXb9xuIrOHlsnG2ifWK5+2r1WBzDYAzsmws=; b=WaRdWhKs14yDXnkk8gqP4iL2oP2Ux2gWv0skydQfE4EcEawIxYJN27eUjFyid1Ei07 yFQQhqf+Bs1TnziwwQcDos3d9gRcKhzjeyhuuTVK9UDRWfRrp05w5m2jDksVJeeHnjTj ApqPW04HnqwgbQ3cn6c65f7l20dZu+u7WzAGx5k0bb2FMewbBOhcqyNc6gM8dhxkSbM7 gb4SLvgrsQydsqlO5Bv0qb1Iye+WLv4lsOdxMidcF+h3Jg3LllYXskmzGIrL9WpaE50X gMdHpHlslJP5XTBv3RtgaA5/y1bV6ruw4F0hY3LWw3oLiYMqEYSb2yAGi5VgssIUrLIT YzPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Gif4TJI6; 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:17 -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=Gif4TJI6; 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 S1726746AbeK3UZx (ORCPT + 32 others); Fri, 30 Nov 2018 15:25:53 -0500 Received: from conuserg-09.nifty.com ([210.131.2.76]:53049 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726641AbeK3UZx (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 wAU9GEaa028692; Fri, 30 Nov 2018 18:16:15 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com wAU9GEaa028692 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1543569375; bh=Ila7IG6OhXb9xuIrOHlsnG2ifWK5+2r1WBzDYAzsmws=; h=From:To:Cc:Subject:Date:From; b=Gif4TJI61WXA20XdCFtR8WvqtE/MizphhVqSZHUA78BzkR/Ss3W4wPL6uvnu6H2bg ABzKR0tlVB78fsJnJcbV7QPsMVJECqtkYDnEc1Al1psH4hwM8c9YKH+RHD6v058bLe hxlkXtPathYat5hV3nES5jJCpVtiJFgFFQPUtQglzzenMuwRnGw6TsPaZuBX3I8/Jn hGlP0/ZMK0A8IsQ9Hrr71Jq0alR0qu6toZWoEcrk6HEy8yQjOTtgcxECQrVk5Oprfy HD6s40BUCsV6pZS0xQGhGcP/t1k5ptoZma1lJwwzTEhQN3uR+VJ3QmhvLJtWUetvQh a7zetDD7fHxag== 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 1/5] kconfig: remove unneeded setsym label in conf_read_simple() Date: Fri, 30 Nov 2018 18:15:48 +0900 Message-Id: <1543569352-4899-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The two 'goto setsym' statements are reachable only when sym == NULL. The code below the 'setsym:' label does nothing when sym == NULL since there is just one if-block guarded by 'if (sym && ...)'. Hence, 'goto setsym' can be replaced with 'continue'. Signed-off-by: Masahiro Yamada --- scripts/kconfig/confdata.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.7.4 diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 91d0a5c..1e35529 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -363,7 +363,7 @@ int conf_read_simple(const char *name, int def) sym = sym_find(line + 2 + strlen(CONFIG_)); if (!sym) { sym_add_change_count(1); - goto setsym; + continue; } } else { sym = sym_lookup(line + 2 + strlen(CONFIG_), 0); @@ -397,7 +397,7 @@ int conf_read_simple(const char *name, int def) sym = sym_find(line + strlen(CONFIG_)); if (!sym) { sym_add_change_count(1); - goto setsym; + continue; } } else { sym = sym_lookup(line + strlen(CONFIG_), 0); @@ -416,7 +416,7 @@ int conf_read_simple(const char *name, int def) continue; } -setsym: + if (sym && sym_is_choice_value(sym)) { struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym)); switch (sym->def[def].tri) { From patchwork Fri Nov 30 09:15:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 152498 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp3423527ljp; Fri, 30 Nov 2018 01:17:16 -0800 (PST) X-Google-Smtp-Source: AFSGD/W7xmBEOJoOaKaZ9yNojCtKFYsov05yTF3DUEt8ppGhMsTCMyqZ3nyCf+kU8jE92MLNw++L X-Received: by 2002:a62:4b4d:: with SMTP id y74mr4801629pfa.186.1543569436721; 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=Cm2q1gmLwoikPzpdWg47wBMBsPhrBZac5FhmMKev5fR4VpPIqFxfHPpxq7boI6C2Gd w+aElfujYK+7nJUT8c47xqixms2+gZeh7nkYx8Os5LagRvgnwGbJ/9CsDbqM00lPKJIy X9NYUGPNOcptH6HT9r6oRqHK4p3nInQ6OQdRNbcuhXTU/YZ4who6i/KgZ5n/qIAaqICP Ew1ZdqsPGrttzME4sTKnJb36QLcCUjPdIzzZq/neqToWj8tDQNZSRe1uJJFrDx68rGGA 1wYd3msXd87YhVFdVIpBhNmll6QfBLNstj5vjKsN6O7tYuUBuujJ/x1uXzOUzO1fthy8 5YyQ== 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=kqMXos4G/lPaZHDP8a5rB5HT6m4xOVUCjqkGig4Uqy4=; b=P1cVxjFp8TFkypWM9e0qjsX8tbyVksTIScHGjSaV+ItCTipPOQDbGsa6YN7LxRPy64 /Aaaq9xbnE0u8uy61fTmkiPsWrpP0RhnA0VNyuVUKNb/eAIxXGfwM9fBow+ugVB0TQwd +Lan1TnjWqe8UuNjMWm8dde1nMnlHDumCaxI8YChTiIdo3c8godxwTVm9ejEFqOrDsA3 t8Kry6a5wq1TXR2cVYaWtQQZwakIopZG2k1ssd18tkGTx1l8T+VRjYfg67l96n8g6xi5 GHAILWocEYkoncN+rOlBVnUTCRvALLUEzULEsLZJRUrlK50CWmp6kySFNxiTd0Kzyp7C p4jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=uXM9iz7B; 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=uXM9iz7B; 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 S1726691AbeK3UZx (ORCPT + 32 others); Fri, 30 Nov 2018 15:25:53 -0500 Received: from conuserg-09.nifty.com ([210.131.2.76]:53044 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726640AbeK3UZx (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 wAU9GEab028692; Fri, 30 Nov 2018 18:16:15 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com wAU9GEab028692 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1543569376; bh=kqMXos4G/lPaZHDP8a5rB5HT6m4xOVUCjqkGig4Uqy4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uXM9iz7BjVgr3HaB5P4EA7P7ho5Jz9jGuBYhVb9WLFMeaZQB/so6i0IEgqaNQ4t7m JKOdMfZKNwuJSjR4q0sO3rWMYjH5OBhcLpdVvYRTOIKILP7aKWGM9jZdWRw4p11JCC Yst3bj6W1M3hkui49420hFrc0EPeg+NICpqcxStFBMkeXPNYKc5KdzxejbbTea4nUi hYykOHE3ery60ZI5x8a49e9dp0e3S/l+ltOzTBnGLyw0WTrqRQTZGKaWiZU20N2tL6 YNIZsJvrhoiYc0T6wpAXFvtaXn4Vzbod8Wn6970pJ2KjHu50XIxfxEMzS8SRfF3gj8 3HFpC4mbXU2kQ== 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 2/5] kconfig: rename conf_split_config() to conf_touch_deps() Date: Fri, 30 Nov 2018 18:15:49 +0900 Message-Id: <1543569352-4899-2-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 According to commit 2e3646e51b2d ("kconfig: integrate split config into silentoldconfig"), this function was named after split-include tool, which used to exist in old versions of Linux. Setting aside the historical reason, rename it into a more intuitive name. This function touches timestamp files under include/config/ in order to interact with the fixdep tool. Signed-off-by: Masahiro Yamada --- scripts/kconfig/confdata.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 1e35529..4c76d56 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -906,7 +906,7 @@ static int conf_write_dep(const char *name) return 0; } -static int conf_split_config(void) +static int conf_touch_deps(void) { const char *name; char path[PATH_MAX+1]; @@ -1028,7 +1028,7 @@ int conf_write_autoconf(int overwrite) conf_write_dep("include/config/auto.conf.cmd"); - if (conf_split_config()) + if (conf_touch_deps()) return 1; out = fopen(".tmpconfig", "w"); From patchwork Fri Nov 30 09:15:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 152500 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp3423617ljp; Fri, 30 Nov 2018 01:17:22 -0800 (PST) X-Google-Smtp-Source: AFSGD/Wnvy9C+cl/bIqDYYxyx5Y7rVrgIb4zhItBpPKZrAb669m7yuHavAmbNkJBnam4FNmpCLeE X-Received: by 2002:a17:902:d905:: with SMTP id c5mr4778208plz.43.1543569442439; Fri, 30 Nov 2018 01:17:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543569442; cv=none; d=google.com; s=arc-20160816; b=Y6582x/PiyIMDfYX0GC2JtvWwd1ov79OE25Uabl/L5YYbFYjZHc8k3klPiS7VRsHuL mIm1cE00iC86rfruU4V22VRRJmXZJYE1jCY+6IpZO4K16lntdCL1vOYuUOcbn0HmE1cy i2A771cwsBaK02cc9L4cjI5sTPTNjyjO2XuBm9T4xH0cGmhWGPndwzpbAOIrChw0mKFN Ql9MBS+diQ9ioSy9lLBbF1Z9E95KWNmK4dn9PXlfwgmzUvodRbriX5Epr/hRLebU6V/t /a7eOn8q18pzGo5PRNGIIWnk3jUygYMCt06deuqe+e3pXpLbm0HEtezGm0gsNq/T/mWC aWzQ== 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=HiMqj/ME+AaGau+DxV454Be5fNhnAhoE/t6iCz3z6jg=; b=R6v/FJMXvVpIUVZczXOMvoYbrpG6RcS9J/C84vrIADiTSxkvJatkxfqW6toD0p1CE2 ikYfVjhjYDDnku0PqGobvkxvEbqwiS//tWBZ+6dwbDc1f/k26gwPt0ynXuA6Co8Kp61B xknmcXYxWLHidsT6QxkDL10oaIWfn0AdkyXoe78D1i4MR8lUu9P/q2q8HbpuU4L7nH5e igWqtwMacE5Pxx6KecvdYApHWCxO4iXzjPJxvPPFbre3pRSeiADqNjVsgifX5ZIU6s/H lXniSYql+2wTxhLqdV7d4etiPPBgLprEo8LcxeOFDte8VyKMKtBAM4CEA5UZlm6IjS8y Rygw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=0lPI4l5Q; 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 m65si5030740pfg.282.2018.11.30.01.17.21; Fri, 30 Nov 2018 01:17:22 -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=0lPI4l5Q; 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 S1726789AbeK3UZ7 (ORCPT + 32 others); Fri, 30 Nov 2018 15:25:59 -0500 Received: from conuserg-09.nifty.com ([210.131.2.76]:53048 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726644AbeK3UZx (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 wAU9GEac028692; Fri, 30 Nov 2018 18:16:16 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com wAU9GEac028692 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1543569376; bh=HiMqj/ME+AaGau+DxV454Be5fNhnAhoE/t6iCz3z6jg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0lPI4l5QGeZ4FmFhB/3a9h8BVW7oBdM/qSU9p6YwNGzHP9nRB0gfgHj4pYmH1yGWG LYkh7Cdo4wdnem8m11bWar/IW3pOibroI/ohq/5zaDRUdMNA1Yno7CTlHfcgpIJ8O6 KpBuc3YgtCTBHzujQm5/l2RK67n2I7l/afD+pig7sHvZ6iOYZ1f3rTNJfQb5qUfD2o HaivYoNgvbqvyMDdLJlyMizYgephTbiAdrP8Cia/Z9H2CZm9EhVcjoONNpyn0MCrjl D65NB86DUMrUMmuk8psBlyhvHN7XST8u+mdfsArGImSb1Fl3IrtjexDxmqeJHnPm+s OppF+2kH0PB7g== 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 3/5] kconfig: split out code touching a file to conf_touch_dep() Date: Fri, 30 Nov 2018 18:15:50 +0900 Message-Id: <1543569352-4899-3-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 conf_touch_deps() iterates over symbols, touching corresponding include/config/*.h files as needed. Split the part that touches a single file into a new helper so it can be reused. The new helper, conf_touch_dep(), takes a symbol name as a parameter, and touches the corresponding include/config/*.h file. Signed-off-by: Masahiro Yamada --- scripts/kconfig/confdata.c | 92 ++++++++++++++++++++++++---------------------- 1 file changed, 49 insertions(+), 43 deletions(-) -- 2.7.4 diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 4c76d56..7263b83 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -74,6 +74,47 @@ static int make_parent_dir(const char *path) return 0; } +static char depfile_path[PATH_MAX]; +static size_t depfile_prefix_len; + +/* touch depfile for symbol 'name' */ +static int conf_touch_dep(const char *name) +{ + int fd, ret; + const char *s; + char *d, c; + + /* check overflow: prefix + name + ".h" + '\0' must fix in buffer. */ + if (depfile_prefix_len + strlen(name) + 3 > sizeof(depfile_path)) + return -1; + + d = depfile_path + depfile_prefix_len; + s = name; + + while ((c = *s++)) + *d++ = (c == '_') ? '/' : tolower(c); + strcpy(d, ".h"); + + /* Assume directory path already exists. */ + fd = open(depfile_path, O_WRONLY | O_CREAT | O_TRUNC, 0644); + if (fd == -1) { + if (errno != ENOENT) + return -1; + + ret = make_parent_dir(depfile_path); + if (ret) + return ret; + + /* Try it again. */ + fd = open(depfile_path, O_WRONLY | O_CREAT | O_TRUNC, 0644); + if (fd == -1) + return -1; + } + close(fd); + + return 0; +} + struct conf_printer { void (*print_symbol)(FILE *, struct symbol *, const char *, void *); void (*print_comment)(FILE *, const char *, void *); @@ -909,21 +950,16 @@ static int conf_write_dep(const char *name) static int conf_touch_deps(void) { const char *name; - char path[PATH_MAX+1]; - char *s, *d, c; struct symbol *sym; - int res, i, fd; + int res, i; + + strcpy(depfile_path, "include/config/"); + depfile_prefix_len = strlen(depfile_path); name = conf_get_autoconfig_name(); conf_read_simple(name, S_DEF_AUTO); sym_calc_value(modules_sym); - if (make_parent_dir("include/config/foo.h")) - return 1; - if (chdir("include/config")) - return 1; - - res = 0; for_all_symbols(i, sym) { sym_calc_value(sym); if ((sym->flags & SYMBOL_NO_WRITE) || !sym->name) @@ -975,42 +1011,12 @@ static int conf_touch_deps(void) * different from 'no'). */ - /* Replace all '_' and append ".h" */ - s = sym->name; - d = path; - while ((c = *s++)) { - c = tolower(c); - *d++ = (c == '_') ? '/' : c; - } - strcpy(d, ".h"); - - /* Assume directory path already exists. */ - fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644); - if (fd == -1) { - if (errno != ENOENT) { - res = 1; - break; - } - - if (make_parent_dir(path)) { - res = 1; - goto out; - } - - /* Try it again. */ - fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644); - if (fd == -1) { - res = 1; - break; - } - } - close(fd); + res = conf_touch_dep(sym->name); + if (res) + return res; } -out: - if (chdir("../..")) - return 1; - return res; + return 0; } int conf_write_autoconf(int overwrite) 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; } 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);