This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gcov] Use assert
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 30 Aug 2004 16:51:25 +0100
- Subject: [gcov] Use assert
- Organization: Codesourcery LLC
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 ----