This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[Patch] libstdc++/28080: <iosfwd>
- From: Paolo Carlini <pcarlini at suse dot de>
- To: libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Sun, 11 Mar 2007 02:44:55 +0100
- Subject: [Patch] libstdc++/28080: <iosfwd>
Hi,
on Linux, this tweak reduces the size of <iosfwd> by 40 KB, a rather
useful improvement, I think, considering how much the header is
"advertised" in the literature as being very small and convenient wrt
the stream headers (when applicable, of course).
At this point, I guess I will close the PR as fixed, further
improvements then considered proper enhancements.
Tested x86-linux without PCHs.
Paolo.
/////////////
2007-03-11 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/28080 (partial)
* include/std/iosfwd: Do not include <bits/c++io.h>.
* config/io/basic_file_stdio.h: Do it here.
* include/ext/stdio_sync_filebuf.h: Likewise.
* include/ext/rope: Include <bits/gthr.h> unconditionally.
* include/std/fstream: Do not include <bits/gthr.h>.
* include/std/ios: Do not include <cstdio>.
* include/bits/ios_base.h: Do it here.
* testsuite/27_io/ios_base/cons/assign_neg.cc: Adjust dg-error
line numbers.
* testsuite/27_io/ios_base/cons/copy_neg.cc: Likewise.
Index: include/ext/stdio_sync_filebuf.h
===================================================================
--- include/ext/stdio_sync_filebuf.h (revision 122800)
+++ include/ext/stdio_sync_filebuf.h (working copy)
@@ -1,6 +1,6 @@
// Iostreams wrapper for stdio FILE* -*- C++ -*-
-// Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+// Copyright (C) 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
@@ -39,6 +39,7 @@
#include <streambuf>
#include <unistd.h>
#include <cstdio>
+#include <bits/c++io.h> // For __c_file
#ifdef _GLIBCXX_USE_WCHAR_T
#include <cwchar>
Index: include/ext/rope
===================================================================
--- include/ext/rope (revision 122800)
+++ include/ext/rope (working copy)
@@ -58,11 +58,11 @@
#include <bits/allocator.h>
#include <ext/hash_fun.h>
#include <iosfwd>
+#include <bits/gthr.h>
# ifdef __GC
# define __GC_CONST const
# else
-# include <bits/gthr.h>
# define __GC_CONST // constant except for deallocation
# endif
Index: include/bits/ios_base.h
===================================================================
--- include/bits/ios_base.h (revision 122800)
+++ include/bits/ios_base.h (working copy)
@@ -1,6 +1,7 @@
// Iostreams base classes -*- C++ -*-
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 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
@@ -45,6 +46,7 @@
#include <ext/atomicity.h>
#include <bits/localefwd.h>
#include <bits/locale_classes.h>
+#include <cstdio> // For SEEK_CUR, SEEK_END
_GLIBCXX_BEGIN_NAMESPACE(std)
Index: include/std/ios
===================================================================
--- include/std/ios (revision 122800)
+++ include/std/ios (working copy)
@@ -1,6 +1,7 @@
// Iostreams base classes -*- C++ -*-
-// Copyright (C) 1997, 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+// 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
// software; you can redistribute it and/or modify it under the
@@ -43,7 +44,6 @@
#include <iosfwd>
#include <exception> // For ios_base::failure
#include <bits/char_traits.h> // For char_traits, streamoff, streamsize, fpos
-#include <cstdio> // For SEEK_SET, SEEK_CUR, SEEK_END
#include <bits/localefwd.h> // For class locale
#include <bits/ios_base.h> // For ios_base declarations.
#include <streambuf>
Index: include/std/iosfwd
===================================================================
--- include/std/iosfwd (revision 122800)
+++ include/std/iosfwd (working copy)
@@ -44,7 +44,6 @@
#include <bits/c++config.h>
#include <bits/c++locale.h>
-#include <bits/c++io.h>
#include <bits/stringfwd.h> // For string forward declarations.
#include <bits/postypes.h>
#include <bits/functexcept.h>
Index: include/std/fstream
===================================================================
--- include/std/fstream (revision 122800)
+++ include/std/fstream (working copy)
@@ -1,6 +1,7 @@
// File based streams -*- C++ -*-
-// Copyright (C) 1997, 1998, 1999, 2000, 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
@@ -44,9 +45,8 @@
#include <istream>
#include <ostream>
#include <locale> // For codecvt
-#include <cstdio> // For SEEK_SET, SEEK_CUR, SEEK_END, BUFSIZ
-#include <bits/basic_file.h>
-#include <bits/gthr.h>
+#include <cstdio> // For BUFSIZ
+#include <bits/basic_file.h> // For __basic_file, __c_lock
_GLIBCXX_BEGIN_NAMESPACE(std)
Index: testsuite/27_io/ios_base/cons/assign_neg.cc
===================================================================
--- testsuite/27_io/ios_base/cons/assign_neg.cc (revision 122800)
+++ testsuite/27_io/ios_base/cons/assign_neg.cc (working copy)
@@ -1,6 +1,6 @@
// { dg-do compile }
-// Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+// Copyright (C) 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
@@ -42,5 +42,5 @@
}
// { dg-error "synthesized" "" { target *-*-* } 41 }
// { dg-error "within this context" "" { target *-*-* } 34 }
-// { dg-error "is private" "" { target *-*-* } 782 }
+// { dg-error "is private" "" { target *-*-* } 784 }
// { dg-error "operator=" "" { target *-*-* } 0 }
Index: testsuite/27_io/ios_base/cons/copy_neg.cc
===================================================================
--- testsuite/27_io/ios_base/cons/copy_neg.cc (revision 122800)
+++ testsuite/27_io/ios_base/cons/copy_neg.cc (working copy)
@@ -1,6 +1,6 @@
// { dg-do compile }
-// Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+// Copyright (C) 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
@@ -42,5 +42,5 @@
}
// { dg-error "within this context" "" { target *-*-* } 35 }
// { dg-error "synthesized" "" { target *-*-* } 41 }
-// { dg-error "is private" "" { target *-*-* } 779 }
+// { dg-error "is private" "" { target *-*-* } 781 }
// { dg-error "copy constructor" "" { target *-*-* } 0 }
Index: config/io/basic_file_stdio.h
===================================================================
--- config/io/basic_file_stdio.h (revision 122800)
+++ config/io/basic_file_stdio.h (working copy)
@@ -1,6 +1,6 @@
// Wrapper of C-language FILE struct -*- C++ -*-
-// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005
+// 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
@@ -43,6 +43,7 @@
#pragma GCC system_header
#include <bits/c++config.h>
+#include <bits/c++io.h> // for __c_lock and __c_file
#include <ios>
_GLIBCXX_BEGIN_NAMESPACE(std)