IF(ENABLE_EXTRA_PROTECT)
GET_TARGET_PROPERTY(TMPCFLAGS sarg COMPILE_FLAGS)
SET_TARGET_PROPERTIES(sarg PROPERTIES COMPILE_FLAGS "${TMPCFLAGS} -fstack-protector -D_FORTIFY_SOURCE=2 -Werror")
+
CHECK_C_COMPILER_FLAG("-Wformat -Werror=format-security" HAVE_WERROR_FORMAT_SECURITY)
IF(HAVE_WERROR_FORMAT_SECURITY)
GET_TARGET_PROPERTY(TMPCFLAGS sarg COMPILE_FLAGS)
SET_TARGET_PROPERTIES(sarg PROPERTIES COMPILE_FLAGS "${TMPCFLAGS} -Wformat -Werror=format-security")
ENDIF(HAVE_WERROR_FORMAT_SECURITY)
+
+ CHECK_C_COMPILER_FLAG("-Wempty-body" HAVE_EMPTY_BODY)
+ IF(HAVE_EMPTY_BODY)
+ GET_TARGET_PROPERTY(TMPCFLAGS sarg COMPILE_FLAGS)
+ SET_TARGET_PROPERTIES(sarg PROPERTIES COMPILE_FLAGS "${TMPCFLAGS} -Wempty-body")
+ ENDIF(HAVE_EMPTY_BODY)
ENDIF(ENABLE_EXTRA_PROTECT)
# Compile sarg for debugging
if test "$have_format_security" == "no" ; then
CFLAGS="${saved_CFLAGS}"
fi
+
+ AC_MSG_CHECKING([for empty body flag in $CC])
+ saved_CFLAGS="${CFLAGS}"
+ CFLAGS="${CFLAGS} -Wempty-body"
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],[have_empty_body="yes"],[have_empty_body="no"])
+ AC_MSG_RESULT($have_empty_body)
+ if test "$have_empty_body" == "no" ; then
+ CFLAGS="${saved_CFLAGS}"
+ fi
fi
])