Update HACKING for changed doc generation instructions
[geany-mirror.git] / scripts / warning-summary.pl
blob45dcf8986b07e99899557e3aec9bfb43192afab7
1 #!/usr/bin/env perl
2 # warning-summary.pl
3 # Copyright (c) 2008, Daniel Richard G. <skunk(at)iskunk(dot)org>
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are
7 # met:
9 # * Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # * Redistributions in binary form must reproduce the above
12 # copyright notice, this list of conditions and the following disclaimer
13 # in the documentation and/or other materials provided with the
14 # distribution.
15 # * Neither the name of the author nor the names of
16 # contributors may be used to endorse or promote products derived from
17 # this software without specific prior written permission.
19 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 use strict;
32 use warnings;
34 use encoding 'utf8';
36 binmode(STDIN, ":utf8");
38 open(OUT, "| sort | uniq -c | sort -nr");
39 binmode(OUT, ":utf8");
41 while (<>)
43 /warning:/ || next;
44 /near initialization for/ && next;
45 /shadowed declaration is here/ && next;
46 /\(this will be reported only once per input file\)/ && next;
48 s/^.*: warning: //g;
50 tr/\x{2018}\x{2019}/''/;
52 s/\barg(ument|) \d+\b/arg$1 N/g;
54 s/\b(type|function|variable|enumeration value|declaration of|argument N of|parameter|type of|type of bit-field|prototype for) '[^']+'/$1 'blah'/g;
56 s/"[^"]+" (is not defined)/"BLAH" $1/g;
58 s/'[^']+' (defined but not used)/'blah' $1/g;
60 s/format '%\w+'/format '%blah'/g;
62 s/'%\w+' printf format/'%blah' printf format/g;
64 s/'\d+'/'NNN'/g;
66 s/'[^']+' (declared 'static' but never defined)/'blah' $1/g;
68 s/(missing braces around initializer for) '\w+'/$1 'blah'/g;
70 s/(missing initializer for member) '\w+::\w+'/$1 'Foo::bar'/g;
72 print OUT;
75 close(OUT);
77 # end warning-summary.pl