Skip to content

Commit

Permalink
Drop Objective C++ support (#2468)
Browse files Browse the repository at this point in the history
  • Loading branch information
miscco authored Sep 28, 2024
1 parent e3800d7 commit 94e4e75
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 167 deletions.
10 changes: 0 additions & 10 deletions libcudacxx/include/cuda/std/__functional/function.h
Original file line number Diff line number Diff line change
Expand Up @@ -920,21 +920,13 @@ class __func<_Rp1 (^)(_ArgTypes1...), _Alloc, _Rp(_ArgTypes...)> : public __base

public:
_LIBCUDACXX_HIDE_FROM_ABI explicit __func(__block_type const& __f)
# ifdef _LIBCUDACXX_HAS_OBJC_ARC
: __f_(__f)
# else
: __f_(reinterpret_cast<__block_type>(__f ? _Block_copy(__f) : nullptr))
# endif
{}

// [TODO] add && to save on a retain

_LIBCUDACXX_HIDE_FROM_ABI explicit __func(__block_type __f, const _Alloc& /* unused */)
# ifdef _LIBCUDACXX_HAS_OBJC_ARC
: __f_(__f)
# else
: __f_(reinterpret_cast<__block_type>(__f ? _Block_copy(__f) : nullptr))
# endif
{}

virtual __base<_Rp(_ArgTypes...)>* __clone() const
Expand All @@ -953,12 +945,10 @@ class __func<_Rp1 (^)(_ArgTypes1...), _Alloc, _Rp(_ArgTypes...)> : public __base

virtual void destroy() noexcept
{
# ifndef _LIBCUDACXX_HAS_OBJC_ARC
if (__f_)
{
_Block_release(__f_);
}
# endif
__f_ = 0;
}

Expand Down
32 changes: 0 additions & 32 deletions libcudacxx/include/cuda/std/__memory/addressof.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,38 +43,6 @@ _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_NO_CFI _Tp* addressof(_Tp& __x) noexcept

#endif // defined(_LIBCUDACXX_ADDRESSOF)

#if defined(_LIBCUDACXX_HAS_OBJC_ARC) && !defined(_LIBCUDACXX_PREDEFINED_OBJC_ARC_ADDRESSOF)
// Objective-C++ Automatic Reference Counting uses qualified pointers
// that require special addressof() signatures. When
// _LIBCUDACXX_PREDEFINED_OBJC_ARC_ADDRESSOF is defined, the compiler
// itself is providing these definitions. Otherwise, we provide them.
template <class _Tp>
_LIBCUDACXX_HIDE_FROM_ABI __strong _Tp* addressof(__strong _Tp& __x) noexcept
{
return &__x;
}

# ifdef _LIBCUDACXX_HAS_OBJC_ARC_WEAK
template <class _Tp>
_LIBCUDACXX_HIDE_FROM_ABI __weak _Tp* addressof(__weak _Tp& __x) noexcept
{
return &__x;
}
# endif

template <class _Tp>
_LIBCUDACXX_HIDE_FROM_ABI __autoreleasing _Tp* addressof(__autoreleasing _Tp& __x) noexcept
{
return &__x;
}

template <class _Tp>
_LIBCUDACXX_HIDE_FROM_ABI __unsafe_unretained _Tp* addressof(__unsafe_unretained _Tp& __x) noexcept
{
return &__x;
}
#endif

template <class _Tp>
_Tp* addressof(const _Tp&&) noexcept = delete;

Expand Down
31 changes: 1 addition & 30 deletions libcudacxx/include/cuda/std/__type_traits/is_pointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,36 +46,7 @@ struct __libcpp_is_pointer<_Tp*> : public true_type
{};

template <class _Tp>
struct __libcpp_remove_objc_qualifiers
{
typedef _Tp type;
};
# if defined(_LIBCUDACXX_HAS_OBJC_ARC)
template <class _Tp>
struct __libcpp_remove_objc_qualifiers<_Tp __strong>
{
typedef _Tp type;
};
template <class _Tp>
struct __libcpp_remove_objc_qualifiers<_Tp __weak>
{
typedef _Tp type;
};
template <class _Tp>
struct __libcpp_remove_objc_qualifiers<_Tp __autoreleasing>
{
typedef _Tp type;
};
template <class _Tp>
struct __libcpp_remove_objc_qualifiers<_Tp __unsafe_unretained>
{
typedef _Tp type;
};
# endif

template <class _Tp>
struct _CCCL_TYPE_VISIBILITY_DEFAULT is_pointer
: public __libcpp_is_pointer<typename __libcpp_remove_objc_qualifiers<__remove_cv_t<_Tp>>::type>
struct _CCCL_TYPE_VISIBILITY_DEFAULT is_pointer : public __libcpp_is_pointer<__remove_cv_t<_Tp>>
{};

# if _CCCL_STD_VER > 2011 && !defined(_LIBCUDACXX_HAS_NO_VARIABLE_TEMPLATES)
Expand Down
9 changes: 0 additions & 9 deletions libcudacxx/include/cuda/std/detail/libcxx/include/__config
Original file line number Diff line number Diff line change
Expand Up @@ -733,15 +733,6 @@ typedef __char32_t char32_t;
# define _LIBCUDACXX_HAS_NO_GENERALIZED_INITIALIZERS
# endif

// Objective-C++ features (opt-in)
# if __has_feature(objc_arc)
# define _LIBCUDACXX_HAS_OBJC_ARC
# endif

# if __has_feature(objc_arc_weak)
# define _LIBCUDACXX_HAS_OBJC_ARC_WEAK
# endif

# if !(__has_feature(cxx_variable_templates))
# define _LIBCUDACXX_HAS_NO_VARIABLE_TEMPLATES
# endif
Expand Down

This file was deleted.

6 changes: 0 additions & 6 deletions libcudacxx/test/utils/libcudacxx/test/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,12 +636,6 @@ def configure_features(self):
self.config.available_features.add('libcudacxx_gdb')
self.cxx.libcudacxx_gdb = libcudacxx_gdb

# Support Objective-C++ only on MacOS and if the compiler supports it.
if self.target_info.platform() == "darwin" and \
self.target_info.is_host_macosx() and \
self.cxx.hasCompileFlag(["-x", "objective-c++", "-fobjc-arc"]):
self.config.available_features.add("objective-c++")

def configure_compile_flags(self):
self.configure_default_compile_flags()
# Configure extra flags
Expand Down
15 changes: 0 additions & 15 deletions libcudacxx/test/utils/libcudacxx/test/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,13 @@ def _execute(self, test, lit_config):
is_pass_test = name.endswith('.pass.cpp') or name.endswith('.pass.mm')
is_fail_test = name.endswith('.fail.cpp') or name.endswith('.fail.mm')
is_runfail_test = name.endswith('.runfail.cpp') or name.endswith('.runfail.mm')
is_objcxx_test = name.endswith('.mm')
is_objcxx_arc_test = name.endswith('.arc.pass.mm') or \
name.endswith('.arc.fail.mm')
assert is_sh_test or name_ext == '.cpp' or name_ext == '.mm', \
'non-cpp file must be sh test'

if test.config.unsupported:
return (lit.Test.UNSUPPORTED,
"A lit.local.cfg marked this unsupported")

if is_objcxx_test and not \
'objective-c++' in test.config.available_features:
return (lit.Test.UNSUPPORTED, "Objective-C++ is not supported")

parsers = self._make_custom_parsers()
script = lit.TestRunner.parseIntegratedTestScript(
test, additional_parsers=parsers, require_script=is_sh_test)
Expand Down Expand Up @@ -150,14 +143,6 @@ def _execute(self, test, lit_config):
if b'#define _LIBCUDACXX_ASSERT' in contents:
test_cxx.useModules(False)

if is_objcxx_test:
test_cxx.source_lang = 'objective-c++'
if is_objcxx_arc_test:
test_cxx.compile_flags += ['-fobjc-arc']
else:
test_cxx.compile_flags += ['-fno-objc-arc']
test_cxx.link_flags += ['-framework', 'Foundation']

# Dispatch the test based on its suffix.
if is_sh_test:
if not isinstance(self.executor, LocalExecutor):
Expand Down

0 comments on commit 94e4e75

Please sign in to comment.