浏览代码

Select different pragma statements for GCC/MSVC.

Resolves unknown pragma Visual Studio warnings.
Jason Valenzuela 4 年之前
父节点
当前提交
ff92a7f5ca
共有 1 个文件被更改,包括 6 次插入4 次删除
  1. 6 4
      source/src/ports/generic_networkhandler.c

+ 6 - 4
source/src/ports/generic_networkhandler.c

@@ -52,10 +52,12 @@ const uint16_t kOpenerEthernetPort = 0xAF12;
 
 #ifndef MSG_NOSIGNAL
 #define MSG_NOSIGNAL 0
-#pragma \
-  GCC warning "MSG_NOSIGNAL not defined. Check if your system stops on SIGPIPE, as this can happen with the send() function"
-#pragma \
-  message("MSG_NOSIGNAL not defined. Check if your system stops on SIGPIPE, as this can happen with the send() function")
+#define MSG_NOSIGNAL_PRAGMA_MESSAGE "MSG_NOSIGNAL not defined. Check if your system stops on SIGPIPE, as this can happen with the send() function"
+#if defined(_WIN32)
+#pragma message(MSG_NOSIGNAL_PRAGMA_MESSAGE)
+#else
+#pragma GCC warning MSG_NOSIGNAL_PRAGMA_MESSAGE
+#endif /* defined(_WIN32) */
 #endif
 
 SocketTimer g_timestamps[OPENER_NUMBER_OF_SUPPORTED_SESSIONS];