From 90880522259a389c7e4e29a240370e676b7d2b25 Mon Sep 17 00:00:00 2001 From: Michal Nowak Date: Fri, 6 Nov 2020 12:27:41 +0100 Subject: [PATCH 1/3] Drop unused headers --- bin/rndc/include/rndc/os.h | 34 ------------------- lib/isc/Makefile.am | 3 +- lib/isc/timer_p.h | 23 ------------- lib/isccfg/Makefile.am | 1 - lib/isccfg/include/isccfg/dnsconf.h | 28 --------------- lib/isccfg/win32/libisccfg.vcxproj.filters.in | 3 -- lib/isccfg/win32/libisccfg.vcxproj.in | 1 - util/copyrights | 3 -- 8 files changed, 1 insertion(+), 95 deletions(-) delete mode 100644 bin/rndc/include/rndc/os.h delete mode 100644 lib/isc/timer_p.h delete mode 100644 lib/isccfg/include/isccfg/dnsconf.h diff --git a/bin/rndc/include/rndc/os.h b/bin/rndc/include/rndc/os.h deleted file mode 100644 index acb50ae718..0000000000 --- a/bin/rndc/include/rndc/os.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, you can obtain one at https://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - -/*! \file */ - -#ifndef RNDC_OS_H -#define RNDC_OS_H 1 - -#include - -#include - -ISC_LANG_BEGINDECLS - -int -set_user(FILE *fd, const char *user); -/*%< - * Set the owner of the file referenced by 'fd' to 'user'. - * Returns: - * 0 success - * -1 insufficient permissions, or 'user' does not exist. - */ - -ISC_LANG_ENDDECLS - -#endif /* ifndef RNDC_OS_H */ diff --git a/lib/isc/Makefile.am b/lib/isc/Makefile.am index 67408322cc..82eae08351 100644 --- a/lib/isc/Makefile.am +++ b/lib/isc/Makefile.am @@ -216,8 +216,7 @@ libisc_la_SOURCES = \ entropy_private.h \ fsaccess_common_p.h \ mem_p.h \ - task_p.h \ - timer_p.h + task_p.h libisc_la_CPPFLAGS = \ $(AM_CPPFLAGS) \ diff --git a/lib/isc/timer_p.h b/lib/isc/timer_p.h deleted file mode 100644 index ac11582e6c..0000000000 --- a/lib/isc/timer_p.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, you can obtain one at https://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - -#ifndef ISC_TIMER_P_H -#define ISC_TIMER_P_H - -/*! \file */ - -isc_result_t -isc__timermgr_nextevent(isc_timermgr_t *timermgr, isc_time_t *when); - -void -isc__timermgr_dispatch(isc_timermgr_t *timermgr); - -#endif /* ISC_TIMER_P_H */ diff --git a/lib/isccfg/Makefile.am b/lib/isccfg/Makefile.am index eb4b7d53d9..09b8a7065b 100644 --- a/lib/isccfg/Makefile.am +++ b/lib/isccfg/Makefile.am @@ -6,7 +6,6 @@ libisccfg_ladir = $(includedir)/isccfg libisccfg_la_HEADERS = \ include/isccfg/aclconf.h \ include/isccfg/cfg.h \ - include/isccfg/dnsconf.h \ include/isccfg/grammar.h \ include/isccfg/kaspconf.h \ include/isccfg/log.h \ diff --git a/lib/isccfg/include/isccfg/dnsconf.h b/lib/isccfg/include/isccfg/dnsconf.h deleted file mode 100644 index 5878c60709..0000000000 --- a/lib/isccfg/include/isccfg/dnsconf.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, you can obtain one at https://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - -#ifndef ISCCFG_DNSCONF_H -#define ISCCFG_DNSCONF_H 1 - -/*! \file - * \brief - * This module defines the named.conf, rndc.conf, and rndc.key grammars. - */ - -#include - -/* - * Configuration object types. - */ -LIBISCCFG_EXTERNAL_DATA extern cfg_type_t cfg_type_dnsconf; -/*%< A complete dns.conf file. */ - -#endif /* ISCCFG_DNSCONF_H */ diff --git a/lib/isccfg/win32/libisccfg.vcxproj.filters.in b/lib/isccfg/win32/libisccfg.vcxproj.filters.in index 70aebf1879..3d2faaf980 100644 --- a/lib/isccfg/win32/libisccfg.vcxproj.filters.in +++ b/lib/isccfg/win32/libisccfg.vcxproj.filters.in @@ -44,9 +44,6 @@ Header Files - - Header Files - Header Files diff --git a/lib/isccfg/win32/libisccfg.vcxproj.in b/lib/isccfg/win32/libisccfg.vcxproj.in index c828431b5f..e92129ed1f 100644 --- a/lib/isccfg/win32/libisccfg.vcxproj.in +++ b/lib/isccfg/win32/libisccfg.vcxproj.in @@ -128,7 +128,6 @@ - diff --git a/util/copyrights b/util/copyrights index 5b5de94f1c..1b29c20edf 100644 --- a/util/copyrights +++ b/util/copyrights @@ -190,7 +190,6 @@ ./bin/pkcs11/win32/pk11tokens.vcxproj.user X 2014,2018,2019,2020 ./bin/plugins/filter-aaaa.c C 2018,2019,2020 ./bin/plugins/filter-aaaa.rst RST 2020 -./bin/rndc/include/rndc/os.h C 2001,2004,2005,2007,2009,2016,2018,2019,2020 ./bin/rndc/rndc.c C 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./bin/rndc/rndc.conf.rst RST 2020 ./bin/rndc/rndc.rst RST 2020 @@ -1961,7 +1960,6 @@ ./lib/isc/tests/time_test.c C 2014,2015,2016,2018,2019,2020 ./lib/isc/tests/timer_test.c C 2018,2019,2020 ./lib/isc/timer.c C 1998,1999,2000,2001,2002,2004,2005,2007,2008,2009,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 -./lib/isc/timer_p.h C 2000,2001,2004,2005,2007,2009,2016,2017,2018,2019,2020 ./lib/isc/tm.c C 2014,2016,2018,2019,2020 ./lib/isc/unix/dir.c C 1999,2000,2001,2004,2005,2007,2008,2009,2011,2012,2016,2017,2018,2019,2020 ./lib/isc/unix/errno.c C 2016,2018,2019,2020 @@ -2077,7 +2075,6 @@ ./lib/isccfg/dnsconf.c C 2009,2016,2018,2019,2020 ./lib/isccfg/include/isccfg/aclconf.h C 1999,2000,2001,2004,2005,2006,2007,2010,2011,2012,2013,2014,2016,2018,2019,2020 ./lib/isccfg/include/isccfg/cfg.h C 2000,2001,2002,2004,2005,2006,2007,2010,2013,2014,2015,2016,2018,2019,2020 -./lib/isccfg/include/isccfg/dnsconf.h C 2009,2016,2018,2019,2020 ./lib/isccfg/include/isccfg/grammar.h C 2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2013,2014,2015,2016,2017,2018,2019,2020 ./lib/isccfg/include/isccfg/kaspconf.h C 2019,2020 ./lib/isccfg/include/isccfg/log.h C 2001,2004,2005,2006,2007,2009,2016,2018,2019,2020 From a0d359bbfa3227b8bf3536c5df87161ae8991831 Mon Sep 17 00:00:00 2001 From: Michal Nowak Date: Fri, 6 Nov 2020 12:28:26 +0100 Subject: [PATCH 2/3] Add unused headers check to CI --- .gitlab-ci.yml | 1 + util/copyrights | 1 + util/unused-headers.sh | 29 +++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+) create mode 100755 util/unused-headers.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3e939721b8..6c5dee8ac2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -466,6 +466,7 @@ misc: - sh util/check-win32util-configure - sh util/check-categories.sh - if git grep SYSTEMTESTTOP -- ':!.gitlab-ci.yml'; then echo 'Please use relative paths instead of $SYSTEMTESTTOP.'; exit 1; fi + - bash util/unused-headers.sh needs: [] artifacts: paths: diff --git a/util/copyrights b/util/copyrights index 1b29c20edf..161226d4de 100644 --- a/util/copyrights +++ b/util/copyrights @@ -2193,6 +2193,7 @@ ./util/run-clang-tidy X 2020 ./util/spacewhack.pl PERL 2000,2001,2004,2007,2012,2016,2018,2019,2020 ./util/tabify-changes SH 2004,2007,2012,2016,2018,2019,2020 +./util/unused-headers.sh SH 2020 ./util/update-drafts.pl PERL 2000,2001,2004,2007,2012,2016,2018,2019,2020 ./util/update_branches PERL 2005,2007,2012,2016,2018,2019,2020 ./util/update_copyrights PERL 1998,1999,2000,2001,2004,2005,2006,2007,2008,2009,2010,2012,2013,2014,2015,2016,2017,2018,2019,2020 diff --git a/util/unused-headers.sh b/util/unused-headers.sh new file mode 100755 index 0000000000..35af0f69f8 --- /dev/null +++ b/util/unused-headers.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# +# Copyright (C) Internet Systems Consortium, Inc. ("ISC") +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, you can obtain one at https://mozilla.org/MPL/2.0/. +# +# See the COPYRIGHT file distributed with this work for additional +# information regarding copyright ownership. + +unused_headers=$( + git ls-files -- '*.h' ':!:*include*' ':!:*rdata*' ':!:*win32*' | + sed 's|.*/\(.*\.h\)|\1|' | + while read -r header; do + git grep -q "#include \".*${header}\"" || echo "${header}" + done + + git ls-files -- '*include/*.h' | + sed 's|.*/include\/\(.*\.h\)|\1|' | + while read -r header; do + git grep -q "#include <${header}>" || echo "${header}" + done +) + +if [ -n "${unused_headers}" ]; then + echo -e "Following headers are unused:\n${unused_headers}" + exit 1 +fi From 096b0b2195ea7e951dcf9aa9438f739963908976 Mon Sep 17 00:00:00 2001 From: Michal Nowak Date: Fri, 6 Nov 2020 14:42:20 +0100 Subject: [PATCH 3/3] Add CHANGES entry --- CHANGES | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGES b/CHANGES index d7abfabb05..03542d8df4 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,8 @@ +5532. [cleanup] Unused header files were removed: + bin/rndc/include/rndc/os.h, lib/isc/timer_p.h, + lib/isccfg/include/isccfg/dnsconf.h and code related + to those files. [GL #1913] + 5531. [func] Add a netmgr TLS layer, enabling server-side DoT support (not yet available), and client-side DoT support in dig with "dig +tls". [GL #1840]