Check for -- and remove -- some unnecessarily included header files.
authorJim Meyering <meyering@redhat.com>
Wed, 19 Mar 2008 14:52:26 +0000 (15:52 +0100)
committerJim Meyering <meyering@redhat.com>
Wed, 19 Mar 2008 15:48:32 +0000 (16:48 +0100)
* Makefile.maint: Add checks for a handful of additional header files.
* src/mktemp.c: Don't include "long-options.h".  Not used.
* src/pr.c: Don't include "inttostr.h".  Not used.
* src/printenv.c: Don't include "error.h".  Not used.
* src/test.c: Don't include "error.h".  Not used.
* src/touch.c: Don't include "safe-read.h".  Not used.

Makefile.maint
src/mktemp.c
src/pr.c
src/printenv.c
src/test.c
src/touch.c

index 9f9401b..c866cba 100644 (file)
@@ -196,6 +196,36 @@ sc_prohibit_quotearg_without_use:
 sc_prohibit_quote_without_use:
        @h='"quote.h"' re='\<quote(_n)? *\(' $(_header_without_use)
 
+# Don't include this header unless you use one of its functions.
+sc_prohibit_long_options_without_use:
+       @h='"long-options.h"' re='\<parse_long_options *\(' \
+         $(_header_without_use)
+
+# Don't include this header unless you use one of its functions.
+sc_prohibit_inttostr_without_use:
+       @h='"inttostr.h"' re='\<(off|[iu]max|uint)tostr *\(' \
+         $(_header_without_use)
+
+# Don't include this header unless you use one of its functions.
+sc_prohibit_error_without_use:
+       @h='"error.h"' \
+       re='\<error(_at_line|_print_progname|_one_per_line|_message_count)? *\('\
+         $(_header_without_use)
+
+sc_prohibit_safe_read_without_use:
+       @h='"safe-read.h"' re='(\<SAFE_READ_ERROR\>|\<safe_read *\()' \
+         $(_header_without_use)
+
+sc_prohibit_argmatch_without_use:
+       @h='"argmatch.h"' \
+       re='(\<(ARRAY_CARDINALITY|X?ARGMATCH(|_TO_ARGUMENT|_VERIFY))\>|\<argmatch(_exit_fn|_(in)?valid) *\()' \
+         $(_header_without_use)
+
+sc_prohibit_root_dev_ino_without_use:
+       @h='"root-dev-ino.h"' \
+       re='(\<ROOT_DEV_INO_(CHECK|WARN)\>|\<get_root_dev_ino *\()' \
+         $(_header_without_use)
+
 sc_obsolete_symbols:
        @grep -nE '\<(HAVE''_FCNTL_H|O''_NDELAY)\>'                     \
             $$($(VC_LIST_EXCEPT)) &&                                   \
index 279077f..6f12d99 100644 (file)
@@ -25,7 +25,6 @@
 
 #include "error.h"
 #include "filenamecat.h"
-#include "long-options.h"
 #include "quote.h"
 #include "tempname.h"
 
index 1ed79d6..77d4c8a 100644 (file)
--- a/src/pr.c
+++ b/src/pr.c
@@ -1,5 +1,5 @@
 /* pr -- convert text files for printing.
-   Copyright (C) 88, 91, 1995-2007 Free Software Foundation, Inc.
+   Copyright (C) 88, 91, 1995-2008 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 #include "system.h"
 #include "error.h"
 #include "hard-locale.h"
-#include "inttostr.h"
 #include "mbswidth.h"
 #include "quote.h"
 #include "stat-time.h"
index 69384ce..fff1644 100644 (file)
@@ -1,5 +1,5 @@
 /* printenv -- print all or part of environment
-   Copyright (C) 1989-1997, 1999-2005, 2007 Free Software Foundation, Inc.
+   Copyright (C) 1989-1997, 1999-2005, 2007-2008 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -33,7 +33,6 @@
 #include <getopt.h>
 
 #include "system.h"
-#include "error.h"
 #include "long-options.h"
 
 /* Exit status for syntax errors, etc.  */
index daaf250..c6502f9 100644 (file)
@@ -2,7 +2,7 @@
 
 /* Modified to run with the GNU shell by bfox. */
 
-/* Copyright (C) 1987-2005, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2005, 2007-2008 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -38,7 +38,6 @@
 #endif
 
 #include "system.h"
-#include "error.h"
 #include "euidaccess.h"
 #include "inttostr.h"
 #include "quote.h"
index 205fbf6..76c811f 100644 (file)
@@ -1,5 +1,6 @@
 /* touch -- change modification and access times of files
-   Copyright (C) 87, 1989-1991, 1995-2005, 2007 Free Software Foundation, Inc.
+   Copyright (C) 87, 1989-1991, 1995-2005, 2007-2008
+   Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -30,7 +31,6 @@
 #include "posixtm.h"
 #include "posixver.h"
 #include "quote.h"
-#include "safe-read.h"
 #include "stat-time.h"
 #include "utimens.h"