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]

[V3 PATCH] Fix for defect report libstdc++/1897


This patch simply eliminates a warning for those of use who
compile with -pedantic -Wall and -Werror.


2001-02-13  Greg Bumgardner <bumgard@roguewave.com>

	* libstdc++-v3/include/bits/codecvt.h: See next...
	* libstdc++-v3/include/bits/fstream.tcc: See next...
	* libstdc++-v3/include/bits/ostream.tcc: Add __extension__ 
	to variable-length arrays.  

Index: gcc/libstdc++-v3/include/bits/codecvt.h
diff -c gcc/libstdc++-v3/include/bits/codecvt.h:1.1.1.1 gcc/libstdc++-v3/include/bits/codecvt.h:1.1.1.1.14.2
*** gcc/libstdc++-v3/include/bits/codecvt.h:1.1.1.1	Tue Feb 13 00:19:50 2001
--- gcc/libstdc++-v3/include/bits/codecvt.h	Tue Feb 13 13:19:37 2001
***************
*** 417,423 ****
  	  if (__int_bom)
  	    {	  
  	      size_t __size = __from_end - __from;
! 	      intern_type __cfixed[__size + 1];
  	      __cfixed[0] = static_cast<intern_type>(__int_bom);
  	      char_traits<intern_type>::copy(__cfixed + 1, __from, __size);
  	      __cfrom = reinterpret_cast<char*>(__cfixed);
--- 417,423 ----
  	  if (__int_bom)
  	    {	  
  	      size_t __size = __from_end - __from;
! 	      __extension__ intern_type __cfixed[__size + 1];
  	      __cfixed[0] = static_cast<intern_type>(__int_bom);
  	      char_traits<intern_type>::copy(__cfixed + 1, __from, __size);
  	      __cfrom = reinterpret_cast<char*>(__cfixed);
***************
*** 522,528 ****
  	  if (__ext_bom)
  	    {	  
  	      size_t __size = __from_end - __from;
! 	      extern_type __cfixed[__size + 1];
  	      __cfixed[0] = static_cast<extern_type>(__ext_bom);
  	      char_traits<extern_type>::copy(__cfixed + 1, __from, __size);
  	      __cfrom = reinterpret_cast<char*>(__cfixed);
--- 522,528 ----
  	  if (__ext_bom)
  	    {	  
  	      size_t __size = __from_end - __from;
! 	      __extension__ extern_type __cfixed[__size + 1];
  	      __cfixed[0] = static_cast<extern_type>(__ext_bom);
  	      char_traits<extern_type>::copy(__cfixed + 1, __from, __size);
  	      __cfrom = reinterpret_cast<char*>(__cfixed);
Index: gcc/libstdc++-v3/include/bits/fstream.tcc
diff -c gcc/libstdc++-v3/include/bits/fstream.tcc:1.1.1.1 gcc/libstdc++-v3/include/bits/fstream.tcc:1.1.1.1.14.2
*** gcc/libstdc++-v3/include/bits/fstream.tcc:1.1.1.1	Tue Feb 13 00:20:03 2001
--- gcc/libstdc++-v3/include/bits/fstream.tcc	Tue Feb 13 13:19:37 2001
***************
*** 262,268 ****
  	      // Part one: (Re)fill external buf (_M_file->_IO_*) from
  	      // external byte sequence (whatever physical byte sink or
  	      // FILE actually is.)
! 	      char_type __conv_buf[_M_buf_size];
  	      streamsize __size = _M_file->xsgetn(__conv_buf, _M_buf_size);
  	      
  	      // Part two: (Re)fill internal buf contents from external buf.
--- 262,268 ----
  	      // Part one: (Re)fill external buf (_M_file->_IO_*) from
  	      // external byte sequence (whatever physical byte sink or
  	      // FILE actually is.)
! 	      __extension__ char_type __conv_buf[_M_buf_size];
  	      streamsize __size = _M_file->xsgetn(__conv_buf, _M_buf_size);
  	      
  	      // Part two: (Re)fill internal buf contents from external buf.
***************
*** 436,442 ****
  	  // stack. Convert internal buffer plus __c (ie,
  	  // "pending sequence") to temporary conversion buffer.
  	  int __plen = _M_out_end - _M_out_beg;
! 	  char_type __pbuf[__plen + 1];	      
  	  traits_type::copy(__pbuf, this->pbase(), __plen);
  	  if (!__testeof)
  	    {
--- 436,442 ----
  	  // stack. Convert internal buffer plus __c (ie,
  	  // "pending sequence") to temporary conversion buffer.
  	  int __plen = _M_out_end - _M_out_beg;
! 	  __extension__ char_type __pbuf[__plen + 1];	      
  	  traits_type::copy(__pbuf, this->pbase(), __plen);
  	  if (!__testeof)
  	    {
***************
*** 445,451 ****
  	    }
  
  	  char_type* __pend;
! 	  char __conv_buf[__plen];
  	  char* __conv_end;
  	  _M_state_beg = _M_state_cur;
  
--- 445,451 ----
  	    }
  
  	  char_type* __pend;
! 	  __extension__ char __conv_buf[__plen];
  	  char* __conv_end;
  	  _M_state_beg = _M_state_cur;
  
Index: gcc/libstdc++-v3/include/bits/ostream.tcc
diff -c gcc/libstdc++-v3/include/bits/ostream.tcc:1.1.1.1 gcc/libstdc++-v3/include/bits/ostream.tcc:1.1.1.1.14.2
*** gcc/libstdc++-v3/include/bits/ostream.tcc:1.1.1.1	Tue Feb 13 00:20:46 2001
--- gcc/libstdc++-v3/include/bits/ostream.tcc	Tue Feb 13 13:19:37 2001
***************
*** 417,423 ****
        typedef typename traits_type::int_type int_type;
        
        int_type __plen = static_cast<size_t>(__newlen - __oldlen); 
!       char_type __pads[__plen];
        traits_type::assign(__pads, __plen, __ios.fill()); 
  
        char_type* __beg;
--- 417,423 ----
        typedef typename traits_type::int_type int_type;
        
        int_type __plen = static_cast<size_t>(__newlen - __oldlen); 
!       __extension__ char_type __pads[__plen];
        traits_type::assign(__pads, __plen, __ios.fill()); 
  
        char_type* __beg;
***************
*** 496,502 ****
  	{
  	  try {
  	    streamsize __w = __out.width();
! 	    _CharT __pads[__w];
  	    __pads[0] = __c;
  	    streamsize __len = 1;
  	    if (__w > __len)
--- 496,502 ----
  	{
  	  try {
  	    streamsize __w = __out.width();
! 	    __extension__ _CharT __pads[__w];
  	    __pads[0] = __c;
  	    streamsize __len = 1;
  	    if (__w > __len)
***************
*** 529,535 ****
  	{
  	  try {
  	    streamsize __w = __out.width();
! 	    char __pads[__w + 1];
  	    __pads[0] = __c;
  	    streamsize __len = 1;
  	    if (__w > __len)
--- 529,535 ----
  	{
  	  try {
  	    streamsize __w = __out.width();
! 	    __extension__ char __pads[__w + 1];
  	    __pads[0] = __c;
  	    streamsize __len = 1;
  	    if (__w > __len)
***************
*** 561,567 ****
  	{
  	  try {
  	    streamsize __w = __out.width();
! 	    _CharT __pads[__w];
  	    streamsize __len = static_cast<streamsize>(_Traits::length(__s));
  	    if (__w > __len)
  	      {
--- 561,567 ----
  	{
  	  try {
  	    streamsize __w = __out.width();
! 	    __extension__ _CharT __pads[__w];
  	    streamsize __len = static_cast<streamsize>(_Traits::length(__s));
  	    if (__w > __len)
  	      {
***************
*** 596,602 ****
        if (__cerb)
  	{
  	  size_t __clen = __ctraits_type::length(__s);
! 	  _CharT __ws[__clen + 1];
  	  for (size_t  __i = 0; __i <= __clen; ++__i)
  	    __ws[__i] = __out.widen(__s[__i]);
  	  _CharT* __str = __ws;
--- 596,602 ----
        if (__cerb)
  	{
  	  size_t __clen = __ctraits_type::length(__s);
! 	  __extension__ _CharT __ws[__clen + 1];
  	  for (size_t  __i = 0; __i <= __clen; ++__i)
  	    __ws[__i] = __out.widen(__s[__i]);
  	  _CharT* __str = __ws;
***************
*** 604,610 ****
  	  try {
  	    streamsize __len = static_cast<streamsize>(__clen);
  	    streamsize __w = __out.width();
! 	    _CharT __pads[__w];
  
  	    if (__w > __len)
  	      {
--- 604,610 ----
  	  try {
  	    streamsize __len = static_cast<streamsize>(__clen);
  	    streamsize __w = __out.width();
! 	    __extension__ _CharT __pads[__w];
  
  	    if (__w > __len)
  	      {
***************
*** 637,643 ****
  	{
  	  try {
  	    streamsize __w = __out.width();
! 	    char __pads[__w];
  	    streamsize __len = static_cast<streamsize>(_Traits::length(__s));
  	    if (__w > __len)
  	      {
--- 637,643 ----
  	{
  	  try {
  	    streamsize __w = __out.width();
! 	    __extension__ char __pads[__w];
  	    streamsize __len = static_cast<streamsize>(_Traits::length(__s));
  	    if (__w > __len)
  	      {


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