Blame SOURCES/audit-3.0.7-gcc-flags.patch

95ab14
From 36beaefbb4ecb0a222ac68ec9f17f854a82f7235 Mon Sep 17 00:00:00 2001
95ab14
From: Steve Grubb <sgrubb@redhat.com>
95ab14
Date: Mon, 14 Feb 2022 15:30:09 -0500
95ab14
Subject: [PATCH] Adjust compile flags
95ab14
95ab14
---
95ab14
 audisp/plugins/remote/Makefile.am |  2 +-
95ab14
 auparse/Makefile.am               |  2 +-
95ab14
 configure.ac                      | 15 +++++++++++++++
95ab14
 src/Makefile.am                   |  2 +-
95ab14
 4 files changed, 18 insertions(+), 3 deletions(-)
95ab14
95ab14
diff --git a/audisp/plugins/remote/Makefile.am b/audisp/plugins/remote/Makefile.am
95ab14
index 217d477c5..1ac77ee8d 100644
95ab14
--- a/audisp/plugins/remote/Makefile.am
95ab14
+++ b/audisp/plugins/remote/Makefile.am
95ab14
@@ -36,7 +36,7 @@ TESTS = $(check_PROGRAMS)
95ab14
 
95ab14
 audisp_remote_DEPENDENCIES = ${top_builddir}/common/libaucommon.la
95ab14
 audisp_remote_SOURCES = audisp-remote.c remote-config.c queue.c
95ab14
-audisp_remote_CFLAGS = -fPIE -DPIE -g -D_REENTRANT -D_GNU_SOURCE -Wundef
95ab14
+audisp_remote_CFLAGS = -fPIE -DPIE -g -D_REENTRANT -D_GNU_SOURCE -Wundef ${WFLAGS}
95ab14
 audisp_remote_LDFLAGS = -pie -Wl,-z,relro -Wl,-z,now
95ab14
 audisp_remote_LDADD = $(CAPNG_LDADD) $(gss_libs) ${top_builddir}/common/libaucommon.la
95ab14
 
95ab14
diff --git a/auparse/Makefile.am b/auparse/Makefile.am
95ab14
index b34b6c042..1eb5352cf 100644
95ab14
--- a/auparse/Makefile.am
95ab14
+++ b/auparse/Makefile.am
95ab14
@@ -26,7 +26,7 @@ SUBDIRS = test
95ab14
 EXTRA_DIST = expression-design.txt
95ab14
 CLEANFILES = $(BUILT_SOURCES)
95ab14
 CONFIG_CLEAN_FILES = *.loT *.rej *.orig
95ab14
-AM_CFLAGS = -fPIC -DPIC -D_GNU_SOURCE -g ${DEBUG} -Wno-pointer-sign -Wno-enum-compare -Wno-switch
95ab14
+AM_CFLAGS = -fPIC -DPIC -D_GNU_SOURCE -g ${DEBUG} -Wno-pointer-sign -Wno-enum-compare -Wno-switch ${WFLAGS}
95ab14
 AM_CPPFLAGS = -I. -I${top_srcdir} -I${top_srcdir}/src -I${top_srcdir}/lib -I${top_srcdir}/common
95ab14
 LIBS =
95ab14
 
95ab14
diff --git a/configure.ac b/configure.ac
95ab14
index e40d41e14..e74fd7036 100644
95ab14
--- a/configure.ac
95ab14
+++ b/configure.ac
95ab14
@@ -341,6 +341,21 @@ else
95ab14
 fi
95ab14
 ],WARNS="$ALLWARNS")
95ab14
 
95ab14
+WFLAGS=""
95ab14
+AC_MSG_CHECKING(for -Wformat-truncation)
95ab14
+TMPCFLAGS="${CFLAGS}"
95ab14
+CFLAGS="${CFLAGS} -Wformat-truncation"
95ab14
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[WFLAGS="-Wno-format-truncation"
95ab14
+	AC_MSG_RESULT(yes)],
95ab14
+	[AC_MSG_RESULT(no)])
95ab14
+CFLAGS="${TMPCFLAGS}"
95ab14
+CFLAGS="${CFLAGS} -Wunused-but-set-variable"
95ab14
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[WFLAGS="${WFLAGS} -Wno-unused-but-set-variable"
95ab14
+	AC_MSG_RESULT(yes)],
95ab14
+	[AC_MSG_RESULT(no)])
95ab14
+CFLAGS="${TMPCFLAGS}"
95ab14
+AC_SUBST(WFLAGS)
95ab14
+
95ab14
 withval=""
95ab14
 AC_MSG_CHECKING(whether to include arm eabi processor support)
95ab14
 AC_ARG_WITH(arm,
95ab14
diff --git a/src/Makefile.am b/src/Makefile.am
95ab14
index 9c68b42db..2bebf8d50 100644
95ab14
--- a/src/Makefile.am
95ab14
+++ b/src/Makefile.am
95ab14
@@ -25,7 +25,7 @@ CONFIG_CLEAN_FILES = *.rej *.orig
95ab14
 SUBDIRS = test
95ab14
 AM_CPPFLAGS = -I${top_srcdir} -I${top_srcdir}/lib -I${top_srcdir}/src/libev -I${top_srcdir}/auparse -I${top_srcdir}/audisp -I${top_srcdir}/common
95ab14
 sbin_PROGRAMS = auditd auditctl aureport ausearch autrace
95ab14
-AM_CFLAGS = -D_GNU_SOURCE -Wno-pointer-sign
95ab14
+AM_CFLAGS = -D_GNU_SOURCE -Wno-pointer-sign ${WFLAGS}
95ab14
 noinst_HEADERS = auditd-config.h auditd-event.h auditd-listen.h ausearch-llist.h ausearch-options.h auditctl-llist.h aureport-options.h ausearch-parse.h aureport-scan.h ausearch-lookup.h ausearch-int.h auditd-dispatch.h ausearch-string.h ausearch-nvpair.h ausearch-common.h ausearch-avc.h ausearch-time.h ausearch-lol.h auditctl-listing.h ausearch-checkpt.h
95ab14
 
95ab14
 auditd_SOURCES = auditd.c auditd-event.c auditd-config.c auditd-reconfig.c auditd-sendmail.c auditd-dispatch.c