<URL: http://bugs.freeciv.org/Ticket/Display.html?id=39548 >

> [EMAIL PROTECTED] - So 12. Aug 2007, 16:50:47]:
> 
>  This fixes warning when neither SOCKET_ZERO_ISNT_STDIN nor
> HAVE_READLINE is defined.
> 
> 
>  - ML
> 

There are actually two locations where the handle_stdin_close() function
might get called. At the one location HAVE_LIBREADLINE is defined and at
the other location both SOCKET_ZERO_ISNT_STDIN and HAVE_LIBREADLINE are
undefined. Updated patches for S2_0, S2_1 and trunk are attached.
Index: server/sernet.c
===================================================================
--- server/sernet.c	(revision 13338)
+++ server/sernet.c	(working copy)
@@ -130,6 +130,10 @@
 
 static bool no_input = FALSE;
 
+/* Avoid compiler warning about defined, but unused function
+ * by defining it only when needed */
+#if defined(HAVE_LIBREADLINE) || \
+    (!defined(SOCKET_ZERO_ISNT_STDIN) && !defined(HAVE_LIBREADLINE))  
 /*****************************************************************************
   This happens if you type an EOF character with nothing on the current line.
 *****************************************************************************/
@@ -141,9 +145,11 @@
 #ifndef SOCKET_ZERO_ISNT_STDIN
   freelog(LOG_NORMAL, _("Server cannot read standard input. Ignoring input."));
   no_input = TRUE;
-#endif
+#endif /* SOCKET_ZERO_ISNT_STDIN */
 }
 
+#endif /* HAVE_LIBREADLINE || (!SOCKET_ZERO_ISNT_STDIN && !HAVE_LIBREADLINE) */
+
 #ifdef HAVE_LIBREADLINE
 /****************************************************************************/
 
Index: server/sernet.c
===================================================================
--- server/sernet.c	(revision 13338)
+++ server/sernet.c	(working copy)
@@ -133,7 +133,8 @@
 
 /* Avoid compiler warning about defined, but unused function
  * by defining it only when needed */
-#if !defined(SOCKET_ZERO_ISNT_STDIN) && !defined(HAVE_READLINE)
+#if defined(HAVE_LIBREADLINE) || \
+    (!defined(SOCKET_ZERO_ISNT_STDIN) && !defined(HAVE_LIBREADLINE))  
 /*****************************************************************************
   This happens if you type an EOF character with nothing on the current line.
 *****************************************************************************/
@@ -148,7 +149,7 @@
 #endif /* SOCKET_ZERO_ISNT_STDIN */
 }
 
-#endif /* !SOCKET_ZERO_ISNT_STDIN && !HAVE_READLINE */
+#endif /* HAVE_LIBREADLINE || (!SOCKET_ZERO_ISNT_STDIN && !HAVE_LIBREADLINE) */
 
 #ifdef HAVE_LIBREADLINE
 /****************************************************************************/
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to