From 06e744948bac604868ec7bbedf726b8d1a19b9e8 Mon Sep 17 00:00:00 2001 From: Benjamin Kosnik Date: Mon, 4 Sep 2006 15:41:18 +0000 Subject: [PATCH] re PR c++/28871 (massive C++ compile time slowdown) 2006-09-04 Benjamin Kosnik PR c++/28871 * include/ext/bitmap_allocator.h: Add comment for end of anonymous namespace. * include/ext/rope: Same. * include/bits/cpp_type_traits.h: Same. * include/tr1/tuple: Same. * include/tr1/functional_iterate.h: Same. * include/bits/cpp_type_traits.h: Revert anonymous namespace change, use nested detail instead. * testsuite/lib/libstdc++.exp (libstdc++_init): PCHFLAGS revert to stdc++.h. From-SVN: r116680 --- libstdc++-v3/ChangeLog | 16 ++++++++++ libstdc++-v3/include/bits/cpp_type_traits.h | 30 +++++++++---------- libstdc++-v3/include/ext/bitmap_allocator.h | 2 +- libstdc++-v3/include/ext/rope | 2 +- libstdc++-v3/include/tr1/functional_iterate.h | 2 +- libstdc++-v3/include/tr1/tuple | 2 +- libstdc++-v3/testsuite/lib/libstdc++.exp | 4 +-- 7 files changed, 37 insertions(+), 21 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index a1feede7fc4..563621e458c 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,19 @@ +2006-09-04 Benjamin Kosnik + + PR c++/28871 + * include/ext/bitmap_allocator.h: Add comment for end of anonymous + namespace. + * include/ext/rope: Same. + * include/bits/cpp_type_traits.h: Same. + * include/tr1/tuple: Same. + * include/tr1/functional_iterate.h: Same. + + * include/bits/cpp_type_traits.h: Revert anonymous namespace + change, use nested detail instead. + + * testsuite/lib/libstdc++.exp (libstdc++_init): PCHFLAGS revert to + stdc++.h. + 2006-09-04 Paolo Carlini * src/mt_allocator.cc (__pool::_M_reclaim_block): Do diff --git a/libstdc++-v3/include/bits/cpp_type_traits.h b/libstdc++-v3/include/bits/cpp_type_traits.h index f796b0ce3b8..a79c1bea634 100644 --- a/libstdc++-v3/include/bits/cpp_type_traits.h +++ b/libstdc++-v3/include/bits/cpp_type_traits.h @@ -83,6 +83,19 @@ struct __false_type { }; _GLIBCXX_BEGIN_NAMESPACE(std) +namespace detail +{ + // NB: g++ can not compile these if declared within the class + // __is_pod itself. + typedef char __one; + typedef char __two[2]; + + template + __one __test_type(int _Tp::*); + template + __two& __test_type(...); +} // namespace detail + template struct __truth_type { typedef __false_type __type; }; @@ -339,27 +352,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std) : public __traitor<__is_arithmetic<_Tp>, __is_pointer<_Tp> > { }; - // NB: g++ can not compile these if declared within the class - // __is_pod itself. - namespace - { - typedef char __one; - typedef char __two[2]; - - template - __one __test_type(int _Tp::*); - - template - __two& __test_type(...); - } - // For the immediate use, the following is a good approximation. template struct __is_pod { enum { - __value = (sizeof(__test_type<_Tp>(0)) != sizeof(__one)) + __value = (sizeof(detail::__test_type<_Tp>(0)) + != sizeof(detail::__one)) }; }; diff --git a/libstdc++-v3/include/ext/bitmap_allocator.h b/libstdc++-v3/include/ext/bitmap_allocator.h index 42109b46891..0f903077c2c 100644 --- a/libstdc++-v3/include/ext/bitmap_allocator.h +++ b/libstdc++-v3/include/ext/bitmap_allocator.h @@ -82,7 +82,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) * else do no use any synchronization primitives. */ bool const __threads_enabled = __gthread_active_p(); - } + } // anonymous namespace #endif #if defined __GTHREADS diff --git a/libstdc++-v3/include/ext/rope b/libstdc++-v3/include/ext/rope index 059342f22a5..d24366c95c5 100644 --- a/libstdc++-v3/include/ext/rope +++ b/libstdc++-v3/include/ext/rope @@ -71,7 +71,7 @@ namespace { enum { _S_max_rope_depth = 45 }; enum _Tag {_S_leaf, _S_concat, _S_substringfn, _S_function}; -} +} // anonymous namespace _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) diff --git a/libstdc++-v3/include/tr1/functional_iterate.h b/libstdc++-v3/include/tr1/functional_iterate.h index 0b08a6969a7..c29e341b8bf 100644 --- a/libstdc++-v3/include/tr1/functional_iterate.h +++ b/libstdc++-v3/include/tr1/functional_iterate.h @@ -396,7 +396,7 @@ namespace placeholders namespace { _Placeholder<_GLIBCXX_NUM_ARGS> _GLIBCXX_JOIN(_,_GLIBCXX_NUM_ARGS); -} +} // anonymous namespace } #endif diff --git a/libstdc++-v3/include/tr1/tuple b/libstdc++-v3/include/tr1/tuple index 15c944f9eec..bd1a81fad1f 100644 --- a/libstdc++-v3/include/tr1/tuple +++ b/libstdc++-v3/include/tr1/tuple @@ -258,7 +258,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) namespace { swallow_assign ignore; - }; + }; // anonymous namespace #define _GLIBCXX_CAT(x,y) _GLIBCXX_CAT2(x,y) #define _GLIBCXX_CAT2(x,y) x##y diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp index e6524603e8f..36c2e97fabe 100644 --- a/libstdc++-v3/testsuite/lib/libstdc++.exp +++ b/libstdc++-v3/testsuite/lib/libstdc++.exp @@ -214,8 +214,8 @@ proc libstdc++_init { testfile } { "additional_flags=-include additional_flags=bits/stdtr1c++.h"] if {$lines == "" } { # set PCH_CXXFLAGS "-include bits/extc++.h" - set PCH_CXXFLAGS "-include bits/stdtr1c++.h" -# set PCH_CXXFLAGS "-include bits/stdc++.h" +# set PCH_CXXFLAGS "-include bits/stdtr1c++.h" + set PCH_CXXFLAGS "-include bits/stdc++.h" } else { set PCH_CXXFLAGS "" }