فهرست منبع

Disable GCC warning (flaw in GCC socket macros)

bel2125 8 سال پیش
والد
کامیت
376acb4d65
1فایلهای تغییر یافته به همراه12 افزوده شده و 0 حذف شده
  1. 12 0
      src/civetweb.c

+ 12 - 0
src/civetweb.c

@@ -5184,6 +5184,14 @@ push_inner(struct mg_context *ctx,
 			struct timeval tv;
 			struct timeval tv;
 			int sret;
 			int sret;
 
 
+#if defined(__GNUC__) || defined(__MINGW32__)
+/* GCC seems to have a flaw with it's own socket macros:
+ * http://www.linuxquestions.org/questions/programming-9/impossible-to-use-gcc-with-wconversion-and-standard-socket-macros-841935/
+ */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wconversion"
+#endif
+
 			FD_ZERO(&wfds);
 			FD_ZERO(&wfds);
 			FD_SET(sock, &wfds);
 			FD_SET(sock, &wfds);
 			tv.tv_sec = (time_t)(ms_wait / 1000);
 			tv.tv_sec = (time_t)(ms_wait / 1000);
@@ -5191,6 +5199,10 @@ push_inner(struct mg_context *ctx,
 
 
 			sret = select((int)sock + 1, NULL, &wfds, NULL, &tv);
 			sret = select((int)sock + 1, NULL, &wfds, NULL, &tv);
 
 
+#if defined(__GNUC__) || defined(__MINGW32__)
+#pragma GCC diagnostic pop
+#endif
+
 			if (sret > 0) {
 			if (sret > 0) {
 				/* We got ready to write. Don't check the timeout
 				/* We got ready to write. Don't check the timeout
 				 * but directly go back to write again. */
 				 * but directly go back to write again. */