diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2020-10-05 22:45:27 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2020-10-05 22:46:46 +0100 |
commit | 1c72f460e9e4fce1220e426989226dfeb0db816e (patch) | |
tree | 7591372ecfb33588126986cb9a475bd418c91dcb /libstdc++-v3/include/std/numeric | |
parent | ea6da7f50fe2adc3a09fc10a3f437902c40ebff9 (diff) | |
download | gcc-1c72f460e9e4fce1220e426989226dfeb0db816e.zip gcc-1c72f460e9e4fce1220e426989226dfeb0db816e.tar.gz gcc-1c72f460e9e4fce1220e426989226dfeb0db816e.tar.bz2 |
libstdc++: Minor header cleanup in <numeric>
When adding new features to <numeric> 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.
Diffstat (limited to 'libstdc++-v3/include/std/numeric')
-rw-r--r-- | libstdc++-v3/include/std/numeric | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/libstdc++-v3/include/std/numeric b/libstdc++-v3/include/std/numeric index 2de6aaf..af1e788 100644 --- a/libstdc++-v3/include/std/numeric +++ b/libstdc++-v3/include/std/numeric @@ -60,12 +60,24 @@ #include <bits/c++config.h> #include <bits/stl_iterator_base_types.h> #include <bits/stl_numeric.h> -#include <ext/numeric_traits.h> #ifdef _GLIBCXX_PARALLEL # include <parallel/numeric> #endif +#if __cplusplus >= 201402L +# include <type_traits> +# include <bit> +#endif + +#if __cplusplus >= 201703L +# include <bits/stl_function.h> +#endif + +#if __cplusplus > 201703L +# include <limits> +#endif + /** * @defgroup numerics Numerics * @@ -74,14 +86,11 @@ * arrays, generalized numeric algorithms, and mathematical special functions. */ -#if __cplusplus >= 201402L -#include <type_traits> -#include <bit> - 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 <limits> -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 <bits/stl_function.h> - -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 <execution> has already been included, pull in implementations |