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]

[gcov] Use assert


I've installed this patch which fixes up gcov's assertion mechanism.

built on i686-pc-linux-gnu.

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

2004-08-30  Nathan Sidwell  <nathan@codesourcery.com>

	* gcov-io.c (GCOV_CHECK): Use gcc_assert when available.
	* gcov.c (abort): Remove undef.

Index: gcov-io.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcov-io.h,v
retrieving revision 1.51
diff -c -3 -p -r1.51 gcov-io.h
*** gcov-io.h	29 Jul 2004 08:58:58 -0000	1.51
--- gcov-io.h	30 Aug 2004 15:44:24 -0000
*************** GCOV_LINKAGE time_t gcov_time (void);
*** 547,556 ****
  #endif
  
  /* Make sure the library is used correctly.  */
  #if ENABLE_CHECKING
! #define GCOV_CHECK(expr) ((expr) ? (void)0 : (void)abort ())
  #else
! #define GCOV_CHECK(expr)
  #endif
  #define GCOV_CHECK_READING() GCOV_CHECK(gcov_var.mode > 0)
  #define GCOV_CHECK_WRITING() GCOV_CHECK(gcov_var.mode < 0)
--- 547,561 ----
  #endif
  
  /* Make sure the library is used correctly.  */
+ #if IN_LIBGCOV
  #if ENABLE_CHECKING
! #define GCOV_CHECK(EXPR) (!(EXPR) ? abort (), 0 : 0)
! #else
! /* Include EXPR, so that unused variable warnings do not occur.  */
! #define GCOV_CHECK(EXPR) ((void)(0 && (EXPR)))
! #endif
  #else
! #define GCOV_CHECK(EXPR) gcc_assert (EXPR)
  #endif
  #define GCOV_CHECK_READING() GCOV_CHECK(gcov_var.mode > 0)
  #define GCOV_CHECK_WRITING() GCOV_CHECK(gcov_var.mode < 0)
Index: gcov.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcov.c,v
retrieving revision 1.83
diff -c -3 -p -r1.83 gcov.c
*** gcov.c	23 Aug 2004 11:56:54 -0000	1.83
--- gcov.c	30 Aug 2004 15:44:27 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 47,53 ****
  #include "tm.h"
  #include "intl.h"
  #include "version.h"
- #undef abort
  
  #include <getopt.h>
  
--- 47,52 ----

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