Explorar el Código

compile with warnings enabled

Dimitri Stolnikov hace 13 años
padre
commit
e5e68c6524
Se han modificado 2 ficheros con 13 adiciones y 1 borrados
  1. 5 1
      CMakeLists.txt
  2. 8 0
      configure.ac

+ 5 - 1
CMakeLists.txt

@@ -36,7 +36,11 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
 ########################################################################
 # Compiler specific setup
 ########################################################################
-if(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
+if(CMAKE_COMPILER_IS_GNUCC AND NOT WIN32)
+    ADD_DEFINITIONS(-Wall)
+    ADD_DEFINITIONS(-Wextra)
+    ADD_DEFINITIONS(-Wno-unused)
+    ADD_DEFINITIONS(-Wsign-compare)
     #http://gcc.gnu.org/wiki/Visibility
     add_definitions(-fvisibility=hidden)
 endif()

+ 8 - 0
configure.ac

@@ -38,6 +38,14 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
 CFLAGS="$saved_CFLAGS"
 AC_SUBST(SYMBOL_VISIBILITY)
 
+AC_MSG_CHECKING(whether compiler understands -Wall)
+old_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Wall -Wextra -Wno-unused -Wsign-compare"
+AC_TRY_COMPILE([],[],
+  AC_MSG_RESULT(yes),
+  AC_MSG_RESULT(no)
+  CFLAGS="$old_CFLAGS")
+
 dnl Generate the output
 AM_CONFIG_HEADER(config.h)