From a4c224682f867bc071f39182dd3fd96e7a7a8d3e Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 18 Apr 2024 13:49:40 -0700 Subject: [PATCH] Remove `_FPOSOFF` and `std::fpos::seekpos()`. Boost stopped using `_FPOSOFF` when https://github.com/boostorg/iostreams/commit/7c2592c770975909bee33726f76744321a46c439 was merged on 2016-09-16. I've verified that this shipped in Boost 1.63.0 on 2016-12-26. We deprecated `std::fpos::seekpos()` with MSVC-PR-132953 merged on 2018-07-18. (We first noticed the problem when MSVC-PR-115404 was merged on 2018-04-11.) Boost stopped using it when https://github.com/boostorg/iostreams/pull/57 was merged on 2018-04-20. I've verified that this shipped in Boost 1.69.0 on 2018-12-12. Note that while the `std::fpos` type appears in the parameter types and return types of dllexported functions, `std::fpos` is not dllexported itself, as indicated by the lack of explicit calling conventions in the source. Because `std::fpos::seekpos()` isn't dllexported, we can freely remove it. (The only mentions of `seekpos` in the dllexport surface are for the different `std::basic_streambuf::seekpos()`, which conveniently also demonstrates how it takes and returns `std::fpos`.) ``` D:\GitHub\STL\out\x64\out\bin\amd64>dumpbin /exports msvcp140d_oss.dll | rg "\bseekpos\b" 1206 4B5 00053D70 ?seekpos@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA?AV?$fpos@U_Mbstatet@@@2@V32@H@Z = ?seekpos@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA?AV?$fpos@U_Mbstatet@@@2@V32@H@Z (protected: virtual class std::fpos __cdecl std::basic_streambuf >::seekpos(class std::fpos,int)) 1207 4B6 00053DB0 ?seekpos@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAA?AV?$fpos@U_Mbstatet@@@2@V32@H@Z = ?seekpos@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAA?AV?$fpos@U_Mbstatet@@@2@V32@H@Z (protected: virtual class std::fpos __cdecl std::basic_streambuf >::seekpos(class std::fpos,int)) 1208 4B7 00053DF0 ?seekpos@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAA?AV?$fpos@U_Mbstatet@@@2@V32@H@Z = ?seekpos@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAA?AV?$fpos@U_Mbstatet@@@2@V32@H@Z (protected: virtual class std::fpos __cdecl std::basic_streambuf >::seekpos(class std::fpos,int)) ``` --- stl/inc/cstdio | 3 --- stl/inc/iosfwd | 6 ------ stl/inc/yvals_core.h | 15 +-------------- tests/std/test.lst | 1 - .../tests/VSO_0000000_oss_workarounds/env.lst | 4 ---- .../VSO_0000000_oss_workarounds/test.cpp | 19 ------------------- 6 files changed, 1 insertion(+), 47 deletions(-) delete mode 100644 tests/std/tests/VSO_0000000_oss_workarounds/env.lst delete mode 100644 tests/std/tests/VSO_0000000_oss_workarounds/test.cpp diff --git a/stl/inc/cstdio b/stl/inc/cstdio index 70a2b4bb73a..674c36c3c75 100644 --- a/stl/inc/cstdio +++ b/stl/inc/cstdio @@ -26,9 +26,6 @@ _STL_DISABLE_CLANG_WARNINGS #undef putc #undef putchar -// TRANSITION: Boost nonconformingly uses this macro -#define _FPOSOFF(fp) (static_cast(fp)) - _STD_BEGIN #pragma warning(push) #pragma warning(disable : 4995) // name was marked as #pragma deprecated diff --git a/stl/inc/iosfwd b/stl/inc/iosfwd index 871ab02ec1e..666c823a6ea 100644 --- a/stl/inc/iosfwd +++ b/stl/inc/iosfwd @@ -67,12 +67,6 @@ public: return _Myoff + _Fpos; } -#ifndef _REMOVE_FPOS_SEEKPOS - _DEPRECATE_FPOS_SEEKPOS fpos_t seekpos() const noexcept { - return {}; - } -#endif // !defined(_REMOVE_FPOS_SEEKPOS) - _NODISCARD streamoff operator-(const fpos& _Right) const noexcept /* strengthened */ { return static_cast(*this) - static_cast(_Right); } diff --git a/stl/inc/yvals_core.h b/stl/inc/yvals_core.h index ab51dea02b0..f7e831719a0 100644 --- a/stl/inc/yvals_core.h +++ b/stl/inc/yvals_core.h @@ -1221,20 +1221,7 @@ _EMIT_STL_ERROR(STL1004, "C++98 unexpected() is incompatible with C++23 unexpect // STL4018 was "The non-Standard std::tr2::sys namespace is deprecated and will be REMOVED." -#ifdef _SILENCE_FPOS_SEEKPOS_DEPRECATION_WARNING -#define _DEPRECATE_FPOS_SEEKPOS -#else // ^^^ warning disabled / warning enabled vvv -#define _DEPRECATE_FPOS_SEEKPOS \ - [[deprecated("warning STL4019: " \ - "The member std::fpos::seekpos() is non-Standard, and is preserved only for compatibility with " \ - "workarounds for old versions of Visual C++. It will be removed in a future release, and in this " \ - "release always returns 0. Please use standards-conforming mechanisms to manipulate fpos, such as " \ - "conversions to and from streamoff, or an integral type, instead. If you are receiving this message " \ - "while compiling Boost.IOStreams, a fix has been submitted upstream to make Boost use " \ - "standards-conforming mechanisms, as it does for other compilers. You can define " \ - "_SILENCE_FPOS_SEEKPOS_DEPRECATION_WARNING to suppress this warning, " \ - "or define _REMOVE_FPOS_SEEKPOS to remove std::fpos::seekpos entirely.")]] -#endif // ^^^ warning enabled ^^^ +// STL4019 was "The member std::fpos::seekpos() is non-Standard, and [...] will be removed" // P0482R6 Library Support For char8_t // Other C++20 deprecation warnings diff --git a/tests/std/test.lst b/tests/std/test.lst index 13dec80ac31..cd5ae5ae0c4 100644 --- a/tests/std/test.lst +++ b/tests/std/test.lst @@ -688,7 +688,6 @@ tests\VSO_0000000_list_unique_self_reference tests\VSO_0000000_matching_npos_address tests\VSO_0000000_more_pair_tuple_sfinae tests\VSO_0000000_nullptr_stream_out -tests\VSO_0000000_oss_workarounds tests\VSO_0000000_path_stream_parameter tests\VSO_0000000_regex_interface tests\VSO_0000000_regex_use diff --git a/tests/std/tests/VSO_0000000_oss_workarounds/env.lst b/tests/std/tests/VSO_0000000_oss_workarounds/env.lst deleted file mode 100644 index 19f025bd0e6..00000000000 --- a/tests/std/tests/VSO_0000000_oss_workarounds/env.lst +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) Microsoft Corporation. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -RUNALL_INCLUDE ..\usual_matrix.lst diff --git a/tests/std/tests/VSO_0000000_oss_workarounds/test.cpp b/tests/std/tests/VSO_0000000_oss_workarounds/test.cpp deleted file mode 100644 index 9b11b5c280e..00000000000 --- a/tests/std/tests/VSO_0000000_oss_workarounds/test.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -#define _SILENCE_FPOS_SEEKPOS_DEPRECATION_WARNING -#include -#include - -int main() { - std::streampos pos(1234); - - // The following workarounds must be present as long as Boost 1.67 is supported: - // use of "seekpos", submitted upstream at https://github.com/boostorg/iostreams/pull/57 - assert(0 == pos.seekpos()); - - // _FPOSOFF macro, left in place due to use in Boost (somewhere around VS2015 Update 3 timeframe) - // Boost has since fixed this here; _FPOSOFF should be removed at the same time as seekpos in a future release. - // https://github.com/boostorg/iostreams/blob/develop/include/boost/iostreams/detail/config/fpos.hpp#L36 - assert(0 == _FPOSOFF(pos.seekpos())); -}