[libcxx-commits] [libcxx] 937040d - [libc++] Add REQUIRES for tests that need -fblocks and -fobjc-arc

Shoaib Meenai via libcxx-commits libcxx-commits at lists.llvm.org
Fri Apr 3 12:38:05 PDT 2020


To be clear, this is a target thing and not an AppleClang vs. Clang thing. If you built Clang yourself but passed e.g. `-target x86_64-apple-macosx10.15`, you'd also get blocks and ARC by default.

On 4/3/20, 7:11 AM, "libcxx-commits on behalf of Louis Dionne via libcxx-commits" <libcxx-commits-bounces at lists.llvm.org on behalf of libcxx-commits at lists.llvm.org> wrote:

    
    Author: Louis Dionne
    Date: 2020-04-03T10:10:35-04:00
    New Revision: 937040d18196987221ed28fd6f3d2586102a6dbe
    
    URL: https://github.com/llvm/llvm-project/commit/937040d18196987221ed28fd6f3d2586102a6dbe
    DIFF: https://github.com/llvm/llvm-project/commit/937040d18196987221ed28fd6f3d2586102a6dbe.diff
    
    LOG: [libc++] Add REQUIRES for tests that need -fblocks and -fobjc-arc
    
    AppleClang seems to support these extensions by default, but other
    compilers don't.
    
    Added: 
        
    
    Modified: 
        libcxx/test/libcxx/selftest/test.arc.pass.mm
        libcxx/test/libcxx/type_traits/is_pointer.arc.pass.mm
        libcxx/test/libcxx/type_traits/is_scalar.objc.pass.mm
        libcxx/test/libcxx/utilities/optional/block.objc.pass.mm
        libcxx/utils/libcxx/test/config.py
    
    Removed: 
        
    
    
    ################################################################################
    diff  --git a/libcxx/test/libcxx/selftest/test.arc.pass.mm b/libcxx/test/libcxx/selftest/test.arc.pass.mm
    index 0c83cc825542..b70b24e63183 100644
    --- a/libcxx/test/libcxx/selftest/test.arc.pass.mm
    +++ b/libcxx/test/libcxx/selftest/test.arc.pass.mm
    @@ -7,6 +7,7 @@
     //
     //===----------------------------------------------------------------------===//
     
    +// REQUIRES: has-fobjc-arc
     // ADDITIONAL_COMPILE_FLAGS: -fobjc-arc
     
     #if __has_feature(objc_arc) == 0
    
    diff  --git a/libcxx/test/libcxx/type_traits/is_pointer.arc.pass.mm b/libcxx/test/libcxx/type_traits/is_pointer.arc.pass.mm
    index 3b297d5c2271..168869972dd1 100644
    --- a/libcxx/test/libcxx/type_traits/is_pointer.arc.pass.mm
    +++ b/libcxx/test/libcxx/type_traits/is_pointer.arc.pass.mm
    @@ -5,9 +5,9 @@
     // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
     //
     //===----------------------------------------------------------------------===//
    -//
    -// UNSUPPORTED: c++98, c++03
     
    +// UNSUPPORTED: c++98, c++03
    +// REQUIRES: has-fobjc-arc
     // ADDITIONAL_COMPILE_FLAGS: -fobjc-arc
     
     // <type_traits>
    
    diff  --git a/libcxx/test/libcxx/type_traits/is_scalar.objc.pass.mm b/libcxx/test/libcxx/type_traits/is_scalar.objc.pass.mm
    index 1f7ffec8efda..23693fc064eb 100644
    --- a/libcxx/test/libcxx/type_traits/is_scalar.objc.pass.mm
    +++ b/libcxx/test/libcxx/type_traits/is_scalar.objc.pass.mm
    @@ -5,8 +5,10 @@
     // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
     //
     //===----------------------------------------------------------------------===//
    -//
    +
     // UNSUPPORTED: c++98, c++03
    +// REQUIRES: has-fblocks
    +// ADDITIONAL_COMPILE_FLAGS: -fblocks
     
     // <type_traits>
     
    
    diff  --git a/libcxx/test/libcxx/utilities/optional/block.objc.pass.mm b/libcxx/test/libcxx/utilities/optional/block.objc.pass.mm
    index 8d2722bf8534..77674602f377 100644
    --- a/libcxx/test/libcxx/utilities/optional/block.objc.pass.mm
    +++ b/libcxx/test/libcxx/utilities/optional/block.objc.pass.mm
    @@ -7,6 +7,8 @@
     //===----------------------------------------------------------------------===//
     
     // UNSUPPORTED: c++98, c++03, c++11, c++14
    +// REQUIRES: has-fblocks
    +// ADDITIONAL_COMPILE_FLAGS: -fblocks
     
     // <optional>
     
    
    diff  --git a/libcxx/utils/libcxx/test/config.py b/libcxx/utils/libcxx/test/config.py
    index 20d0a796a3af..0a5f62eefe30 100644
    --- a/libcxx/utils/libcxx/test/config.py
    +++ b/libcxx/utils/libcxx/test/config.py
    @@ -6,6 +6,7 @@
     #
     #===----------------------------------------------------------------------===##
     
    +import copy
     import locale
     import os
     import platform
    @@ -149,6 +150,8 @@ def configure(self):
             self.configure_coverage()
             self.configure_modules()
             self.configure_coroutines()
    +        self.configure_blocks()
    +        self.configure_objc_arc()
             self.configure_substitutions()
             self.configure_features()
     
    @@ -987,6 +990,16 @@ def configure_coroutines(self):
                 if intMacroValue(macros['__cpp_coroutines']) >= 201703:
                     self.config.available_features.add('fcoroutines-ts')
     
    +    def configure_blocks(self):
    +        if self.cxx.hasCompileFlag('-fblocks'):
    +            self.config.available_features.add('has-fblocks')
    +
    +    def configure_objc_arc(self):
    +        cxx = copy.deepcopy(self.cxx)
    +        cxx.source_lang = 'objective-c++'
    +        if cxx.hasCompileFlag('-fobjc-arc'):
    +            self.config.available_features.add('has-fobjc-arc')
    +
         def configure_modules(self):
             modules_flags = ['-fmodules']
             if not self.target_info.is_darwin():
    
    
            
    _______________________________________________
    libcxx-commits mailing list
    libcxx-commits at lists.llvm.org
    https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_libcxx-2Dcommits&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=WrGGZgQwQdGbIJlkwYK5We3mB6G7BX5Lei0LseLjse4&s=e_OBmVPWyRQ-yAI1s47eBm8NTT3Y8zV926MFYA_PG_0&e= 
    



More information about the libcxx-commits mailing list