From 48ec9b5c4a889634932a22a2fde25d3a2c66a263 Mon Sep 17 00:00:00 2001 From: Janos SUTO Date: Thu, 24 Dec 2020 16:23:14 +0100 Subject: [PATCH] Add -Wimplicit-fallthrough=2 cflag only to gcc version 7+ Signed-off-by: Janos SUTO --- configure | 8 +++++++- configure.in | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 6423657e..7eaab2d9 100755 --- a/configure +++ b/configure @@ -4852,7 +4852,13 @@ if test $? -eq 1; then echo "the user \"$RUNNING_USER\" does not exists, please echo; echo -CFLAGS="$static -std=c99 -O2 -fPIC -Wall -Wextra -Wimplicit-fallthrough=2 -Wuninitialized -Wno-format-truncation -g" +gcc_version="$(gcc -dumpversion)" +extra_cflags="" +if [ "${gcc_version:0:1}" -gt 5 ]; then + extra_cflags="-Wimplicit-fallthrough=2" +fi + +CFLAGS="$static -std=c99 -O2 -fPIC -Wall -Wextra $extra_cflags -Wuninitialized -Wno-format-truncation -g" LIBS="$antispam_libs $sunos_libs " OBJS="dirs.o misc.o counters.o cfg.o sig.o decoder.o hash.o parser.o parser_utils.o rules.o smtp.o session.o bdat.o message.o attachment.o digest.o store.o archive.o tai.o import.o import_pilerexport.o import_maildir.o import_mailbox.o import_pop3.o import_imap.o imap.o pop3.o extract.o mydomains.o tokenizer.o $objs" diff --git a/configure.in b/configure.in index 0f2a83d5..8c50891d 100644 --- a/configure.in +++ b/configure.in @@ -535,7 +535,13 @@ if test $? -eq 1; then echo "the user \"$RUNNING_USER\" does not exists, please echo; echo -CFLAGS="$static -std=c99 -O2 -fPIC -Wall -Wextra -Wimplicit-fallthrough=2 -Wuninitialized -Wno-format-truncation -g" +gcc_version="$(gcc -dumpversion)" +extra_cflags="" +if [[ "${gcc_version:0:1}" -gt 5 ]]; then + extra_cflags="-Wimplicit-fallthrough=2" +fi + +CFLAGS="$static -std=c99 -O2 -fPIC -Wall -Wextra $extra_cflags -Wuninitialized -Wno-format-truncation -g" LIBS="$antispam_libs $sunos_libs " OBJS="dirs.o misc.o counters.o cfg.o sig.o decoder.o hash.o parser.o parser_utils.o rules.o smtp.o session.o bdat.o message.o attachment.o digest.o store.o archive.o tai.o import.o import_pilerexport.o import_maildir.o import_mailbox.o import_pop3.o import_imap.o imap.o pop3.o extract.o mydomains.o tokenizer.o $objs"