Ver código fonte

Adjust warnings for clang

bel 8 anos atrás
pai
commit
5a2f231184
2 arquivos alterados com 13 adições e 3 exclusões
  1. 2 1
      CMakeLists.txt
  2. 11 2
      src/civetweb.c

+ 2 - 1
CMakeLists.txt

@@ -257,7 +257,7 @@ endif()
 add_c_compiler_flag(-Wall)
 add_c_compiler_flag(-Wextra)
 add_c_compiler_flag(-Wshadow)
-add_c_compiler_flag(-Wsign-conversion)
+add_c_compiler_flag(-Wconversion)
 add_c_compiler_flag(-Wmissing-prototypes)
 add_c_compiler_flag(-Weverything)
 add_c_compiler_flag(/W4)
@@ -265,6 +265,7 @@ add_c_compiler_flag(-Wno-padded)
 add_c_compiler_flag(/Wd4820) # padding
 add_c_compiler_flag(-Wno-unused-macros)
 add_c_compiler_flag(-Wno-format-nonliteral)
+add_c_compiler_flag(-Wparentheses)
 if (MINGW)
   add_c_compiler_flag(-Wno-format)
 endif()

+ 11 - 2
src/civetweb.c

@@ -125,7 +125,16 @@ mg_static_assert(sizeof(void *) >= sizeof(int), "data type size check");
 #include <fcntl.h>
 #endif /* !_WIN32_WCE */
 
-#ifdef __MACH__
+
+#ifdef __clang__
+/* When using -Weverything, clang does not accept it's own headers
+ * in a release build configuration. Disable what is too much in
+ * -Weverything. */
+#pragma clang diagnostic ignored "-Wdisabled-macro-expansion"
+#endif
+
+
+#ifdef __MACH__ /* Apple OSX section */
 
 #ifdef __clang__
 /* Avoid warnings for Xopen 7.00 and higher */
@@ -2410,7 +2419,7 @@ skip_quoted(char **buf,
 		*buf = end_word;
 	} else {
 		end_whitespace =
-		    end_word + 1u + (unsigned int)strspn(end_word + 1, whitespace);
+		    end_word + ((unsigned int)strspn(end_word + 1, whitespace) + 1u);
 
 		for (p = end_word; p < end_whitespace; p++) {
 			*p = '\0';