Skip to content

Commit 20d0aac

Browse files
committed
Try to work around attribute issue on GCC
1 parent 92a4186 commit 20d0aac

File tree

1 file changed

+14
-5
lines changed
  • libcxx/include/__locale_dir/support

1 file changed

+14
-5
lines changed

libcxx/include/__locale_dir/support/linux.h

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,10 @@ __mbsrtowcs(wchar_t* __dest, const char** __src, size_t __len, mbstate_t* __ps,
232232
# endif // _LIBCPP_HAS_WIDE_CHARACTERS
233233
#endif // _LIBCPP_BUILDING_LIBRARY
234234

235-
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 4, 5) int __snprintf(
235+
#ifndef _LIBCPP_COMPILER_GCC // GCC complains that this can't be always_inline due to C-style varargs
236+
_LIBCPP_HIDE_FROM_ABI
237+
#endif
238+
inline _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 4, 5) int __snprintf(
236239
char* __s, size_t __n, __locale_t __loc, const char* __format, ...) {
237240
va_list __va;
238241
va_start(__va, __format);
@@ -242,8 +245,11 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 4, 5) int __sn
242245
return __res;
243246
}
244247

245-
inline _LIBCPP_HIDE_FROM_ABI
246-
_LIBCPP_ATTRIBUTE_FORMAT(__printf__, 3, 4) int __asprintf(char** __s, __locale_t __loc, const char* __format, ...) {
248+
#ifndef _LIBCPP_COMPILER_GCC // GCC complains that this can't be always_inline due to C-style varargs
249+
_LIBCPP_HIDE_FROM_ABI
250+
#endif
251+
inline _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 3, 4) int __asprintf(
252+
char** __s, __locale_t __loc, const char* __format, ...) {
247253
va_list __va;
248254
va_start(__va, __format);
249255
__locale_guard __current(__loc);
@@ -252,8 +258,11 @@ _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 3, 4) int __asprintf(char** __s, __locale_t
252258
return __res;
253259
}
254260

255-
inline _LIBCPP_HIDE_FROM_ABI
256-
_LIBCPP_ATTRIBUTE_FORMAT(__scanf__, 3, 4) int __sscanf(const char* __s, __locale_t __loc, const char* __format, ...) {
261+
#ifndef _LIBCPP_COMPILER_GCC // GCC complains that this can't be always_inline due to C-style varargs
262+
_LIBCPP_HIDE_FROM_ABI
263+
#endif
264+
inline _LIBCPP_ATTRIBUTE_FORMAT(__scanf__, 3, 4) int __sscanf(
265+
const char* __s, __locale_t __loc, const char* __format, ...) {
257266
va_list __va;
258267
va_start(__va, __format);
259268
__locale_guard __current(__loc);

0 commit comments

Comments
 (0)