Apply developer flags to C++ as well as C.

This commit is contained in:
Dag-Erling Smørgrav 2017-12-17 14:03:26 +01:00
parent 1bf0b415a3
commit 785612b12b
2 changed files with 11 additions and 5 deletions

View file

@ -160,19 +160,25 @@ AC_ARG_ENABLE([rsaref-tests],
[build unit tests enable RSAREF support]))
AM_CONDITIONAL([RSAREF_TESTS], [test x"enable_rsaref_tests" = x"yes"])
XFLAGS=""
# Developer-friendly compiler flags
AC_ARG_ENABLE([developer-warnings],
AS_HELP_STRING([--enable-developer-warnings],
[enable strict warnings (default is NO)]),
[CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual -Wshadow"])
[XFLAGS="${XFLAGS} -Wall -Wextra -Wcast-qual -Wshadow"])
AC_ARG_ENABLE([debugging-symbols],
AS_HELP_STRING([--enable-debugging-symbols],
[enable debugging symbols (default is NO)]),
[CFLAGS="${CFLAGS} -O0 -g -fno-inline"])
[XFLAGS="${XFLAGS} -O0 -fno-inline -g"])
AC_ARG_ENABLE([werror],
AS_HELP_STRING([--enable-werror],
[use -Werror (default is NO)]),
[CFLAGS="${CFLAGS} -Werror"])
[XFLAGS="${XFLAGS} -Werror"])
CFLAGS="${CFLAGS} ${XFLAGS}"
CXXFLAGS="${CXXFLAGS} ${XFLAGS}"
unset XFLAGS
############################################################################
#

View file

@ -105,7 +105,7 @@ TEST(rand)
#undef TEST
int
main(int argc, char *argv[])
main(void)
{
std::vector<test *> tests;
int ret;
@ -156,7 +156,7 @@ main(int argc, char *argv[])
"ok 1 - dummy" << std::endl;
} else {
std::cout << "1.." << tests.size() << std::endl;
for (int i = 0; i < tests.size(); ++i) {
for (unsigned int i = 0; i < tests.size(); ++i) {
if (!tests[i]->run()) {
std::cout << "not ";
ret = 1;