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, libstdcxx_so_7] Fix the ABI-unsafe half of 17922


Hi,

I have committed the below to the branch, which fixes the remaining
issue with the dummy *_end enumerators. Tested x86-linux.

Paolo.

////////////
2005-02-21  Paolo Carlini  <pcarlini@suse.de>

	PR libstdc++/17922 (ABI-unsafe half)
	* config/io/c_io_stdio.h (struct __ios_flags): Remove.
	* include/bits/ios_base.h (enum _Ios_Fmtflags, enum _Ios_Openmode,
	enum _Ios_Iostate, enum _Ios_Seekdir): Remove *_end enumerators.
	(class ios_base): Adjust fmtflags, iostate, openmore, seekdir
	static constants.
	* src/ios.cc: Remove definitions of __ios_flags constants.
	* testsuite/27_io/ios_base/types/fmtflags/case_label.cc: Adjust,
	removing the dummy label.
	* testsuite/27_io/ios_base/types/iostate/case_label.cc: Likewise.
	* testsuite/27_io/ios_base/types/openmode/case_label.cc: Likewise.
	* testsuite/27_io/ios_base/types/seekdir/case_label.cc: Likewise.
	* testsuite/27_io/ios_base/cons/assign_neg.cc: Adjust dg-error
	line numbers.
	* testsuite/27_io/ios_base/cons/copy_neg.cc: Likewise.
	
diff -urN libstdc++-v3-orig/config/io/c_io_stdio.h libstdc++-v3/config/io/c_io_stdio.h
--- libstdc++-v3-orig/config/io/c_io_stdio.h	2004-11-08 22:31:11.000000000 +0100
+++ libstdc++-v3/config/io/c_io_stdio.h	2005-02-21 16:32:12.000000000 +0100
@@ -1,6 +1,7 @@
 // underlying io library  -*- C++ -*-
 
-// Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005
+// 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,45 +43,6 @@
 
   // for basic_file.h
   typedef FILE __c_file;
-
-  // XXX GLIBCXX_ABI Deprecated
-  // for ios_base.h
-  struct __ios_flags
-  {
-    typedef short __int_type;
-
-    static const __int_type _S_boolalpha =	0x0001;
-    static const __int_type _S_dec =		0x0002;
-    static const __int_type _S_fixed = 		0x0004;
-    static const __int_type _S_hex =		0x0008;
-    static const __int_type _S_internal = 	0x0010;
-    static const __int_type _S_left =   	0x0020;
-    static const __int_type _S_oct =		0x0040;
-    static const __int_type _S_right =		0x0080;
-    static const __int_type _S_scientific =	0x0100;
-    static const __int_type _S_showbase =       0x0200;
-    static const __int_type _S_showpoint =	0x0400;
-    static const __int_type _S_showpos =	0x0800;
-    static const __int_type _S_skipws =		0x1000;
-    static const __int_type _S_unitbuf =	0x2000;
-    static const __int_type _S_uppercase =	0x4000;
-    static const __int_type _S_adjustfield =	0x0020 | 0x0080 | 0x0010;
-    static const __int_type _S_basefield =	0x0002 | 0x0040 | 0x0008;
-    static const __int_type _S_floatfield =	0x0100 | 0x0004;
-
-    // 27.4.2.1.3  Type ios_base::iostate
-    static const __int_type _S_badbit =		0x01;
-    static const __int_type _S_eofbit =		0x02;
-    static const __int_type _S_failbit =       	0x04;
-
-    // 27.4.2.1.4  Type openmode
-    static const __int_type _S_app =		0x01;
-    static const __int_type _S_ate =		0x02;
-    static const __int_type _S_bin =		0x04;
-    static const __int_type _S_in =		0x08;
-    static const __int_type _S_out =		0x10;
-    static const __int_type _S_trunc =		0x20;
-  };
 }
 
 #endif
diff -urN libstdc++-v3-orig/include/bits/ios_base.h libstdc++-v3/include/bits/ios_base.h
--- libstdc++-v3-orig/include/bits/ios_base.h	2004-12-06 12:12:33.000000000 +0100
+++ libstdc++-v3/include/bits/ios_base.h	2005-02-21 16:31:10.000000000 +0100
@@ -1,6 +1,6 @@
 // Iostreams base classes -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -71,8 +71,7 @@
       _S_uppercase 	= 1L << 14,
       _S_adjustfield 	= _S_left | _S_right | _S_internal,
       _S_basefield 	= _S_dec | _S_oct | _S_hex,
-      _S_floatfield 	= _S_scientific | _S_fixed,
-      _S_ios_fmtflags_end = 1L << 16 
+      _S_floatfield 	= _S_scientific | _S_fixed
     };
 
   inline _Ios_Fmtflags
@@ -111,8 +110,7 @@
       _S_bin 		= 1L << 2,
       _S_in 		= 1L << 3,
       _S_out 		= 1L << 4,
-      _S_trunc 		= 1L << 5,
-      _S_ios_openmode_end = 1L << 16 
+      _S_trunc 		= 1L << 5
     };
 
   inline _Ios_Openmode
@@ -149,8 +147,7 @@
       _S_goodbit 		= 0,
       _S_badbit 		= 1L << 0,
       _S_eofbit 		= 1L << 1,
-      _S_failbit		= 1L << 2,
-      _S_ios_iostate_end = 1L << 16 
+      _S_failbit		= 1L << 2
     };
 
   inline _Ios_Iostate
@@ -185,8 +182,7 @@
     { 
       _S_beg = 0,
       _S_cur = SEEK_CUR,
-      _S_end = SEEK_END,
-      _S_ios_seekdir_end = 1L << 16 
+      _S_end = SEEK_END
     };
 
   // 27.4.2  Class ios_base
@@ -253,65 +249,65 @@
     typedef _Ios_Fmtflags fmtflags;
 
     /// Insert/extract @c bool in alphabetic rather than numeric format.
-    static const fmtflags boolalpha =   fmtflags(__ios_flags::_S_boolalpha);
+    static const fmtflags boolalpha =   _S_boolalpha;
 
     /// Converts integer input or generates integer output in decimal base.
-    static const fmtflags dec =         fmtflags(__ios_flags::_S_dec);
+    static const fmtflags dec =         _S_dec;
 
     /// Generate floating-point output in fixed-point notation.
-    static const fmtflags fixed =       fmtflags(__ios_flags::_S_fixed);
+    static const fmtflags fixed =       _S_fixed;
 
     /// Converts integer input or generates integer output in hexadecimal base.
-    static const fmtflags hex =         fmtflags(__ios_flags::_S_hex);
+    static const fmtflags hex =         _S_hex;
 
     /// Adds fill characters at a designated internal point in certain
     /// generated output, or identical to @c right if no such point is
     /// designated.
-    static const fmtflags internal =    fmtflags(__ios_flags::_S_internal);
+    static const fmtflags internal =    _S_internal;
 
     /// Adds fill characters on the right (final positions) of certain
     /// generated output.  (I.e., the thing you print is flush left.)
-    static const fmtflags left =        fmtflags(__ios_flags::_S_left);
+    static const fmtflags left =        _S_left;
 
     /// Converts integer input or generates integer output in octal base.
-    static const fmtflags oct =         fmtflags(__ios_flags::_S_oct);
+    static const fmtflags oct =         _S_oct;
 
     /// Adds fill characters on the left (initial positions) of certain
     /// generated output.  (I.e., the thing you print is flush right.)
-    static const fmtflags right =       fmtflags(__ios_flags::_S_right);
+    static const fmtflags right =       _S_right;
 
     /// Generates floating-point output in scientific notation.
-    static const fmtflags scientific =  fmtflags(__ios_flags::_S_scientific);
+    static const fmtflags scientific =  _S_scientific;
 
     /// Generates a prefix indicating the numeric base of generated integer
     /// output.
-    static const fmtflags showbase =    fmtflags(__ios_flags::_S_showbase);
+    static const fmtflags showbase =    _S_showbase;
 
     /// Generates a decimal-point character unconditionally in generated
     /// floating-point output.
-    static const fmtflags showpoint =   fmtflags(__ios_flags::_S_showpoint);
+    static const fmtflags showpoint =   _S_showpoint;
 
     /// Generates a + sign in non-negative generated numeric output.
-    static const fmtflags showpos =     fmtflags(__ios_flags::_S_showpos);
+    static const fmtflags showpos =     _S_showpos;
 
     /// Skips leading white space before certain input operations.
-    static const fmtflags skipws =      fmtflags(__ios_flags::_S_skipws);
+    static const fmtflags skipws =      _S_skipws;
 
     /// Flushes output after each output operation.
-    static const fmtflags unitbuf =     fmtflags(__ios_flags::_S_unitbuf);
+    static const fmtflags unitbuf =     _S_unitbuf;
 
     /// Replaces certain lowercase letters with their uppercase equivalents
     /// in generated output.
-    static const fmtflags uppercase =   fmtflags(__ios_flags::_S_uppercase);
+    static const fmtflags uppercase =   _S_uppercase;
 
     /// A mask of left|right|internal.  Useful for the 2-arg form of @c setf.
-    static const fmtflags adjustfield = fmtflags(__ios_flags::_S_adjustfield);
+    static const fmtflags adjustfield = _S_adjustfield;
 
     /// A mask of dec|oct|hex.  Useful for the 2-arg form of @c setf.
-    static const fmtflags basefield =   fmtflags(__ios_flags::_S_basefield);
+    static const fmtflags basefield =   _S_basefield;
 
     /// A mask of scientific|fixed.  Useful for the 2-arg form of @c setf.
-    static const fmtflags floatfield =  fmtflags(__ios_flags::_S_floatfield);
+    static const fmtflags floatfield =  _S_floatfield;
 
     // 27.4.2.1.3  Type ios_base::iostate
     /**
@@ -329,18 +325,18 @@
 
     /// Indicates a loss of integrity in an input or output sequence (such
     /// as an irrecoverable read error from a file).
-    static const iostate badbit =	iostate(__ios_flags::_S_badbit);
+    static const iostate badbit =	_S_badbit;
 
     /// Indicates that an input operation reached the end of an input sequence.
-    static const iostate eofbit =	iostate(__ios_flags::_S_eofbit);
+    static const iostate eofbit =	_S_eofbit;
 
     /// Indicates that an input operation failed to read the expected
     /// characters, or that an output operation failed to generate the
     /// desired characters.
-    static const iostate failbit =	iostate(__ios_flags::_S_failbit);
+    static const iostate failbit =	_S_failbit;
 
     /// Indicates all is well.
-    static const iostate goodbit =	iostate(0);
+    static const iostate goodbit =	_S_goodbit;
 
     // 27.4.2.1.4  Type ios_base::openmode
     /**
@@ -359,25 +355,25 @@
     typedef _Ios_Openmode openmode;
 
     /// Seek to end before each write.
-    static const openmode app =		openmode(__ios_flags::_S_app);
+    static const openmode app =		_S_app;
 
     /// Open and seek to end immediately after opening.
-    static const openmode ate =		openmode(__ios_flags::_S_ate);
+    static const openmode ate =		_S_ate;
 
     /// Perform input and output in binary mode (as opposed to text mode).
     /// This is probably not what you think it is; see
     /// http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#3 and
     /// http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#7 for more.
-    static const openmode binary =	openmode(__ios_flags::_S_bin);
+    static const openmode binary =	_S_bin;
 
     /// Open for input.  Default for @c ifstream and fstream.
-    static const openmode in =		openmode(__ios_flags::_S_in);
+    static const openmode in =		_S_in;
 
     /// Open for output.  Default for @c ofstream and fstream.
-    static const openmode out =		openmode(__ios_flags::_S_out);
+    static const openmode out =		_S_out;
 
     /// Open for input.  Default for @c ofstream.
-    static const openmode trunc =	openmode(__ios_flags::_S_trunc);
+    static const openmode trunc =	_S_trunc;
 
     // 27.4.2.1.5  Type ios_base::seekdir
     /**
@@ -392,13 +388,13 @@
     typedef _Ios_Seekdir seekdir;
 
     /// Request a seek relative to the beginning of the stream.
-    static const seekdir beg =		seekdir(0);
+    static const seekdir beg =		_S_beg;
 
     /// Request a seek relative to the current position within the sequence.
-    static const seekdir cur =		seekdir(SEEK_CUR);
+    static const seekdir cur =		_S_cur;
 
     /// Request a seek relative to the current end of the sequence.
-    static const seekdir end =		seekdir(SEEK_END);
+    static const seekdir end =		_S_end;
 
     // Annex D.6
     typedef int io_state;
diff -urN libstdc++-v3-orig/src/ios.cc libstdc++-v3/src/ios.cc
--- libstdc++-v3-orig/src/ios.cc	2004-11-08 22:31:32.000000000 +0100
+++ libstdc++-v3/src/ios.cc	2005-02-21 16:31:54.000000000 +0100
@@ -1,6 +1,6 @@
 // Iostreams base classes -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -38,38 +38,6 @@
 
 namespace std 
 {  
-  // XXX GLIBCXX_ABI Deprecated
-   // Definitions for static const data members of __ios_flags.
-  const __ios_flags::__int_type __ios_flags::_S_boolalpha;
-  const __ios_flags::__int_type __ios_flags::_S_dec;
-  const __ios_flags::__int_type __ios_flags::_S_fixed;
-  const __ios_flags::__int_type __ios_flags::_S_hex;
-  const __ios_flags::__int_type __ios_flags::_S_internal;
-  const __ios_flags::__int_type __ios_flags::_S_left;
-  const __ios_flags::__int_type __ios_flags::_S_oct;
-  const __ios_flags::__int_type __ios_flags::_S_right;
-  const __ios_flags::__int_type __ios_flags::_S_scientific;
-  const __ios_flags::__int_type __ios_flags::_S_showbase;
-  const __ios_flags::__int_type __ios_flags::_S_showpoint;
-  const __ios_flags::__int_type __ios_flags::_S_showpos;
-  const __ios_flags::__int_type __ios_flags::_S_skipws;
-  const __ios_flags::__int_type __ios_flags::_S_unitbuf;
-  const __ios_flags::__int_type __ios_flags::_S_uppercase;
-  const __ios_flags::__int_type __ios_flags::_S_adjustfield;
-  const __ios_flags::__int_type __ios_flags::_S_basefield;
-  const __ios_flags::__int_type __ios_flags::_S_floatfield;
-
-  const __ios_flags::__int_type __ios_flags::_S_badbit;
-  const __ios_flags::__int_type __ios_flags::_S_eofbit;
-  const __ios_flags::__int_type __ios_flags::_S_failbit;
-
-  const __ios_flags::__int_type __ios_flags::_S_app;
-  const __ios_flags::__int_type __ios_flags::_S_ate;
-  const __ios_flags::__int_type __ios_flags::_S_bin;
-  const __ios_flags::__int_type __ios_flags::_S_in;
-  const __ios_flags::__int_type __ios_flags::_S_out;
-  const __ios_flags::__int_type __ios_flags::_S_trunc;
-
   // Definitions for static const members of ios_base.
   const ios_base::fmtflags ios_base::boolalpha;
   const ios_base::fmtflags ios_base::dec;
diff -urN libstdc++-v3-orig/testsuite/27_io/ios_base/cons/assign_neg.cc libstdc++-v3/testsuite/27_io/ios_base/cons/assign_neg.cc
--- libstdc++-v3-orig/testsuite/27_io/ios_base/cons/assign_neg.cc	2004-11-08 22:31:38.000000000 +0100
+++ libstdc++-v3/testsuite/27_io/ios_base/cons/assign_neg.cc	2005-02-21 17:10:09.000000000 +0100
@@ -1,6 +1,6 @@
 // { dg-do compile }
 
-// Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+// Copyright (C) 2003, 2004, 2005 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
@@ -41,5 +41,5 @@
   io1 = io2;
 }
 // { dg-error "within this context" "" { target *-*-* } 41 } 
-// { dg-error "is private" "" { target *-*-* } 782 } 
+// { dg-error "is private" "" { target *-*-* } 778 } 
 // { dg-error "operator=" "" { target *-*-* } 0 } 
diff -urN libstdc++-v3-orig/testsuite/27_io/ios_base/cons/copy_neg.cc libstdc++-v3/testsuite/27_io/ios_base/cons/copy_neg.cc
--- libstdc++-v3-orig/testsuite/27_io/ios_base/cons/copy_neg.cc	2004-11-08 22:31:38.000000000 +0100
+++ libstdc++-v3/testsuite/27_io/ios_base/cons/copy_neg.cc	2005-02-21 17:10:27.000000000 +0100
@@ -1,6 +1,6 @@
 // { dg-do compile }
 
-// Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+// Copyright (C) 2003, 2004, 2005 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
@@ -41,5 +41,5 @@
   test_base io2 = io1; 
 }
 // { dg-error "within this context" "" { target *-*-* } 41 } 
-// { dg-error "is private" "" { target *-*-* } 779 } 
+// { dg-error "is private" "" { target *-*-* } 775 } 
 // { dg-error "copy constructor" "" { target *-*-* } 0 } 
diff -urN libstdc++-v3-orig/testsuite/27_io/ios_base/types/fmtflags/case_label.cc libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/case_label.cc
--- libstdc++-v3-orig/testsuite/27_io/ios_base/types/fmtflags/case_label.cc	2004-11-08 22:41:59.000000000 +0100
+++ libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/case_label.cc	2005-02-21 17:07:23.000000000 +0100
@@ -2,7 +2,7 @@
 // { dg-options "-Wall" { target *-*-* } }
 // -*- C++ -*-
  
-// Copyright (C) 2004 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005 Free Software Foundation, Inc.
  
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License as
@@ -78,7 +78,5 @@
       break;
     case std::ios_base::floatfield:
       break;
-    case std::_S_ios_fmtflags_end:
-      break;
     }
 }
diff -urN libstdc++-v3-orig/testsuite/27_io/ios_base/types/iostate/case_label.cc libstdc++-v3/testsuite/27_io/ios_base/types/iostate/case_label.cc
--- libstdc++-v3-orig/testsuite/27_io/ios_base/types/iostate/case_label.cc	2004-11-08 22:41:59.000000000 +0100
+++ libstdc++-v3/testsuite/27_io/ios_base/types/iostate/case_label.cc	2005-02-21 17:07:47.000000000 +0100
@@ -2,7 +2,7 @@
 // { dg-options "-Wall" { target *-*-* } }
 // -*- C++ -*-
  
-// Copyright (C) 2004 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005 Free Software Foundation, Inc.
  
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License as
@@ -50,7 +50,5 @@
       break;
     case std::ios_base::failbit:
       break;
-    case std::_S_ios_iostate_end:
-      break;
     }
 }
diff -urN libstdc++-v3-orig/testsuite/27_io/ios_base/types/openmode/case_label.cc libstdc++-v3/testsuite/27_io/ios_base/types/openmode/case_label.cc
--- libstdc++-v3-orig/testsuite/27_io/ios_base/types/openmode/case_label.cc	2004-11-08 22:41:59.000000000 +0100
+++ libstdc++-v3/testsuite/27_io/ios_base/types/openmode/case_label.cc	2005-02-21 17:08:18.000000000 +0100
@@ -2,7 +2,7 @@
 // { dg-options "-Wall" { target *-*-* } }
 // -*- C++ -*-
  
-// Copyright (C) 2004 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005 Free Software Foundation, Inc.
  
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License as
@@ -54,7 +54,5 @@
       break;
     case std::ios_base::trunc:
       break;
-    case std::_S_ios_openmode_end:
-      break;
     }
 }
diff -urN libstdc++-v3-orig/testsuite/27_io/ios_base/types/seekdir/case_label.cc libstdc++-v3/testsuite/27_io/ios_base/types/seekdir/case_label.cc
--- libstdc++-v3-orig/testsuite/27_io/ios_base/types/seekdir/case_label.cc	2004-11-08 22:41:59.000000000 +0100
+++ libstdc++-v3/testsuite/27_io/ios_base/types/seekdir/case_label.cc	2005-02-21 17:08:38.000000000 +0100
@@ -2,7 +2,7 @@
 // { dg-options "-Wall" { target *-*-* } }
 // -*- C++ -*-
  
-// Copyright (C) 2004 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005 Free Software Foundation, Inc.
  
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License as
@@ -48,7 +48,5 @@
       break;
     case std::ios_base::end:
       break;
-    case std::_S_ios_fmtflags_end:
-      break;
     }
 }

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