Build fixes needed for latest Riece pkg.
[packages] / find-macro-err.awk
1 #!/bin/awk -f
2 #
3 # This file is part of XEmacs.
4 #
5 # XEmacs is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by the
7 # Free Software Foundation; either version 2, or (at your option) any
8 # later version.
9 #
10 # XEmacs is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13 # for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with XEmacs; see the file COPYING.  If not, write to
17 # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 # Boston, MA 02110-1301, USA.
19 #
20 # Written by Jerry James
21 # December 18, 2002
22 #
23 # Updated January 14, 2004 to also report the type of definition miscompiled
24 # (defmacro, defsubst, etc.).
25 #
26 # Updated May 22, 2007 to take macro names to be suppressed from the file
27 # macro.suppress.
28 #
29 # Find undefined function messages in the smoketest log and try to match them
30 # against the macro list.  Invoke this script in a directory containing
31 # macro.list, the output of gen-macro-list.awk.
32 # Usage: awk -f find-macro-err.awk < $package_build_log
33
34 # Read macro.list into an array and save RS and FS
35 BEGIN {
36   OrigRS = RS
37   OrigFS = FS
38   while ((getline < "macro.list") > 0) {
39     macro[$1] = $2
40     macrotype[$1] = $3
41   }
42   close("macro.list")
43   while ((getline < "macro.suppress") > 0) {
44     delete macro[$1]
45     delete macrotype[$1]
46   }
47   close("macro.suppress")
48 }
49 # Track the current package/file name from the log
50 /Compiling .*\.\.\./ {
51   # Get rid of the trailing dots
52   split($2, path, "[ .]") - 1
53   fil = substr(path[1], match(path[1], "(xemacs|mule)-packages")) ".el"
54 }
55 # Find single undefined functions
56 /is not known to be defined/ {
57   if ($4 in macro)
58     printf("%s (%s)\n  Definition: %s\n  Miscompile: %s\n",
59            $4, macrotype[$4], macro[$4], fil)
60 }
61 # Find multiple undefined functions
62 /are not known to be defined/ {
63   RS = "Wrote"
64   FS = ",?[ \t\n\f]+"
65   getline
66   for (i = 1; i <= NF; i++)
67     if ($i !~ "^[ \t\n\f]*$" && $i in macro)
68       printf("%s (%s)\n  Definition: %s\n  Miscompile: %s\n",
69              $i, macrotype[$i], macro[$i], fil)
70   RS = OrigRS
71   FS = OrigFS
72 }