Unverified Commit e734bc53 authored by Louis Dionne's avatar Louis Dionne Committed by GitHub
Browse files

[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.
parent f35f863a
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -1344,13 +1344,6 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c
#    define _LIBCPP_FOPEN_CLOEXEC_MODE
#  endif

// Support for _FILE_OFFSET_BITS=64 landed gradually in Android, so the full set
// of functions used in cstdio may not be available for low API levels when
// using 64-bit file offsets on LP32.
#  if defined(__BIONIC__) && defined(__USE_FILE_OFFSET64) && __ANDROID_API__ < 24
#    define _LIBCPP_HAS_NO_FGETPOS_FSETPOS
#  endif

#  if __has_attribute(__init_priority__)
#    define _LIBCPP_INIT_PRIORITY_MAX __attribute__((__init_priority__(100)))
#  else
+0 −4
Original line number Diff line number Diff line
@@ -141,13 +141,9 @@ using ::putc _LIBCPP_USING_IF_EXISTS;
using ::ungetc _LIBCPP_USING_IF_EXISTS;
using ::fread _LIBCPP_USING_IF_EXISTS;
using ::fwrite _LIBCPP_USING_IF_EXISTS;
#ifndef _LIBCPP_HAS_NO_FGETPOS_FSETPOS
using ::fgetpos _LIBCPP_USING_IF_EXISTS;
#endif
using ::fseek _LIBCPP_USING_IF_EXISTS;
#ifndef _LIBCPP_HAS_NO_FGETPOS_FSETPOS
using ::fsetpos _LIBCPP_USING_IF_EXISTS;
#endif
using ::ftell _LIBCPP_USING_IF_EXISTS;
using ::rewind _LIBCPP_USING_IF_EXISTS;
using ::clearerr _LIBCPP_USING_IF_EXISTS;
+0 −20
Original line number Diff line number Diff line
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++03

#include <cstdio>

using U = decltype(::fgetpos);
using V = decltype(::fsetpos);
#ifdef _LIBCPP_HAS_NO_FGETPOS_FSETPOS
// expected-error@-3 {{no member named 'fgetpos' in the global namespace}}
// expected-error@-3 {{no member named 'fsetpos' in the global namespace}}
#else
// expected-no-diagnostics
#endif
+0 −4
Original line number Diff line number Diff line
@@ -161,13 +161,9 @@ ASSERT_SAME_TYPE(int, decltype(puts("")));
ASSERT_SAME_TYPE(int,    decltype(ungetc(0,fp)));
ASSERT_SAME_TYPE(size_t, decltype(fread((void*)0,0,0,fp)));
ASSERT_SAME_TYPE(size_t, decltype(fwrite((const void*)arr,1,0,fp)));
#ifndef TEST_HAS_NO_FGETPOS_FSETPOS
ASSERT_SAME_TYPE(int,    decltype(fgetpos(fp, &fpos)));
#endif
ASSERT_SAME_TYPE(int,    decltype(fseek(fp, 0,0)));
#ifndef TEST_HAS_NO_FGETPOS_FSETPOS
ASSERT_SAME_TYPE(int,    decltype(fsetpos(fp, &fpos)));
#endif
ASSERT_SAME_TYPE(long,   decltype(ftell(fp)));
ASSERT_SAME_TYPE(void,   decltype(rewind(fp)));
ASSERT_SAME_TYPE(void,   decltype(clearerr(fp)));
+0 −4
Original line number Diff line number Diff line
@@ -126,13 +126,9 @@ int main(int, char**)
    static_assert((std::is_same<decltype(std::ungetc(0,fp)), int>::value), "");
    static_assert((std::is_same<decltype(std::fread((void*)0,0,0,fp)), std::size_t>::value), "");
    static_assert((std::is_same<decltype(std::fwrite(vp,0,0,fp)), std::size_t>::value), "");
#ifndef TEST_HAS_NO_FGETPOS_FSETPOS
    static_assert((std::is_same<decltype(std::fgetpos(fp, &fpos)), int>::value), "");
#endif
    static_assert((std::is_same<decltype(std::fseek(fp, 0,0)), int>::value), "");
#ifndef TEST_HAS_NO_FGETPOS_FSETPOS
    static_assert((std::is_same<decltype(std::fsetpos(fp, &fpos)), int>::value), "");
#endif
    static_assert((std::is_same<decltype(std::ftell(fp)), long>::value), "");
    static_assert((std::is_same<decltype(std::rewind(fp)), void>::value), "");
    static_assert((std::is_same<decltype(std::clearerr(fp)), void>::value), "");
Loading