This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

[v3] Small localefwd.h clean-up


Hi,

tested x86-linux without PCHs, committed to mainline.

Paolo.

/////////////
2007-04-29  Paolo Carlini  <pcarlini@suse.de>

	* include/bits/localefwd.h: Remove redundant inline qualifiers.
	(__check_facet): Move...
	* include/bits/basic_ios.h: ... here.
	(widen(char), narrow(char_type, char)): Define inline.
	* include/bits/basic_ios.tcc (widen(char), narrow(char_type, char)):
	Remove.
Index: include/bits/basic_ios.h
===================================================================
--- include/bits/basic_ios.h	(revision 124273)
+++ include/bits/basic_ios.h	(working copy)
@@ -1,6 +1,7 @@
 // Iostreams base classes -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2001, 2002, 2003, 2004, 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
@@ -38,13 +39,22 @@
 
 #pragma GCC system_header
 
-#include <bits/streambuf_iterator.h>
 #include <bits/localefwd.h>
 #include <bits/locale_classes.h>
 #include <bits/locale_facets.h>
+#include <bits/streambuf_iterator.h>
 
 _GLIBCXX_BEGIN_NAMESPACE(std)
 
+  template<typename _Facet>
+    inline const _Facet&
+    __check_facet(const _Facet* __f)
+    {
+      if (!__f)
+	__throw_bad_cast();
+      return *__f;
+    }
+
   // 27.4.5  Template class basic_ios
   /**
    *  @brief  Virtual base class for all stream classes.
@@ -255,7 +265,7 @@
       explicit
       basic_ios(basic_streambuf<_CharT, _Traits>* __sb)
       : ios_base(), _M_tie(0), _M_fill(), _M_fill_init(false), _M_streambuf(0),
-      _M_ctype(0), _M_num_put(0), _M_num_get(0)
+	_M_ctype(0), _M_num_put(0), _M_num_get(0)
       { this->init(__sb); }
 
       /**
@@ -413,7 +423,8 @@
        *  http://gcc.gnu.org/onlinedocs/libstdc++/22_locale/howto.html
       */
       char
-      narrow(char_type __c, char __dfault) const;
+      narrow(char_type __c, char __dfault) const
+      { return __check_facet(_M_ctype).narrow(__c, __dfault); }
 
       /**
        *  @brief  Widens characters.
@@ -431,7 +442,8 @@
        *  http://gcc.gnu.org/onlinedocs/libstdc++/22_locale/howto.html
       */
       char_type
-      widen(char __c) const;
+      widen(char __c) const
+      { return __check_facet(_M_ctype).widen(__c); }
 
     protected:
       // 27.4.5.1  basic_ios constructors
@@ -443,7 +455,7 @@
       */
       basic_ios()
       : ios_base(), _M_tie(0), _M_fill(char_type()), _M_fill_init(false), 
-      _M_streambuf(0), _M_ctype(0), _M_num_put(0), _M_num_get(0)
+	_M_streambuf(0), _M_ctype(0), _M_num_put(0), _M_num_get(0)
       { }
 
       /**
Index: include/bits/localefwd.h
===================================================================
--- include/bits/localefwd.h	(revision 124273)
+++ include/bits/localefwd.h	(working copy)
@@ -1,6 +1,7 @@
 // Locale support -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 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,67 +44,74 @@
 #pragma GCC system_header
 
 #include <bits/c++config.h>
-#include <bits/c++locale.h>     // Defines __c_locale, config-specific includes
-#include <iosfwd>		// For ostreambuf_iterator, istreambuf_iterator
+#include <bits/c++locale.h>  // Defines __c_locale, config-specific include
+#include <iosfwd>            // For ostreambuf_iterator, istreambuf_iterator
 #include <cctype>
-#include <bits/functexcept.h>
 
 _GLIBCXX_BEGIN_NAMESPACE(std)
 
   // 22.1.1 Locale
   class locale;
 
+  template<typename _Facet>
+    bool
+    has_facet(const locale&) throw();
+
+  template<typename _Facet>
+    const _Facet&
+    use_facet(const locale&);
+
   // 22.1.3 Convenience interfaces
   template<typename _CharT>
-    inline bool
+    bool
     isspace(_CharT, const locale&);
 
   template<typename _CharT>
-    inline bool
+    bool
     isprint(_CharT, const locale&);
 
   template<typename _CharT>
-    inline bool
+    bool
     iscntrl(_CharT, const locale&);
 
   template<typename _CharT>
-    inline bool
+    bool
     isupper(_CharT, const locale&);
 
   template<typename _CharT>
-    inline bool
+    bool
     islower(_CharT, const locale&);
 
   template<typename _CharT>
-    inline bool
+    bool
     isalpha(_CharT, const locale&);
 
   template<typename _CharT>
-    inline bool
+    bool
     isdigit(_CharT, const locale&);
 
   template<typename _CharT>
-    inline bool
+    bool
     ispunct(_CharT, const locale&);
 
   template<typename _CharT>
-    inline bool
+    bool
     isxdigit(_CharT, const locale&);
 
   template<typename _CharT>
-    inline bool
+    bool
     isalnum(_CharT, const locale&);
 
   template<typename _CharT>
-    inline bool
+    bool
     isgraph(_CharT, const locale&);
 
   template<typename _CharT>
-    inline _CharT
+    _CharT
     toupper(_CharT, const locale&);
 
   template<typename _CharT>
-    inline _CharT
+    _CharT
     tolower(_CharT, const locale&);
 
   // 22.2.1 and 22.2.1.3 ctype
@@ -175,23 +183,6 @@
   template<typename _CharT>
     class messages_byname;
 
-  template<typename _Facet>
-    bool
-    has_facet(const locale& __loc) throw();
-
-  template<typename _Facet>
-    const _Facet&
-    use_facet(const locale& __loc);
-
-  template<typename _Facet>
-    inline const _Facet&
-    __check_facet(const _Facet* __f)
-    {
-      if (!__f)
-	__throw_bad_cast();
-      return *__f;
-    }
-
 _GLIBCXX_END_NAMESPACE
 
 #endif
Index: include/bits/basic_ios.tcc
===================================================================
--- include/bits/basic_ios.tcc	(revision 124273)
+++ include/bits/basic_ios.tcc	(working copy)
@@ -1,6 +1,6 @@
 // basic_ios member functions -*- C++ -*-
 
-// Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005
+// Copyright (C) 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
@@ -112,16 +112,6 @@
       return *this;
     }
 
-  template<typename _CharT, typename _Traits>
-    char
-    basic_ios<_CharT, _Traits>::narrow(char_type __c, char __dfault) const
-    { return __check_facet(_M_ctype).narrow(__c, __dfault); }
-
-  template<typename _CharT, typename _Traits>
-    _CharT
-    basic_ios<_CharT, _Traits>::widen(char __c) const
-    { return __check_facet(_M_ctype).widen(__c); }
-
   // Locales:
   template<typename _CharT, typename _Traits>
     locale

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