[Libreoffice-commits] core.git: bin/find-unneeded-includes
Gabor Kelemen (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jul 15 10:00:25 UTC 2021
bin/find-unneeded-includes | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
New commits:
commit 246c766cadcafc5d26f39f832a683a13f2dfe40b
Author: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
AuthorDate: Wed Jul 14 22:33:01 2021 +0200
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Thu Jul 15 11:59:52 2021 +0200
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 at collabora.com>
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
More information about the Libreoffice-commits
mailing list