Welp. It looks like the reason for c++/28871 is that anonymous
namespace usage in libstdc++ headers was making PCH files unusable.

This, despite -Winvalid-pch not telling me this...

This, despite -H showing the pch used...

UGH!!!!! 

I only found this by using --disable-libstdcxx-pch and noticing that my
test times improved by 20 minutes. With this patch in, test times for
libstdc++ are now back to late july levels. (ie, 23 minutes vs. 57
minutes to 64 minutes on my laptop.)

I thought there was a bugzilla about this issue (which impacts boost,
or used to), but I cannot find it at the moment.

:(

-benjamin



2006-09-04  Benjamin Kosnik  <[EMAIL PROTECTED]>

        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.
        
Index: include/ext/bitmap_allocator.h
===================================================================
--- include/ext/bitmap_allocator.h      (revision 116678)
+++ include/ext/bitmap_allocator.h      (working copy)
@@ -82,7 +82,7 @@
      *  else do no use any synchronization primitives.
      */
     bool const __threads_enabled = __gthread_active_p();
-  }
+  } // anonymous namespace
 #endif
 
 #if defined __GTHREADS
Index: include/ext/rope
===================================================================
--- include/ext/rope    (revision 116678)
+++ include/ext/rope    (working copy)
@@ -71,7 +71,7 @@
 {
   enum { _S_max_rope_depth = 45 };
   enum _Tag {_S_leaf, _S_concat, _S_substringfn, _S_function};
-}
+} // anonymous namespace
 
 _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
 
Index: include/bits/cpp_type_traits.h
===================================================================
--- include/bits/cpp_type_traits.h      (revision 116678)
+++ include/bits/cpp_type_traits.h      (working copy)
@@ -83,6 +83,19 @@
 
 _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<typename _Tp>
+  __one __test_type(int _Tp::*);
+  template<typename _Tp>
+  __two& __test_type(...);
+} // namespace detail
+
   template<bool>
     struct __truth_type
     { typedef __false_type __type; };
@@ -339,27 +352,14 @@
     : 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<typename _Tp>
-    __one __test_type(int _Tp::*);
-    
-    template<typename _Tp>
-    __two& __test_type(...);
-  }
-
   // For the immediate use, the following is a good approximation.
   template<typename _Tp>
     struct __is_pod
     {
       enum
        {
-         __value = (sizeof(__test_type<_Tp>(0)) != sizeof(__one))
+         __value = (sizeof(detail::__test_type<_Tp>(0))
+                    != sizeof(detail::__one))
        };
     };
 
Index: include/tr1/tuple
===================================================================
--- include/tr1/tuple   (revision 116678)
+++ include/tr1/tuple   (working copy)
@@ -258,7 +258,7 @@
  namespace
  {
    swallow_assign ignore;
- };
+ }; // anonymous namespace
 
 #define _GLIBCXX_CAT(x,y) _GLIBCXX_CAT2(x,y)
 #define _GLIBCXX_CAT2(x,y) x##y
Index: include/tr1/functional_iterate.h
===================================================================
--- include/tr1/functional_iterate.h    (revision 116678)
+++ include/tr1/functional_iterate.h    (working copy)
@@ -396,8 +396,8 @@
 namespace
 {
    _Placeholder<_GLIBCXX_NUM_ARGS> _GLIBCXX_JOIN(_,_GLIBCXX_NUM_ARGS);
+} // anonymous namespace
 }
-}
 #endif
 
 template<typename _Functor _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>
Index: testsuite/lib/libstdc++.exp
===================================================================
--- testsuite/lib/libstdc++.exp (revision 116678)
+++ testsuite/lib/libstdc++.exp (working copy)
@@ -214,8 +214,8 @@
                 "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 ""
        }

Reply via email to