Skip to content

Commit 67b0b02

Browse files
committed
[libcxx] Remove static inline and make use of _LIBCPP_HIDE_FROM_ABI in __support headers
After feedback from D122861, do the same thing with some of the other headers. Try to move the headers so they have a similar style and way of doing things. Reviewed By: ldionne, daltenty Differential Revision: https://reviews.llvm.org/D124227
1 parent ed85de6 commit 67b0b02

File tree

4 files changed

+67
-75
lines changed

4 files changed

+67
-75
lines changed

libcxx/include/__support/ibm/gettod_zos.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212

1313
#include <time.h>
1414

15-
static inline int gettimeofdayMonotonic(struct timespec64* Output) {
15+
inline _LIBCPP_HIDE_FROM_ABI int
16+
gettimeofdayMonotonic(struct timespec64* Output) {
1617

1718
// The POSIX gettimeofday() function is not available on z/OS. Therefore,
1819
// we will call stcke and other hardware instructions in implement equivalent.

libcxx/include/__support/ibm/xlocale.h

+23-30
Original file line numberDiff line numberDiff line change
@@ -52,57 +52,50 @@ struct __setAndRestore {
5252

5353
// The following are not POSIX routines. These are quick-and-dirty hacks
5454
// to make things pretend to work
55-
static inline
56-
long long strtoll_l(const char *__nptr, char **__endptr,
57-
int __base, locale_t locale) {
55+
inline _LIBCPP_HIDE_FROM_ABI long long
56+
strtoll_l(const char *__nptr, char **__endptr, int __base, locale_t locale) {
5857
__setAndRestore __newloc(locale);
59-
return strtoll(__nptr, __endptr, __base);
58+
return ::strtoll(__nptr, __endptr, __base);
6059
}
6160

62-
static inline
63-
long strtol_l(const char *__nptr, char **__endptr,
64-
int __base, locale_t locale) {
61+
inline _LIBCPP_HIDE_FROM_ABI long
62+
strtol_l(const char *__nptr, char **__endptr, int __base, locale_t locale) {
6563
__setAndRestore __newloc(locale);
66-
return strtol(__nptr, __endptr, __base);
64+
return ::strtol(__nptr, __endptr, __base);
6765
}
6866

69-
static inline
70-
double strtod_l(const char *__nptr, char **__endptr,
71-
locale_t locale) {
67+
inline _LIBCPP_HIDE_FROM_ABI double
68+
strtod_l(const char *__nptr, char **__endptr, locale_t locale) {
7269
__setAndRestore __newloc(locale);
73-
return strtod(__nptr, __endptr);
70+
return ::strtod(__nptr, __endptr);
7471
}
7572

76-
static inline
77-
float strtof_l(const char *__nptr, char **__endptr,
78-
locale_t locale) {
73+
inline _LIBCPP_HIDE_FROM_ABI float
74+
strtof_l(const char *__nptr, char **__endptr, locale_t locale) {
7975
__setAndRestore __newloc(locale);
80-
return strtof(__nptr, __endptr);
76+
return ::strtof(__nptr, __endptr);
8177
}
8278

83-
static inline
84-
long double strtold_l(const char *__nptr, char **__endptr,
85-
locale_t locale) {
79+
inline _LIBCPP_HIDE_FROM_ABI long double
80+
strtold_l(const char *__nptr, char **__endptr, locale_t locale) {
8681
__setAndRestore __newloc(locale);
87-
return strtold(__nptr, __endptr);
82+
return ::strtold(__nptr, __endptr);
8883
}
8984

90-
static inline
91-
unsigned long long strtoull_l(const char *__nptr, char **__endptr,
92-
int __base, locale_t locale) {
85+
inline _LIBCPP_HIDE_FROM_ABI unsigned long long
86+
strtoull_l(const char *__nptr, char **__endptr, int __base, locale_t locale) {
9387
__setAndRestore __newloc(locale);
94-
return strtoull(__nptr, __endptr, __base);
88+
return ::strtoull(__nptr, __endptr, __base);
9589
}
9690

97-
static inline
98-
unsigned long strtoul_l(const char *__nptr, char **__endptr,
99-
int __base, locale_t locale) {
91+
inline _LIBCPP_HIDE_FROM_ABI unsigned long
92+
strtoul_l(const char *__nptr, char **__endptr, int __base, locale_t locale) {
10093
__setAndRestore __newloc(locale);
101-
return strtoul(__nptr, __endptr, __base);
94+
return ::strtoul(__nptr, __endptr, __base);
10295
}
10396

104-
static inline
105-
int vasprintf(char **strp, const char *fmt, va_list ap) {
97+
inline _LIBCPP_HIDE_FROM_ABI int
98+
vasprintf(char **strp, const char *fmt, va_list ap) {
10699
const size_t buff_size = 256;
107100
if ((*strp = (char *)malloc(buff_size)) == NULL) {
108101
return -1;

libcxx/include/__support/musl/xlocale.h

+15-16
Original file line numberDiff line numberDiff line change
@@ -24,30 +24,29 @@
2424
extern "C" {
2525
#endif
2626

27-
static inline long long strtoll_l(const char *nptr, char **endptr, int base,
28-
locale_t) {
29-
return strtoll(nptr, endptr, base);
27+
inline _LIBCPP_HIDE_FROM_ABI long long
28+
strtoll_l(const char *nptr, char **endptr, int base, locale_t) {
29+
return ::strtoll(nptr, endptr, base);
3030
}
3131

32-
static inline unsigned long long strtoull_l(const char *nptr, char **endptr,
33-
int base, locale_t) {
34-
return strtoull(nptr, endptr, base);
32+
inline _LIBCPP_HIDE_FROM_ABI unsigned long long
33+
strtoull_l(const char *nptr, char **endptr, int base, locale_t) {
34+
return ::strtoull(nptr, endptr, base);
3535
}
3636

37-
static inline long long wcstoll_l(const wchar_t *nptr, wchar_t **endptr,
38-
int base, locale_t) {
39-
return wcstoll(nptr, endptr, base);
37+
inline _LIBCPP_HIDE_FROM_ABI long long
38+
wcstoll_l(const wchar_t *nptr, wchar_t **endptr, int base, locale_t) {
39+
return ::wcstoll(nptr, endptr, base);
4040
}
4141

42-
static inline unsigned long long wcstoull_l(const wchar_t *nptr,
43-
wchar_t **endptr, int base,
44-
locale_t) {
45-
return wcstoull(nptr, endptr, base);
42+
inline _LIBCPP_HIDE_FROM_ABI long long
43+
wcstoull_l(const wchar_t *nptr, wchar_t **endptr, int base, locale_t) {
44+
return ::wcstoull(nptr, endptr, base);
4645
}
4746

48-
static inline long double wcstold_l(const wchar_t *nptr, wchar_t **endptr,
49-
locale_t) {
50-
return wcstold(nptr, endptr);
47+
inline _LIBCPP_HIDE_FROM_ABI long double
48+
wcstold_l(const wchar_t *nptr, wchar_t **endptr, locale_t) {
49+
return ::wcstold(nptr, endptr);
5150
}
5251

5352
#ifdef __cplusplus

libcxx/include/__support/solaris/xlocale.h

+27-28
Original file line numberDiff line numberDiff line change
@@ -32,40 +32,39 @@ struct lconv *localeconv(void);
3232
struct lconv *localeconv_l(locale_t __l);
3333

3434
// FIXME: These are quick-and-dirty hacks to make things pretend to work
35-
static inline
36-
long long strtoll_l(const char *__nptr, char **__endptr,
37-
int __base, locale_t __loc) {
38-
return strtoll(__nptr, __endptr, __base);
35+
inline _LIBCPP_HIDE_FROM_ABI long long
36+
strtoll_l(const char *__nptr, char **__endptr, int __base, locale_t __loc) {
37+
return ::strtoll(__nptr, __endptr, __base);
3938
}
40-
static inline
41-
long strtol_l(const char *__nptr, char **__endptr,
42-
int __base, locale_t __loc) {
43-
return strtol(__nptr, __endptr, __base);
39+
40+
inline _LIBCPP_HIDE_FROM_ABI long
41+
strtol_l(const char *__nptr, char **__endptr, int __base, locale_t __loc) {
42+
return ::strtol(__nptr, __endptr, __base);
4443
}
45-
static inline
46-
unsigned long long strtoull_l(const char *__nptr, char **__endptr,
47-
int __base, locale_t __loc) {
48-
return strtoull(__nptr, __endptr, __base);
44+
45+
inline _LIBCPP_HIDE_FROM_ABI unsigned long long
46+
strtoull_l(const char *__nptr, char **__endptr, int __base, locale_t __loc)
47+
return ::strtoull(__nptr, __endptr, __base);
4948
}
50-
static inline
51-
unsigned long strtoul_l(const char *__nptr, char **__endptr,
52-
int __base, locale_t __loc) {
53-
return strtoul(__nptr, __endptr, __base);
49+
50+
inline _LIBCPP_HIDE_FROM_ABI unsigned long
51+
strtoul_l(const char *__nptr, char **__endptr, int __base, locale_t __loc) {
52+
return ::strtoul(__nptr, __endptr, __base);
5453
}
55-
static inline
56-
float strtof_l(const char *__nptr, char **__endptr,
57-
locale_t __loc) {
58-
return strtof(__nptr, __endptr);
54+
55+
inline _LIBCPP_HIDE_FROM_ABI float
56+
strtof_l(const char *__nptr, char **__endptr, locale_t __loc) {
57+
return ::strtof(__nptr, __endptr);
5958
}
60-
static inline
61-
double strtod_l(const char *__nptr, char **__endptr,
62-
locale_t __loc) {
63-
return strtod(__nptr, __endptr);
59+
60+
inline _LIBCPP_HIDE_FROM_ABI double
61+
strtod_l(const char *__nptr, char **__endptr, locale_t __loc) {
62+
return ::strtod(__nptr, __endptr);
6463
}
65-
static inline
66-
long double strtold_l(const char *__nptr, char **__endptr,
67-
locale_t __loc) {
68-
return strtold(__nptr, __endptr);
64+
65+
inline _LIBCPP_HIDE_FROM_ABI long double
66+
strtold_l(const char *__nptr, char **__endptr, locale_t __loc) {
67+
return ::strtold(__nptr, __endptr);
6968
}
7069

7170

0 commit comments

Comments
 (0)