mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-23 02:44:18 +08:00
29abd09a74
These Python scripts have "*/" at the end of the license header comment blocks, presumably copy&pasted from C files. contrib/ChangeLog: * analyze_brprob.py: Remove stray text at end of comment. * analyze_brprob_spec.py: Likewise. * check-params-in-docs.py: Likewise. * check_GNU_style.py: Likewise. * check_GNU_style_lib.py: Likewise. * filter-clang-warnings.py: Likewise. * gcc-changelog/git_check_commit.py: Likewise. * gcc-changelog/git_commit.py: Likewise. * gcc-changelog/git_email.py: Likewise. * gcc-changelog/git_repository.py: Likewise. * gcc-changelog/git_update_version.py: Likewise. * gcc-changelog/test_email.py: Likewise. * gen_autofdo_event.py: Likewise. * mark_spam.py: Likewise. * unicode/gen-box-drawing-chars.py: Likewise. * unicode/gen-combining-chars.py: Likewise. * unicode/gen-printable-chars.py: Likewise. * unicode/gen_wcwidth.py: Likewise.
46 lines
1.5 KiB
Python
Executable File
46 lines
1.5 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
# Copyright (C) 2017-2024 Free Software Foundation, Inc.
|
|
#
|
|
# Checks some of the GNU style formatting rules in a set of patches.
|
|
# The script is a rewritten of the same bash script and should eventually
|
|
# replace the former script.
|
|
#
|
|
# This file is part of GCC.
|
|
#
|
|
# GCC is free software; you can redistribute it and/or modify it under
|
|
# the terms of the GNU General Public License as published by the Free
|
|
# Software Foundation; either version 3, or (at your option) any later
|
|
# version.
|
|
#
|
|
# GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
# WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
# for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with GCC; see the file COPYING3. If not see
|
|
# <http://www.gnu.org/licenses/>.
|
|
|
|
import argparse
|
|
import sys
|
|
from check_GNU_style_lib import check_GNU_style_file
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description='Check GNU coding style.')
|
|
parser.add_argument('file', help = 'File with a patch')
|
|
parser.add_argument('-f', '--format', default = 'stdio',
|
|
help = 'Display format',
|
|
choices = ['stdio', 'quickfix'])
|
|
args = parser.parse_args()
|
|
filename = args.file
|
|
format = args.format
|
|
|
|
if filename == '-':
|
|
check_GNU_style_file(sys.stdin, format)
|
|
else:
|
|
with open(filename, newline='\n') as diff_file:
|
|
check_GNU_style_file(diff_file, format)
|
|
|
|
main()
|