git: 6bfca4dcab07 - main - tools: Automated cleanup of cdefs and other formatting

From: Warner Losh <imp_at_FreeBSD.org>
Date: Mon, 27 Nov 2023 05:25:08 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=6bfca4dcab07dad45a805879d954876b353c0810

commit 6bfca4dcab07dad45a805879d954876b353c0810
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2023-11-24 20:12:57 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-11-27 05:24:01 +0000

    tools: Automated cleanup of cdefs and other formatting
    
    Apply the following automated changes to try to eliminate
    no-longer-needed sys/cdefs.h includes as well as now-empty
    blank lines in a row.
    
    Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
    Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
    Remove /\n+#if.*\n#endif.*\n+/
    Remove /^#if.*\n#endif.*\n/
    Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
    Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
    Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/
    
    Sponsored by:           Netflix
---
 tools/build/cross-build/capsicum_stubs.c                        | 2 +-
 tools/build/cross-build/fgetln_fallback.c                       | 2 +-
 tools/build/cross-build/include/linux/libutil.h                 | 1 -
 tools/bus_space/C/lang.c                                        | 1 -
 tools/regression/aio/aiop/aiop.c                                | 1 -
 tools/regression/capsicum/syscalls/cap_fcntls_limit.c           | 1 -
 tools/regression/capsicum/syscalls/cap_getmode.c                | 1 -
 tools/regression/capsicum/syscalls/cap_ioctls_limit.c           | 1 -
 tools/regression/capsicum/syscalls/misc.c                       | 1 -
 tools/regression/ethernet/ethermulti/ethermulti.c               | 1 -
 tools/regression/geom_gpt/gctl_test_helper.c                    | 1 -
 tools/regression/kthread/kld/kthrdlk.c                          | 1 -
 tools/regression/netinet/ipbroadcast/ipbroadcast.c              | 1 -
 tools/regression/netinet/ipmulticast/ipmulticast.c              | 1 -
 tools/regression/netinet6/inet6_rth/inet6_rth-segments.c        | 1 -
 tools/regression/netinet6/inet6_rth/test_subr.c                 | 1 -
 tools/regression/posixsem/posixsem.c                            | 1 -
 tools/regression/redzone9/redzone.c                             | 1 -
 tools/regression/security/cap_test/cap_test_capabilities.c      | 1 -
 tools/regression/security/cap_test/cap_test_capmode.c           | 1 -
 tools/regression/security/cap_test/cap_test_fcntl.c             | 1 -
 tools/regression/security/cap_test/cap_test_pdfork.c            | 1 -
 tools/regression/security/cap_test/cap_test_pdkill.c            | 1 -
 tools/regression/security/cap_test/cap_test_relative.c          | 1 -
 tools/regression/security/cap_test/cap_test_sysctl.c            | 1 -
 tools/regression/security/open_to_operation/open_to_operation.c | 1 -
 tools/regression/sockets/udp_pingpong/udp_pingpong.c            | 1 -
 tools/regression/sockets/unix_cmsg/t_cmsg_len.c                 | 1 -
 tools/regression/sockets/unix_cmsg/t_cmsgcred.c                 | 1 -
 tools/regression/sockets/unix_cmsg/t_cmsgcred_sockcred.c        | 1 -
 tools/regression/sockets/unix_cmsg/t_generic.c                  | 1 -
 tools/regression/sockets/unix_cmsg/t_peercred.c                 | 1 -
 tools/regression/sockets/unix_cmsg/t_sockcred.c                 | 1 -
 tools/regression/sockets/unix_cmsg/unix_cmsg.c                  | 1 -
 tools/test/iconv/const-gnuism.c                                 | 1 -
 tools/test/iconv/posix/posix.c                                  | 1 -
 tools/test/pthread_vfork/pthread_vfork_test.c                   | 1 -
 tools/test/ptrace/scescx.c                                      | 1 -
 tools/test/stress2/misc/kern_umtx_inf_loop.sh                   | 1 -
 tools/test/stress2/misc/ldt.sh                                  | 1 -
 tools/tools/aac/aac_checkq.c                                    | 1 -
 tools/tools/bootparttest/bootparttest.c                         | 1 -
 tools/tools/dmardump/dmardump.c                                 | 1 -
 tools/tools/drm/radeon/mkregtable/mkregtable.c                  | 1 -
 tools/tools/ifpifa/ifpifa.c                                     | 2 +-
 tools/tools/ipw/ipwstats.c                                      | 1 -
 tools/tools/iwi/iwistats.c                                      | 1 -
 tools/tools/mfi/mfi_checkq.c                                    | 1 -
 tools/tools/ncpus/biosmptable.c                                 | 1 -
 tools/tools/netmap/nmreplay.c                                   | 3 +--
 tools/tools/pciroms/pciroms.c                                   | 1 -
 tools/tools/pirtool/pirtool.c                                   | 2 +-
 tools/tools/switch_tls/switch_tls.c                             | 1 -
 tools/tools/tscdrift/tscdrift.c                                 | 2 --
 tools/tools/vhba/vhba.h                                         | 2 +-
 55 files changed, 6 insertions(+), 57 deletions(-)

diff --git a/tools/build/cross-build/capsicum_stubs.c b/tools/build/cross-build/capsicum_stubs.c
index 5c7d0e617adf..75eff8534fc4 100644
--- a/tools/build/cross-build/capsicum_stubs.c
+++ b/tools/build/cross-build/capsicum_stubs.c
@@ -33,7 +33,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
-#include <sys/cdefs.h>
+
 #include <sys/types.h>
 #include <sys/capsicum.h>
 
diff --git a/tools/build/cross-build/fgetln_fallback.c b/tools/build/cross-build/fgetln_fallback.c
index 9bd202c125da..000cd38ce596 100644
--- a/tools/build/cross-build/fgetln_fallback.c
+++ b/tools/build/cross-build/fgetln_fallback.c
@@ -26,7 +26,7 @@
  */
 
 #include <stdio.h>
-#include <sys/cdefs.h>
+
 #include <sys/types.h>
 #include <string.h>
 
diff --git a/tools/build/cross-build/include/linux/libutil.h b/tools/build/cross-build/include/linux/libutil.h
index 3a9652c27098..8f9ca406edc1 100644
--- a/tools/build/cross-build/include/linux/libutil.h
+++ b/tools/build/cross-build/include/linux/libutil.h
@@ -35,7 +35,6 @@
  */
 #pragma once
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 
diff --git a/tools/bus_space/C/lang.c b/tools/bus_space/C/lang.c
index a96a45f212e2..e6d242b5a7f8 100644
--- a/tools/bus_space/C/lang.c
+++ b/tools/bus_space/C/lang.c
@@ -24,7 +24,6 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <errno.h>
 
diff --git a/tools/regression/aio/aiop/aiop.c b/tools/regression/aio/aiop/aiop.c
index e83e9047cb86..4b6bc986600b 100644
--- a/tools/regression/aio/aiop/aiop.c
+++ b/tools/regression/aio/aiop/aiop.c
@@ -38,7 +38,6 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <sys/disk.h>
 #include <sys/ioctl.h>
diff --git a/tools/regression/capsicum/syscalls/cap_fcntls_limit.c b/tools/regression/capsicum/syscalls/cap_fcntls_limit.c
index 55627579963b..d26f3e3b7c36 100644
--- a/tools/regression/capsicum/syscalls/cap_fcntls_limit.c
+++ b/tools/regression/capsicum/syscalls/cap_fcntls_limit.c
@@ -27,7 +27,6 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <sys/capsicum.h>
 #include <sys/procdesc.h>
diff --git a/tools/regression/capsicum/syscalls/cap_getmode.c b/tools/regression/capsicum/syscalls/cap_getmode.c
index a2584895b179..72596b615877 100644
--- a/tools/regression/capsicum/syscalls/cap_getmode.c
+++ b/tools/regression/capsicum/syscalls/cap_getmode.c
@@ -27,7 +27,6 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <sys/capsicum.h>
 #include <sys/procdesc.h>
diff --git a/tools/regression/capsicum/syscalls/cap_ioctls_limit.c b/tools/regression/capsicum/syscalls/cap_ioctls_limit.c
index b0d392c8f0c0..68bdefb417ce 100644
--- a/tools/regression/capsicum/syscalls/cap_ioctls_limit.c
+++ b/tools/regression/capsicum/syscalls/cap_ioctls_limit.c
@@ -27,7 +27,6 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/cdefs.h>
 #include <sys/param.h>
 #include <sys/capsicum.h>
 #include <sys/ioctl.h>
diff --git a/tools/regression/capsicum/syscalls/misc.c b/tools/regression/capsicum/syscalls/misc.c
index 914c606ac904..704fd70b83ff 100644
--- a/tools/regression/capsicum/syscalls/misc.c
+++ b/tools/regression/capsicum/syscalls/misc.c
@@ -27,7 +27,6 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <sys/select.h>
 #include <sys/socket.h>
diff --git a/tools/regression/ethernet/ethermulti/ethermulti.c b/tools/regression/ethernet/ethermulti/ethermulti.c
index b278a106b946..4b1b00c78cab 100644
--- a/tools/regression/ethernet/ethermulti/ethermulti.c
+++ b/tools/regression/ethernet/ethermulti/ethermulti.c
@@ -24,7 +24,6 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/time.h>
diff --git a/tools/regression/geom_gpt/gctl_test_helper.c b/tools/regression/geom_gpt/gctl_test_helper.c
index 700ce0aeb169..1ac8dceb50fd 100644
--- a/tools/regression/geom_gpt/gctl_test_helper.c
+++ b/tools/regression/geom_gpt/gctl_test_helper.c
@@ -24,7 +24,6 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <sys/cdefs.h>
 #include <sys/param.h>
 #include <assert.h>
 #include <err.h>
diff --git a/tools/regression/kthread/kld/kthrdlk.c b/tools/regression/kthread/kld/kthrdlk.c
index 8e4ed1a35853..5d970b95959d 100644
--- a/tools/regression/kthread/kld/kthrdlk.c
+++ b/tools/regression/kthread/kld/kthrdlk.c
@@ -32,7 +32,6 @@
  *
  */
 
-#include <sys/cdefs.h>
 #include <sys/param.h>
 #include <sys/kernel.h>
 #include <sys/kthread.h>
diff --git a/tools/regression/netinet/ipbroadcast/ipbroadcast.c b/tools/regression/netinet/ipbroadcast/ipbroadcast.c
index 43957e9fd108..6177ce964749 100644
--- a/tools/regression/netinet/ipbroadcast/ipbroadcast.c
+++ b/tools/regression/netinet/ipbroadcast/ipbroadcast.c
@@ -28,7 +28,6 @@
  * Test utility for IPv4 broadcast sockets.
  */
 
-#include <sys/cdefs.h>
 #include <sys/param.h>
 #include <sys/types.h>
 #include <sys/ioctl.h>
diff --git a/tools/regression/netinet/ipmulticast/ipmulticast.c b/tools/regression/netinet/ipmulticast/ipmulticast.c
index 7bd97dfc002a..eb06c544a7ea 100644
--- a/tools/regression/netinet/ipmulticast/ipmulticast.c
+++ b/tools/regression/netinet/ipmulticast/ipmulticast.c
@@ -32,7 +32,6 @@
  * TODO: Merge multicast socket option tests from ipsockopt.
  */
 
-#include <sys/cdefs.h>
 #include <sys/param.h>
 #include <sys/types.h>
 #include <sys/ioctl.h>
diff --git a/tools/regression/netinet6/inet6_rth/inet6_rth-segments.c b/tools/regression/netinet6/inet6_rth/inet6_rth-segments.c
index c3de967cc5b5..5ca6bfcdde76 100644
--- a/tools/regression/netinet6/inet6_rth/inet6_rth-segments.c
+++ b/tools/regression/netinet6/inet6_rth/inet6_rth-segments.c
@@ -25,7 +25,6 @@
  *
  */
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 
diff --git a/tools/regression/netinet6/inet6_rth/test_subr.c b/tools/regression/netinet6/inet6_rth/test_subr.c
index 2beedd837027..59d4e43fff6d 100644
--- a/tools/regression/netinet6/inet6_rth/test_subr.c
+++ b/tools/regression/netinet6/inet6_rth/test_subr.c
@@ -25,7 +25,6 @@
  *
  */
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 
 #include <stdio.h>
diff --git a/tools/regression/posixsem/posixsem.c b/tools/regression/posixsem/posixsem.c
index d03a64c04b9b..0668a0d4f4fb 100644
--- a/tools/regression/posixsem/posixsem.c
+++ b/tools/regression/posixsem/posixsem.c
@@ -30,7 +30,6 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/cdefs.h>
 #include <sys/param.h>
 #include <sys/queue.h>
 #include <sys/_semaphore.h>
diff --git a/tools/regression/redzone9/redzone.c b/tools/regression/redzone9/redzone.c
index d4d5c3e3e785..579e5a08cda7 100644
--- a/tools/regression/redzone9/redzone.c
+++ b/tools/regression/redzone9/redzone.c
@@ -24,7 +24,6 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/cdefs.h>
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
diff --git a/tools/regression/security/cap_test/cap_test_capabilities.c b/tools/regression/security/cap_test/cap_test_capabilities.c
index 9fa60a2f8dd2..b22749360bb1 100644
--- a/tools/regression/security/cap_test/cap_test_capabilities.c
+++ b/tools/regression/security/cap_test/cap_test_capabilities.c
@@ -34,7 +34,6 @@
  * various object types.
  */
 
-#include <sys/cdefs.h>
 #include <sys/param.h>
 #include <sys/capsicum.h>
 #include <sys/errno.h>
diff --git a/tools/regression/security/cap_test/cap_test_capmode.c b/tools/regression/security/cap_test/cap_test_capmode.c
index 81dce2e758e2..9d1eaf45ea85 100644
--- a/tools/regression/security/cap_test/cap_test_capmode.c
+++ b/tools/regression/security/cap_test/cap_test_capmode.c
@@ -31,7 +31,6 @@
  * whether or not they return the expected ECAPMODE.
  */
 
-#include <sys/cdefs.h>
 #include <sys/param.h>
 #include <sys/capsicum.h>
 #include <sys/errno.h>
diff --git a/tools/regression/security/cap_test/cap_test_fcntl.c b/tools/regression/security/cap_test/cap_test_fcntl.c
index b08bc3f88288..5ef9c55a3e4d 100644
--- a/tools/regression/security/cap_test/cap_test_fcntl.c
+++ b/tools/regression/security/cap_test/cap_test_fcntl.c
@@ -29,7 +29,6 @@
  * Test that fcntl works in capability mode.
  */
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <sys/capsicum.h>
 #include <sys/errno.h>
diff --git a/tools/regression/security/cap_test/cap_test_pdfork.c b/tools/regression/security/cap_test/cap_test_pdfork.c
index 791c83855647..fdd0b5d6ad04 100644
--- a/tools/regression/security/cap_test/cap_test_pdfork.c
+++ b/tools/regression/security/cap_test/cap_test_pdfork.c
@@ -31,7 +31,6 @@
  * whether or not they return the expected ECAPMODE.
  */
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 
 #include <sys/capsium.h>
diff --git a/tools/regression/security/cap_test/cap_test_pdkill.c b/tools/regression/security/cap_test/cap_test_pdkill.c
index be4cae793d5b..2f2a18b3baa7 100644
--- a/tools/regression/security/cap_test/cap_test_pdkill.c
+++ b/tools/regression/security/cap_test/cap_test_pdkill.c
@@ -31,7 +31,6 @@
  * whether or not they return the expected ECAPMODE.
  */
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 
 #include <sys/capsicum.h>
diff --git a/tools/regression/security/cap_test/cap_test_relative.c b/tools/regression/security/cap_test/cap_test_relative.c
index 517ff0bf5733..ef2e561b0158 100644
--- a/tools/regression/security/cap_test/cap_test_relative.c
+++ b/tools/regression/security/cap_test/cap_test_relative.c
@@ -25,7 +25,6 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/cdefs.h>
 #include <sys/param.h>
 #include <sys/capsicum.h>
 #include <sys/errno.h>
diff --git a/tools/regression/security/cap_test/cap_test_sysctl.c b/tools/regression/security/cap_test/cap_test_sysctl.c
index 04982c1e9fc0..dcc6970606da 100644
--- a/tools/regression/security/cap_test/cap_test_sysctl.c
+++ b/tools/regression/security/cap_test/cap_test_sysctl.c
@@ -29,7 +29,6 @@
  * Test that various sysctls are (and aren't) available on capability mode.
  */
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <sys/capsicum.h>
 #include <sys/errno.h>
diff --git a/tools/regression/security/open_to_operation/open_to_operation.c b/tools/regression/security/open_to_operation/open_to_operation.c
index 444c574aa078..235b785b5993 100644
--- a/tools/regression/security/open_to_operation/open_to_operation.c
+++ b/tools/regression/security/open_to_operation/open_to_operation.c
@@ -89,7 +89,6 @@
  * XXXRW: message queue and shared memory fds?
  */
 
-#include <sys/cdefs.h>
 #include <sys/param.h>
 #include <sys/mman.h>
 #include <sys/mount.h>
diff --git a/tools/regression/sockets/udp_pingpong/udp_pingpong.c b/tools/regression/sockets/udp_pingpong/udp_pingpong.c
index 9babe144adcb..2fe342debdc6 100644
--- a/tools/regression/sockets/udp_pingpong/udp_pingpong.c
+++ b/tools/regression/sockets/udp_pingpong/udp_pingpong.c
@@ -34,7 +34,6 @@
  * sure it makes sense.
  */
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/wait.h>
diff --git a/tools/regression/sockets/unix_cmsg/t_cmsg_len.c b/tools/regression/sockets/unix_cmsg/t_cmsg_len.c
index c0064f15fd2e..d9e4b6fb99ae 100644
--- a/tools/regression/sockets/unix_cmsg/t_cmsg_len.c
+++ b/tools/regression/sockets/unix_cmsg/t_cmsg_len.c
@@ -24,7 +24,6 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/un.h>
diff --git a/tools/regression/sockets/unix_cmsg/t_cmsgcred.c b/tools/regression/sockets/unix_cmsg/t_cmsgcred.c
index de87f1d62b2a..a1f6dc43e1db 100644
--- a/tools/regression/sockets/unix_cmsg/t_cmsgcred.c
+++ b/tools/regression/sockets/unix_cmsg/t_cmsgcred.c
@@ -24,7 +24,6 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/un.h>
diff --git a/tools/regression/sockets/unix_cmsg/t_cmsgcred_sockcred.c b/tools/regression/sockets/unix_cmsg/t_cmsgcred_sockcred.c
index 323458f9748e..af4232470812 100644
--- a/tools/regression/sockets/unix_cmsg/t_cmsgcred_sockcred.c
+++ b/tools/regression/sockets/unix_cmsg/t_cmsgcred_sockcred.c
@@ -24,7 +24,6 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/un.h>
diff --git a/tools/regression/sockets/unix_cmsg/t_generic.c b/tools/regression/sockets/unix_cmsg/t_generic.c
index 7add752433d8..8b4e251e92fe 100644
--- a/tools/regression/sockets/unix_cmsg/t_generic.c
+++ b/tools/regression/sockets/unix_cmsg/t_generic.c
@@ -24,7 +24,6 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/un.h>
diff --git a/tools/regression/sockets/unix_cmsg/t_peercred.c b/tools/regression/sockets/unix_cmsg/t_peercred.c
index f10ee2833df4..cbea69eaea97 100644
--- a/tools/regression/sockets/unix_cmsg/t_peercred.c
+++ b/tools/regression/sockets/unix_cmsg/t_peercred.c
@@ -24,7 +24,6 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/ucred.h>
diff --git a/tools/regression/sockets/unix_cmsg/t_sockcred.c b/tools/regression/sockets/unix_cmsg/t_sockcred.c
index d6156dc74c39..d5171946f988 100644
--- a/tools/regression/sockets/unix_cmsg/t_sockcred.c
+++ b/tools/regression/sockets/unix_cmsg/t_sockcred.c
@@ -24,7 +24,6 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/un.h>
diff --git a/tools/regression/sockets/unix_cmsg/unix_cmsg.c b/tools/regression/sockets/unix_cmsg/unix_cmsg.c
index 45a2fd021791..bd3753140b46 100644
--- a/tools/regression/sockets/unix_cmsg/unix_cmsg.c
+++ b/tools/regression/sockets/unix_cmsg/unix_cmsg.c
@@ -24,7 +24,6 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <sys/limits.h>
 #include <sys/socket.h>
diff --git a/tools/test/iconv/const-gnuism.c b/tools/test/iconv/const-gnuism.c
index e30a23cc68ac..957f7e0786c7 100644
--- a/tools/test/iconv/const-gnuism.c
+++ b/tools/test/iconv/const-gnuism.c
@@ -24,7 +24,6 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 
 #include <err.h>
diff --git a/tools/test/iconv/posix/posix.c b/tools/test/iconv/posix/posix.c
index 1ca9d43d9caa..36e662f882f7 100644
--- a/tools/test/iconv/posix/posix.c
+++ b/tools/test/iconv/posix/posix.c
@@ -24,7 +24,6 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/cdefs.h>
 #include <sys/param.h>
 #include <sys/endian.h>
 
diff --git a/tools/test/pthread_vfork/pthread_vfork_test.c b/tools/test/pthread_vfork/pthread_vfork_test.c
index 1f65f70a1c3c..6525e51fe6f7 100644
--- a/tools/test/pthread_vfork/pthread_vfork_test.c
+++ b/tools/test/pthread_vfork/pthread_vfork_test.c
@@ -26,7 +26,6 @@
  *
  */
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <err.h>
diff --git a/tools/test/ptrace/scescx.c b/tools/test/ptrace/scescx.c
index fc6aed86da4b..27a00b40f737 100644
--- a/tools/test/ptrace/scescx.c
+++ b/tools/test/ptrace/scescx.c
@@ -23,7 +23,6 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <sys/ptrace.h>
 #include <sys/syscall.h>
diff --git a/tools/test/stress2/misc/kern_umtx_inf_loop.sh b/tools/test/stress2/misc/kern_umtx_inf_loop.sh
index b8088814d7b2..2c4d99149480 100755
--- a/tools/test/stress2/misc/kern_umtx_inf_loop.sh
+++ b/tools/test/stress2/misc/kern_umtx_inf_loop.sh
@@ -46,7 +46,6 @@ EOF
  * SUCH DAMAGE.
  */
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 
 #include <machine/cpufunc.h>
diff --git a/tools/test/stress2/misc/ldt.sh b/tools/test/stress2/misc/ldt.sh
index 21c7055d76fe..7b23548c9eea 100755
--- a/tools/test/stress2/misc/ldt.sh
+++ b/tools/test/stress2/misc/ldt.sh
@@ -284,7 +284,6 @@ EOF
 	cat > fault.c <<EOF
 /* \$Id: fault.c,v 1.5 2008/10/28 17:39:16 kostik Exp \$ */
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <sys/ucontext.h>
 #include <errno.h>
diff --git a/tools/tools/aac/aac_checkq.c b/tools/tools/aac/aac_checkq.c
index 220d2eb7b793..007f224ba003 100644
--- a/tools/tools/aac/aac_checkq.c
+++ b/tools/tools/aac/aac_checkq.c
@@ -23,7 +23,6 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <sys/fcntl.h>
 #include <sys/ioctl.h>
diff --git a/tools/tools/bootparttest/bootparttest.c b/tools/tools/bootparttest/bootparttest.c
index af784027f95e..7556f02929f8 100644
--- a/tools/tools/bootparttest/bootparttest.c
+++ b/tools/tools/bootparttest/bootparttest.c
@@ -24,7 +24,6 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 
diff --git a/tools/tools/dmardump/dmardump.c b/tools/tools/dmardump/dmardump.c
index 08b2570ba6e5..6888200983bc 100644
--- a/tools/tools/dmardump/dmardump.c
+++ b/tools/tools/dmardump/dmardump.c
@@ -25,7 +25,6 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/cdefs.h>
 #include <sys/param.h>
 #include <sys/endian.h>
 #include <sys/pciio.h>
diff --git a/tools/tools/drm/radeon/mkregtable/mkregtable.c b/tools/tools/drm/radeon/mkregtable/mkregtable.c
index e39264fbcd2b..5a82b6b75849 100644
--- a/tools/tools/drm/radeon/mkregtable/mkregtable.c
+++ b/tools/tools/drm/radeon/mkregtable/mkregtable.c
@@ -9,7 +9,6 @@
  * 	Dave Airlie
  */
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/tools/tools/ifpifa/ifpifa.c b/tools/tools/ifpifa/ifpifa.c
index 493be768f048..bc8f7352bbb6 100644
--- a/tools/tools/ifpifa/ifpifa.c
+++ b/tools/tools/ifpifa/ifpifa.c
@@ -28,7 +28,7 @@
 
 #include <sys/types.h>
 #include <sys/callout.h>
-#include <sys/cdefs.h>
+
 #include <sys/param.h>
 #include <sys/protosw.h>
 #include <sys/queue.h>
diff --git a/tools/tools/ipw/ipwstats.c b/tools/tools/ipw/ipwstats.c
index 1da6efeeaea5..8b95607397b0 100644
--- a/tools/tools/ipw/ipwstats.c
+++ b/tools/tools/ipw/ipwstats.c
@@ -25,7 +25,6 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <sys/sysctl.h>
 
diff --git a/tools/tools/iwi/iwistats.c b/tools/tools/iwi/iwistats.c
index 16044f1a7ba7..48572e44a875 100644
--- a/tools/tools/iwi/iwistats.c
+++ b/tools/tools/iwi/iwistats.c
@@ -26,7 +26,6 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <sys/sysctl.h>
 
diff --git a/tools/tools/mfi/mfi_checkq.c b/tools/tools/mfi/mfi_checkq.c
index ca3fc0c7fa8c..05d0e97e21d6 100644
--- a/tools/tools/mfi/mfi_checkq.c
+++ b/tools/tools/mfi/mfi_checkq.c
@@ -23,7 +23,6 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <sys/fcntl.h>
 #include <sys/ioctl.h>
diff --git a/tools/tools/ncpus/biosmptable.c b/tools/tools/ncpus/biosmptable.c
index 0289409939be..848eadf02d0f 100644
--- a/tools/tools/ncpus/biosmptable.c
+++ b/tools/tools/ncpus/biosmptable.c
@@ -30,7 +30,6 @@
  * the number of cpu's identified.
  */
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <x86/mptable.h>
 
diff --git a/tools/tools/netmap/nmreplay.c b/tools/tools/netmap/nmreplay.c
index 75b5b8b5f62b..257157c48945 100644
--- a/tools/tools/netmap/nmreplay.c
+++ b/tools/tools/netmap/nmreplay.c
@@ -1538,8 +1538,7 @@ uniform_delay_run(struct _qs *q, struct _cfg *arg)
 {
 	uint64_t x = my_random24();
 	q->cur_delay = arg->d[0] + ((arg->d[2] * x) >> 24);
-#if 0 /* COMPUTE_STATS */
-#endif /* COMPUTE_STATS */
+
 	return 0;
 }
 
diff --git a/tools/tools/pciroms/pciroms.c b/tools/tools/pciroms/pciroms.c
index 0e5e3236c96f..48bd7be75eef 100644
--- a/tools/tools/pciroms/pciroms.c
+++ b/tools/tools/pciroms/pciroms.c
@@ -24,7 +24,6 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <sys/ioctl.h>
 #include <sys/pciio.h>
diff --git a/tools/tools/pirtool/pirtool.c b/tools/tools/pirtool/pirtool.c
index 024810109a72..03659dbb56dd 100644
--- a/tools/tools/pirtool/pirtool.c
+++ b/tools/tools/pirtool/pirtool.c
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  *
  */
-#include <sys/cdefs.h>
+
 #include <sys/types.h>
 #include <sys/ioctl.h>
 #include <sys/mman.h>
diff --git a/tools/tools/switch_tls/switch_tls.c b/tools/tools/switch_tls/switch_tls.c
index 2e214af2e45b..e79cba5a30f8 100644
--- a/tools/tools/switch_tls/switch_tls.c
+++ b/tools/tools/switch_tls/switch_tls.c
@@ -17,7 +17,6 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#include <sys/cdefs.h>
 #include <sys/param.h>
 #include <sys/types.h>
 #include <sys/socket.h>
diff --git a/tools/tools/tscdrift/tscdrift.c b/tools/tools/tscdrift/tscdrift.c
index 7d8940e9f3a1..cf20993bd1ee 100644
--- a/tools/tools/tscdrift/tscdrift.c
+++ b/tools/tools/tscdrift/tscdrift.c
@@ -25,8 +25,6 @@
  * SUCH DAMAGE.
  */
 
-
-#include <sys/cdefs.h>
 #include <sys/param.h>
 #include <sys/cpuset.h>
 #include <machine/atomic.h>
diff --git a/tools/tools/vhba/vhba.h b/tools/tools/vhba/vhba.h
index 9e9ca0e7eabe..d6b32b10b56d 100644
--- a/tools/tools/vhba/vhba.h
+++ b/tools/tools/vhba/vhba.h
@@ -26,7 +26,7 @@
 /*
  * Virtual HBA defines
  */
-#include <sys/cdefs.h>
+
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/endian.h>