From 785612b12bfe5bae2e74b224668f912de7799aab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Sun, 17 Dec 2017 14:03:26 +0100 Subject: [PATCH] Apply developer flags to C++ as well as C. --- configure.ac | 12 +++++++++--- t/t_cxx.cc | 4 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 68bddf5..29ffa48 100644 --- a/configure.ac +++ b/configure.ac @@ -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 ############################################################################ # diff --git a/t/t_cxx.cc b/t/t_cxx.cc index a822a58..83d3799 100644 --- a/t/t_cxx.cc +++ b/t/t_cxx.cc @@ -105,7 +105,7 @@ TEST(rand) #undef TEST int -main(int argc, char *argv[]) +main(void) { std::vector 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;