+2004-11-02 Benjamin Kosnik <bkoz@redhat.com>
+
+ PR libstdc++/17922
+ * include/bits/ios_base.h : Add enum values.
+ * testsuite/testsuite_hooks.h (bitmask_operators): Add function.
+ * testsuite/27_io/ios_base/types/fmtflags/bitmask_operators.cc: New.
+ * testsuite/27_io/ios_base/types/fmtflags/case_label.cc: New.
+ * testsuite/27_io/ios_base/types/iostate/bitmask_operators.cc: New.
+ * testsuite/27_io/ios_base/types/iostate/case_label.cc: New.
+ * testsuite/27_io/ios_base/types/openmode/bitmask_operators.cc: New.
+ * testsuite/27_io/ios_base/types/openmode/case_label.cc: New.
+ * testsuite/27_io/ios_base/types/seekdir/case_label.cc: New.
+
+ * config/io/c_io_stdio.h (__ios_flags): Mark deprecated.
+ * src/ios.cc: Same.
+
+ * testsuite/27_io/ios_base/cons/assign_neg.cc: Adjust line numbers.
+ * testsuite/27_io/ios_base/cons/copy_neg.cc: Same.
+
2004-11-01 Momchil Velikov <velco@fadata.bg>
PR libstdc++/18185
// underlying io library -*- C++ -*-
-// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+// Copyright (C) 2000, 2001, 2002, 2003, 2004 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
// for basic_file.h
typedef FILE __c_file;
+ // XXX GLIBCXX_ABI Deprecated
// for ios_base.h
struct __ios_flags
{
// as permitted (but not required) in the standard, in order to provide
// better type safety in iostream calls. A side effect is that
// expressions involving them are no longer compile-time constants.
- enum _Ios_Fmtflags { _S_ios_fmtflags_end = 1L << 16 };
+ enum _Ios_Fmtflags
+ {
+ _S_boolalpha = 1L << 0,
+ _S_dec = 1L << 1,
+ _S_fixed = 1L << 2,
+ _S_hex = 1L << 3,
+ _S_internal = 1L << 4,
+ _S_left = 1L << 5,
+ _S_oct = 1L << 6,
+ _S_right = 1L << 7,
+ _S_scientific = 1L << 8,
+ _S_showbase = 1L << 9,
+ _S_showpoint = 1L << 10,
+ _S_showpos = 1L << 11,
+ _S_skipws = 1L << 12,
+ _S_unitbuf = 1L << 13,
+ _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
+ };
inline _Ios_Fmtflags
operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
operator^(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
{ return _Ios_Fmtflags(static_cast<int>(__a) ^ static_cast<int>(__b)); }
- inline _Ios_Fmtflags
+ inline _Ios_Fmtflags&
operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
{ return __a = __a | __b; }
- inline _Ios_Fmtflags
+ inline _Ios_Fmtflags&
operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
{ return __a = __a & __b; }
- inline _Ios_Fmtflags
+ inline _Ios_Fmtflags&
operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
{ return __a = __a ^ __b; }
{ return _Ios_Fmtflags(~static_cast<int>(__a)); }
- enum _Ios_Openmode { _S_ios_openmode_end = 1L << 16 };
+ enum _Ios_Openmode
+ {
+ _S_app = 1L << 0,
+ _S_ate = 1L << 1,
+ _S_bin = 1L << 2,
+ _S_in = 1L << 3,
+ _S_out = 1L << 4,
+ _S_trunc = 1L << 5,
+ _S_ios_openmode_end = 1L << 16
+ };
inline _Ios_Openmode
operator&(_Ios_Openmode __a, _Ios_Openmode __b)
operator^(_Ios_Openmode __a, _Ios_Openmode __b)
{ return _Ios_Openmode(static_cast<int>(__a) ^ static_cast<int>(__b)); }
- inline _Ios_Openmode
+ inline _Ios_Openmode&
operator|=(_Ios_Openmode& __a, _Ios_Openmode __b)
{ return __a = __a | __b; }
- inline _Ios_Openmode
+ inline _Ios_Openmode&
operator&=(_Ios_Openmode& __a, _Ios_Openmode __b)
{ return __a = __a & __b; }
- inline _Ios_Openmode
+ inline _Ios_Openmode&
operator^=(_Ios_Openmode& __a, _Ios_Openmode __b)
{ return __a = __a ^ __b; }
{ return _Ios_Openmode(~static_cast<int>(__a)); }
- enum _Ios_Iostate { _S_ios_iostate_end = 1L << 16 };
+ enum _Ios_Iostate
+ {
+ _S_goodbit = 0,
+ _S_badbit = 1L << 0,
+ _S_eofbit = 1L << 1,
+ _S_failbit = 1L << 2,
+ _S_ios_iostate_end = 1L << 16
+ };
inline _Ios_Iostate
operator&(_Ios_Iostate __a, _Ios_Iostate __b)
operator^(_Ios_Iostate __a, _Ios_Iostate __b)
{ return _Ios_Iostate(static_cast<int>(__a) ^ static_cast<int>(__b)); }
- inline _Ios_Iostate
+ inline _Ios_Iostate&
operator|=(_Ios_Iostate& __a, _Ios_Iostate __b)
{ return __a = __a | __b; }
- inline _Ios_Iostate
+ inline _Ios_Iostate&
operator&=(_Ios_Iostate& __a, _Ios_Iostate __b)
{ return __a = __a & __b; }
- inline _Ios_Iostate
+ inline _Ios_Iostate&
operator^=(_Ios_Iostate& __a, _Ios_Iostate __b)
{ return __a = __a ^ __b; }
operator~(_Ios_Iostate __a)
{ return _Ios_Iostate(~static_cast<int>(__a)); }
- enum _Ios_Seekdir { _S_ios_seekdir_end = 1L << 16 };
+ enum _Ios_Seekdir
+ {
+ _S_beg = 0,
+ _S_cur = SEEK_CUR,
+ _S_end = SEEK_END,
+ _S_ios_seekdir_end = 1L << 16
+ };
// 27.4.2 Class ios_base
/**
#include <bits/atomicity.h>
namespace std
-{
- // Definitions for static const data members of __ios_flags.
+{
+ // 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;
io1 = io2;
}
// { dg-error "within this context" "" { target *-*-* } 41 }
-// { dg-error "is private" "" { target *-*-* } 739 }
+// { dg-error "is private" "" { target *-*-* } 782 }
// { dg-error "operator=" "" { target *-*-* } 0 }
test_base io2 = io1;
}
// { dg-error "within this context" "" { target *-*-* } 41 }
-// { dg-error "is private" "" { target *-*-* } 736 }
+// { dg-error "is private" "" { target *-*-* } 779 }
// { dg-error "copy constructor" "" { target *-*-* } 0 }
--- /dev/null
+// { dg-do compile }
+// -*- C++ -*-
+
+// Copyright (C) 2004 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
+// published by the Free Software Foundation; either version 2, or (at
+// your option) any later version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+// Benjamin Kosnik <bkoz@redhat.com>
+
+#include <ios>
+#include <testsuite_hooks.h>
+
+int main()
+{
+ __gnu_test::bitmask_operators<std::ios_base::fmtflags>();
+};
--- /dev/null
+// { dg-do compile }
+// { dg-options "-Wall" { target *-*-* } }
+// -*- C++ -*-
+
+// Copyright (C) 2004 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
+// published by the Free Software Foundation; either version 2, or (at
+// your option) any later version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+// Benjamin Kosnik <bkoz@redhat.com>
+
+#include <ios>
+
+// PR libstdc++/17922
+// -Wall
+typedef std::ios_base::fmtflags bitmask_type;
+
+void
+case_labels(bitmask_type b)
+{
+ switch (b)
+ {
+ case std::ios_base::boolalpha:
+ break;
+ case std::ios_base::dec:
+ break;
+ case std::ios_base::fixed:
+ break;
+ case std::ios_base::hex:
+ break;
+ case std::ios_base::internal:
+ break;
+ case std::ios_base::left:
+ break;
+ case std::ios_base::oct:
+ break;
+ case std::ios_base::right:
+ break;
+ case std::ios_base::scientific:
+ break;
+ case std::ios_base::showbase:
+ break;
+ case std::ios_base::showpoint:
+ break;
+ case std::ios_base::showpos:
+ break;
+ case std::ios_base::skipws:
+ break;
+ case std::ios_base::unitbuf:
+ break;
+ case std::ios_base::uppercase:
+ break;
+ case std::ios_base::adjustfield:
+ break;
+ case std::ios_base::basefield:
+ break;
+ case std::ios_base::floatfield:
+ break;
+ case std::_S_ios_fmtflags_end:
+ break;
+ }
+}
--- /dev/null
+// { dg-do compile }
+// -*- C++ -*-
+
+// Copyright (C) 2004 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
+// published by the Free Software Foundation; either version 2, or (at
+// your option) any later version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+// Benjamin Kosnik <bkoz@redhat.com>
+
+#include <ios>
+#include <testsuite_hooks.h>
+
+int main()
+{
+ __gnu_test::bitmask_operators<std::ios_base::iostate>();
+};
--- /dev/null
+// { dg-do compile }
+// { dg-options "-Wall" { target *-*-* } }
+// -*- C++ -*-
+
+// Copyright (C) 2004 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
+// published by the Free Software Foundation; either version 2, or (at
+// your option) any later version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+// Benjamin Kosnik <bkoz@redhat.com>
+
+#include <ios>
+
+// PR libstdc++/17922
+// -Wall
+typedef std::ios_base::iostate bitmask_type;
+
+void
+case_labels(bitmask_type b)
+{
+ switch (b)
+ {
+ case std::ios_base::goodbit:
+ break;
+ case std::ios_base::badbit:
+ break;
+ case std::ios_base::eofbit:
+ break;
+ case std::ios_base::failbit:
+ break;
+ case std::_S_ios_iostate_end:
+ break;
+ }
+}
--- /dev/null
+// { dg-do compile }
+// -*- C++ -*-
+
+// Copyright (C) 2004 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
+// published by the Free Software Foundation; either version 2, or (at
+// your option) any later version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+// Benjamin Kosnik <bkoz@redhat.com>
+
+#include <ios>
+#include <testsuite_hooks.h>
+
+int main()
+{
+ __gnu_test::bitmask_operators<std::ios_base::openmode>();
+};
--- /dev/null
+// { dg-do compile }
+// { dg-options "-Wall" { target *-*-* } }
+// -*- C++ -*-
+
+// Copyright (C) 2004 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
+// published by the Free Software Foundation; either version 2, or (at
+// your option) any later version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+// Benjamin Kosnik <bkoz@redhat.com>
+
+#include <ios>
+
+// PR libstdc++/17922
+// -Wall
+typedef std::ios_base::openmode bitmask_type;
+
+void
+case_labels(bitmask_type b)
+{
+ switch (b)
+ {
+ case std::ios_base::app:
+ break;
+ case std::ios_base::ate:
+ break;
+ case std::ios_base::binary:
+ break;
+ case std::ios_base::in:
+ break;
+ case std::ios_base::out:
+ break;
+ case std::ios_base::trunc:
+ break;
+ case std::_S_ios_openmode_end:
+ break;
+ }
+}
--- /dev/null
+// { dg-do compile }
+// { dg-options "-Wall" { target *-*-* } }
+// -*- C++ -*-
+
+// Copyright (C) 2004 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
+// published by the Free Software Foundation; either version 2, or (at
+// your option) any later version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+// Benjamin Kosnik <bkoz@redhat.com>
+
+#include <ios>
+
+// PR libstdc++/17922
+// -Wall
+typedef std::ios_base::seekdir test_type;
+
+void
+case_labels(test_type b)
+{
+ switch (b)
+ {
+ case std::ios_base::beg:
+ break;
+ case std::ios_base::cur:
+ break;
+ case std::ios_base::end:
+ break;
+ case std::_S_ios_fmtflags_end:
+ break;
+ }
+}
void
verify_demangle(const char* mangled, const char* wanted);
+ // 17.3.2.1.2 - Bitmask types [lib.bitmask.types]
+ // bitmask_operators
+ template<typename bitmask_type>
+ void
+ bitmask_operators()
+ {
+ bitmask_type a;
+ bitmask_type b;
+ a | b;
+ a & b;
+ a ^ b;
+ ~b;
+ a |= b; // set
+ a &= ~b; // clear
+ a ^= b;
+ }
+
// Simple callback structure for variable numbers of tests (all with
// same signature). Assume all unit tests are of the signature
// void test01();