summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbuj <[email protected]>2019-09-09 22:36:21 +0200
committerraveit65 <[email protected]>2019-09-15 10:21:47 +0200
commitf14af86aa11acfdf6833fe0f8349f2ad47bb1f6d (patch)
tree92ea21f643801a2b257d8fa2bc2b06e6a54865f2
parentabff3730fe5be92164dd00dfc36ebc60a73f233c (diff)
downloadmarco-f14af86aa11acfdf6833fe0f8349f2ad47bb1f6d.tar.bz2
marco-f14af86aa11acfdf6833fe0f8349f2ad47bb1f6d.tar.xz
build: add --enable-more-warnings configure flag
- Remove -ansi from CFLAGS. - By default, CFLAGS: -Wall -Wcast-align -Wchar-subscripts -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wsign-compare -Wshadow - If --enable-more-warnings, add -Wextra to CFLAGS. - Requires autoconf-archive package.
-rw-r--r--.travis.yml6
-rw-r--r--configure.ac84
-rw-r--r--meson.build5
3 files changed, 17 insertions, 78 deletions
diff --git a/.travis.yml b/.travis.yml
index dd0a8a42..b2faf62c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -64,6 +64,7 @@ env:
requires:
archlinux:
# Useful URL: https://git.archlinux.org/svntogit/community.git/tree/marco/trunk/PKGBUILD
+ - autoconf-archive
- clang
- gcc
- git
@@ -83,6 +84,7 @@ requires:
debian:
# Useful URL: https://github.com/mate-desktop/debian-packages
# Useful URL: https://salsa.debian.org/debian-mate-team/marco
+ - autoconf-archive
- autopoint
- clang
- clang-tools
@@ -117,6 +119,7 @@ requires:
fedora:
# Useful URL: https://src.fedoraproject.org/cgit/rpms/marco.git
+ - autoconf-archive
- clang-analyzer
- clang
- cppcheck-htmlreport
@@ -139,6 +142,7 @@ requires:
- zenity
ubuntu:
+ - autoconf-archive
- autopoint
- clang
- clang-tools
@@ -170,7 +174,7 @@ requires:
- zenity
variables:
- - CFLAGS="-Wall -Werror=format-security"
+ - CFLAGS="-Wall -Wcast-align -Wchar-subscripts -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wsign-compare -Wshadow"
- 'CHECKERS="
-enable-checker deadcode.DeadStores
-enable-checker alpha.deadcode.UnreachableCode
diff --git a/configure.ac b/configure.ac
index 7048f1b6..d20745f1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -15,6 +15,7 @@ AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([subdir-objects no-dist-gzip dist-xz check-news])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AM_MAINTAINER_MODE
+AX_CHECK_ENABLE_DEBUG()
dnl **************************************************************************
dnl Library version information
@@ -54,67 +55,15 @@ AC_CHECK_SIZEOF(__int64)
AC_C_BIGENDIAN
#### Warnings
-
-changequote(,)dnl
-if test "x$GCC" = "xyes"; then
- case " $CFLAGS " in
- *[\ \ ]-Wall[\ \ ]*) ;;
- *) CFLAGS="$CFLAGS -Wall" ;;
- esac
-
-# case " $CFLAGS " in
-# *[\ \ ]-Wshadow[\ \ ]*) ;;
-# *) CFLAGS="$CFLAGS -Wshadow" ;;
-# esac
-
- case " $CFLAGS " in
- *[\ \ ]-Wchar-subscripts[\ \ ]*) ;;
- *) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
- esac
-
- case " $CFLAGS " in
- *[\ \ ]-Wmissing-declarations[\ \ ]*) ;;
- *) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
- esac
-
- case " $CFLAGS " in
- *[\ \ ]-Wmissing-prototypes[\ \ ]*) ;;
- *) CFLAGS="$CFLAGS -Wmissing-prototypes" ;;
- esac
-
- case " $CFLAGS " in
- *[\ \ ]-Wnested-externs[\ \ ]*) ;;
- *) CFLAGS="$CFLAGS -Wnested-externs" ;;
- esac
-
- case " $CFLAGS " in
- *[\ \ ]-Wpointer-arith[\ \ ]*) ;;
- *) CFLAGS="$CFLAGS -Wpointer-arith" ;;
- esac
-
- case " $CFLAGS " in
- *[\ \ ]-Wcast-align[\ \ ]*) ;;
- *) CFLAGS="$CFLAGS -Wcast-align" ;;
- esac
-
- case " $CFLAGS " in
- *[\ \ ]-Wsign-compare[\ \ ]*) ;;
- *) CFLAGS="$CFLAGS -Wsign-compare" ;;
- esac
-
- if test "x$enable_ansi" = "xyes"; then
- case " $CFLAGS " in
- *[\ \ ]-ansi[\ \ ]*) ;;
- *) CFLAGS="$CFLAGS -ansi" ;;
- esac
-
- case " $CFLAGS " in
- *[\ \ ]-pedantic[\ \ ]*) ;;
- *) CFLAGS="$CFLAGS -pedantic" ;;
- esac
- fi
+AX_APPEND_COMPILE_FLAGS([-Wall -Wcast-align -Wchar-subscripts -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wsign-compare -Wshadow], [CFLAGS])
+AC_ARG_ENABLE(more-warnings,
+ AC_HELP_STRING([--enable-more-warnings], [Maximum compiler warnings]),
+ set_more_warnings="$enableval",
+ set_more_warnings=no
+)
+if test "$set_more_warnings" != "no"; then
+ AX_APPEND_COMPILE_FLAGS([-Wextra], [CFLAGS])
fi
-changequote([,])dnl
GIO_MIN_VERSION=2.25.10
GTK_MIN_VERSION=3.22.0
@@ -483,21 +432,6 @@ if test x"$ZENITY" = xno; then
AC_MSG_ERROR([zenity not found in your path - needed for dialogs])
fi
-AC_ARG_ENABLE(debug,
- [ --enable-debug enable debugging],,
- enable_debug=no)
-if test "x$enable_debug" = "xyes"; then
- CFLAGS="$CFLAGS -g -O"
-fi
-
-# Warnings are there for a reason
-if test "x$GCC" = "xyes"; then
- CFLAGS="$CFLAGS -Wall -ansi"
- if test "x$enable_maintainer_mode" = "xyes"; then
- CFLAGS="$CFLAGS"
- fi
-fi
-
# Use yelp-tools:
YELP_HELP_INIT
diff --git a/meson.build b/meson.build
index d93f0b9a..3a9abca6 100644
--- a/meson.build
+++ b/meson.build
@@ -56,6 +56,7 @@ test_args = [
#'-Wformat=2',
#'-Wformat-nonliteral',
#'-Wformat-security',
+ ['-Werror=format-security', '-Werror=format=2'],
#'-Wformat-signedness',
#'-Wignored-qualifiers',
#'-Wimplicit-function-declaration',
@@ -90,13 +91,13 @@ test_args = [
#'-Wunused-but-set-variable',
#'-Wwrite-strings'
'-Wall',
- '-ansi',
+ #'-ansi',
]
cc = meson.get_compiler('c')
foreach arg: test_args
- if cc.has_argument(arg)
+ if cc.has_multi_arguments(arg)
add_project_arguments(arg, language : 'c')
endif
endforeach