Skip to content

Commit e734bc5

Browse files
authored
[libc++] Remove _LIBCPP_HAS_NO_FGETPOS_FSETPOS (#72073)
Instead of using individual macros to turn off missing C library features, we use the using_if_exists attribute now. This patch removes the _LIBCPP_HAS_NO_FGETPOS_FSETPOS macro used to workaround missing fgetpos and fsetpos on older versions of Android -- using_if_exists should take care of those in the headers and we should add appropriate XFAILs to the tests instead of using TEST_HAS_NO_FGETPOS_FSETPOS.
1 parent f35f863 commit e734bc5

File tree

6 files changed

+0
-43
lines changed

6 files changed

+0
-43
lines changed

libcxx/include/__config

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,13 +1344,6 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c
13441344
# define _LIBCPP_FOPEN_CLOEXEC_MODE
13451345
# endif
13461346

1347-
// Support for _FILE_OFFSET_BITS=64 landed gradually in Android, so the full set
1348-
// of functions used in cstdio may not be available for low API levels when
1349-
// using 64-bit file offsets on LP32.
1350-
# if defined(__BIONIC__) && defined(__USE_FILE_OFFSET64) && __ANDROID_API__ < 24
1351-
# define _LIBCPP_HAS_NO_FGETPOS_FSETPOS
1352-
# endif
1353-
13541347
# if __has_attribute(__init_priority__)
13551348
# define _LIBCPP_INIT_PRIORITY_MAX __attribute__((__init_priority__(100)))
13561349
# else

libcxx/include/cstdio

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,9 @@ using ::putc _LIBCPP_USING_IF_EXISTS;
141141
using ::ungetc _LIBCPP_USING_IF_EXISTS;
142142
using ::fread _LIBCPP_USING_IF_EXISTS;
143143
using ::fwrite _LIBCPP_USING_IF_EXISTS;
144-
#ifndef _LIBCPP_HAS_NO_FGETPOS_FSETPOS
145144
using ::fgetpos _LIBCPP_USING_IF_EXISTS;
146-
#endif
147145
using ::fseek _LIBCPP_USING_IF_EXISTS;
148-
#ifndef _LIBCPP_HAS_NO_FGETPOS_FSETPOS
149146
using ::fsetpos _LIBCPP_USING_IF_EXISTS;
150-
#endif
151147
using ::ftell _LIBCPP_USING_IF_EXISTS;
152148
using ::rewind _LIBCPP_USING_IF_EXISTS;
153149
using ::clearerr _LIBCPP_USING_IF_EXISTS;

libcxx/test/libcxx/depr/depr.c.headers/no_fgetpos_fsetpos.verify.cpp

Lines changed: 0 additions & 20 deletions
This file was deleted.

libcxx/test/std/depr/depr.c.headers/stdio_h.compile.pass.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,9 @@ ASSERT_SAME_TYPE(int, decltype(puts("")));
161161
ASSERT_SAME_TYPE(int, decltype(ungetc(0,fp)));
162162
ASSERT_SAME_TYPE(size_t, decltype(fread((void*)0,0,0,fp)));
163163
ASSERT_SAME_TYPE(size_t, decltype(fwrite((const void*)arr,1,0,fp)));
164-
#ifndef TEST_HAS_NO_FGETPOS_FSETPOS
165164
ASSERT_SAME_TYPE(int, decltype(fgetpos(fp, &fpos)));
166-
#endif
167165
ASSERT_SAME_TYPE(int, decltype(fseek(fp, 0,0)));
168-
#ifndef TEST_HAS_NO_FGETPOS_FSETPOS
169166
ASSERT_SAME_TYPE(int, decltype(fsetpos(fp, &fpos)));
170-
#endif
171167
ASSERT_SAME_TYPE(long, decltype(ftell(fp)));
172168
ASSERT_SAME_TYPE(void, decltype(rewind(fp)));
173169
ASSERT_SAME_TYPE(void, decltype(clearerr(fp)));

libcxx/test/std/input.output/file.streams/c.files/cstdio.pass.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,9 @@ int main(int, char**)
126126
static_assert((std::is_same<decltype(std::ungetc(0,fp)), int>::value), "");
127127
static_assert((std::is_same<decltype(std::fread((void*)0,0,0,fp)), std::size_t>::value), "");
128128
static_assert((std::is_same<decltype(std::fwrite(vp,0,0,fp)), std::size_t>::value), "");
129-
#ifndef TEST_HAS_NO_FGETPOS_FSETPOS
130129
static_assert((std::is_same<decltype(std::fgetpos(fp, &fpos)), int>::value), "");
131-
#endif
132130
static_assert((std::is_same<decltype(std::fseek(fp, 0,0)), int>::value), "");
133-
#ifndef TEST_HAS_NO_FGETPOS_FSETPOS
134131
static_assert((std::is_same<decltype(std::fsetpos(fp, &fpos)), int>::value), "");
135-
#endif
136132
static_assert((std::is_same<decltype(std::ftell(fp)), long>::value), "");
137133
static_assert((std::is_same<decltype(std::rewind(fp)), void>::value), "");
138134
static_assert((std::is_same<decltype(std::clearerr(fp)), void>::value), "");

libcxx/test/support/test_macros.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,10 +390,6 @@ inline void DoNotOptimize(Tp const& value) {
390390
# define TEST_HAS_NO_FILESYSTEM
391391
#endif
392392

393-
#if defined(_LIBCPP_HAS_NO_FGETPOS_FSETPOS)
394-
# define TEST_HAS_NO_FGETPOS_FSETPOS
395-
#endif
396-
397393
#if defined(_LIBCPP_HAS_NO_C8RTOMB_MBRTOC8)
398394
# define TEST_HAS_NO_C8RTOMB_MBRTOC8
399395
#endif

0 commit comments

Comments
 (0)