summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorGabor Kelemen <kelemen.gabor2@nisz.hu>2021-07-14 22:33:01 +0200
committerMiklos Vajna <vmiklos@collabora.com>2021-07-15 11:59:52 +0200
commit246c766cadcafc5d26f39f832a683a13f2dfe40b (patch)
tree82fa5beea600769eb782dea18727e17d11d45883 /bin
parent2d496c3b1c0912c747bf7a83a4a982fd2dc3a801 (diff)
find-unneeded-includes: Add --headers option
so that --recursive checks only header files. if omitted, --recursive checks source files. Change-Id: I7406e90dc4df4603b62d23751d3c78a1fdedec38 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118959 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/find-unneeded-includes10
1 files changed, 8 insertions, 2 deletions
diff --git a/bin/find-unneeded-includes b/bin/find-unneeded-includes
index 9b38fd524f49..0e8cec276968 100755
--- a/bin/find-unneeded-includes
+++ b/bin/find-unneeded-includes
@@ -310,6 +310,8 @@ def main(argv):
help='The files to be checked')
parser.add_argument('--recursive', metavar='DIR', nargs=1, type=str,
help='Recursively search a directory for source files to check')
+ parser.add_argument('--headers', action='store_true',
+ help='Check header files. If omitted, check source files. Use with --recursive.')
args = parser.parse_args()
@@ -321,8 +323,12 @@ def main(argv):
if args.recursive:
for root, dirs, files in os.walk(args.recursive[0]):
for file in files:
- if (file.endswith(".cxx") or file.endswith(".hxx") or file.endswith(".hrc") or file.endswith(".h") or file.endswith(".c")):
- list_of_files.append(os.path.join(root,file))
+ if args.headers:
+ if (file.endswith(".hxx") or file.endswith(".hrc") or file.endswith(".h")):
+ list_of_files.append(os.path.join(root,file))
+ else:
+ if (file.endswith(".cxx") or file.endswith(".c")):
+ list_of_files.append(os.path.join(root,file))
else:
list_of_files = args.Files