This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch] More of libstdc++/28080


Hi,

the below is another batch: in some cases the improvement is big, for example <numeric> now is just ~10 Kb, <valarray> is also much smaller. Apparently, compile-time performance consistently benefits, nice.

The general effort of including only a minimal set of headers, also means including in <bitset> and <iomanip> only <ios> instead of the whole <istream> and <ostream>: I think it's fine, because the actual definitions are used only in template functions, but please double check with me.

Also note that some spared inclusions can be very simply explained by the relatively recent split out of some HP/SGI facilities to ext/: such headers are used only by facilities now in ext/ headers.

Tested x86-linux without PCHs (and not including the whole <locale> in testsuite_hooks.h helps making the tests more effective, I hope)

Paolo.

/////////////////
2007-02-26  Paolo Carlini  <pcarlini@suse.de>

	PR libstdc++/28080 (partial)
	* include/std/bitset: Do not include <istream> and <ostream>,
	<ios> is enough.
	* include/std/iomanip: Do not include the whole <istream>,
	<ios> is enough; do not include <functional>; reformat.
	* include/std/functional: Do not include <cstddef>.
	* include/std/list: Do not include <bits/stl_uninitialized.h>.
	* include/std/numeric: Do not include the whole <iterator> and
	<bits/stl_function.h>.
	* include/std/valarray: Do not include <numeric>.
	* include/bits/stl_numeric.h: Include <bits/concept_check.h>.
	* src/iostream-inst.cc: Include <istream>.
	* include/ext/functional: Include <cstddef>.
	* testsuite/util/testsuite_hooks.h: Do not include <locale>,
	<ctime> is enough; qualify tm.
	* testsuite/util/testsuite_hooks.cc: Qualify tm.
Index: src/iostream-inst.cc
===================================================================
--- src/iostream-inst.cc	(revision 122296)
+++ src/iostream-inst.cc	(working copy)
@@ -1,6 +1,7 @@
 // Explicit instantiation file.
 
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -33,6 +34,7 @@
 //
 
 #include <iomanip>
+#include <istream>
 
 _GLIBCXX_BEGIN_NAMESPACE(std)
 
Index: include/ext/functional
===================================================================
--- include/ext/functional	(revision 122296)
+++ include/ext/functional	(working copy)
@@ -1,6 +1,7 @@
 // Functional extensions -*- C++ -*-
 
-// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007
+// Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -64,6 +65,7 @@
 #pragma GCC system_header
 
 #include <functional>
+#include <cstddef>
 
 _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
 
Index: include/bits/stl_numeric.h
===================================================================
--- include/bits/stl_numeric.h	(revision 122296)
+++ include/bits/stl_numeric.h	(working copy)
@@ -1,6 +1,7 @@
 // Numeric functions implementation -*- C++ -*-
 
-// Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
+// Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -61,6 +62,7 @@
 #ifndef _STL_NUMERIC_H
 #define _STL_NUMERIC_H 1
 
+#include <bits/concept_check.h>
 #include <debug/debug.h>
 
 _GLIBCXX_BEGIN_NAMESPACE(std)
Index: include/std/valarray
===================================================================
--- include/std/valarray	(revision 122296)
+++ include/std/valarray	(working copy)
@@ -1,6 +1,7 @@
 // The template and inlines for the -*- C++ -*- valarray class.
 
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+// 2006, 2007
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -43,7 +44,6 @@
 #include <cstddef>
 #include <cmath>
 #include <cstdlib>
-#include <numeric>
 #include <algorithm>
 #include <debug/debug.h>
 
Index: include/std/bitset
===================================================================
--- include/std/bitset	(revision 122296)
+++ include/std/bitset	(working copy)
@@ -1,6 +1,6 @@
 // <bitset> -*- C++ -*-
 
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -52,14 +52,12 @@
 
 #include <cstddef>     // For size_t
 #include <cstring>     // For memset
-#include <limits>      // For numeric_limits
 #include <string>
 #include <bits/functexcept.h>   // For invalid_argument, out_of_range,
                                 // overflow_error
-#include <ostream>     // For ostream (operator<<)
-#include <istream>     // For istream (operator>>)
+#include <ios>
 
-#define _GLIBCXX_BITSET_BITS_PER_WORD  numeric_limits<unsigned long>::digits
+#define _GLIBCXX_BITSET_BITS_PER_WORD  (__CHAR_BIT__ * sizeof(unsigned long))
 #define _GLIBCXX_BITSET_WORDS(__n) \
  ((__n) < 1 ? 0 : ((__n) + _GLIBCXX_BITSET_BITS_PER_WORD - 1) \
                   / _GLIBCXX_BITSET_BITS_PER_WORD)
Index: include/std/iomanip
===================================================================
--- include/std/iomanip	(revision 122311)
+++ include/std/iomanip	(working copy)
@@ -1,6 +1,7 @@
 // Standard stream manipulators -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2001, 2002, 2003, 2005
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+// 2006, 2007
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -42,8 +43,7 @@
 #pragma GCC system_header
 
 #include <bits/c++config.h>
-#include <istream>
-#include <functional>
+#include <ios>
 
 _GLIBCXX_BEGIN_NAMESPACE(std)
 
@@ -68,16 +68,16 @@
   }
 
   template<typename _CharT, typename _Traits>
-    inline basic_istream<_CharT,_Traits>& 
-    operator>>(basic_istream<_CharT,_Traits>& __is, _Resetiosflags __f)
+    inline basic_istream<_CharT, _Traits>& 
+    operator>>(basic_istream<_CharT, _Traits>& __is, _Resetiosflags __f)
     { 
       __is.setf(ios_base::fmtflags(0), __f._M_mask); 
       return __is; 
     }
 
   template<typename _CharT, typename _Traits>
-    inline basic_ostream<_CharT,_Traits>& 
-    operator<<(basic_ostream<_CharT,_Traits>& __os, _Resetiosflags __f)
+    inline basic_ostream<_CharT, _Traits>& 
+    operator<<(basic_ostream<_CharT, _Traits>& __os, _Resetiosflags __f)
     { 
       __os.setf(ios_base::fmtflags(0), __f._M_mask); 
       return __os; 
@@ -102,15 +102,15 @@
   }
 
   template<typename _CharT, typename _Traits>
-    inline basic_istream<_CharT,_Traits>& 
-    operator>>(basic_istream<_CharT,_Traits>& __is, _Setiosflags __f)
+    inline basic_istream<_CharT, _Traits>& 
+    operator>>(basic_istream<_CharT, _Traits>& __is, _Setiosflags __f)
     { 
       __is.setf(__f._M_mask); 
       return __is; 
     }
 
   template<typename _CharT, typename _Traits>
-    inline basic_ostream<_CharT,_Traits>& 
+    inline basic_ostream<_CharT, _Traits>& 
     operator<<(basic_ostream<_CharT,_Traits>& __os, _Setiosflags __f)
     { 
       __os.setf(__f._M_mask); 
@@ -137,19 +137,19 @@
   }
 
   template<typename _CharT, typename _Traits>
-    inline basic_istream<_CharT,_Traits>& 
-    operator>>(basic_istream<_CharT,_Traits>& __is, _Setbase __f)
+    inline basic_istream<_CharT, _Traits>& 
+    operator>>(basic_istream<_CharT, _Traits>& __is, _Setbase __f)
     {
       __is.setf(__f._M_base ==  8 ? ios_base::oct : 
-	      __f._M_base == 10 ? ios_base::dec : 
-	      __f._M_base == 16 ? ios_base::hex : 
-	      ios_base::fmtflags(0), ios_base::basefield);
+		__f._M_base == 10 ? ios_base::dec : 
+		__f._M_base == 16 ? ios_base::hex : 
+		ios_base::fmtflags(0), ios_base::basefield);
       return __is; 
     }
   
   template<typename _CharT, typename _Traits>
-    inline basic_ostream<_CharT,_Traits>& 
-    operator<<(basic_ostream<_CharT,_Traits>& __os, _Setbase __f)
+    inline basic_ostream<_CharT, _Traits>& 
+    operator<<(basic_ostream<_CharT, _Traits>& __os, _Setbase __f)
     {
       __os.setf(__f._M_base ==  8 ? ios_base::oct : 
 		__f._M_base == 10 ? ios_base::dec : 
@@ -179,16 +179,16 @@
     }
 
   template<typename _CharT, typename _Traits>
-    inline basic_istream<_CharT,_Traits>& 
-    operator>>(basic_istream<_CharT,_Traits>& __is, _Setfill<_CharT> __f)
+    inline basic_istream<_CharT, _Traits>& 
+    operator>>(basic_istream<_CharT, _Traits>& __is, _Setfill<_CharT> __f)
     { 
       __is.fill(__f._M_c); 
       return __is; 
     }
 
   template<typename _CharT, typename _Traits>
-    inline basic_ostream<_CharT,_Traits>& 
-    operator<<(basic_ostream<_CharT,_Traits>& __os, _Setfill<_CharT> __f)
+    inline basic_ostream<_CharT, _Traits>& 
+    operator<<(basic_ostream<_CharT, _Traits>& __os, _Setfill<_CharT> __f)
     { 
       __os.fill(__f._M_c); 
       return __os; 
@@ -213,16 +213,16 @@
   }
 
   template<typename _CharT, typename _Traits>
-    inline basic_istream<_CharT,_Traits>& 
-    operator>>(basic_istream<_CharT,_Traits>& __is, _Setprecision __f)
+    inline basic_istream<_CharT, _Traits>& 
+    operator>>(basic_istream<_CharT, _Traits>& __is, _Setprecision __f)
     { 
       __is.precision(__f._M_n); 
       return __is; 
     }
 
   template<typename _CharT, typename _Traits>
-    inline basic_ostream<_CharT,_Traits>& 
-    operator<<(basic_ostream<_CharT,_Traits>& __os, _Setprecision __f)
+    inline basic_ostream<_CharT, _Traits>& 
+    operator<<(basic_ostream<_CharT, _Traits>& __os, _Setprecision __f)
     { 
       __os.precision(__f._M_n); 
       return __os; 
@@ -247,16 +247,16 @@
   }
 
   template<typename _CharT, typename _Traits>
-    inline basic_istream<_CharT,_Traits>& 
-    operator>>(basic_istream<_CharT,_Traits>& __is, _Setw __f)
+    inline basic_istream<_CharT, _Traits>& 
+    operator>>(basic_istream<_CharT, _Traits>& __is, _Setw __f)
     { 
       __is.width(__f._M_n); 
       return __is; 
     }
 
   template<typename _CharT, typename _Traits>
-    inline basic_ostream<_CharT,_Traits>& 
-    operator<<(basic_ostream<_CharT,_Traits>& __os, _Setw __f)
+    inline basic_ostream<_CharT, _Traits>& 
+    operator<<(basic_ostream<_CharT, _Traits>& __os, _Setw __f)
     { 
       __os.width(__f._M_n); 
       return __os; 
Index: include/std/functional
===================================================================
--- include/std/functional	(revision 122296)
+++ include/std/functional	(working copy)
@@ -1,6 +1,7 @@
 // <functional> -*- C++ -*-
 
-// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
+// Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -51,7 +52,6 @@
 #pragma GCC system_header
 
 #include <bits/c++config.h>
-#include <cstddef>
 #include <bits/stl_function.h>
 
 #endif /* _GLIBCXX_FUNCTIONAL */
Index: include/std/numeric
===================================================================
--- include/std/numeric	(revision 122311)
+++ include/std/numeric	(working copy)
@@ -64,8 +64,7 @@
 
 #include <bits/c++config.h>
 #include <cstddef>
-#include <iterator>
-#include <bits/stl_function.h>
+#include <bits/stl_iterator_base_types.h>
 #include <bits/stl_numeric.h>
 
 #endif /* _GLIBCXX_NUMERIC */
Index: include/std/list
===================================================================
--- include/std/list	(revision 122296)
+++ include/std/list	(working copy)
@@ -1,6 +1,7 @@
 // <list> -*- C++ -*-
 
-// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
+// Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -66,7 +67,6 @@
 #include <bits/stl_algobase.h>
 #include <bits/allocator.h>
 #include <bits/stl_construct.h>
-#include <bits/stl_uninitialized.h>
 #include <bits/stl_list.h>
 
 #ifndef _GLIBCXX_EXPORT_TEMPLATE
Index: testsuite/util/testsuite_hooks.cc
===================================================================
--- testsuite/util/testsuite_hooks.cc	(revision 122296)
+++ testsuite/util/testsuite_hooks.cc	(working copy)
@@ -2,7 +2,8 @@
 
 // Utility subroutines for the C++ library testsuite. 
 //
-// Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007
+// Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -314,11 +315,11 @@
   }
 
   // For use in 22_locale/time_get and time_put.
-  tm
+  std::tm
   test_tm(int sec, int min, int hour, int mday, int mon,
 	  int year, int wday, int yday, int isdst)
   {
-    static tm tmp;
+    static std::tm tmp;
     tmp.tm_sec = sec;
     tmp.tm_min = min;
     tmp.tm_hour = hour;
Index: testsuite/util/testsuite_hooks.h
===================================================================
--- testsuite/util/testsuite_hooks.h	(revision 122296)
+++ testsuite/util/testsuite_hooks.h	(working copy)
@@ -1,7 +1,7 @@
 // -*- C++ -*-
 // Utility subroutines for the C++ library testsuite. 
 //
-// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006
+// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -59,7 +59,8 @@
 #include <bits/c++config.h>
 #include <bits/functexcept.h>
 #include <cstddef>
-#include <locale>
+#include <ctime>
+
 #ifdef _GLIBCXX_HAVE_SYS_STAT_H
 #include <sys/stat.h>
 #endif
@@ -387,8 +388,8 @@
   };
 
   // For use in 22_locale/time_get and time_put.
-  tm test_tm(int sec, int min, int hour, int mday, int mon,
-	     int year, int wday, int yday, int isdst);
+  std::tm test_tm(int sec, int min, int hour, int mday, int mon,
+		  int year, int wday, int yday, int isdst);
 
 } // namespace __gnu_test
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]