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

configure: add macro to check compiler flag '-Wstrict-prototype'

Strict prototype are better for portability and to avoid bugs because it
makes sure the compiler has the information to properly validate the
arguments given when a function is called.

This flag however need special care when checking for it, because the
declaration for 'main' generated by autoconf cannot be a strict prototype
so the detection would always see the flag as failing.

This patch handles this by creating a dedicated macro for this detection
which uses a good prototype because we're in a case where it is possible,
so the detection will not always fail; it also makes sure to add the flag
to CFLAG only at the end, to avoid falsely crashing any further test done
in the configure script.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2014-12-08 22:42:23 +01:00
committed by Carlos R. Mafra
parent 11fe8bd860
commit 30e1fad926
2 changed files with 44 additions and 1 deletions

View File

@@ -129,6 +129,11 @@ AS_IF([test "x$debug" = "xyes"],
dnl more difficult, so try to avoid it
AX_CFLAGS_GCC_OPTION([-Wredundant-decls])
dnl
dnl Prototype of function must be explicit, no deprecated K&R syntax
dnl and no empty argument list which prevents compiler from doing
dnl type checking when using the function
WM_CFLAGS_GCC_OPTION_STRICTPROTO
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