[PATCH] D55172: [gn build] Fix cosmetic bug in write_cmake_config.py

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 1 19:08:32 PST 2018


thakis created this revision.
thakis added a reviewer: phosek.
Herald added a subscriber: mgorny.

Before,`#cmakedefine FOO` resulted in `#define FOO ` with a trailing space if FOO was set to something truthy. Make it so that it's just `#define FOO` without a trailing space.

No functional difference.


https://reviews.llvm.org/D55172

Files:
  llvm/utils/gn/build/write_cmake_config.py


Index: llvm/utils/gn/build/write_cmake_config.py
===================================================================
--- llvm/utils/gn/build/write_cmake_config.py
+++ llvm/utils/gn/build/write_cmake_config.py
@@ -72,11 +72,11 @@
             _, var = in_line.split(None, 1)
             try:
                 var, val = var.split(None, 1)
+                in_line = '#define %s %s' % (var, val)  # val ends in \n.
             except:
-                var, val = var.rstrip(), '\n'
-            if values[var]:
-                in_line = '#define %s %s' % (var, val)
-            else:
+                var = var.rstrip()
+                in_line = '#define %s\n' % var
+            if not values[var]:
                 in_line = '/* #undef %s */\n' % var
             unused_values.discard(var)
         out_lines.append(in_line)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55172.176275.patch
Type: text/x-patch
Size: 831 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181202/40eff0ba/attachment.bin>


More information about the llvm-commits mailing list