Skip to content

[libc++] Make ABI annotations explicit for windows-specific code #140507

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions libcxx/include/__locale_dir/support/windows.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ class __locale_t {
};

#if defined(_LIBCPP_BUILDING_LIBRARY)
_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
_LIBCPP_EXPORTED_FROM_ABI __locale_t __newlocale(int __mask, const char* __locale, __locale_t __base);
inline _LIBCPP_HIDE_FROM_ABI void __freelocale(__locale_t __loc) { ::_free_locale(__loc); }
inline _LIBCPP_HIDE_FROM_ABI char* __setlocale(int __category, const char* __locale) {
Expand All @@ -163,6 +164,7 @@ inline _LIBCPP_HIDE_FROM_ABI char* __setlocale(int __category, const char* __loc
return __new_locale;
}
_LIBCPP_EXPORTED_FROM_ABI __lconv_t* __localeconv(__locale_t& __loc);
_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
#endif // _LIBCPP_BUILDING_LIBRARY

//
Expand All @@ -178,8 +180,10 @@ inline _LIBCPP_HIDE_FROM_ABI long double __strtold(const char* __nptr, char** __
return ::_strtold_l(__nptr, __endptr, __loc);
}
#else
_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
_LIBCPP_EXPORTED_FROM_ABI float __strtof(const char*, char**, __locale_t);
_LIBCPP_EXPORTED_FROM_ABI long double __strtold(const char*, char**, __locale_t);
_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
#endif

inline _LIBCPP_HIDE_FROM_ABI double __strtod(const char* __nptr, char** __endptr, __locale_t __loc) {
Expand Down Expand Up @@ -280,11 +284,13 @@ _LIBCPP_EXPORTED_FROM_ABI size_t
__mbsrtowcs(wchar_t* __restrict, const char** __restrict, size_t, mbstate_t* __restrict, __locale_t);
#endif // _LIBCPP_BUILDING_LIBRARY

_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
_LIBCPP_EXPORTED_FROM_ABI _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 4, 5) int __snprintf(
char* __ret, size_t __n, __locale_t __loc, const char* __format, ...);

_LIBCPP_EXPORTED_FROM_ABI
_LIBCPP_ATTRIBUTE_FORMAT(__printf__, 3, 4) int __asprintf(char** __ret, __locale_t __loc, const char* __format, ...);
_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS

_LIBCPP_DIAGNOSTIC_PUSH
_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wgcc-compat")
Expand Down
2 changes: 2 additions & 0 deletions libcxx/include/__thread/support/windows.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#endif

_LIBCPP_BEGIN_NAMESPACE_STD
_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS

using __libcpp_timespec_t = ::timespec;

Expand Down Expand Up @@ -128,6 +129,7 @@ _LIBCPP_EXPORTED_FROM_ABI void* __libcpp_tls_get(__libcpp_tls_key __key);

_LIBCPP_EXPORTED_FROM_ABI int __libcpp_tls_set(__libcpp_tls_key __key, void* __p);

_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
_LIBCPP_END_NAMESPACE_STD

#endif // _LIBCPP___THREAD_SUPPORT_WINDOWS_H
2 changes: 2 additions & 0 deletions libcxx/src/support/win32/locale_win32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <cwchar> // wide char manipulation

_LIBCPP_BEGIN_NAMESPACE_STD
_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
namespace __locale {

//
Expand Down Expand Up @@ -182,4 +183,5 @@ int __asprintf(char** ret, __locale_t loc, const char* format, ...) {
}

} // namespace __locale
_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
_LIBCPP_END_NAMESPACE_STD
2 changes: 2 additions & 0 deletions libcxx/src/support/win32/thread_win32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <fibersapi.h>

_LIBCPP_BEGIN_NAMESPACE_STD
_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS

static_assert(sizeof(__libcpp_mutex_t) == sizeof(SRWLOCK), "");
static_assert(alignof(__libcpp_mutex_t) == alignof(SRWLOCK), "");
Expand Down Expand Up @@ -211,4 +212,5 @@ int __libcpp_tls_set(__libcpp_tls_key __key, void* __p) {
return 0;
}

_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
_LIBCPP_END_NAMESPACE_STD
Loading