[libcxx-commits] [PATCH] D98869: [libc++] Future-proof generate_feature_test_macro_components.py against long names

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Mar 18 07:35:03 PDT 2021


Quuxplusone created this revision.
Quuxplusone added a reviewer: libc++.
Quuxplusone added a project: libc++.
Herald added a subscriber: arichardson.
Quuxplusone requested review of this revision.
Herald added a subscriber: libcxx-commits.
Herald added 1 blocking reviewer(s): libc++.

The proposed-for-C++2b `__cpp_lib_default_template_type_for_algorithm_values` is 52 characters long, which is enough to reduce the multiplier to less-than-zero, producing an empty string between the name of the macro and its numeric value. Ensure there's always a space between the name of the macro and its value.

When run, this produces no diffs in the generated headers/tests.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98869

Files:
  libcxx/utils/generate_feature_test_macro_components.py


Index: libcxx/utils/generate_feature_test_macro_components.py
===================================================================
--- libcxx/utils/generate_feature_test_macro_components.py
+++ libcxx/utils/generate_feature_test_macro_components.py
@@ -724,7 +724,7 @@
 
 def produce_macros_definition_for_std(std):
   result = ""
-  indent = 56
+  indent = 55
   for tc in feature_test_macros:
     if std not in tc["values"]:
       continue
@@ -738,7 +738,7 @@
       result += "# undef  %s\n" % tc["name"]
     line = "#%sdefine %s" % ((" " * inner_indent), tc["name"])
     line += " " * (indent - len(line))
-    line += "%sL" % tc["values"][std]
+    line += " %sL" % tc["values"][std]
     if 'unimplemented' in tc.keys():
       line = "// " + line
     result += line


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98869.331561.patch
Type: text/x-patch
Size: 777 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210318/25587a90/attachment-0001.bin>


More information about the libcxx-commits mailing list