fixdep: remove some false CONFIG_ matches
authorRasmus Villemoes <linux@rasmusvillemoes.dk>
Wed, 28 Feb 2018 19:17:36 +0000 (20:17 +0100)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Mon, 5 Mar 2018 14:48:25 +0000 (23:48 +0900)
The string CONFIG_ quite often appears after other alphanumerics,
meaning that that instance cannot be referencing a Kconfig
symbol. Omitting these means make has fewer files to stat() when
deciding what needs to be rebuilt - for a defconfig build, this seems to
remove about 2% of the (wildcard ...) lines from the .o.cmd files.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
scripts/basic/fixdep.c

index d7fbe545dd5d47762993acb730b663389dbfcc4c..1b21870d6e7f9fb95041b2d3e61e1590d5fd79aa 100644 (file)
@@ -225,8 +225,13 @@ static int str_ends_with(const char *s, int slen, const char *sub)
 static void parse_config_file(const char *p)
 {
        const char *q, *r;
+       const char *start = p;
 
        while ((p = strstr(p, "CONFIG_"))) {
+               if (p > start && (isalnum(p[-1]) || p[-1] == '_')) {
+                       p += 7;
+                       continue;
+               }
                p += 7;
                q = p;
                while (*q && (isalnum(*q) || *q == '_'))