V3 PATCH: Various pedantic fixes

Mark Mitchell mark@codesourcery.com
Fri Dec 27 15:04:00 GMT 2002


Here is the V3 part of the parser merge; these changes just fix extant
invalidities in V3 not caught by the old parser.

Tested on i686-pc-linux-gnu, applied on the mainline.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

2002-12-27  Mark Mitchell  <mark@codesourcery.com>

	* config/locale/gnu/ctype_members.cc
	(ctype<wchar_t>::_M_convert_to_wmask): Remove stray semicolon.
	* config/locale/gnu/monetary_members.cc
	(moneypunct<wchar_t, true>::_M_initialize_moneypunct): Avoid
	defining classes in static_cast.
	(moneypunct<wchar_t, false>::_M_initialize_moneypunct): Likewise.
	* config/locale/gnu/numeric_members.cc
	(numpunct<wchar_t, false>::_M_initialize_numpunct): Likewise.
	* include/bits/stl_deque.h (operator-): Insert typename where
	required.
	* include/bits/stl_multiset.h (multiset): Remove stray semicolon.
	* include/bits/stl_set.h (set): Likewise.
	* include/bits/valarray_meta.h (bits/slice_array.h): Include it.
	* include/std/std_fstream.h (basic_fstream::open): Use this-> to
	avoid Koenig lookup.
	(basic_fstream::close): Likewise.
	* libsupc++/new (operator delete): Remove stray semicolon.
	* libsupc++/new (operator delete[]): Likewise.
	* libsupc++/tinfo.cc: Likewise.
	* src/stdexcept.c (logic_error::~logic_error): Likewise.
	(runtime_error::~runtime_error): Likewise.
	
Index: config/locale/gnu/ctype_members.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/config/locale/gnu/ctype_members.cc,v
retrieving revision 1.7
retrieving revision 1.3.4.3
diff -c -5 -p -r1.7 -r1.3.4.3
*** config/locale/gnu/ctype_members.cc	16 Dec 2002 19:01:57 -0000	1.7
--- config/locale/gnu/ctype_members.cc	20 Dec 2002 05:01:44 -0000	1.3.4.3
*************** namespace std
*** 93,103 ****
  	break;
        default:
  	__ret = 0;
        }
      return __ret;
!   };
    
    wchar_t
    ctype<wchar_t>::do_toupper(wchar_t __c) const
    { return __towupper_l(__c, _M_c_locale_ctype); }
  
--- 93,103 ----
  	break;
        default:
  	__ret = 0;
        }
      return __ret;
!   }
    
    wchar_t
    ctype<wchar_t>::do_toupper(wchar_t __c) const
    { return __towupper_l(__c, _M_c_locale_ctype); }
  
Index: config/locale/gnu/monetary_members.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/config/locale/gnu/monetary_members.cc,v
retrieving revision 1.8
retrieving revision 1.2.6.4
diff -c -5 -p -r1.8 -r1.2.6.4
*** config/locale/gnu/monetary_members.cc	16 Dec 2002 19:01:57 -0000	1.8
--- config/locale/gnu/monetary_members.cc	20 Dec 2002 05:01:44 -0000	1.2.6.4
*************** namespace std
*** 345,357 ****
  	  // Switch to named locale so that mbsrtowcs will work.
  	  char* __old = strdup(setlocale(LC_ALL, NULL));
  	  setlocale(LC_ALL, __name);
  #endif
  
! 	  _M_decimal_point = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc)}).__w);
  
! 	  _M_thousands_sep = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc)}).__w);
  	  _M_grouping = __nl_langinfo_l(GROUPING, __cloc);
  
  	  const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
  	  const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
  	  const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
--- 345,360 ----
  	  // Switch to named locale so that mbsrtowcs will work.
  	  char* __old = strdup(setlocale(LC_ALL, NULL));
  	  setlocale(LC_ALL, __name);
  #endif
  
! 	  union __s_and_w { const char *__s; unsigned int __w; } __u;
! 	  __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
! 	  _M_decimal_point = static_cast<wchar_t>(__u.__w);
  
! 	  __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
! 	  _M_thousands_sep = static_cast<wchar_t>(__u.__w);
  	  _M_grouping = __nl_langinfo_l(GROUPING, __cloc);
  
  	  const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
  	  const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
  	  const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
*************** namespace std
*** 446,457 ****
  	  // Switch to named locale so that mbsrtowcs will work.
  	  char* __old = strdup(setlocale(LC_ALL, NULL));
  	  setlocale(LC_ALL, __name);
  #endif
  
! 	  _M_decimal_point = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc)}).__w);
! 	  _M_thousands_sep = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc)}).__w);
  	  _M_grouping = __nl_langinfo_l(GROUPING, __cloc);
  
  	  const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
  	  const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
  	  const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
--- 449,464 ----
  	  // Switch to named locale so that mbsrtowcs will work.
  	  char* __old = strdup(setlocale(LC_ALL, NULL));
  	  setlocale(LC_ALL, __name);
  #endif
  
! 	  union __s_and_w { const char *__s; unsigned int __w; } __u;
! 	  __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
! 	  _M_decimal_point = static_cast<wchar_t>(__u.__w);
! 
! 	  __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
! 	  _M_thousands_sep = static_cast<wchar_t>(__u.__w);
  	  _M_grouping = __nl_langinfo_l(GROUPING, __cloc);
  
  	  const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
  	  const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
  	  const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
Index: config/locale/gnu/numeric_members.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/config/locale/gnu/numeric_members.cc,v
retrieving revision 1.5
retrieving revision 1.2.6.3
diff -c -5 -p -r1.5 -r1.2.6.3
*** config/locale/gnu/numeric_members.cc	16 Dec 2002 19:01:57 -0000	1.5
--- config/locale/gnu/numeric_members.cc	20 Dec 2002 05:01:44 -0000	1.2.6.3
*************** namespace std
*** 84,95 ****
  	  _M_grouping = "";
  	}
        else
  	{
  	  // Named locale.
! 	  _M_decimal_point = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc)}).__w);
! 	  _M_thousands_sep = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc)}).__w);
  	  if (_M_thousands_sep == L'\0')
  	    _M_grouping = "";
  	  else
  	    _M_grouping = __nl_langinfo_l(GROUPING, __cloc);
  	}
--- 84,99 ----
  	  _M_grouping = "";
  	}
        else
  	{
  	  // Named locale.
! 	  union __s_and_w { const char *__s; unsigned int __w; } __u;
! 	  __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
! 	  _M_decimal_point = static_cast<wchar_t>(__u.__w);
! 
! 	  __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
! 	  _M_thousands_sep = static_cast<wchar_t>(__u.__w);
  	  if (_M_thousands_sep == L'\0')
  	    _M_grouping = "";
  	  else
  	    _M_grouping = __nl_langinfo_l(GROUPING, __cloc);
  	}
Index: include/bits/stl_deque.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/stl_deque.h,v
retrieving revision 1.32
retrieving revision 1.22.4.8
diff -c -5 -p -r1.32 -r1.22.4.8
*** include/bits/stl_deque.h	23 Dec 2002 17:36:24 -0000	1.32
--- include/bits/stl_deque.h	24 Dec 2002 06:40:26 -0000	1.22.4.8
*************** namespace std
*** 317,327 ****
                            typename _RefR, typename _PtrR>
    inline typename _Deque_iterator<_Tp, _RefL, _PtrL>::difference_type
    operator-(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
    	  const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
    {
!     return _Deque_iterator<_Tp, _RefL, _PtrL>::difference_type
        (_Deque_iterator<_Tp, _RefL, _PtrL>::_S_buffer_size()) *
        (__x._M_node - __y._M_node - 1) + (__x._M_cur - __x._M_first) +
        (__y._M_last - __y._M_cur);
    }
    
--- 317,327 ----
                            typename _RefR, typename _PtrR>
    inline typename _Deque_iterator<_Tp, _RefL, _PtrL>::difference_type
    operator-(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
    	  const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
    {
!     return typename _Deque_iterator<_Tp, _RefL, _PtrL>::difference_type
        (_Deque_iterator<_Tp, _RefL, _PtrL>::_S_buffer_size()) *
        (__x._M_node - __y._M_node - 1) + (__x._M_cur - __x._M_first) +
        (__y._M_last - __y._M_cur);
    }
    
Index: include/bits/stl_multiset.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/stl_multiset.h,v
retrieving revision 1.11
retrieving revision 1.11.12.1
diff -c -5 -p -r1.11 -r1.11.12.1
*** include/bits/stl_multiset.h	6 Dec 2001 20:29:31 -0000	1.11
--- include/bits/stl_multiset.h	16 Sep 2002 16:26:12 -0000	1.11.12.1
***************
*** 1,8 ****
  // Multiset implementation -*- C++ -*-
  
! // Copyright (C) 2001 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
  // terms of the GNU General Public License as published by the
  // Free Software Foundation; either version 2, or (at your option)
--- 1,8 ----
  // Multiset implementation -*- C++ -*-
  
! // Copyright (C) 2001, 2002 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
  // terms of the GNU General Public License as published by the
  // Free Software Foundation; either version 2, or (at your option)
*************** inline bool operator<(const multiset<_Ke
*** 83,93 ****
  template <class _Key, class _Compare, class _Alloc>
  class multiset
  {
    // concept requirements
    __glibcpp_class_requires(_Key, _SGIAssignableConcept)
!   __glibcpp_class_requires4(_Compare, bool, _Key, _Key, _BinaryFunctionConcept);
  
  public:
  
    // typedefs:
  
--- 83,93 ----
  template <class _Key, class _Compare, class _Alloc>
  class multiset
  {
    // concept requirements
    __glibcpp_class_requires(_Key, _SGIAssignableConcept)
!   __glibcpp_class_requires4(_Compare, bool, _Key, _Key, _BinaryFunctionConcept)
  
  public:
  
    // typedefs:
  
Index: include/bits/stl_set.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/stl_set.h,v
retrieving revision 1.11
retrieving revision 1.11.12.1
diff -c -5 -p -r1.11 -r1.11.12.1
*** include/bits/stl_set.h	6 Dec 2001 20:29:31 -0000	1.11
--- include/bits/stl_set.h	8 Sep 2002 19:19:06 -0000	1.11.12.1
***************
*** 1,8 ****
  // Set implementation -*- C++ -*-
  
! // Copyright (C) 2001 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
  // terms of the GNU General Public License as published by the
  // Free Software Foundation; either version 2, or (at your option)
--- 1,8 ----
  // Set implementation -*- C++ -*-
  
! // Copyright (C) 2001, 2002 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
  // terms of the GNU General Public License as published by the
  // Free Software Foundation; either version 2, or (at your option)
*************** inline bool operator<(const set<_Key,_Co
*** 84,94 ****
  template <class _Key, class _Compare, class _Alloc>
  class set
  {
    // concept requirements
    __glibcpp_class_requires(_Key, _SGIAssignableConcept)
!   __glibcpp_class_requires4(_Compare, bool, _Key, _Key, _BinaryFunctionConcept);
  
  public:
    // typedefs:
    typedef _Key     key_type;
    typedef _Key     value_type;
--- 84,94 ----
  template <class _Key, class _Compare, class _Alloc>
  class set
  {
    // concept requirements
    __glibcpp_class_requires(_Key, _SGIAssignableConcept)
!   __glibcpp_class_requires4(_Compare, bool, _Key, _Key, _BinaryFunctionConcept)
  
  public:
    // typedefs:
    typedef _Key     key_type;
    typedef _Key     value_type;
Index: include/bits/valarray_meta.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/valarray_meta.h,v
retrieving revision 1.11
retrieving revision 1.7.10.3
diff -c -5 -p -r1.11 -r1.7.10.3
*** include/bits/valarray_meta.h	2 Aug 2002 23:08:39 -0000	1.11
--- include/bits/valarray_meta.h	4 Sep 2002 21:51:47 -0000	1.7.10.3
***************
*** 1,8 ****
  // The template and inlines for the -*- C++ -*- internal _Meta class.
  
! // Copyright (C) 1997, 1998, 1999, 2000, 2001 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
  // terms of the GNU General Public License as published by the
  // Free Software Foundation; either version 2, or (at your option)
--- 1,8 ----
  // The template and inlines for the -*- C++ -*- internal _Meta class.
  
! // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 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
  // terms of the GNU General Public License as published by the
  // Free Software Foundation; either version 2, or (at your option)
***************
*** 36,45 ****
--- 36,47 ----
  
  #ifndef _CPP_VALARRAY_META_H
  #define _CPP_VALARRAY_META_H 1
  
  #pragma GCC system_header
+ 
+ #include <bits/slice_array.h>
  
  namespace std
  {
    //
    // Implementing a loosened valarray return value is tricky.
Index: include/std/std_fstream.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/std/std_fstream.h,v
retrieving revision 1.14
retrieving revision 1.12.6.3
diff -c -5 -p -r1.14 -r1.12.6.3
*** include/std/std_fstream.h	21 Nov 2002 07:06:40 -0000	1.14
--- include/std/std_fstream.h	27 Nov 2002 01:51:23 -0000	1.12.6.3
*************** namespace std
*** 795,805 ****
        void
        open(const char* __s,
  	   ios_base::openmode __mode = ios_base::in | ios_base::out)
        {
  	if (!_M_filebuf.open(__s, __mode))
! 	  setstate(ios_base::failbit);
        }
  
        /**
         *  @brief  Close the file.
         *
--- 795,805 ----
        void
        open(const char* __s,
  	   ios_base::openmode __mode = ios_base::in | ios_base::out)
        {
  	if (!_M_filebuf.open(__s, __mode))
! 	  this->setstate(ios_base::failbit);
        }
  
        /**
         *  @brief  Close the file.
         *
*************** namespace std
*** 808,818 ****
        */
        void
        close()
        {
  	if (!_M_filebuf.close())
! 	  setstate(ios_base::failbit);
        }
      };
  } // namespace std
  
  #ifdef _GLIBCPP_NO_TEMPLATE_EXPORT
--- 808,818 ----
        */
        void
        close()
        {
  	if (!_M_filebuf.close())
! 	  this->setstate(ios_base::failbit);
        }
      };
  } // namespace std
  
  #ifdef _GLIBCPP_NO_TEMPLATE_EXPORT
Index: libsupc++/new
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/libsupc++/new,v
retrieving revision 1.14
retrieving revision 1.10.4.1
diff -c -5 -p -r1.14 -r1.10.4.1
*** libsupc++/new	26 Jul 2002 20:12:00 -0000	1.14
--- libsupc++/new	8 Aug 2002 20:03:09 -0000	1.10.4.1
*************** void operator delete[](void*, const std:
*** 91,101 ****
  // Default placement versions of operator new.
  inline void* operator new(std::size_t, void* __p) throw() { return __p; }
  inline void* operator new[](std::size_t, void* __p) throw() { return __p; }
  
  // Default placement versions of operator delete.
! inline void  operator delete  (void*, void*) throw() { };
! inline void  operator delete[](void*, void*) throw() { };
  //@}
  } // extern "C++"
  
  #endif
--- 91,101 ----
  // Default placement versions of operator new.
  inline void* operator new(std::size_t, void* __p) throw() { return __p; }
  inline void* operator new[](std::size_t, void* __p) throw() { return __p; }
  
  // Default placement versions of operator delete.
! inline void  operator delete  (void*, void*) throw() { }
! inline void  operator delete[](void*, void*) throw() { }
  //@}
  } // extern "C++"
  
  #endif
Index: libsupc++/tinfo.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/libsupc++/tinfo.cc,v
retrieving revision 1.11
retrieving revision 1.9.12.3
diff -c -5 -p -r1.11 -r1.9.12.3
*** libsupc++/tinfo.cc	31 Jul 2002 21:24:18 -0000	1.11
--- libsupc++/tinfo.cc	3 Sep 2002 19:10:04 -0000	1.9.12.3
*************** bool type_info::
*** 83,93 ****
  __do_upcast (const abi::__class_type_info *, void **) const
  {
    return false;
  }
  
! };
  
  namespace {
  
  using namespace std;
  using namespace abi;
--- 83,93 ----
  __do_upcast (const abi::__class_type_info *, void **) const
  {
    return false;
  }
  
! }
  
  namespace {
  
  using namespace std;
  using namespace abi;
*************** inline bool contained_nonvirtual_p (__cl
*** 170,180 ****
  }
  
  static const __class_type_info *const nonvirtual_base_type =
      static_cast <const __class_type_info *> (0) + 1;
  
! }; // namespace
  
  namespace __cxxabiv1
  {
  
  __class_type_info::
--- 170,180 ----
  }
  
  static const __class_type_info *const nonvirtual_base_type =
      static_cast <const __class_type_info *> (0) + 1;
  
! } // namespace
  
  namespace __cxxabiv1
  {
  
  __class_type_info::
*************** __dynamic_cast (const void *src_ptr,    
*** 733,738 ****
      return const_cast <void *> (result.dst_ptr);
    // Must be an invalid down cast, or the cross cast wasn't bettered
    return NULL;
  }
  
! }; // namespace __cxxabiv1
--- 733,738 ----
      return const_cast <void *> (result.dst_ptr);
    // Must be an invalid down cast, or the cross cast wasn't bettered
    return NULL;
  }
  
! } // namespace __cxxabiv1
Index: src/stdexcept.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/src/stdexcept.cc,v
retrieving revision 1.5
retrieving revision 1.5.12.1
diff -c -5 -p -r1.5 -r1.5.12.1
*** src/stdexcept.cc	4 Jan 2002 21:27:35 -0000	1.5
--- src/stdexcept.cc	4 Sep 2002 17:48:50 -0000	1.5.12.1
***************
*** 1,8 ****
  // Methods for Exception Support for -*- C++ -*-
  
! // Copyright (C) 1997, 1999, 2001 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
  // terms of the GNU General Public License as published by the
  // Free Software Foundation; either version 2, or (at your option)
--- 1,8 ----
  // Methods for Exception Support for -*- C++ -*-
  
! // Copyright (C) 1997, 1999, 2001, 2002 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
  // terms of the GNU General Public License as published by the
  // Free Software Foundation; either version 2, or (at your option)
***************
*** 37,47 ****
  namespace std 
  {
    logic_error::logic_error(const string& __arg) 
    : exception(), _M_msg(__arg) { }
  
!   logic_error::~logic_error() throw() { };
  
    const char*
    logic_error::what() const throw()
    { return _M_msg.c_str(); }
  
--- 37,47 ----
  namespace std 
  {
    logic_error::logic_error(const string& __arg) 
    : exception(), _M_msg(__arg) { }
  
!   logic_error::~logic_error() throw() { }
  
    const char*
    logic_error::what() const throw()
    { return _M_msg.c_str(); }
  
*************** namespace std 
*** 58,68 ****
    : logic_error(__arg) { }
  
    runtime_error::runtime_error(const string& __arg) 
    : exception(), _M_msg(__arg) { }
  
!   runtime_error::~runtime_error() throw() { };
  
    const char*
    runtime_error::what() const throw()
    { return _M_msg.c_str(); }
  
--- 58,68 ----
    : logic_error(__arg) { }
  
    runtime_error::runtime_error(const string& __arg) 
    : exception(), _M_msg(__arg) { }
  
!   runtime_error::~runtime_error() throw() { }
  
    const char*
    runtime_error::what() const throw()
    { return _M_msg.c_str(); }
  



More information about the Gcc-patches mailing list