gnugo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gnugo-devel] better valgrind checking


From: Daniel Bump
Subject: Re: [gnugo-devel] better valgrind checking
Date: Fri, 30 Apr 2004 06:55:29 -0700

> I added this patch to CVS, I hope noone had objections. It requires a
> re-run of autoconf, which I did not do yet, as I have slightly differnt
> versions than Dan's. For the moment this gives plenty of compile
> warnings.
> 
> Dan, could you do to the rerun? (I think only autoconf is needed.)

I'm getting some errors with gcc 2.96. After running autoconf 
and configure (without --enable-valgrind) I have in config.h

#define USE_VALGRIND 0

Now I get these errors:

influence.c: In function `compute_escape_influence':
influence.c:1784: parse error before `static'
influence.c:1800: `cached_board' undeclared (first use in this function)
influence.c:1800: (Each undeclared identifier is reported only once
influence.c:1800: for each function it appears in.)
influence.c:1808: `active_caches' undeclared (first use in this function)
influence.c:1810: `cache_number' undeclared (first use in this function)
influence.c:1813: `escape_values' undeclared (first use in this function)

By your macros VALGRIND_MAKE_WRITABLE should be defined to be empty.

If I replace this macro by the empty string, so that the beginning
of compute_escape_influence begins:

  int k;
  int ii;
  int save_debug = debug;
  ;

  /* IMPORTANT: The caching relies on the fact that safe_stones[] and
   * strength[] will currently always be identical for identical board[]
   * states. Better check for these, too.
   */
  static int cached_board[BOARDMAX];
  static char escape_values[BOARDMAX][2];
  static int active_caches[2] = {0, 0};

then I still get these errors. So the problem is that gcc 2.96
barfs on an empty statement among the declarations.

If I move things around as below there is no problem. I assume
this won't break anything for --enable-valgrind but I haven't
installed valgrind, so I'm not sure about this.

I autoconf'd and cvs ci'd with this change. Let me know if this is OK
for --enable-valgrind.

Dan


Index: engine/influence.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/influence.c,v
retrieving revision 1.100
diff -u -r1.100 influence.c
--- engine/influence.c  29 Apr 2004 23:59:21 -0000      1.100
+++ engine/influence.c  30 Apr 2004 15:09:23 -0000
@@ -1775,7 +1775,6 @@
   int k;
   int ii;
   int save_debug = debug;
-  VALGRIND_MAKE_WRITABLE(&escape_influence, sizeof(escape_influence));
 
   /* IMPORTANT: The caching relies on the fact that safe_stones[] and
    * strength[] will currently always be identical for identical board[]
@@ -1786,6 +1785,8 @@
   static int active_caches[2] = {0, 0};
 
   int cache_number = (color == WHITE);
+
+  VALGRIND_MAKE_WRITABLE(&escape_influence, sizeof(escape_influence));
 
   if (!goal) {
     /* Encode the values of color and dragons_known into an integer





reply via email to

[Prev in Thread] Current Thread [Next in Thread]