[libcxx-commits] [libcxx] eb37d35 - [libc++] Future-proof generate_feature_test_macro_components.py against long names.

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


Author: Arthur O'Dwyer
Date: 2021-03-18T13:35:28-04:00
New Revision: eb37d3546cd0c6e67798496634c45e501f7806f1

URL: https://github.com/llvm/llvm-project/commit/eb37d3546cd0c6e67798496634c45e501f7806f1
DIFF: https://github.com/llvm/llvm-project/commit/eb37d3546cd0c6e67798496634c45e501f7806f1.diff

LOG: [libc++] Future-proof generate_feature_test_macro_components.py against long names.

`__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.

Differential Revision: https://reviews.llvm.org/D98869

Added: 
    

Modified: 
    libcxx/utils/generate_feature_test_macro_components.py

Removed: 
    


################################################################################
diff  --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py
index ce0007610b084..e69c7c1f9442a 100755
--- a/libcxx/utils/generate_feature_test_macro_components.py
+++ b/libcxx/utils/generate_feature_test_macro_components.py
@@ -720,7 +720,7 @@ def get_std_number(std):
 
 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
@@ -734,7 +734,7 @@ def produce_macros_definition_for_std(std):
       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


        


More information about the libcxx-commits mailing list