From: Erwin Janssen Date: Mon, 11 Jul 2016 16:28:36 +0000 (+0200) Subject: Set std=c99 and multiple warnings for GCC X-Git-Tag: untagged-9ee5934fa10f12b4043f^2~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=490481afaf4fffa92afbf73716f89b90da30b040;p=graphviz Set std=c99 and multiple warnings for GCC Using std=c99 enables some convenient features in the C language. More compiler warnings offer a chance to improve the code quality. --- diff --git a/configure.ac b/configure.ac index 5233e2b04..b8e5c62c6 100644 --- a/configure.ac +++ b/configure.ac @@ -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