Skip to content

Commit 9db148e

Browse files
committed
Add two FreeBSD customizations to libc++, to better support ports usage
of older clang versions: * Add _LIBCPP_ENABLE_COMPILER_VERSION_CHECKS block around compiler version checks, to avoid any warnings about support. This makes some ports that use -Werror fall over. * When using clang < 15.0, avoid using a type visibility attribute on the std namespace, as older versions of clang do not support this.
1 parent ab1dc4a commit 9db148e

File tree

1 file changed

+4
-1
lines changed
  • contrib/llvm-project/libcxx/include

1 file changed

+4
-1
lines changed

contrib/llvm-project/libcxx/include/__config

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
// Warn if a compiler version is used that is not supported anymore
3434
// LLVM RELEASE Update the minimum compiler versions
35+
#if defined(_LIBCPP_ENABLE_COMPILER_VERSION_CHECKS) // FreeBSD customization
3536
# if defined(_LIBCPP_CLANG_VER)
3637
# if _LIBCPP_CLANG_VER < 1600
3738
# warning "Libc++ only supports Clang 16 and later"
@@ -45,6 +46,7 @@
4546
# warning "Libc++ only supports GCC 13 and later"
4647
# endif
4748
# endif
49+
#endif // _LIBCPP_ENABLE_COMPILER_VERSION_CHECKS
4850

4951
// The attributes supported by clang are documented at https://clang.llvm.org/docs/AttributeReference.html
5052

@@ -721,7 +723,8 @@ typedef __char32_t char32_t;
721723
# define _LIBCPP_TEMPLATE_VIS
722724
# endif
723725

724-
# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__)
726+
# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__) \
727+
&& _LIBCPP_CLANG_VER >= 1500 // FreeBSD customization
725728
# define _LIBCPP_TYPE_VISIBILITY_DEFAULT __attribute__((__type_visibility__("default")))
726729
# else
727730
# define _LIBCPP_TYPE_VISIBILITY_DEFAULT

0 commit comments

Comments
 (0)