[libcxx-commits] [libcxx] c56bbb3 - [libc++] Make sure we include a header when checking compiler macros

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Oct 27 12:59:14 PDT 2020


Author: Louis Dionne
Date: 2020-10-27T15:58:43-04:00
New Revision: c56bbb3961e460cdff96c200068c073dd5d9f5cc

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

LOG: [libc++] Make sure we include a header when checking compiler macros

Otherwise, it's possible for some __config_site macros not to be
picked up.

Added: 
    

Modified: 
    libcxx/utils/libcxx/test/dsl.py

Removed: 
    


################################################################################
diff  --git a/libcxx/utils/libcxx/test/dsl.py b/libcxx/utils/libcxx/test/dsl.py
index 938d3711b765..6a02ae634907 100644
--- a/libcxx/utils/libcxx/test/dsl.py
+++ b/libcxx/utils/libcxx/test/dsl.py
@@ -191,8 +191,12 @@ def compilerMacros(config, flags=''):
   be added to the compiler invocation when generating the macros.
   """
   with _makeConfigTest(config) as test:
+    with open(test.getSourcePath(), 'w') as sourceFile:
+      # Make sure files like <__config> are included, since they can define
+      # additional macros.
+      sourceFile.write("#include <cstddef>")
     unparsedOutput, err, exitCode, timeoutInfo = _executeScriptInternal(test, [
-      "%{{cxx}} -xc++ {} -dM -E %{{flags}} %{{compile_flags}} {}".format(os.devnull, flags)
+      "%{{cxx}} %s -dM -E %{{flags}} %{{compile_flags}} {}".format(flags)
     ])
     parsedMacros = dict()
     defines = (l.strip() for l in unparsedOutput.split('\n') if l.startswith('#define '))


        


More information about the libcxx-commits mailing list