Skip to content

Commit

Permalink
Add two FreeBSD customizations to libc++, to better support ports usage
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
DimitryAndric committed Feb 9, 2024
1 parent ab1dc4a commit 9db148e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion contrib/llvm-project/libcxx/include/__config
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

// Warn if a compiler version is used that is not supported anymore
// LLVM RELEASE Update the minimum compiler versions
#if defined(_LIBCPP_ENABLE_COMPILER_VERSION_CHECKS) // FreeBSD customization
# if defined(_LIBCPP_CLANG_VER)
# if _LIBCPP_CLANG_VER < 1600
# warning "Libc++ only supports Clang 16 and later"
Expand All @@ -45,6 +46,7 @@
# warning "Libc++ only supports GCC 13 and later"
# endif
# endif
#endif // _LIBCPP_ENABLE_COMPILER_VERSION_CHECKS

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

Expand Down Expand Up @@ -721,7 +723,8 @@ typedef __char32_t char32_t;
# define _LIBCPP_TEMPLATE_VIS
# endif

# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__)
# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__) \
&& _LIBCPP_CLANG_VER >= 1500 // FreeBSD customization
# define _LIBCPP_TYPE_VISIBILITY_DEFAULT __attribute__((__type_visibility__("default")))
# else
# define _LIBCPP_TYPE_VISIBILITY_DEFAULT
Expand Down

0 comments on commit 9db148e

Please sign in to comment.