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
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
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/>. */
27 from check_GNU_style_lib
import check_GNU_style_file
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()
40 check_GNU_style_file(sys
.stdin
, format
)
42 with
open(filename
, newline
='\n') as diff_file
:
43 check_GNU_style_file(diff_file
, format
)