From b155f9d6fed0d33da27bed707276d48482ac1e7c Mon Sep 17 00:00:00 2001 From: rbuj Date: Sat, 28 Sep 2019 11:34:14 +0200 Subject: Use MATE_COMPILE_WARNINGS and MATE_CXX_WARNINGS macros - It adds WARN_CFLAGS to CFLAGS, and WARN_CXXLAGS to CXXFLAGS - By default, --enable-cxx-warnings=yes --enable-compile-warnings=yes - It prints the warning flags in configure summary --- .travis.yml | 4 ++++ configure.ac | 27 +++++---------------------- src/Makefile.am | 9 ++++++++- tools/Makefile.am | 4 ++-- 4 files changed, 19 insertions(+), 25 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7685367..5cc2de0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -64,6 +64,7 @@ env: requires: archlinux: # Useful URL: https://git.archlinux.org/svntogit/community.git/tree/mate-system-monitor + - autoconf-archive - clang - gcc - git @@ -80,6 +81,7 @@ requires: debian: # Useful URL: https://github.com/mate-desktop/debian-packages # Useful URL: https://salsa.debian.org/debian-mate-team/mate-system-monitor + - autoconf-archive - clang - clang-tools - cppcheck @@ -103,6 +105,7 @@ requires: fedora: # Useful URL: https://src.fedoraproject.org/cgit/rpms/mate-system-monitor.git + - autoconf-archive - clang - clang-analyzer - cppcheck-htmlreport @@ -123,6 +126,7 @@ requires: - systemd-devel ubuntu: + - autoconf-archive - clang - clang-tools - g++ diff --git a/configure.ac b/configure.ac index f7001b4..b86173c 100644 --- a/configure.ac +++ b/configure.ac @@ -60,27 +60,8 @@ fi AM_CONDITIONAL(HAVE_SYSTEMD, [test "$have_systemd" = "yes"]) # Compiler warnings -MATE_COMPILE_WARNINGS([maximum]) - -AC_ARG_ENABLE(more-warnings, -[AC_HELP_STRING([--enable-more-warnings],[Maximum compiler warnings])], -set_more_warnings="$enableval",[ - set_more_warnings=yes -]) -AC_MSG_CHECKING(for more warnings, including -Werror) -if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then - AC_MSG_RESULT(yes) - CFLAGS="\ - -Wall \ - -Winline \ - -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \ - -Wnested-externs -Wpointer-arith \ - -Wcast-align -Wsign-compare \ - $CFLAGS" - CXXFLAGS="-Wall $CXXFLAGS" -else - AC_MSG_RESULT(no) -fi +MATE_COMPILE_WARNINGS([yes]) +MATE_CXX_WARNINGS([yes]) dnl CXXFLAGS="-fvisibility=hidden -fvisibility-inlines-hidden $CXXFLAGS" dnl CXXFLAGS="-fvisibility-inlines-hidden $CXXFLAGS" @@ -117,9 +98,11 @@ Configuration: Source code location: ${srcdir} C Compiler: ${CC} - C++ Compiler: ${CXX} CFLAGS: ${CFLAGS} + WARN_CFLAGS: ${WARN_CFLAGS} + C++ Compiler: ${CXX} CXXFLAGS: ${CXXFLAGS} + WARN_CXXFLAGS: ${WARN_CXXFLAGS} Maintainer mode: ${USE_MAINTAINER_MODE} Systemd support: ${have_systemd} " diff --git a/src/Makefile.am b/src/Makefile.am index 0518134..60a2aba 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -50,6 +50,12 @@ mate_system_monitor_SOURCES = \ $(mate_system_monitor_cpp_files) \ $(mate_system_monitor_c_files) +mate_system_monitor_CXXFLAGS = \ + $(WARN_CXXFLAGS) + +mate_system_monitor_CFLAGS = \ + $(WARN_CFLAGS) + mate_system_monitor_LDADD = @PROCMAN_LIBS@ @SYSTEMD_LIBS@ libbacon.la @@ -57,7 +63,8 @@ noinst_LTLIBRARIES = libbacon.la libbacon_la_SOURCES = \ bacon-message-connection.c \ bacon-message-connection.h - +libbacon_la_CFLAGS = \ + $(WARN_CFLAGS) specdir = $(datadir)/procman diff --git a/tools/Makefile.am b/tools/Makefile.am index 204a42b..e752c94 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -4,9 +4,9 @@ AM_CPPFLAGS = $(TOOLS_CFLAGS) msm_renice_SOURCES = msm_execute_helper.c msm_renice_LDADD = $(TOOLS_LIBS) -msm_renice_CFLAGS = -DCOMMAND=\"renice\" +msm_renice_CFLAGS = -DCOMMAND=\"renice\" $(WARN_CFLAGS) msm_kill_SOURCES = msm_execute_helper.c msm_kill_LDADD = $(TOOLS_LIBS) -msm_kill_CFLAGS = -DCOMMAND=\"kill\" +msm_kill_CFLAGS = -DCOMMAND=\"kill\" $(WARN_CFLAGS) -- cgit v1.2.1