Author: cazfi
Date: Sun Jan  3 15:31:35 2016
New Revision: 31332

URL: http://svn.gna.org/viewcvs/freeciv?rev=31332&view=rev
Log:
Added macro BAD_HEURISTIC_INIT() and used it to silence some compiler warnings.

See patch #6759

Modified:
    trunk/server/diplhand.c
    trunk/utility/shared.h

Modified: trunk/server/diplhand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/diplhand.c?rev=31332&r1=31331&r2=31332&view=diff
==============================================================================
--- trunk/server/diplhand.c     (original)
+++ trunk/server/diplhand.c     Sun Jan  3 15:31:35 2016
@@ -418,7 +418,8 @@
       struct player_diplstate *ds_destgiver
         = player_diplstate_get(pdest, pgiver);
       enum diplstate_type old_diplstate = ds_giverdest->type;
-      struct unit_list *pgiver_seen_units, *pdest_seen_units;
+      struct unit_list *pgiver_seen_units BAD_HEURISTIC_INIT(NULL);
+      struct unit_list *pdest_seen_units BAD_HEURISTIC_INIT(NULL);
 
       switch (pclause->type) {
       case CLAUSE_EMBASSY:

Modified: trunk/utility/shared.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/utility/shared.h?rev=31332&r1=31331&r2=31332&view=diff
==============================================================================
--- trunk/utility/shared.h      (original)
+++ trunk/utility/shared.h      Sun Jan  3 15:31:35 2016
@@ -32,6 +32,14 @@
 /* Use FC_INFINITY to denote that a certain event will never occur or
    another unreachable condition. */
 #define FC_INFINITY            (1000 * 1000 * 1000)
+
+#ifndef TESTMATIC_ENABLED
+/* Initialize something for the sole purpose of silencing false compiler 
warning
+ * about variable possibly used uninitialized. */
+#define BAD_HEURISTIC_INIT(_ini_val_) = _ini_val_
+#else  /* TESTMATIC_ENABLED */
+#define BAD_HEURISTIC_INIT(_ini_val_)
+#endif /* TESTMATIC_ENABLED */
 
 enum fc_tristate { TRI_NO, TRI_YES, TRI_MAYBE };
 #define BOOL_TO_TRISTATE(tri) ((tri) ? TRI_YES : TRI_NO)


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to