浏览代码

Merge pull request #662 from linev/gcc_time_warn

GCC warning -Wdate-time appeared first with gcc4.9
bel2125 6 年之前
父节点
当前提交
adbefa62a6
共有 2 个文件被更改,包括 5 次插入2 次删除
  1. 0 1
      CMakeLists.txt
  2. 5 1
      src/civetweb.c

+ 0 - 1
CMakeLists.txt

@@ -301,7 +301,6 @@ if (HAVE_NO_RESERVED_ID_MACROS)
 add_c_compiler_flag(-Wno-reserved-id-macros) # for system headers
 endif (HAVE_NO_RESERVED_ID_MACROS)
 add_c_compiler_flag(-Wno-format-nonliteral) # printf(myFormatStringVar, ...)
-add_c_compiler_flag(-Wno-date-time) # using __DATE__ once
 add_c_compiler_flag(-Wno-cast-qual) # const cast
 add_c_compiler_flag(/Wd4820) # padding
 

+ 5 - 1
src/civetweb.c

@@ -19046,10 +19046,12 @@ mg_get_system_info_impl(char *buffer, int buflen)
 	/* Build date */
 	{
 #if defined(GCC_DIAGNOSTIC)
+#if GCC_VERSION >= 40900
 #pragma GCC diagnostic push
-/* Disable bogus compiler warning -Wdate-time */
+/* Disable bogus compiler warning -Wdate-time, appeared in gcc5 */
 #pragma GCC diagnostic ignored "-Wdate-time"
 #endif
+#endif
 		mg_snprintf(NULL,
 		            NULL,
 		            block,
@@ -19059,8 +19061,10 @@ mg_get_system_info_impl(char *buffer, int buflen)
 		            eol);
 
 #if defined(GCC_DIAGNOSTIC)
+#if GCC_VERSION >= 40900
 #pragma GCC diagnostic pop
 #endif
+#endif
 
 		system_info_length += (int)strlen(block);
 		if (system_info_length < buflen) {