hppa: Define MAX_FIXED_MODE_SIZE
[official-gcc.git] / contrib / check_GNU_style.py
blobefac33e43ef1b0f3cf00128e341fd6b6da202e89
1 #!/usr/bin/env python3
3 # Copyright (C) 2017-2023 Free Software Foundation, Inc.
5 # Checks some of the GNU style formatting rules in a set of patches.
6 # The script is a rewritten of the same bash script and should eventually
7 # replace the former script.
9 # This file is part of GCC.
11 # GCC is free software; you can redistribute it and/or modify it under
12 # the terms of the GNU General Public License as published by the Free
13 # Software Foundation; either version 3, or (at your option) any later
14 # version.
16 # GCC is distributed in the hope that it will be useful, but WITHOUT ANY
17 # WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 # for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with GCC; see the file COPYING3. If not see
23 # <http://www.gnu.org/licenses/>. */
25 import argparse
26 import sys
27 from check_GNU_style_lib import check_GNU_style_file
29 def main():
30 parser = argparse.ArgumentParser(description='Check GNU coding style.')
31 parser.add_argument('file', help = 'File with a patch')
32 parser.add_argument('-f', '--format', default = 'stdio',
33 help = 'Display format',
34 choices = ['stdio', 'quickfix'])
35 args = parser.parse_args()
36 filename = args.file
37 format = args.format
39 if filename == '-':
40 check_GNU_style_file(sys.stdin, format)
41 else:
42 with open(filename, newline='\n') as diff_file:
43 check_GNU_style_file(diff_file, format)
45 main()