From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 31DC33857C4E; Mon, 5 Oct 2020 21:50:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 31DC33857C4E Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r11-3662] libstdc++: Minor header cleanup in X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: ea6da7f50fe2adc3a09fc10a3f437902c40ebff9 X-Git-Newrev: 1c72f460e9e4fce1220e426989226dfeb0db816e Message-Id: <20201005215005.31DC33857C4E@sourceware.org> Date: Mon, 5 Oct 2020 21:50:05 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Oct 2020 21:50:05 -0000 https://gcc.gnu.org/g:1c72f460e9e4fce1220e426989226dfeb0db816e commit r11-3662-g1c72f460e9e4fce1220e426989226dfeb0db816e Author: Jonathan Wakely Date: Mon Oct 5 22:45:27 2020 +0100 libstdc++: Minor header cleanup in When adding new features to I included the required headers adjacent to the new code. This cleans it up by moving all the includes to the start of the file. libstdc++-v3/ChangeLog: * include/std/numeric: Move all #include directives to the top of the header. * testsuite/26_numerics/gcd/gcd_neg.cc: Adjust dg-error line numbers. * testsuite/26_numerics/lcm/lcm_neg.cc: Likewise. Diff: --- libstdc++-v3/include/std/numeric | 39 ++++++++++------------- libstdc++-v3/testsuite/26_numerics/gcd/gcd_neg.cc | 8 ++--- libstdc++-v3/testsuite/26_numerics/lcm/lcm_neg.cc | 8 ++--- 3 files changed, 25 insertions(+), 30 deletions(-) diff --git a/libstdc++-v3/include/std/numeric b/libstdc++-v3/include/std/numeric index 2de6aaf06ec..af1e7884f6a 100644 --- a/libstdc++-v3/include/std/numeric +++ b/libstdc++-v3/include/std/numeric @@ -60,12 +60,24 @@ #include #include #include -#include #ifdef _GLIBCXX_PARALLEL # include #endif +#if __cplusplus >= 201402L +# include +# include +#endif + +#if __cplusplus >= 201703L +# include +#endif + +#if __cplusplus > 201703L +# include +#endif + /** * @defgroup numerics Numerics * @@ -74,14 +86,11 @@ * arrays, generalized numeric algorithms, and mathematical special functions. */ -#if __cplusplus >= 201402L -#include -#include - namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION +#if __cplusplus >= 201402L namespace __detail { // std::abs is not constexpr, doesn't support unsigned integers, @@ -181,18 +190,10 @@ namespace __detail } #endif // C++17 - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std - #endif // C++14 #if __cplusplus > 201703L -#include -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION // midpoint # define __cpp_lib_interpolate 201902L @@ -241,17 +242,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION static_assert( sizeof(_Tp) != 0, "type must be complete" ); return __a + (__b - __a) / 2; } -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std - #endif // C++20 -#if __cplusplus > 201402L -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION +#if __cplusplus >= 201703L #if __cplusplus > 201703L #define __cpp_lib_constexpr_numeric 201911L @@ -720,10 +713,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } // @} group numeric_ops +#endif // C++17 _GLIBCXX_END_NAMESPACE_VERSION } // namespace std +#if __cplusplus >= 201703L // Parallel STL algorithms # if _PSTL_EXECUTION_POLICIES_DEFINED // If has already been included, pull in implementations diff --git a/libstdc++-v3/testsuite/26_numerics/gcd/gcd_neg.cc b/libstdc++-v3/testsuite/26_numerics/gcd/gcd_neg.cc index fa559b6f475..4294a2c69ce 100644 --- a/libstdc++-v3/testsuite/26_numerics/gcd/gcd_neg.cc +++ b/libstdc++-v3/testsuite/26_numerics/gcd/gcd_neg.cc @@ -46,9 +46,9 @@ test01() std::gcd(0.1, 0.1); // { dg-error "from here" } } -// { dg-error "must be integers" "" { target *-*-* } 160 } -// { dg-error "must be integers" "" { target *-*-* } 161 } -// { dg-error "must not be bool" "" { target *-*-* } 162 } -// { dg-error "must not be bool" "" { target *-*-* } 163 } +// { dg-error "must be integers" "" { target *-*-* } 169 } +// { dg-error "must be integers" "" { target *-*-* } 170 } +// { dg-error "must not be bool" "" { target *-*-* } 171 } +// { dg-error "must not be bool" "" { target *-*-* } 172 } // { dg-prune-output "deleted function" } // { dg-prune-output "incomplete type .*make_unsigned" } diff --git a/libstdc++-v3/testsuite/26_numerics/lcm/lcm_neg.cc b/libstdc++-v3/testsuite/26_numerics/lcm/lcm_neg.cc index 7e36c2654b0..114995cf0b9 100644 --- a/libstdc++-v3/testsuite/26_numerics/lcm/lcm_neg.cc +++ b/libstdc++-v3/testsuite/26_numerics/lcm/lcm_neg.cc @@ -46,9 +46,9 @@ test01() std::lcm(0.1, 0.1); // { dg-error "from here" } } -// { dg-error "must be integers" "" { target *-*-* } 174 } -// { dg-error "must be integers" "" { target *-*-* } 175 } -// { dg-error "must not be bool" "" { target *-*-* } 176 } -// { dg-error "must not be bool" "" { target *-*-* } 177 } +// { dg-error "must be integers" "" { target *-*-* } 183 } +// { dg-error "must be integers" "" { target *-*-* } 184 } +// { dg-error "must not be bool" "" { target *-*-* } 185 } +// { dg-error "must not be bool" "" { target *-*-* } 186 } // { dg-prune-output "deleted function" } // { dg-prune-output "incomplete type .*make_unsigned" }