1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-02-14 12:55:47 +01:00

configure: Enable compiler warnings to help add 'format' attribute

This attribute helps the compiler checking the type matching between
arguments and the specification in a printf-like format string, to
avoid invalid output. This attribute is optional, but some compilers
can suggest functions that could have it.

This patch adds the appropriate compiler flags if they are supported when
the source is being compiled with DEBUG enabled.

The patch also introduces a new macro WM_CFLAGS_CHECK_FIRST because in some
cases AX_CFLAGS_GCC_OPTION is not really efficient and in present case it
does not fits the job.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2013-11-15 18:46:38 +01:00
committed by Carlos R. Mafra
parent 68a902aa2e
commit fc825382d6
2 changed files with 83 additions and 0 deletions

View File

@@ -129,6 +129,12 @@ AS_IF([test "x$debug" = "xyes"],
dnl Having more than 1 prototype for a function makes code updates
dnl more difficult, so try to avoid it
AX_CFLAGS_GCC_OPTION([-Wredundant-decls])
dnl
dnl Proper attributes helps the compiler to produce better code
WM_CFLAGS_CHECK_FIRST([format attribute suggest],
[-Wsuggest-attribute=format dnl new gcc syntax
-Wmissing-format-attribute dnl old gcc syntax, clang
])
], [dnl
dnl When debug not enabled, we try to avoid some non-necessary
dnl messages from the compiler