tools: moveconfig: fix cleanup of defines across multiple lines
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Mon, 25 Jul 2016 10:15:27 +0000 (19:15 +0900)
committerTom Rini <trini@konsulko.com>
Fri, 5 Aug 2016 11:27:17 +0000 (07:27 -0400)
Correct the clean-up of such defines that continue across multiple
lines, like follows:

  #define CONFIG_FOO "this continues to the next line " \
          "this line should be removed too" \
          "this line should be removed as well"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
tools/moveconfig.py

index 253507999c79d7c2aede326d32fc24287c1a9fb6..a0837140e984f1cfcf077ae75ba0d077985f49a1 100755 (executable)
@@ -408,6 +408,9 @@ def cleanup_one_header(header_path, patterns, options):
 
     matched = []
     for i, line in enumerate(lines):
+        if i - 1 in matched and lines[i - 1][-2:] == '\\\n':
+            matched.append(i)
+            continue
         for pattern in patterns:
             if pattern.search(line):
                 matched.append(i)