]> granicus.if.org Git - graphviz/commitdiff
Set std=c99 and multiple warnings for GCC
authorErwin Janssen <erwinjanssen@outlook.com>
Mon, 11 Jul 2016 16:28:36 +0000 (18:28 +0200)
committerErwin Janssen <erwinjanssen@outlook.com>
Fri, 22 Jul 2016 12:26:04 +0000 (14:26 +0200)
Using std=c99 enables some convenient features in the C language.
More compiler warnings offer a chance to improve the code quality.

configure.ac

index 5233e2b04b65854db9c3197b6949a6ccc809952a..b8e5c62c60b6c8eaf89d41a2cbfe336b865a4b90 100644 (file)
@@ -304,6 +304,27 @@ if test "x$TCLSH" = "x"; then
 #  fi
 fi
 
+dnl ===========================================================================
+dnl Set GCC compiler flags
+
+if [test "${GCC}" == "yes"]
+then
+  # Enable c99
+  CFLAGS="${CFLAGS} -std=c99"
+  
+  # When enabling c99 on this codebase, this POSIX version should be defined
+  CFLAGS="${CFLAGS} -D_POSIX_C_SOURCE=200112L"
+  
+  # Enable common warnings flags
+  CFLAGS="${CFLAGS} -Wall"
+  
+  # Enable common extra flags
+  CFLAGS="${CFLAGS} -Wextra"
+  
+  # Enable specific warning flags not included by -Wall or -Wextra
+  CFLAGS="${CFLAGS} -Wdouble-promotion -Wmissing-include-dirs -Wswitch-default -Wtrampolines -Wfloat-equal -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wconversion -Wlogical-op -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs"
+fi
+
 dnl -----------------------------------
 dnl checks for compilers