Parcourir la source

Officially stop support for "-Werror" + "-Wextra/-Weverything" for GCC

Almost all lines lines in CivetWeb compile free of warnings,
even on the highest possible warning level (-Weverything).
For some lines, single warnings need to be explicitly disabled
by a #pragma, and reactivated again. These lines are manually
checked and commented, instead of disabling warnings for the
entire code.
However, for GCC disabling certain warnings does not work.
This is a well known bug in GCC since at least 2012:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431

CivetWeb will not go to a lower warning level, because GCC
does not fix this bug. Support for -Werror for GCC is explicitly
blocked in the CMakeFile until this bug is fixed.

Focus will be to compile free of warnings with other compilers
(Visual Studio, clang).
bel2125 il y a 7 ans
Parent
commit
e37c8c9b90
2 fichiers modifiés avec 8 ajouts et 0 suppressions
  1. 6 0
      CMakeLists.txt
  2. 2 0
      src/civetweb.c

+ 6 - 0
CMakeLists.txt

@@ -113,6 +113,12 @@ message(STATUS "Executable installation - ${CIVETWEB_INSTALL_EXECUTABLE}")
 option(CIVETWEB_ALLOW_WARNINGS "Do not stop build if there are warnings" ON)
 message(STATUS "Build if there are warnings - ${CIVETWEB_ALLOW_WARNINGS}")
 
+if (NOT CIVETWEB_ALLOW_WARNINGS)
+  if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
+    message(FATAL_ERROR "Cannot compile with warning as errors, until this GCC bug is solved: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431")
+  endif()
+endif()
+
 # Link to the shared LUA library
 cmake_dependent_option(
   CIVETWEB_ENABLE_LUA_SHARED  "Link to the shared LUA system library" OFF

+ 2 - 0
src/civetweb.c

@@ -191,6 +191,8 @@ mg_static_assert(sizeof(void *) >= sizeof(int), "data type size check");
  * #pragma clang diagnostic ignored "-Wdate-time"
  * So we just have to disable ALL warnings for some lines
  * of code.
+ * This seems to be a known GCC bug, not resolved since 2012:
+ * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431
  */
 #endif