g++.law/code-gen5.C

Richard Henderson rth@redhat.com
Mon Jun 11 09:38:00 GMT 2001


For some stupid reason DEC's header files have

#define assert(EX) (((int) (EX)) ? (void)0 : __assert(#EX, __FILE__, __LINE__))

The cast to int, given a pointer argument, results in extra warnings,
which result in the test failing.  Now, I somewhat think this is a
stupid definition that should be fixincluded, but I'm equally certain
that this test case doesn't rely on the definition of assert and the
later is easier to change.


r~


        * g++.old-deja/g++.law/code-gen5.C: Don't send raw pointers to assert.

Index: g++.old-deja/g++.law/code-gen5.C
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.old-deja/g++.law/code-gen5.C,v
retrieving revision 1.4.6.1
diff -c -p -d -r1.4.6.1 code-gen5.C
*** code-gen5.C	2001/05/14 19:38:09	1.4.6.1
--- code-gen5.C	2001/06/11 16:27:30
*************** operator=( const Vector &A )
*** 142,148 ****
  double Vector::
  operator()( int row ) const
  {
! 	assert( r );
  
  	return *r->vec;
  }
--- 142,148 ----
  double Vector::
  operator()( int row ) const
  {
! 	assert(r != 0);
  
  	return *r->vec;
  }
*************** operator()( int row ) const
*** 150,156 ****
  VecElem Vector::
  operator()( int r )
  {
! 	assert(r);
  
  	return VecElem( *this, r );
  }
--- 150,156 ----
  VecElem Vector::
  operator()( int r )
  {
! 	assert(r != 0);
  
  	return VecElem( *this, r );
  }
*************** operator()( int r )
*** 159,165 ****
  double Vector::
  assign( int rownum, double d )
  {
! 	assert(r);
  
  	if( rownum > row() || rownum <= 0 ) {
  	  std::cerr << "Warning: trying to assign out of bounds" << std::endl;
--- 159,165 ----
  double Vector::
  assign( int rownum, double d )
  {
! 	assert(r != 0);
  
  	if( rownum > row() || rownum <= 0 ) {
  	  std::cerr << "Warning: trying to assign out of bounds" << std::endl;
*************** VecElem( const VecElem &elem )
*** 246,252 ****
  VecElem::
  operator double()
  {
! 	assert( v.r->vec );
  	return *v.r->vec;
  };
  
--- 246,252 ----
  VecElem::
  operator double()
  {
! 	assert( v.r->vec != 0 );
  	return *v.r->vec;
  };
  



More information about the Gcc-patches mailing list