Преглед изворни кода

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;
 			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_SET(sock, &wfds);
 			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);
 
+#if defined(__GNUC__) || defined(__MINGW32__)
+#pragma GCC diagnostic pop
+#endif
+
 			if (sret > 0) {
 				/* We got ready to write. Don't check the timeout
 				 * but directly go back to write again. */