Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2002:
[Freeciv-Dev] warnings when compiling with NDEBUG (PR#1216)
Home

[Freeciv-Dev] warnings when compiling with NDEBUG (PR#1216)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc: bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] warnings when compiling with NDEBUG (PR#1216)
From: jdorje@xxxxxxxxxxxxxxxxxxxxx
Date: Wed, 9 Jan 2002 15:04:17 -0800 (PST)

gcc gives a number of warnings when compiling with ./configure --disable-debug. The attached patch should remove these.

jason
Index: common/hash.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/hash.c,v
retrieving revision 1.9
diff -u -r1.9 hash.c
--- common/hash.c       2001/09/06 21:23:07     1.9
+++ common/hash.c       2002/01/09 23:01:29
@@ -357,8 +357,9 @@
   for(i=0; i<h->num_buckets; i++) {
     struct hash_bucket *bucket = &h->buckets[i];
     if (bucket->used == BUCKET_USED) {
-      int ret = hash_insert(h_new, bucket->key, bucket->data);
-      assert(ret);
+      if (!hash_insert(h_new, bucket->key, bucket->data)) {
+        assert(0);
+      }
     }
   }
   h_new->frozen = 0;
@@ -610,6 +611,7 @@
   }
   /* never reached */
   assert(0);
+  return NULL;
 }
 
 /**************************************************************************
Index: server/gotohand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/gotohand.c,v
retrieving revision 1.126
diff -u -r1.126 gotohand.c
--- server/gotohand.c   2001/12/09 14:08:26     1.126
+++ server/gotohand.c   2002/01/09 23:01:31
@@ -456,6 +456,7 @@
     best_dir = (diff_y > 0) ? DIR8_SOUTHWEST : DIR8_NORTHWEST;
   } else {
     assert(0);
+    best_dir = 0;
   }
 
   return (best_dir);
Index: server/maphand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/maphand.c,v
retrieving revision 1.92
diff -u -r1.92 maphand.c
--- server/maphand.c    2002/01/09 21:48:11     1.92
+++ server/maphand.c    2002/01/09 23:01:32
@@ -427,7 +427,7 @@
 {
   struct player_tile *plr_tile = map_get_player_tile(x, y, pplayer);
   assert(plr_tile->pending_seen != 0);
-  map_get_player_tile(x, y, pplayer)->pending_seen -= 1;
+  plr_tile->pending_seen -= 1;
 }
 
 /**************************************************************************
Index: server/sanitycheck.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/sanitycheck.c,v
retrieving revision 1.13
diff -u -r1.13 sanitycheck.c
--- server/sanitycheck.c        2001/10/14 21:02:17     1.13
+++ server/sanitycheck.c        2002/01/09 23:01:32
@@ -24,6 +24,8 @@
 
 #include "sanitycheck.h"
 
+#ifdef DEBUG
+
 /**************************************************************************
 ...
 **************************************************************************/
@@ -265,11 +267,14 @@
   } players_iterate_end;
 }
 
+#endif /* DEBUG */
+
 /**************************************************************************
 ...
 **************************************************************************/
 void sanity_check(void)
 {
+#ifdef DEBUG
   check_specials();
   check_fow();
   check_misc();
@@ -277,4 +282,5 @@
   check_cities();
   check_units();
   check_players();
+#endif /* DEBUG */
 }

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] warnings when compiling with NDEBUG (PR#1216), jdorje <=