[GRASS5] Re: [GRASSLIST:5319] Compilation error in r.mapcalc

Thanks, fixed but the bug is in 6.0.0 beta1.

Radim

Tom Russo wrote:

I'm running Grass5.7 on FreeBSD 4.x, which still uses GCC 2.95. When I updated
today and tried to build I got a compilation error in r.mapcalc. Turns
out that in Monday's commit to map3.c, a variable declaration was inserted
after the first executable line in a block --- something that GCC 2.95 considers a syntax error but GCC 3.x does not.

The attached patch fixes it by moving the declaration of "handle" before
the call to setup_region.

Could someone commit this?

------------------------------------------------------------------------

Index: map3.c

RCS file: /home/grass/grassrepository/grass51/raster/r.mapcalc/map3.c,v
retrieving revision 2.2
diff -u -u -r2.2 map3.c
--- map3.c 10 Jan 2005 17:23:46 -0000 2.2
+++ map3.c 12 Jan 2005 16:58:47 -0000
@@ -497,8 +497,9 @@
     mapset = G_find_grid3(tmpname, "");
     if (mapset)
     {
+ void *handle;
       setup_region(); /* TODO: setup_region should be called by evaluate() ? */
- void *handle = G3d_openCellOld(
+ handle = G3d_openCellOld(
         tmpname, mapset, &current_region3,
         G3D_TILE_SAME_AS_FILE, G3D_NO_CACHE);
       result = (G3d_fileTypeMap == G3D_FLOAT)