[libcxx-commits] [libcxx] [libc++] Remove _LIBCPP_HAS_NO_FGETPOS_FSETPOS (PR #72073)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Nov 12 17:45:27 PST 2023
https://github.com/ldionne created https://github.com/llvm/llvm-project/pull/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.
>From 8165d9bf32f71fee86fe035bf5441a4782ee60f9 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Wed, 18 Oct 2023 14:52:45 -0700
Subject: [PATCH] [libc++] Remove _LIBCPP_HAS_NO_FGETPOS_FSETPOS
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.
---
libcxx/include/__config | 7 -------
libcxx/include/cstdio | 4 ----
.../no_fgetpos_fsetpos.verify.cpp | 20 -------------------
.../depr.c.headers/stdio_h.compile.pass.cpp | 4 ----
.../file.streams/c.files/cstdio.pass.cpp | 4 ----
libcxx/test/support/test_macros.h | 4 ----
6 files changed, 43 deletions(-)
delete mode 100644 libcxx/test/libcxx/depr/depr.c.headers/no_fgetpos_fsetpos.verify.cpp
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 4412deb930cb45b..1b30de33e5c4498 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -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
diff --git a/libcxx/include/cstdio b/libcxx/include/cstdio
index 221b0b314cf9848..b1b0ff8d3503939 100644
--- a/libcxx/include/cstdio
+++ b/libcxx/include/cstdio
@@ -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;
diff --git a/libcxx/test/libcxx/depr/depr.c.headers/no_fgetpos_fsetpos.verify.cpp b/libcxx/test/libcxx/depr/depr.c.headers/no_fgetpos_fsetpos.verify.cpp
deleted file mode 100644
index 1aaf953e4e7d453..000000000000000
--- a/libcxx/test/libcxx/depr/depr.c.headers/no_fgetpos_fsetpos.verify.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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 at -3 {{no member named 'fgetpos' in the global namespace}}
-// expected-error at -3 {{no member named 'fsetpos' in the global namespace}}
-#else
-// expected-no-diagnostics
-#endif
diff --git a/libcxx/test/std/depr/depr.c.headers/stdio_h.compile.pass.cpp b/libcxx/test/std/depr/depr.c.headers/stdio_h.compile.pass.cpp
index 27a97627cee38d5..55731c857ecfcef 100644
--- a/libcxx/test/std/depr/depr.c.headers/stdio_h.compile.pass.cpp
+++ b/libcxx/test/std/depr/depr.c.headers/stdio_h.compile.pass.cpp
@@ -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)));
diff --git a/libcxx/test/std/input.output/file.streams/c.files/cstdio.pass.cpp b/libcxx/test/std/input.output/file.streams/c.files/cstdio.pass.cpp
index d18af90fec1c3ac..66ab56f0958a2d2 100644
--- a/libcxx/test/std/input.output/file.streams/c.files/cstdio.pass.cpp
+++ b/libcxx/test/std/input.output/file.streams/c.files/cstdio.pass.cpp
@@ -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), "");
diff --git a/libcxx/test/support/test_macros.h b/libcxx/test/support/test_macros.h
index 80cf600c858e122..252e82ef0410553 100644
--- a/libcxx/test/support/test_macros.h
+++ b/libcxx/test/support/test_macros.h
@@ -390,10 +390,6 @@ inline void DoNotOptimize(Tp const& value) {
# define TEST_HAS_NO_FILESYSTEM
#endif
-#if defined(_LIBCPP_HAS_NO_FGETPOS_FSETPOS)
-# define TEST_HAS_NO_FGETPOS_FSETPOS
-#endif
-
#if defined(_LIBCPP_HAS_NO_C8RTOMB_MBRTOC8)
# define TEST_HAS_NO_C8RTOMB_MBRTOC8
#endif
More information about the libcxx-commits
mailing list