[PATCH] D13331: [libcxx] Use newest supported language dialect when running the test suite.

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 1 00:36:52 PDT 2015


EricWF created this revision.
EricWF added reviewers: mclow.lists, danalbert, jroelofs.
EricWF added a subscriber: cfe-commits.

Currently the test suite defaults to C++11 mode if no standard version is supplied to LIT using `--param=std=c++XX`.  This patch changes that behavior so that the newest possible dialect is selected instead.

I have already patched the C++11 bot to explicitly specify `--param=std=c++11`. I'm just putting this up for review to see if anybody objects to this idea.

http://reviews.llvm.org/D13331

Files:
  test/libcxx/test/config.py

Index: test/libcxx/test/config.py
===================================================================
--- test/libcxx/test/config.py
+++ test/libcxx/test/config.py
@@ -344,7 +344,20 @@
         # Try and get the std version from the command line. Fall back to
         # default given in lit.site.cfg is not present. If default is not
         # present then force c++11.
-        std = self.get_lit_conf('std', 'c++11')
+        std = self.get_lit_conf('std')
+        if not std:
+            # Choose the newest possible language dialect if none is given.
+            possible_stds = ['c++1z', 'c++14', 'c++11', 'c++03']
+            for s in possible_stds:
+                if self.cxx.hasCompileFlag('-std=%s' % s):
+                    std = s
+                    self.lit_config.note(
+                        'inferred language dialect as: %s' % std)
+                    break
+            if not std:
+                self.lit_config.fatal(
+                    'Failed to infer a supported language dialect from one of %r'
+                    % possible_stds)
         self.cxx.compile_flags += ['-std={0}'.format(std)]
         self.config.available_features.add(std)
         # Configure include paths


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13331.36193.patch
Type: text/x-patch
Size: 1218 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151001/97415c02/attachment.bin>


More information about the cfe-commits mailing list