From 790b3108df1f994df5ffdc7e7c2b157df67c4d47 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Wed, 3 Jul 2024 20:15:22 -0500 Subject: [PATCH] Inhibit -Wdeprecated-declarations via CFLAGS Currently, we inhibit various -Wdeprecated-declarations warnings via "#pragma GCC diagnostic warning". Some older compilers (like gcc 4.1 on RHEL5) don't understand the pragma, but still need the warning inhibited in order to build with --enable-checking. So just inhibit this warning via command-line CFLAGS instead of using #pragma directives. One source file, tests/auth/superuser-t.c, was inhibiting the -Wdeprecated-declaractions warning unnecessarily (it has not been needed since commit 5815a04cf1f3 (tests: Move token faking code to its own file)). Just remove the warning inhibition there, instead. Change-Id: I52b1aeeac8699f9a4820626e9f1349f8cd380585 Reviewed-on: https://gerrit.openafs.org/15777 Reviewed-by: Michael Meffie Tested-by: BuildBot --- src/auth/Makefile.in | 1 + src/auth/authcon.c | 4 ---- src/cf/osconf.m4 | 3 +++ src/kauth/Makefile.in | 4 ++++ src/kauth/kaprocs.c | 4 ---- src/kauth/krb_udp.c | 4 ---- src/libafscp/Makefile.in | 1 + src/libafscp/afscp_util.c | 4 ---- src/rxkad/Makefile.in | 2 ++ src/rxkad/test/Makefile.in | 4 +++- src/rxkad/test/stress_c.c | 4 ---- src/rxkad/ticket5.c | 1 - tests/auth/superuser-t.c | 5 ----- tests/common/Makefile.in | 2 ++ tests/common/rxkad.c | 4 ---- 15 files changed, 16 insertions(+), 31 deletions(-) diff --git a/src/auth/Makefile.in b/src/auth/Makefile.in index 9db74f9dea..3f132f13a5 100644 --- a/src/auth/Makefile.in +++ b/src/auth/Makefile.in @@ -123,6 +123,7 @@ acfg_errors.c: acfg_errors.et cellconfig.h: acfg_errors.et cellconfig.p.h ${COMPILE_ET_H} -p ${srcdir} acfg_errors -h cellconfig +CFLAGS_authcon.lo = @CFLAGS_NODEPRECATED_DECLARATIONS@ authcon.lo: cellconfig.h cellconfig.lo: cellconfig.h copyauth.o: cellconfig.h diff --git a/src/auth/authcon.c b/src/auth/authcon.c index 1a428d2f68..22ab5d1045 100644 --- a/src/auth/authcon.c +++ b/src/auth/authcon.c @@ -13,10 +13,6 @@ #include -#ifdef IGNORE_SOME_GCC_WARNINGS -# pragma GCC diagnostic warning "-Wdeprecated-declarations" -#endif - #include #include diff --git a/src/cf/osconf.m4 b/src/cf/osconf.m4 index e5153e6f16..c6327a7688 100644 --- a/src/cf/osconf.m4 +++ b/src/cf/osconf.m4 @@ -620,6 +620,7 @@ CFLAGS_NOIMPLICIT_FALLTHROUGH= CFLAGS_NOCAST_FUNCTION_TYPE= CFLAGS_NODANGLING_POINTER= CFLAGS_NOSTRICT_PROTOTYPES= +CFLAGS_NODEPRECATED_DECLARATIONS= XCFLAGS_NOCHECKING="$XCFLAGS" if test "x$GCC" = "xyes"; then @@ -637,6 +638,7 @@ if test "x$GCC" = "xyes"; then CFLAGS_NOUNUSED="-Wno-unused" CFLAGS_NOOLDSTYLE="-Wno-old-style-definition" CFLAGS_NOSTRICT_PROTOTYPES=-Wno-strict-prototypes + CFLAGS_NODEPRECATED_DECLARATIONS=-Wno-deprecated-declarations AX_APPEND_COMPILE_FLAGS([-Wno-implicit-fallthrough], [CFLAGS_NOIMPLICIT_FALLTHROUGH], [-Werror]) AX_APPEND_COMPILE_FLAGS([-Wno-dangling-pointer], @@ -739,6 +741,7 @@ AC_SUBST(CFLAGS_NOIMPLICIT_FALLTHROUGH) AC_SUBST(CFLAGS_NOCAST_FUNCTION_TYPE) AC_SUBST(CFLAGS_NODANGLING_POINTER) AC_SUBST(CFLAGS_NOSTRICT_PROTOTYPES) +AC_SUBST(CFLAGS_NODEPRECATED_DECLARATIONS) AC_SUBST(CFLAGS_WERROR) AC_SUBST(XCFLAGS64) AC_SUBST(XLDFLAGS) diff --git a/src/kauth/Makefile.in b/src/kauth/Makefile.in index f147c5cc5e..71ef22f015 100644 --- a/src/kauth/Makefile.in +++ b/src/kauth/Makefile.in @@ -122,6 +122,8 @@ kaserver.o: kaserver.c ${INCLS} AFS_component_version_number.o kadatabase.o: kadatabase.c ${INCLS} +CFLAGS_kaprocs.o = @CFLAGS_NODEPRECATED_DECLARATIONS@ +CFLAGS_kaprocs.lo = @CFLAGS_NODEPRECATED_DECLARATIONS@ kaprocs.o: kaprocs.c ${INCLS} kaport.h kaerrors.c: kaerrors.et @@ -239,6 +241,8 @@ kdb: kdb.o ${INCLS} ${LIBS} libkauth.a kdb.o: kdb.c AFS_component_version_number.o +CFLAGS_krb_udp.o = @CFLAGS_NODEPRECATED_DECLARATIONS@ +CFLAGS_krb_udp.lo = @CFLAGS_NODEPRECATED_DECLARATIONS@ krb_udp.o: krb_udp.c kaserver.h kautils.h kauth.h prot.h ${TOP_INCDIR}/lwp.h AFS_component_version_number.o krb_udp: krb_udp.o libkauth.a $(KLIBS) diff --git a/src/kauth/kaprocs.c b/src/kauth/kaprocs.c index ae6c91cbdd..c91fbb49b4 100644 --- a/src/kauth/kaprocs.c +++ b/src/kauth/kaprocs.c @@ -18,10 +18,6 @@ # include #endif -#ifdef IGNORE_SOME_GCC_WARNINGS -# pragma GCC diagnostic warning "-Wdeprecated-declarations" -#endif - #include "kauth.h" #include diff --git a/src/kauth/krb_udp.c b/src/kauth/krb_udp.c index 18698ed569..64d2c39efb 100644 --- a/src/kauth/krb_udp.c +++ b/src/kauth/krb_udp.c @@ -18,10 +18,6 @@ #include -#ifdef IGNORE_SOME_GCC_WARNINGS -# pragma GCC diagnostic warning "-Wdeprecated-declarations" -#endif - #ifdef AFS_NT40_ENV #include #endif diff --git a/src/libafscp/Makefile.in b/src/libafscp/Makefile.in index 2eacac9ac1..c3c11e33af 100644 --- a/src/libafscp/Makefile.in +++ b/src/libafscp/Makefile.in @@ -39,6 +39,7 @@ depinstall: \ ${TOP_INCDIR}/afs/afscp.h: afscp.h ${INSTALL_DATA} $? $@ +CFLAGS_afscp_util.o = @CFLAGS_NODEPRECATED_DECLARATIONS@ CPPFLAGS_afscp_util.o = $(KRB5CPPFLAGS) CPPFLAGS_afscp_server.o = $(KRB5CPPFLAGS) diff --git a/src/libafscp/afscp_util.c b/src/libafscp/afscp_util.c index 954153e87b..00620b7ba4 100644 --- a/src/libafscp/afscp_util.c +++ b/src/libafscp/afscp_util.c @@ -31,10 +31,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include -#ifdef IGNORE_SOME_GCC_WARNINGS -# pragma GCC diagnostic warning "-Wdeprecated-declarations" -#endif - #include #include #ifndef AFSCONF_CLIENTNAME diff --git a/src/rxkad/Makefile.in b/src/rxkad/Makefile.in index 99d42e5136..4303d82f62 100644 --- a/src/rxkad/Makefile.in +++ b/src/rxkad/Makefile.in @@ -95,6 +95,8 @@ rxkad_common.o rxkad_common.lo: rxkad.h rxkad_server.o rxkad_server.lo: rxkad.h ticket5.o ticket5.lo: rxkad.h ticket.o ticket.lo: rxkad.h +CFLAGS_ticket5.o = @CFLAGS_NODEPRECATED_DECLARATIONS@ +CFLAGS_ticket5.lo = @CFLAGS_NODEPRECATED_DECLARATIONS@ tcrypt.o: tcrypt.c AFS_component_version_number.o diff --git a/src/rxkad/test/Makefile.in b/src/rxkad/test/Makefile.in index c77e4669c8..c0ea1374d9 100644 --- a/src/rxkad/test/Makefile.in +++ b/src/rxkad/test/Makefile.in @@ -37,7 +37,7 @@ THLIBS= ${TOP_LIBDIR}/libcmd.a \ ${LIB_roken} \ ${MT_LIBS} -lpthread -THRULE = ${MT_CC} $(COMMON_CFLAGS) $(MT_CFLAGS) +THRULE = ${MT_CC} $(COMMON_CFLAGS) $(MT_CFLAGS) $(CFLAGS_$(@)) fc_test_OBJS=fc_test.o @@ -92,6 +92,7 @@ stress_s.o: stress_errs.h stress.o: ${HEADERS} stress_c.o: ${HEADERS} +CFLAGS_stress_c.o = @CFLAGS_NODEPRECATED_DECLARATIONS@ stress_s.o: ${HEADERS} fc_test.o: ${HEADERS} CFLAGS_fc_test.o = -I$(TOP_SRCDIR)/rxkad -I$(TOP_OBJDIR)/src/rxkad @@ -99,6 +100,7 @@ CFLAGS_fc_test.o = -I$(TOP_SRCDIR)/rxkad -I$(TOP_OBJDIR)/src/rxkad th_stress.o: stress.c ${HEADERS} ${THRULE} -c $(srcdir)/stress.c -o th_stress.o +CFLAGS_th_stress_c.o = @CFLAGS_NODEPRECATED_DECLARATIONS@ th_stress_c.o: stress_c.c ${HEADERS} ${THRULE} -c $(srcdir)/stress_c.c -o th_stress_c.o diff --git a/src/rxkad/test/stress_c.c b/src/rxkad/test/stress_c.c index fa77d4774e..69a298d107 100644 --- a/src/rxkad/test/stress_c.c +++ b/src/rxkad/test/stress_c.c @@ -14,10 +14,6 @@ #include -#ifdef IGNORE_SOME_GCC_WARNINGS -# pragma GCC diagnostic warning "-Wdeprecated-declarations" -#endif - #include #include diff --git a/src/rxkad/ticket5.c b/src/rxkad/ticket5.c index 0820ce6e65..a97f82fdc6 100644 --- a/src/rxkad/ticket5.c +++ b/src/rxkad/ticket5.c @@ -61,7 +61,6 @@ #include #ifdef IGNORE_SOME_GCC_WARNINGS -# pragma GCC diagnostic warning "-Wdeprecated-declarations" # pragma GCC diagnostic warning "-Wimplicit-function-declaration" #endif diff --git a/tests/auth/superuser-t.c b/tests/auth/superuser-t.c index a08938ec15..34042e7bbd 100644 --- a/tests/auth/superuser-t.c +++ b/tests/auth/superuser-t.c @@ -32,10 +32,6 @@ #include #include -#ifdef IGNORE_SOME_GCC_WARNINGS -# pragma GCC diagnostic warning "-Wdeprecated-declarations" -#endif - #include #include #include @@ -43,7 +39,6 @@ #include #include -#include #include #include "test.h" diff --git a/tests/common/Makefile.in b/tests/common/Makefile.in index 176167ece3..4f0d1008fe 100644 --- a/tests/common/Makefile.in +++ b/tests/common/Makefile.in @@ -15,6 +15,8 @@ LT_deps = $(top_builddir)/tests/tap/libafstest_tap.la \ all: libafstest_common.la +CFLAGS_rxkad.lo = @CFLAGS_NODEPRECATED_DECLARATIONS@ + # This library is just used internally for our tests, so use # LT_LDLIB_shlib_internal so we don't need to manage a .sym export list. libafstest_common.la: $(LT_objs) $(LT_deps) diff --git a/tests/common/rxkad.c b/tests/common/rxkad.c index c111da2c7f..f6d027ca1d 100644 --- a/tests/common/rxkad.c +++ b/tests/common/rxkad.c @@ -26,10 +26,6 @@ #include -#ifdef IGNORE_SOME_GCC_WARNINGS -# pragma GCC diagnostic warning "-Wdeprecated-declarations" -#endif - #include #include