Author: cazfi
Date: Sun Jan  3 15:31:41 2016
New Revision: 31333

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

See patch #6759

Modified:
    branches/S2_6/server/diplhand.c
    branches/S2_6/utility/shared.h

Modified: branches/S2_6/server/diplhand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/diplhand.c?rev=31333&r1=31332&r2=31333&view=diff
==============================================================================
--- branches/S2_6/server/diplhand.c     (original)
+++ branches/S2_6/server/diplhand.c     Sun Jan  3 15:31:41 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: branches/S2_6/utility/shared.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/utility/shared.h?rev=31333&r1=31332&r2=31333&view=diff
==============================================================================
--- branches/S2_6/utility/shared.h      (original)
+++ branches/S2_6/utility/shared.h      Sun Jan  3 15:31:41 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