From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11266 invoked by alias); 25 May 2012 08:09:07 -0000 Received: (qmail 11221 invoked by uid 22791); 25 May 2012 08:08:59 -0000 X-SWARE-Spam-Status: No, hits=4.4 required=5.0 tests=AWL,BAYES_50,KAM_STOCKGEN,KHOP_DNSBL_BUMP,KHOP_THREADED,MSGID_MULTIPLE_AT,RCVD_IN_HOSTKARMA_BL,RCVD_IN_JMF_BL,TW_BZ,TW_EG,TW_FN,TW_TJ,TW_XS X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.155) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 25 May 2012 08:08:36 +0000 Received: from md13.u-strasbg.fr (md13.u-strasbg.fr [130.79.200.248]) by mailhost.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id q4P88QNH098371 for ; Fri, 25 May 2012 10:08:27 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from mailserver.u-strasbg.fr (ms12.u-strasbg.fr [130.79.204.112]) by md13.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id q4P88QJA020890 for ; Fri, 25 May 2012 10:08:26 +0200 (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from E6510Muller (gw-ics.u-strasbg.fr [130.79.210.225]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id q4P88PNM005727 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Fri, 25 May 2012 10:08:26 +0200 (envelope-from pierre.muller@ics-cnrs.unistra.fr) From: "Pierre Muller" To: References: <001201cd3547$377188b0$a6549a10$@muller@ics-cnrs.unistra.fr> In-Reply-To: <001201cd3547$377188b0$a6549a10$@muller@ics-cnrs.unistra.fr> Subject: PING [RFA] Add scripts to generate ARI web pages to gdb/contrib/ari directory Date: Fri, 25 May 2012 08:09:00 -0000 Message-ID: <006e01cd3a4d$8f2b12f0$ad8138d0$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-05/txt/msg00959.txt.bz2 Nobody reacted to that RFA... Should I change something more before including ARI scripts into gdb/contrib.=20 I would really like to start working on it, but feel like I am stalled... Pierre > -----Message d'origine----- > De=A0: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] De la part de Pierre Muller > Envoy=E9=A0: samedi 19 mai 2012 00:40 > =C0=A0: gdb-patches@sourceware.org > Objet=A0: [RFA] Add scripts to generate ARI web pages to gdb/contrib/ari > directory >=20 > Here is a RFA for inclusion of scripts to gdb/contrib/ari. >=20 > The only changes to RFC-v2 are: > 1) directory moved from gdb/ari to gdb/contrib./ari > 2) create-web-ari-in-src.sh adapted to new directory > 3) This script now output that location of the generated > web page (with a different message depending on > the existence of this file). >=20 >=20 >=20 > Pierre Muller > GDB pascal language maintainer >=20 >=20 > 2012-05-19 Pierre Muller >=20 > * contrib/ari/create-web-ari-in-src.sh: New file. > * contrib/ari/gdb_ari.sh: New file. > * contrib/ari/gdb_find.sh: New file. > * contrib/ari/update-web-ari.sh: New file. >=20 > Index: contrib/ari/create-web-ari-in-src.sh > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: contrib/ari/create-web-ari-in-src.sh > diff -N contrib/ari/create-web-ari-in-src.sh > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ contrib/ari/create-web-ari-in-src.sh 18 May 2012 22:31:42 -0000 > @@ -0,0 +1,68 @@ > +#! /bin/sh > + > +# GDB script to create web ARI page directly from within gdb/ari directory. > +# > +# Copyright (C) 2012 Free Software Foundation, Inc. > +# > +# This file is part of GDB. > +# > +# This program 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 of the License, or > +# (at your option) any later version. > +# > +# This program 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 this program. If not, see . > + > +set -x > + > +# Determine directory of current script. > +scriptpath=3D`dirname $0` > +# If "scriptpath" is a relative path, then convert it to absolute. > +if [ "`echo ${scriptpath} | cut -b1`" !=3D '/' ] ; then > + scriptpath=3D"`pwd`/${scriptpath}" > +fi > + > +# update-web-ari.sh script wants four parameters > +# 1: directory of checkout src or gdb-RELEASE for release sources. > +# 2: a temp directory. > +# 3: a directory for generated web page. > +# 4: The name of the current package, must be gdb here. > +# Here we provide default values for these 4 parameters > + > +# srcdir parameter > +if [ -z "${srcdir}" ] ; then > + srcdir=3D${scriptpath}/../../.. > +fi > + > +# Determine location of a temporary directory to be used by > +# update-web-ari.sh script. > +if [ -z "${tempdir}" ] ; then > + if [ ! -z "$TMP" ] ; then > + tempdir=3D$TMP/create-ari > + elif [ ! -z "$TEMP" ] ; then > + tempdir=3D$TEMP/create-ari > + else > + tempdir=3D/tmp/create-ari > + fi > +fi > + > +# Default location of generate index.hmtl web page. > +if [ -z "${webdir}" ] ; then > + webdir=3D~/htdocs/www/local/ari > +fi > + > +# Launch update-web-ari.sh in same directory as current script. > +${scriptpath}/update-web-ari.sh ${srcdir} ${tempdir} ${webdir} gdb > + > +if [ -f "${webdir}/index.html" ] ; then > + echo "ARI output can be viewed in file \"${webdir}/index.html\"" > +else > + echo "ARI script failed to generate file \"${webdir}/index.html\"" > +fi > + > Index: contrib/ari/gdb_ari.sh > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: contrib/ari/gdb_ari.sh > diff -N contrib/ari/gdb_ari.sh > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ contrib/ari/gdb_ari.sh 18 May 2012 22:31:42 -0000 > @@ -0,0 +1,1347 @@ > +#!/bin/sh > + > +# GDB script to list of problems using awk. > +# > +# Copyright (C) 2002-2012 Free Software Foundation, Inc. > +# > +# This file is part of GDB. > +# > +# This program 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 of the License, or > +# (at your option) any later version. > +# > +# This program 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 this program. If not, see . > + > +# Make certain that the script is not running in an internationalized > +# environment. > + > +LANG=3Dc ; export LANG > +LC_ALL=3Dc ; export LC_ALL > + > +# Permanent checks take the form: > + > +# Do not use XXXX, ISO C 90 implies YYYY > +# Do not use XXXX, instead use YYYY''. > + > +# and should never be removed. > + > +# Temporary checks take the form: > + > +# Replace XXXX with YYYY > + > +# and once they reach zero, can be eliminated. > + > +# FIXME: It should be able to override this on the command line > +error=3D"regression" > +warning=3D"regression" > +ari=3D"regression eol code comment deprecated legacy obsolete gettext" > +all=3D"regression eol code comment deprecated legacy obsolete gettext > deprecate internal gdbarch macro" > +print_doc=3D0 > +print_idx=3D0 > + > +usage () > +{ > + cat <&2 > +Error: $1 > + > +Usage: > + $0 --print-doc --print-idx -Wall -Werror -W ... > +Options: > + --print-doc Print a list of all potential problems, then exit. > + --print-idx Include the problems IDX (index or key) in every message. > + --src=3Dfile Write source lines to file. > + -Werror Treat all problems as errors. > + -Wall Report all problems. > + -Wari Report problems that should be fixed in new code. > + -W Report problems in the specifed category. Vaid categories > + are: ${all} > +EOF > + exit 1 > +} > + > + > +# Parse the various options > +Woptions=3D > +srclines=3D"" > +while test $# -gt 0 > +do > + case "$1" in > + -Wall ) Woptions=3D"${all}" ;; > + -Wari ) Woptions=3D"${ari}" ;; > + -Werror ) Werror=3D1 ;; > + -W* ) Woptions=3D"${Woptions} `echo x$1 | sed -e 's/x-W//'`" ;; > + --print-doc ) print_doc=3D1 ;; > + --print-idx ) print_idx=3D1 ;; > + --src=3D* ) srclines=3D"`echo $1 | sed -e 's/--src=3D/srclines=3D\"/= '`\"" ;; > + -- ) shift ; break ;; > + - ) break ;; > + -* ) usage "$1: unknown option" ;; > + * ) break ;; > + esac > + shift > +done > +if test -n "$Woptions" ; then > + warning=3D"$Woptions" > + error=3D > +fi > + > + > +# -Werror implies treating all warnings as errors. > +if test -n "${Werror}" ; then > + error=3D"${error} ${warning}" > +fi > + > + > +# Validate all errors and warnings. > +for w in ${warning} ${error} > +do > + case " ${all} " in > + *" ${w} "* ) ;; > + * ) usage "Unknown option -W${w}" ;; > + esac > +done > + > + > +# make certain that there is at least one file. > +if test $# -eq 0 -a ${print_doc} =3D 0 > +then > + usage "Missing file." > +fi > + > + > +# Convert the errors/warnings into corresponding array entries. > +for a in ${all} > +do > + aris=3D"${aris} ari_${a} =3D \"${a}\";" > +done > +for w in ${warning} > +do > + warnings=3D"${warnings} warning[ari_${w}] =3D 1;" > +done > +for e in ${error} > +do > + errors=3D"${errors} error[ari_${e}] =3D 1;" > +done > + > +awk -- ' > +BEGIN { > + # NOTE, for a per-file begin use "FNR =3D=3D 1". > + '"${aris}"' > + '"${errors}"' > + '"${warnings}"' > + '"${srclines}"' > + print_doc =3D '$print_doc' > + print_idx =3D '$print_idx' > + PWD =3D "'`pwd`'" > +} > + > +# Print the error message for BUG. Append SUPLEMENT if non-empty. > +function print_bug(file,line,prefix,category,bug,doc,supplement, > suffix,idx) { > + if (print_idx) { > + idx =3D bug ": " > + } else { > + idx =3D "" > + } > + if (supplement) { > + suffix =3D " (" supplement ")" > + } else { > + suffix =3D "" > + } > + # ari.*.bug: :: : : > + print file ":" line ": " prefix category ": " idx doc suffix > + if (srclines !=3D "") { > + print file ":" line ":" $0 >> srclines > + } > +} > + > +function fix(bug,file,count) { > + skip[bug, file] =3D count > + skipped[bug, file] =3D 0 > +} > + > +function fail(bug,supplement) { > + if (doc[bug] =3D=3D "") { > + print_bug("", 0, "internal: ", "internal", "internal", "Missing doc > for bug " bug) > + exit > + } > + if (category[bug] =3D=3D "") { > + print_bug("", 0, "internal: ", "internal", "internal", "Missing > category for bug " bug) > + exit > + } > + > + if (ARI_OK =3D=3D bug) { > + return > + } > + # Trim the filename down to just DIRECTORY/FILE so that it can be > + # robustly used by the FIX code. > + > + if (FILENAME ~ /^\//) { > + canonicalname =3D FILENAME > + } else { > + canonicalname =3D PWD "/" FILENAME > + } > + shortname =3D gensub (/^.*\/([^\\]*\/[^\\]*)$/, "\\1", 1, canonicalname) > + > + skipped[bug, shortname]++ > + if (skip[bug, shortname] >=3D skipped[bug, shortname]) { > + # print FILENAME, FNR, skip[bug, FILENAME], skipped[bug, FILENAME], > bug > + # Do nothing > + } else if (error[category[bug]]) { > + # ari.*.bug: :: : : > + print_bug(FILENAME, FNR, "", category[bug], bug, doc[bug], > supplement) > + } else if (warning[category[bug]]) { > + # ari.*.bug: :: : : > + print_bug(FILENAME, FNR, "warning: ", category[bug], bug, doc[bug], > supplement) > + } > +} > + > +FNR =3D=3D 1 { > + seen[FILENAME] =3D 1 > + if (match(FILENAME, "\\.[ly]$")) { > + # FILENAME is a lex or yacc source > + is_yacc_or_lex =3D 1 > + } > + else { > + is_yacc_or_lex =3D 0 > + } > +} > +END { > + if (print_idx) { > + idx =3D bug ": " > + } else { > + idx =3D "" > + } > + # Did we do only a partial skip? > + for (bug_n_file in skip) { > + split (bug_n_file, a, SUBSEP) > + bug =3D a[1] > + file =3D a[2] > + if (seen[file] && (skipped[bug_n_file] < skip[bug_n_file])) { > + # ari.*.bug: :: : : > + b =3D file " missing " bug > + print_bug(file, 0, "", "internal", file " missing " bug, > "Expecting " skip[bug_n_file] " occurances of bug " bug " in file " file ", > only found " skipped[bug_n_file]) > + } > + } > +} > + > + > +# Skip OBSOLETE lines > +/(^|[^_[:alnum:]])OBSOLETE([^_[:alnum:]]|$)/ { next; } > + > +# Skip ARI lines > + > +BEGIN { > + ARI_OK =3D "" > +} > + > +/\/\* ARI:[[:space:]]*(.*)[[:space:]]*\*\// { > + ARI_OK =3D gensub(/^.*\/\* > ARI:[[:space:]]*(.*[^[:space:]])[[:space:]]*\*\/.*$/, "\\1", 1, $0) > + # print "ARI line found \"" $0 "\"" > + # print "ARI_OK \"" ARI_OK "\"" > +} > +! /\/\* ARI:[[:space:]]*(.*)[[:space:]]*\*\// { > + ARI_OK =3D "" > +} > + > + > +# Things in comments > + > +BEGIN { doc["GNU/Linux"] =3D "\ > +Do not use `Linux'\'', instead use `Linux kernel'\'' or `GNU/Linux > system'\'';\ > + comments should clearly differentiate between the two (this test assumes > that\ > + word `Linux'\'' appears on the same line as the word `GNU'\'' or > `kernel'\''\ > + or a kernel version" > + category["GNU/Linux"] =3D ari_comment > +} > +/(^|[^_[:alnum:]])Linux([^_[:alnum:]]|$)/ \ > +&& !/(^|[^_[:alnum:]])Linux\[sic\]([^_[:alnum:]]|$)/ \ > +&& !/(^|[^_[:alnum:]])GNU\/Linux([^_[:alnum:]]|$)/ \ > +&& !/(^|[^_[:alnum:]])Linux kernel([^_[:alnum:]]|$)/ \ > +&& !/(^|[^_[:alnum:]])Linux [:digit:]\.[:digit:]+)/ { > + fail("GNU/Linux") > +} > + > +BEGIN { doc["ARGSUSED"] =3D "\ > +Do not use ARGSUSED, unnecessary" > + category["ARGSUSED"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])ARGSUSED([^_[:alnum:]]|$)/ { > + fail("ARGSUSED") > +} > + > + > +# SNIP - Strip out comments - SNIP > + > +FNR =3D=3D 1 { > + comment_p =3D 0 > +} > +comment_p && /\*\// { gsub (/^([^\*]|\*+[^\/\*])*\*+\//, " "); comment_p =3D > 0; } > +comment_p { next; } > +!comment_p { gsub (/\/\*([^\*]|\*+[^\/\*])*\*+\//, " "); } > +!comment_p && /(^|[^"])\/\*/ { gsub (/\/\*.*$/, " "); comment_p =3D 1; } > + > + > +BEGIN { doc["_ markup"] =3D "\ > +All messages should be marked up with _." > + category["_ markup"] =3D ari_gettext > +} > +/^[^"]*[[:space:]](warning|error|error_no_arg|query|perror_with_name)[[:spa > ce:]]*\([^_\(a-z]/ { > + if (! /\("%s"/) { > + fail("_ markup") > + } > +} > + > +BEGIN { doc["trailing new line"] =3D "\ > +A message should not have a trailing new line" > + category["trailing new line"] =3D ari_gettext > +} > +/(^|[^_[:alnum:]])(warning|error)[[:space:]]*\(_\(".*\\n"\)[\),]/ { > + fail("trailing new line") > +} > + > +# Include files for which GDB has a custom version. > + > +BEGIN { doc["assert.h"] =3D "\ > +Do not include assert.h, instead include \"gdb_assert.h\""; > + category["assert.h"] =3D ari_regression > + fix("assert.h", "gdb/gdb_assert.h", 0) # it does not use it > +} > +/^#[[:space:]]*include[[:space:]]+.assert\.h./ { > + fail("assert.h") > +} > + > +BEGIN { doc["dirent.h"] =3D "\ > +Do not include dirent.h, instead include gdb_dirent.h" > + category["dirent.h"] =3D ari_regression > +} > +/^#[[:space:]]*include[[:space:]]*.dirent\.h./ { > + fail("dirent.h") > +} > + > +BEGIN { doc["regex.h"] =3D "\ > +Do not include regex.h, instead include gdb_regex.h" > + category["regex.h"] =3D ari_regression > + fix("regex.h", "gdb/gdb_regex.h", 1) > +} > +/^#[[:space:]]*include[[:space:]]*.regex\.h./ { > + fail("regex.h") > +} > + > +BEGIN { doc["xregex.h"] =3D "\ > +Do not include xregex.h, instead include gdb_regex.h" > + category["xregex.h"] =3D ari_regression > + fix("xregex.h", "gdb/gdb_regex.h", 1) > +} > +/^#[[:space:]]*include[[:space:]]*.xregex\.h./ { > + fail("xregex.h") > +} > + > +BEGIN { doc["gnu-regex.h"] =3D "\ > +Do not include gnu-regex.h, instead include gdb_regex.h" > + category["gnu-regex.h"] =3D ari_regression > +} > +/^#[[:space:]]*include[[:space:]]*.gnu-regex\.h./ { > + fail("gnu regex.h") > +} > + > +BEGIN { doc["stat.h"] =3D "\ > +Do not include stat.h or sys/stat.h, instead include gdb_stat.h" > + category["stat.h"] =3D ari_regression > + fix("stat.h", "gdb/gdb_stat.h", 1) > +} > +/^#[[:space:]]*include[[:space:]]*.stat\.h./ \ > +|| /^#[[:space:]]*include[[:space:]]*.sys\/stat\.h./ { > + fail("stat.h") > +} > + > +BEGIN { doc["wait.h"] =3D "\ > +Do not include wait.h or sys/wait.h, instead include gdb_wait.h" > + fix("wait.h", "gdb/gdb_wait.h", 2); > + category["wait.h"] =3D ari_regression > +} > +/^#[[:space:]]*include[[:space:]]*.wait\.h./ \ > +|| /^#[[:space:]]*include[[:space:]]*.sys\/wait\.h./ { > + fail("wait.h") > +} > + > +BEGIN { doc["vfork.h"] =3D "\ > +Do not include vfork.h, instead include gdb_vfork.h" > + fix("vfork.h", "gdb/gdb_vfork.h", 1); > + category["vfork.h"] =3D ari_regression > +} > +/^#[[:space:]]*include[[:space:]]*.vfork\.h./ { > + fail("vfork.h") > +} > + > +BEGIN { doc["error not internal-warning"] =3D "\ > +Do not use error(\"internal-warning\"), instead use internal_warning" > + category["error not internal-warning"] =3D ari_regression > +} > +/error.*\"[Ii]nternal.warning/ { > + fail("error not internal-warning") > +} > + > +BEGIN { doc["%p"] =3D "\ > +Do not use printf(\"%p\"), instead use printf(\"%s\",paddr()) to dump a \ > +target address, or host_address_to_string() for a host address" > + category["%p"] =3D ari_code > +} > +/%p/ && !/%prec/ { > + fail("%p") > +} > + > +BEGIN { doc["%ll"] =3D "\ > +Do not use printf(\"%ll\"), instead use printf(\"%s\",phex()) to dump a \ > +`long long'\'' value" > + category["%ll"] =3D ari_code > +} > +# Allow %ll in scanf > +/%[0-9]*ll/ && !/scanf \(.*%[0-9]*ll/ { > + fail("%ll") > +} > + > + > +# SNIP - Strip out strings - SNIP > + > +# Test on top.c, scm-valprint.c, remote-rdi.c, ada-lang.c > +FNR =3D=3D 1 { > + string_p =3D 0 > + trace_string =3D 0 > +} > +# Strip escaped characters. > +{ gsub(/\\./, "."); } > +# Strip quoted quotes. > +{ gsub(/'\''.'\''/, "'\''.'\''"); } > +# End of multi-line string > +string_p && /\"/ { > + if (trace_string) print "EOS:" FNR, $0; > + gsub (/^[^\"]*\"/, "'\''"); > + string_p =3D 0; > +} > +# Middle of multi-line string, discard line. > +string_p { > + if (trace_string) print "MOS:" FNR, $0; > + $0 =3D "" > +} > +# Strip complete strings from the middle of the line > +!string_p && /\"[^\"]*\"/ { > + if (trace_string) print "COS:" FNR, $0; > + gsub (/\"[^\"]*\"/, "'\''"); > +} > +# Start of multi-line string > +BEGIN { doc["multi-line string"] =3D "\ > +Multi-line string must have the newline escaped" > + category["multi-line string"] =3D ari_regression > +} > +!string_p && /\"/ { > + if (trace_string) print "SOS:" FNR, $0; > + if (/[^\\]$/) { > + fail("multi-line string") > + } > + gsub (/\"[^\"]*$/, "'\''"); > + string_p =3D 1; > +} > +# { print } > + > +# Multi-line string > +string_p && > + > +# Accumulate continuation lines > +FNR =3D=3D 1 { > + cont_p =3D 0 > +} > +!cont_p { full_line =3D ""; } > +/[^\\]\\$/ { gsub (/\\$/, ""); full_line =3D full_line $0; cont_p =3D 1; next; > } > +cont_p { $0 =3D full_line $0; cont_p =3D 0; full_line =3D ""; } > + > + > +# GDB uses ISO C 90. Check for any non pure ISO C 90 code > + > +BEGIN { doc["PARAMS"] =3D "\ > +Do not use PARAMS(), ISO C 90 implies prototypes" > + category["PARAMS"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])PARAMS([^_[:alnum:]]|$)/ { > + fail("PARAMS") > +} > + > +BEGIN { doc["__func__"] =3D "\ > +Do not use __func__, ISO C 90 does not support this macro" > + category["__func__"] =3D ari_regression > + fix("__func__", "gdb/gdb_assert.h", 1) > +} > +/(^|[^_[:alnum:]])__func__([^_[:alnum:]]|$)/ { > + fail("__func__") > +} > + > +BEGIN { doc["__FUNCTION__"] =3D "\ > +Do not use __FUNCTION__, ISO C 90 does not support this macro" > + category["__FUNCTION__"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])__FUNCTION__([^_[:alnum:]]|$)/ { > + fail("__FUNCTION__") > +} > + > +BEGIN { doc["__CYGWIN32__"] =3D "\ > +Do not use __CYGWIN32__, instead use __CYGWIN__ or, better, an explicit \ > +autoconf tests" > + category["__CYGWIN32__"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])__CYGWIN32__([^_[:alnum:]]|$)/ { > + fail("__CYGWIN32__") > +} > + > +BEGIN { doc["PTR"] =3D "\ > +Do not use PTR, ISO C 90 implies `void *'\''" > + category["PTR"] =3D ari_regression > + #fix("PTR", "gdb/utils.c", 6) > +} > +/(^|[^_[:alnum:]])PTR([^_[:alnum:]]|$)/ { > + fail("PTR") > +} > + > +BEGIN { doc["UCASE function"] =3D "\ > +Function name is uppercase." > + category["UCASE function"] =3D ari_code > + possible_UCASE =3D 0 > + UCASE_full_line =3D "" > +} > +(possible_UCASE) { > + if (ARI_OK =3D=3D "UCASE function") { > + possible_UCASE =3D 0 > + } > + # Closing brace found? > + else if (UCASE_full_line ~ \ > + /^[A-Z][[:alnum:]_]*[[:space:]]*\([^()]*\).*$/) { > + if ((UCASE_full_line ~ \ > + /^[A-Z][[:alnum:]_]*[[:space:]]*\([^()]*\)[[:space:]]*$/) \ > + && ($0 ~ /^\{/) && (is_yacc_or_lex =3D=3D 0)) { > + store_FNR =3D FNR > + FNR =3D possible_FNR > + store_0 =3D $0; > + $0 =3D UCASE_full_line; > + fail("UCASE function") > + FNR =3D store_FNR > + $0 =3D store_0; > + } > + possible_UCASE =3D 0 > + UCASE_full_line =3D "" > + } else { > + UCASE_full_line =3D UCASE_full_line $0; > + } > +} > +/^[A-Z][[:alnum:]_]*[[:space:]]*\([^()]*(|\))[[:space:]]*$/ { > + possible_UCASE =3D 1 > + if (ARI_OK =3D=3D "UCASE function") { > + possible_UCASE =3D 0 > + } > + possible_FNR =3D FNR > + UCASE_full_line =3D $0 > +} > + > + > +BEGIN { doc["editCase function"] =3D "\ > +Function name starts lower case but has uppercased letters." > + category["editCase function"] =3D ari_code > + possible_editCase =3D 0 > + editCase_full_line =3D "" > +} > +(possible_editCase) { > + if (ARI_OK =3D=3D "ediCase function") { > + possible_editCase =3D 0 > + } > + # Closing brace found? > + else if (editCase_full_line ~ \ > +/^[a-z][a-z0-9_]*[A-Z][a-z0-9A-Z_]*[[:space:]]*\([^()]*\).*$/) { > + if ((editCase_full_line ~ \ > +/^[a-z][a-z0-9_]*[A-Z][a-z0-9A-Z_]*[[:space:]]*\([^()]*\)[[:space:]]*$/) \ > + && ($0 ~ /^\{/) && (is_yacc_or_lex =3D=3D 0)) { > + store_FNR =3D FNR > + FNR =3D possible_FNR > + store_0 =3D $0; > + $0 =3D editCase_full_line; > + fail("editCase function") > + FNR =3D store_FNR > + $0 =3D store_0; > + } > + possible_editCase =3D 0 > + editCase_full_line =3D "" > + } else { > + editCase_full_line =3D editCase_full_line $0; > + } > +} > +/^[a-z][a-z0-9_]*[A-Z][a-z0-9A-Z_]*[[:space:]]*\([^()]*(|\))[[:space:]]*$/ > { > + possible_editCase =3D 1 > + if (ARI_OK =3D=3D "editCase function") { > + possible_editCase =3D 0 > + } > + possible_FNR =3D FNR > + editCase_full_line =3D $0 > +} > + > +# Only function implementation should be on first column > +BEGIN { doc["function call in first column"] =3D "\ > +Function name in first column should be restricted to function > implementation" > + category["function call in first column"] =3D ari_code > +} > +/^[a-z][a-z0-9_]*[[:space:]]*\((|[^*][^()]*)\)[[:space:]]*[^ \t]+/ { > + fail("function call in first column") > +} > + > + > +# Functions without any parameter should have (void) > +# after their name not simply (). > +BEGIN { doc["no parameter function"] =3D "\ > +Function having no parameter should be declared with funcname (void)." > + category["no parameter function"] =3D ari_code > +} > +/^[a-zA-Z][a-z0-9A-Z_]*[[:space:]]*\(\)/ { > + fail("no parameter function") > +} > + > +BEGIN { doc["hash"] =3D "\ > +Do not use ` #...'\'', instead use `#...'\''(some compilers only correctly > \ > +parse a C preprocessor directive when `#'\'' is the first character on \ > +the line)" > + category["hash"] =3D ari_regression > +} > +/^[[:space:]]+#/ { > + fail("hash") > +} > + > +BEGIN { doc["OP eol"] =3D "\ > +Do not use &&, or || at the end of a line" > + category["OP eol"] =3D ari_code > +} > +/(\|\||\&\&|=3D=3D|!=3D)[[:space:]]*$/ { > + fail("OP eol") > +} > + > +BEGIN { doc["strerror"] =3D "\ > +Do not use strerror(), instead use safe_strerror()" > + category["strerror"] =3D ari_regression > + fix("strerror", "gdb/gdb_string.h", 1) > + fix("strerror", "gdb/mingw-hdep.c", 1) > + fix("strerror", "gdb/posix-hdep.c", 1) > +} > +/(^|[^_[:alnum:]])strerror[[:space:]]*\(/ { > + fail("strerror") > +} > + > +BEGIN { doc["long long"] =3D "\ > +Do not use `long long'\'', instead use LONGEST" > + category["long long"] =3D ari_code > + # defs.h needs two such patterns for LONGEST and ULONGEST definitions > + fix("long long", "gdb/defs.h", 2) > +} > +/(^|[^_[:alnum:]])long[[:space:]]+long([^_[:alnum:]]|$)/ { > + fail("long long") > +} > + > +BEGIN { doc["ATTRIBUTE_UNUSED"] =3D "\ > +Do not use ATTRIBUTE_UNUSED, do not bother (GDB is compiled with -Werror > and, \ > +consequently, is not able to tolerate false warnings. Since -Wunused-param > \ > +produces such warnings, neither that warning flag nor ATTRIBUTE_UNUSED \ > +are used by GDB" > + category["ATTRIBUTE_UNUSED"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])ATTRIBUTE_UNUSED([^_[:alnum:]]|$)/ { > + fail("ATTRIBUTE_UNUSED") > +} > + > +BEGIN { doc["ATTR_FORMAT"] =3D "\ > +Do not use ATTR_FORMAT, use ATTRIBUTE_PRINTF instead" > + category["ATTR_FORMAT"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])ATTR_FORMAT([^_[:alnum:]]|$)/ { > + fail("ATTR_FORMAT") > +} > + > +BEGIN { doc["ATTR_NORETURN"] =3D "\ > +Do not use ATTR_NORETURN, use ATTRIBUTE_NORETURN instead" > + category["ATTR_NORETURN"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])ATTR_NORETURN([^_[:alnum:]]|$)/ { > + fail("ATTR_NORETURN") > +} > + > +BEGIN { doc["NORETURN"] =3D "\ > +Do not use NORETURN, use ATTRIBUTE_NORETURN instead" > + category["NORETURN"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])NORETURN([^_[:alnum:]]|$)/ { > + fail("NORETURN") > +} > + > + > +# General problems > + > +BEGIN { doc["multiple messages"] =3D "\ > +Do not use multiple calls to warning or error, instead use a single call" > + category["multiple messages"] =3D ari_gettext > +} > +FNR =3D=3D 1 { > + warning_fnr =3D -1 > +} > +/(^|[^_[:alnum:]])(warning|error)[[:space:]]*\(/ { > + if (FNR =3D=3D warning_fnr + 1) { > + fail("multiple messages") > + } else { > + warning_fnr =3D FNR > + } > +} > + > +# Commented out, but left inside sources, just in case. > +# BEGIN { doc["inline"] =3D "\ > +# Do not use the inline attribute; \ > +# since the compiler generally ignores this, better algorithm selection \ > +# is needed to improved performance" > +# category["inline"] =3D ari_code > +# } > +# /(^|[^_[:alnum:]])inline([^_[:alnum:]]|$)/ { > +# fail("inline") > +# } > + > +# This test is obsolete as this type > +# has been deprecated and finally suppressed from GDB sources > +#BEGIN { doc["obj_private"] =3D "\ > +#Replace obj_private with objfile_data" > +# category["obj_private"] =3D ari_obsolete > +#} > +#/(^|[^_[:alnum:]])obj_private([^_[:alnum:]]|$)/ { > +# fail("obj_private") > +#} > + > +BEGIN { doc["abort"] =3D "\ > +Do not use abort, instead use internal_error; GDB should never abort" > + category["abort"] =3D ari_regression > + fix("abort", "gdb/utils.c", 3) > +} > +/(^|[^_[:alnum:]])abort[[:space:]]*\(/ { > + fail("abort") > +} > + > +BEGIN { doc["basename"] =3D "\ > +Do not use basename, instead use lbasename" > + category["basename"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])basename[[:space:]]*\(/ { > + fail("basename") > +} > + > +BEGIN { doc["assert"] =3D "\ > +Do not use assert, instead use gdb_assert or internal_error; assert \ > +calls abort and GDB should never call abort" > + category["assert"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])assert[[:space:]]*\(/ { > + fail("assert") > +} > + > +BEGIN { doc["TARGET_HAS_HARDWARE_WATCHPOINTS"] =3D "\ > +Replace TARGET_HAS_HARDWARE_WATCHPOINTS with nothing, not needed" > + category["TARGET_HAS_HARDWARE_WATCHPOINTS"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])TARGET_HAS_HARDWARE_WATCHPOINTS([^_[:alnum:]]|$)/ { > + fail("TARGET_HAS_HARDWARE_WATCHPOINTS") > +} > + > +BEGIN { doc["ADD_SHARED_SYMBOL_FILES"] =3D "\ > +Replace ADD_SHARED_SYMBOL_FILES with nothing, not needed?" > + category["ADD_SHARED_SYMBOL_FILES"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])ADD_SHARED_SYMBOL_FILES([^_[:alnum:]]|$)/ { > + fail("ADD_SHARED_SYMBOL_FILES") > +} > + > +BEGIN { doc["SOLIB_ADD"] =3D "\ > +Replace SOLIB_ADD with nothing, not needed?" > + category["SOLIB_ADD"] =3D ari_deprecate > +} > +/(^|[^_[:alnum:]])SOLIB_ADD([^_[:alnum:]]|$)/ { > + fail("SOLIB_ADD") > +} > + > +BEGIN { doc["SOLIB_CREATE_INFERIOR_HOOK"] =3D "\ > +Replace SOLIB_CREATE_INFERIOR_HOOK with nothing, not needed?" > + category["SOLIB_CREATE_INFERIOR_HOOK"] =3D ari_deprecate > +} > +/(^|[^_[:alnum:]])SOLIB_CREATE_INFERIOR_HOOK([^_[:alnum:]]|$)/ { > + fail("SOLIB_CREATE_INFERIOR_HOOK") > +} > + > +BEGIN { doc["SOLIB_LOADED_LIBRARY_PATHNAME"] =3D "\ > +Replace SOLIB_LOADED_LIBRARY_PATHNAME with nothing, not needed?" > + category["SOLIB_LOADED_LIBRARY_PATHNAME"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])SOLIB_LOADED_LIBRARY_PATHNAME([^_[:alnum:]]|$)/ { > + fail("SOLIB_LOADED_LIBRARY_PATHNAME") > +} > + > +BEGIN { doc["REGISTER_U_ADDR"] =3D "\ > +Replace REGISTER_U_ADDR with nothing, not needed?" > + category["REGISTER_U_ADDR"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])REGISTER_U_ADDR([^_[:alnum:]]|$)/ { > + fail("REGISTER_U_ADDR") > +} > + > +BEGIN { doc["PROCESS_LINENUMBER_HOOK"] =3D "\ > +Replace PROCESS_LINENUMBER_HOOK with nothing, not needed?" > + category["PROCESS_LINENUMBER_HOOK"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])PROCESS_LINENUMBER_HOOK([^_[:alnum:]]|$)/ { > + fail("PROCESS_LINENUMBER_HOOK") > +} > + > +BEGIN { doc["PC_SOLIB"] =3D "\ > +Replace PC_SOLIB with nothing, not needed?" > + category["PC_SOLIB"] =3D ari_deprecate > +} > +/(^|[^_[:alnum:]])PC_SOLIB([^_[:alnum:]]|$)/ { > + fail("PC_SOLIB") > +} > + > +BEGIN { doc["IN_SOLIB_DYNSYM_RESOLVE_CODE"] =3D "\ > +Replace IN_SOLIB_DYNSYM_RESOLVE_CODE with nothing, not needed?" > + category["IN_SOLIB_DYNSYM_RESOLVE_CODE"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])IN_SOLIB_DYNSYM_RESOLVE_CODE([^_[:alnum:]]|$)/ { > + fail("IN_SOLIB_DYNSYM_RESOLVE_CODE") > +} > + > +BEGIN { doc["GCC_COMPILED_FLAG_SYMBOL"] =3D "\ > +Replace GCC_COMPILED_FLAG_SYMBOL with nothing, not needed?" > + category["GCC_COMPILED_FLAG_SYMBOL"] =3D ari_deprecate > +} > +/(^|[^_[:alnum:]])GCC_COMPILED_FLAG_SYMBOL([^_[:alnum:]]|$)/ { > + fail("GCC_COMPILED_FLAG_SYMBOL") > +} > + > +BEGIN { doc["GCC2_COMPILED_FLAG_SYMBOL"] =3D "\ > +Replace GCC2_COMPILED_FLAG_SYMBOL with nothing, not needed?" > + category["GCC2_COMPILED_FLAG_SYMBOL"] =3D ari_deprecate > +} > +/(^|[^_[:alnum:]])GCC2_COMPILED_FLAG_SYMBOL([^_[:alnum:]]|$)/ { > + fail("GCC2_COMPILED_FLAG_SYMBOL") > +} > + > +BEGIN { doc["FUNCTION_EPILOGUE_SIZE"] =3D "\ > +Replace FUNCTION_EPILOGUE_SIZE with nothing, not needed?" > + category["FUNCTION_EPILOGUE_SIZE"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])FUNCTION_EPILOGUE_SIZE([^_[:alnum:]]|$)/ { > + fail("FUNCTION_EPILOGUE_SIZE") > +} > + > +BEGIN { doc["HAVE_VFORK"] =3D "\ > +Do not use HAVE_VFORK, instead include \"gdb_vfork.h\" and call vfork() \ > +unconditionally" > + category["HAVE_VFORK"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])HAVE_VFORK([^_[:alnum:]]|$)/ { > + fail("HAVE_VFORK") > +} > + > +BEGIN { doc["bcmp"] =3D "\ > +Do not use bcmp(), ISO C 90 implies memcmp()" > + category["bcmp"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])bcmp[[:space:]]*\(/ { > + fail("bcmp") > +} > + > +BEGIN { doc["setlinebuf"] =3D "\ > +Do not use setlinebuf(), ISO C 90 implies setvbuf()" > + category["setlinebuf"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])setlinebuf[[:space:]]*\(/ { > + fail("setlinebuf") > +} > + > +BEGIN { doc["bcopy"] =3D "\ > +Do not use bcopy(), ISO C 90 implies memcpy() and memmove()" > + category["bcopy"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])bcopy[[:space:]]*\(/ { > + fail("bcopy") > +} > + > +BEGIN { doc["get_frame_base"] =3D "\ > +Replace get_frame_base with get_frame_id, get_frame_base_address, \ > +get_frame_locals_address, or get_frame_args_address." > + category["get_frame_base"] =3D ari_obsolete > +} > +/(^|[^_[:alnum:]])get_frame_base([^_[:alnum:]]|$)/ { > + fail("get_frame_base") > +} > + > +BEGIN { doc["floatformat_to_double"] =3D "\ > +Do not use floatformat_to_double() from libierty, \ > +instead use floatformat_to_doublest()" > + fix("floatformat_to_double", "gdb/doublest.c", 1) > + category["floatformat_to_double"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])floatformat_to_double[[:space:]]*\(/ { > + fail("floatformat_to_double") > +} > + > +BEGIN { doc["floatformat_from_double"] =3D "\ > +Do not use floatformat_from_double() from libierty, \ > +instead use floatformat_from_doublest()" > + category["floatformat_from_double"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])floatformat_from_double[[:space:]]*\(/ { > + fail("floatformat_from_double") > +} > + > +BEGIN { doc["BIG_ENDIAN"] =3D "\ > +Do not use BIG_ENDIAN, instead use BFD_ENDIAN_BIG" > + category["BIG_ENDIAN"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])BIG_ENDIAN([^_[:alnum:]]|$)/ { > + fail("BIG_ENDIAN") > +} > + > +BEGIN { doc["LITTLE_ENDIAN"] =3D "\ > +Do not use LITTLE_ENDIAN, instead use BFD_ENDIAN_LITTLE"; > + category["LITTLE_ENDIAN"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])LITTLE_ENDIAN([^_[:alnum:]]|$)/ { > + fail("LITTLE_ENDIAN") > +} > + > +BEGIN { doc["BIG_ENDIAN"] =3D "\ > +Do not use BIG_ENDIAN, instead use BFD_ENDIAN_BIG" > + category["BIG_ENDIAN"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])BIG_ENDIAN([^_[:alnum:]]|$)/ { > + fail("BIG_ENDIAN") > +} > + > +BEGIN { doc["sec_ptr"] =3D "\ > +Instead of sec_ptr, use struct bfd_section"; > + category["sec_ptr"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])sec_ptr([^_[:alnum:]]|$)/ { > + fail("sec_ptr") > +} > + > +BEGIN { doc["frame_unwind_unsigned_register"] =3D "\ > +Replace frame_unwind_unsigned_register with frame_unwind_register_unsigned" > + category["frame_unwind_unsigned_register"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])frame_unwind_unsigned_register([^_[:alnum:]]|$)/ { > + fail("frame_unwind_unsigned_register") > +} > + > +BEGIN { doc["frame_register_read"] =3D "\ > +Replace frame_register_read() with get_frame_register(), or \ > +possibly introduce a new method safe_get_frame_register()" > + category["frame_register_read"] =3D ari_obsolete > +} > +/(^|[^_[:alnum:]])frame_register_read([^_[:alnum:]]|$)/ { > + fail("frame_register_read") > +} > + > +BEGIN { doc["read_register"] =3D "\ > +Replace read_register() with regcache_read() et.al." > + category["read_register"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])read_register([^_[:alnum:]]|$)/ { > + fail("read_register") > +} > + > +BEGIN { doc["write_register"] =3D "\ > +Replace write_register() with regcache_read() et.al." > + category["write_register"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])write_register([^_[:alnum:]]|$)/ { > + fail("write_register") > +} > + > +function report(name) { > + # Drop any trailing _P. > + name =3D gensub(/(_P|_p)$/, "", 1, name) > + # Convert to lower case > + name =3D tolower(name) > + # Split into category and bug > + cat =3D gensub(/^([[:alpha:]]+)_([_[:alnum:]]*)$/, "\\1", 1, name) > + bug =3D gensub(/^([[:alpha:]]+)_([_[:alnum:]]*)$/, "\\2", 1, name) > + # Report it > + name =3D cat " " bug > + doc[name] =3D "Do not use " cat " " bug ", see declaration for detai= ls" > + category[name] =3D cat > + fail(name) > +} > + > +/(^|[^_[:alnum:]])(DEPRECATED|deprecated|set_gdbarch_deprecated|LEGACY|lega > cy|set_gdbarch_legacy)_/ { > + line =3D $0 > + # print "0 =3D", $0 > + while (1) { > + name =3D > gensub(/^(|.*[^_[:alnum:]])((DEPRECATED|deprecated|LEGACY|legacy)_[_[:alnum: > ]]*)(.*)$/, "\\2", 1, line) > + line =3D > gensub(/^(|.*[^_[:alnum:]])((DEPRECATED|deprecated|LEGACY|legacy)_[_[:alnum: > ]]*)(.*)$/, "\\1 \\4", 1, line) > + # print "name =3D", name, "line =3D", line > + if (name =3D=3D line) break; > + report(name) > + } > +} > + > +# Count the number of times each architecture method is set > +/(^|[^_[:alnum:]])set_gdbarch_[_[:alnum:]]*([^_[:alnum:]]|$)/ { > + name =3D gensub(/^.*set_gdbarch_([_[:alnum:]]*).*$/, "\\1", 1, $0) > + doc["set " name] =3D "\ > +Call to set_gdbarch_" name > + category["set " name] =3D ari_gdbarch > + fail("set " name) > +} > + > +# Count the number of times each tm/xm/nm macro is defined or undefined > +/^#[[:space:]]*(undef|define)[[:space:]]+[[:alnum:]_]+.*$/ \ > +&& > !/^#[[:space:]]*(undef|define)[[:space:]]+[[:alnum:]_]+_H($|[[:space:]])/ \ > +&& FILENAME ~ /(^|\/)config\/(|[^\/]*\/)(tm-|xm-|nm-).*\.h$/ { > + basename =3D gensub(/(^|.*\/)([^\/]*)$/, "\\2", 1, FILENAME) > + type =3D gensub(/^(tm|xm|nm)-.*\.h$/, "\\1", 1, basename) > + name =3D > gensub(/^#[[:space:]]*(undef|define)[[:space:]]+([[:alnum:]_]+).*$/, "\\2", > 1, $0) > + if (type =3D=3D basename) { > + type =3D "macro" > + } > + doc[type " " name] =3D "\ > +Do not define macros such as " name " in a tm, nm or xm file, \ > +in fact do not provide a tm, nm or xm file" > + category[type " " name] =3D ari_macro > + fail(type " " name) > +} > + > +BEGIN { doc["deprecated_registers"] =3D "\ > +Replace deprecated_registers with nothing, they have reached \ > +end-of-life" > + category["deprecated_registers"] =3D ari_eol > +} > +/(^|[^_[:alnum:]])deprecated_registers([^_[:alnum:]]|$)/ { > + fail("deprecated_registers") > +} > + > +BEGIN { doc["read_pc"] =3D "\ > +Replace READ_PC() with frame_pc_unwind; \ > +at present the inferior function call code still uses this" > + category["read_pc"] =3D ari_deprecate > +} > +/(^|[^_[:alnum:]])read_pc[[:space:]]*\(/ || \ > +/(^|[^_[:alnum:]])set_gdbarch_read_pc[[:space:]]*\(/ || \ > +/(^|[^_[:alnum:]])TARGET_READ_PC[[:space:]]*\(/ { > + fail("read_pc") > +} > + > +BEGIN { doc["write_pc"] =3D "\ > +Replace write_pc() with get_frame_base_address or get_frame_id; \ > +at present the inferior function call code still uses this when doing \ > +a DECR_PC_AFTER_BREAK" > + category["write_pc"] =3D ari_deprecate > +} > +/(^|[^_[:alnum:]])write_pc[[:space:]]*\(/ || \ > +/(^|[^_[:alnum:]])set_gdbarch_write_pc[[:space:]]*\(/ || \ > +/(^|[^_[:alnum:]])TARGET_WRITE_PC[[:space:]]*\(/ { > + fail("write_pc") > +} > + > +BEGIN { doc["generic_target_write_pc"] =3D "\ > +Replace generic_target_write_pc with a per-architecture implementation, \ > +this relies on PC_REGNUM which is being eliminated" > + category["generic_target_write_pc"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])generic_target_write_pc([^_[:alnum:]]|$)/ { > + fail("generic_target_write_pc") > +} > + > +BEGIN { doc["read_sp"] =3D "\ > +Replace read_sp() with frame_sp_unwind" > + category["read_sp"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])read_sp[[:space:]]*\(/ || \ > +/(^|[^_[:alnum:]])set_gdbarch_read_sp[[:space:]]*\(/ || \ > +/(^|[^_[:alnum:]])TARGET_READ_SP[[:space:]]*\(/ { > + fail("read_sp") > +} > + > +BEGIN { doc["register_cached"] =3D "\ > +Replace register_cached() with nothing, does not have a regcache parameter" > + category["register_cached"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])register_cached[[:space:]]*\(/ { > + fail("register_cached") > +} > + > +BEGIN { doc["set_register_cached"] =3D "\ > +Replace set_register_cached() with nothing, does not have a regcache > parameter" > + category["set_register_cached"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])set_register_cached[[:space:]]*\(/ { > + fail("set_register_cached") > +} > + > +# Print functions: Use versions that either check for buffer overflow > +# or safely allocate a fresh buffer. > + > +BEGIN { doc["sprintf"] =3D "\ > +Do not use sprintf, instead use xsnprintf or xstrprintf" > + category["sprintf"] =3D ari_code > +} > +/(^|[^_[:alnum:]])sprintf[[:space:]]*\(/ { > + fail("sprintf") > +} > + > +BEGIN { doc["vsprintf"] =3D "\ > +Do not use vsprintf(), instead use xstrvprintf" > + category["vsprintf"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])vsprintf[[:space:]]*\(/ { > + fail("vsprintf") > +} > + > +BEGIN { doc["asprintf"] =3D "\ > +Do not use asprintf(), instead use xstrprintf()" > + category["asprintf"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])asprintf[[:space:]]*\(/ { > + fail("asprintf") > +} > + > +BEGIN { doc["vasprintf"] =3D "\ > +Do not use vasprintf(), instead use xstrvprintf" > + fix("vasprintf", "gdb/utils.c", 1) > + category["vasprintf"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])vasprintf[[:space:]]*\(/ { > + fail("vasprintf") > +} > + > +BEGIN { doc["xasprintf"] =3D "\ > +Do not use xasprintf(), instead use xstrprintf" > + fix("xasprintf", "gdb/defs.h", 1) > + fix("xasprintf", "gdb/utils.c", 1) > + category["xasprintf"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])xasprintf[[:space:]]*\(/ { > + fail("xasprintf") > +} > + > +BEGIN { doc["xvasprintf"] =3D "\ > +Do not use xvasprintf(), instead use xstrvprintf" > + fix("xvasprintf", "gdb/defs.h", 1) > + fix("xvasprintf", "gdb/utils.c", 1) > + category["xvasprintf"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])xvasprintf[[:space:]]*\(/ { > + fail("xvasprintf") > +} > + > +# More generic memory operations > + > +BEGIN { doc["bzero"] =3D "\ > +Do not use bzero(), instead use memset()" > + category["bzero"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])bzero[[:space:]]*\(/ { > + fail("bzero") > +} > + > +BEGIN { doc["strdup"] =3D "\ > +Do not use strdup(), instead use xstrdup()"; > + category["strdup"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])strdup[[:space:]]*\(/ { > + fail("strdup") > +} > + > +BEGIN { doc["strsave"] =3D "\ > +Do not use strsave(), instead use xstrdup() et.al." > + category["strsave"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])strsave[[:space:]]*\(/ { > + fail("strsave") > +} > + > +# String compare functions > + > +BEGIN { doc["strnicmp"] =3D "\ > +Do not use strnicmp(), instead use strncasecmp()" > + category["strnicmp"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])strnicmp[[:space:]]*\(/ { > + fail("strnicmp") > +} > + > +# Boolean expressions and conditionals > + > +BEGIN { doc["boolean"] =3D "\ > +Do not use `boolean'\'', use `int'\'' instead" > + category["boolean"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])boolean([^_[:alnum:]]|$)/ { > + if (is_yacc_or_lex =3D=3D 0) { > + fail("boolean") > + } > +} > + > +BEGIN { doc["false"] =3D "\ > +Definitely do not use `false'\'' in boolean expressions" > + category["false"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])false([^_[:alnum:]]|$)/ { > + if (is_yacc_or_lex =3D=3D 0) { > + fail("false") > + } > +} > + > +BEGIN { doc["true"] =3D "\ > +Do not try to use `true'\'' in boolean expressions" > + category["true"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])true([^_[:alnum:]]|$)/ { > + if (is_yacc_or_lex =3D=3D 0) { > + fail("true") > + } > +} > + > +# Typedefs that are either redundant or can be reduced to `struct > +# type *''. > +# Must be placed before if assignment otherwise ARI exceptions > +# are not handled correctly. > + > +BEGIN { doc["d_namelen"] =3D "\ > +Do not use dirent.d_namelen, instead use NAMELEN" > + category["d_namelen"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])d_namelen([^_[:alnum:]]|$)/ { > + fail("d_namelen") > +} > + > +BEGIN { doc["strlen d_name"] =3D "\ > +Do not use strlen dirent.d_name, instead use NAMELEN" > + category["strlen d_name"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])strlen[[:space:]]*\(.*[^_[:alnum:]]d_name([^_[:alnum:]]|$ > )/ { > + fail("strlen d_name") > +} > + > +BEGIN { doc["var_boolean"] =3D "\ > +Replace var_boolean with add_setshow_boolean_cmd" > + category["var_boolean"] =3D ari_regression > + fix("var_boolean", "gdb/command.h", 1) > + # fix only uses the last directory level > + fix("var_boolean", "cli/cli-decode.c", 2) > +} > +/(^|[^_[:alnum:]])var_boolean([^_[:alnum:]]|$)/ { > + if ($0 !~ /(^|[^_[:alnum:]])case *var_boolean:/) { > + fail("var_boolean") > + } > +} > + > +BEGIN { doc["generic_use_struct_convention"] =3D "\ > +Replace generic_use_struct_convention with nothing, \ > +EXTRACT_STRUCT_VALUE_ADDRESS is a predicate" > + category["generic_use_struct_convention"] =3D ari_regression > +} > +/(^|[^_[:alnum:]])generic_use_struct_convention([^_[:alnum:]]|$)/ { > + fail("generic_use_struct_convention") > +} > + > +BEGIN { doc["if assignment"] =3D "\ > +An IF statement'\''s expression contains an assignment (the GNU coding \ > +standard discourages this)" > + category["if assignment"] =3D ari_code > +} > +BEGIN { doc["if clause more than 50 lines"] =3D "\ > +An IF statement'\''s expression expands over 50 lines" > + category["if clause more than 50 lines"] =3D ari_code > +} > +# > +# Accumulate continuation lines > +FNR =3D=3D 1 { > + in_if =3D 0 > +} > + > +/(^|[^_[:alnum:]])if / { > + in_if =3D 1; > + if_brace_level =3D 0; > + if_cont_p =3D 0; > + if_count =3D 0; > + if_brace_end_pos =3D 0; > + if_full_line =3D ""; > +} > +(in_if) { > + # We want everything up to closing brace of same level > + if_count++; > + if (if_count > 50) { > + print "multiline if: " if_full_line $0 > + fail("if clause more than 50 lines") > + if_brace_level =3D 0; > + if_full_line =3D ""; > + } else { > + if (if_count =3D=3D 1) { > + i =3D index($0,"if "); > + } else { > + i =3D 1; > + } > + for (i=3Di; i <=3D length($0); i++) { > + char =3D substr($0,i,1); > + if (char =3D=3D "(") { if_brace_level++; } > + if (char =3D=3D ")") { > + if_brace_level--; > + if (!if_brace_level) { > + if_brace_end_pos =3D i; > + after_if =3D substr($0,i+1,length($0)); > + # Do not parse what is following > + break; > + } > + } > + } > + if (if_brace_level =3D=3D 0) { > + $0 =3D substr($0,1,i); > + in_if =3D 0; > + } else { > + if_full_line =3D if_full_line $0; > + if_cont_p =3D 1; > + next; > + } > + } > +} > +# if we arrive here, we need to concatenate, but we are at brace level 0 > + > +(if_brace_end_pos) { > + $0 =3D if_full_line substr($0,1,if_brace_end_pos); > + if (if_count > 1) { > + # print "IF: multi line " if_count " found at " FILENAME ":" FNR " > \"" $0 "\"" > + } > + if_cont_p =3D 0; > + if_full_line =3D ""; > +} > +/(^|[^_[:alnum:]])if .* =3D / { > + # print "fail in if " $0 > + fail("if assignment") > +} > +(if_brace_end_pos) { > + $0 =3D $0 after_if; > + if_brace_end_pos =3D 0; > + in_if =3D 0; > +} > + > +# Printout of all found bug > + > +BEGIN { > + if (print_doc) { > + for (bug in doc) { > + fail(bug) > + } > + exit > + } > +}' "$@" > + > Index: contrib/ari/gdb_find.sh > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: contrib/ari/gdb_find.sh > diff -N contrib/ari/gdb_find.sh > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ contrib/ari/gdb_find.sh 18 May 2012 22:31:42 -0000 > @@ -0,0 +1,41 @@ > +#!/bin/sh > + > +# GDB script to create list of files to check using gdb_ari.sh. > +# > +# Copyright (C) 2003-2012 Free Software Foundation, Inc. > +# > +# This file is part of GDB. > +# > +# This program 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 of the License, or > +# (at your option) any later version. > +# > +# This program 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 this program. If not, see . > + > +# Make certain that the script is not running in an internationalized > +# environment. > + > +LANG=3DC ; export LANG > +LC_ALL=3DC ; export LC_ALL > + > + > +# A find that prunes files that GDB users shouldn't be interested in. > +# Use sort to order files alphabetically. > + > +find "$@" \ > + -name testsuite -prune -o \ > + -name gdbserver -prune -o \ > + -name gnulib -prune -o \ > + -name osf-share -prune -o \ > + -name '*-stub.c' -prune -o \ > + -name '*-exp.c' -prune -o \ > + -name ada-lex.c -prune -o \ > + -name cp-name-parser.c -prune -o \ > + -type f -name '*.[lyhc]' -print | sort > Index: contrib/ari/update-web-ari.sh > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: contrib/ari/update-web-ari.sh > diff -N contrib/ari/update-web-ari.sh > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ contrib/ari/update-web-ari.sh 18 May 2012 22:31:43 -0000 > @@ -0,0 +1,947 @@ > +#!/bin/sh -x > + > +# GDB script to create GDB ARI web page. > +# > +# Copyright (C) 2001-2012 Free Software Foundation, Inc. > +# > +# This file is part of GDB. > +# > +# This program 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 of the License, or > +# (at your option) any later version. > +# > +# This program 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 this program. If not, see . > + > +# TODO: setjmp.h, setjmp and longjmp. > + > +# Direct stderr into stdout but still hang onto stderr (/dev/fd/3) > +exec 3>&2 2>&1 > +ECHO () > +{ > +# echo "$@" | tee /dev/fd/3 1>&2 > + echo "$@" 1>&2 > + echo "$@" 1>&3 > +} > + > +# Really mindless usage > +if test $# -ne 4 > +then > + echo "Usage: $0 " 1>&2 > + exit 1 > +fi > +snapshot=3D$1 ; shift > +tmpdir=3D$1 ; shift > +wwwdir=3D$1 ; shift > +project=3D$1 ; shift > + > +# Try to create destination directory if it doesn't exist yet > +if [ ! -d ${wwwdir} ] > +then > + mkdir -p ${wwwdir} > +fi > + > +# Fail if destination directory doesn't exist or is not writable > +if [ ! -w ${wwwdir} -o ! -d ${wwwdir} ] > +then > + echo ERROR: Can not write to directory ${wwwdir} >&2 > + exit 2 > +fi > + > +if [ ! -r ${snapshot} ] > +then > + echo ERROR: Can not read snapshot file 1>&2 > + exit 1 > +fi > + > +# FILE formats > +# ari.*.bug: :: : : > +# ari.*.idx: :: > +# ari.*.doc: ::: > +# Where ``*'' is {source,warning,indent,doschk} > + > +unpack_source_p=3Dtrue > +delete_source_p=3Dtrue > + > +check_warning_p=3Dfalse # broken > +check_indent_p=3Dfalse # too slow, too many fail > +check_source_p=3Dtrue > +check_doschk_p=3Dtrue > +check_werror_p=3Dtrue > + > +update_doc_p=3Dtrue > +update_web_p=3Dtrue > + > +if [ ! -z "$send_email" ] > +then > + send_email=3Dfalse > +fi > + > +if awk --version 2>&1 /dev/null > +then > + AWK=3Dawk > +else > + AWK=3Dgawk > +fi > + > + > +# Set up a few cleanups > +if ${delete_source_p} > +then > + trap "cd /tmp; rm -rf ${tmpdir}; exit" 0 1 2 15 > +fi > + > + > +# If the first parameter is a directory, > +#we just use it as the extracted source > +if [ -d ${snapshot} ] > +then > + module=3D${project} > + srcdir=3D${snapshot} > + aridir=3D${srcdir}/${module}/ari > + unpack_source_p=3Dfalse > + delete_source_p=3Dfalse > + version_in=3D${srcdir}/${module}/version.in > +else > + # unpack the tar-ball > + if ${unpack_source_p} > + then > + # Was it previously unpacked? > + if ${delete_source_p} || test ! -d ${tmpdir}/${module}* > + then > + /bin/rm -rf "${tmpdir}" > + /bin/mkdir -p ${tmpdir} > + if [ ! -d ${tmpdir} ] > + then > + echo "Problem creating work directory" > + exit 1 > + fi > + cd ${tmpdir} || exit 1 > + echo `date`: Unpacking tar-ball ... > + case ${snapshot} in > + *.tar.bz2 ) bzcat ${snapshot} ;; > + *.tar ) cat ${snapshot} ;; > + * ) ECHO Bad file ${snapshot} ; exit 1 ;; > + esac | tar xf - > + fi > + fi > + > + module=3D`basename ${snapshot}` > + module=3D`basename ${module} .bz2` > + module=3D`basename ${module} .tar` > + srcdir=3D`echo ${tmpdir}/${module}*` > + aridir=3D${HOME}/ss > + version_in=3D${srcdir}/gdb/version.in > +fi > + > +if [ ! -r ${version_in} ] > +then > + echo ERROR: missing version file 1>&2 > + exit 1 > +fi > +version=3D`cat ${version_in}` > + > + > +# THIS HAS SUFFERED BIT ROT > +if ${check_warning_p} && test -d "${srcdir}" > +then > + echo `date`: Parsing compiler warnings 1>&2 > + cat ${root}/ari.compile | $AWK ' > +BEGIN { > + FS=3D":"; > +} > +/^[^:]*:[0-9]*: warning:/ { > + file =3D $1; > + #sub (/^.*\//, "", file); > + warning[file] +=3D 1; > +} > +/^[^:]*:[0-9]*: error:/ { > + file =3D $1; > + #sub (/^.*\//, "", file); > + error[file] +=3D 1; > +} > +END { > + for (file in warning) { > + print file ":warning:" level[file] > + } > + for (file in error) { > + print file ":error:" level[file] > + } > +} > +' > ${root}/ari.warning.bug > +fi > + > +# THIS HAS SUFFERED BIT ROT > +if ${check_indent_p} && test -d "${srcdir}" > +then > + printf "Analizing file indentation:" 1>&2 > + ( cd "${srcdir}" && /bin/sh ${aridir}/gdb_find.sh ${project} | while > read f > + do > + if /bin/sh ${aridir}/gdb_indent.sh < ${f} 2>/dev/null | cmp -s - > ${f} > + then > + : > + else > + # ari.*.bug: :: : : > + echo "${f}:0: info: indent: Indentation does not match GNU > indent output" > + fi > + done ) > ${wwwdir}/ari.indent.bug > + echo "" > +fi > + > +if ${check_source_p} && test -d "${srcdir}" > +then > + bugf=3D${wwwdir}/ari.source.bug > + oldf=3D${wwwdir}/ari.source.old > + srcf=3D${wwwdir}/ari.source.lines > + oldsrcf=3D${wwwdir}/ari.source.lines-old > + > + diff=3D${wwwdir}/ari.source.diff > + diffin=3D${diff}-in > + newf1=3D${bugf}1 > + oldf1=3D${oldf}1 > + oldpruned=3D${oldf1}-pruned > + newpruned=3D${newf1}-pruned > + > + cp -f ${bugf} ${oldf} > + cp -f ${srcf} ${oldsrcf} > + rm -f ${srcf} > + node=3D`uname -n` > + echo "`date`: Using source lines ${srcf}" 1>&2 > + echo "`date`: Checking source code" 1>&2 > + ( cd "${srcdir}" && /bin/sh ${aridir}/gdb_find.sh "${project}" | \ > + xargs /bin/sh ${aridir}/gdb_ari.sh -Werror -Wall --print-idx > --src=3D${srcf} > + ) > ${bugf} > + # Remove things we are not interested in to signal by email > + # gdbarch changes are not important here > + # Also convert ` into ' to avoid command substitution in script below > + sed -e "/.*: gdbarch:.*/d" -e "s:\`:':g" ${oldf} > ${oldf1} > + sed -e "/.*: gdbarch:.*/d" -e "s:\`:':g" ${bugf} > ${newf1} > + # Remove line number info so that code inclusion/deletion > + # has no impact on the result > + sed -e "s/\([^:]*\):\([^:]*\):\(.*\)/\1:0:\3/" ${oldf1} > ${oldpruned} > + sed -e "s/\([^:]*\):\([^:]*\):\(.*\)/\1:0:\3/" ${newf1} > ${newpruned} > + # Use diff without option to get normal diff output that > + # is reparsed after > + diff ${oldpruned} ${newpruned} > ${diffin} > + # Only keep new warnings > + sed -n -e "/^>.*/p" ${diffin} > ${diff} > + sedscript=3D${wwwdir}/sedscript > + script=3D${wwwdir}/script > + sed -n -e "s|\(^[0-9,]*\)a\(.*\)|echo \1a\2 \n \ > + sed -n \'\2s:\\\\(.*\\\\):> \\\\1:p\' ${newf1}|p" \ > + -e "s|\(^[0-9,]*\)d\(.*\)|echo \1d\2\n \ > + sed -n \'\1s:\\\\(.*\\\\):< \\\\1:p\' ${oldf1}|p" \ > + -e "s|\(^[0-9,]*\)c\(.*\)|echo \1c\2\n \ > + sed -n \'\1s:\\\\(.*\\\\):< \\\\1:p\' ${oldf1} \n \ > + sed -n \"\2s:\\\\(.*\\\\):> \\\\1:p\" ${newf1}|p" \ > + ${diffin} > ${sedscript} > + ${SHELL} ${sedscript} > ${wwwdir}/message > + sed -n \ > + -e "s;\(.*\);echo \\\"\1\\\";p" \ > + -e "s;.*< \([^:]*\):\([0-9]*\):.*;grep \"^\1:\2:\" ${oldsrcf};p" \ > + -e "s;.*> \([^:]*\):\([0-9]*\):.*;grep \"^\1:\2:\" ${srcf};p" \ > + ${wwwdir}/message > ${script} > + ${SHELL} ${script} > ${wwwdir}/mail-message > + if [ "x${branch}" !=3D "x" ]; then > + email_suffix=3D"`date` in ${branch}" > + else > + email_suffix=3D"`date`" > + fi > + > + if [ "$send_email" =3D=3D "true" ]; then > + if [ "${node}" =3D "sourceware.org" ]; then > + warning_email=3Dgdb-patches@sourceware.org > + else > + # Use default email > + warning_email=3D${USER}@${node} > + fi > + > + # Check if ${diff} is not empty > + if [ -s ${diff} ]; then > + # Send an email $warning_email > + mutt -s "New ARI warning ${email_suffix}" \ > + ${warning_email} < ${wwwdir}/mail-message > + else > + if [ -s ${wwwdir}/${mail-message} ]; then > + # Send an email to $warning_email > + mutt -s "ARI warning list change ${email_suffix}" \ > + ${warning_email} < ${wwwdir}/mail-message > + fi > + fi > + fi > +fi > + > + > + > + > +if ${check_doschk_p} && test -d "${srcdir}" > +then > + echo "`date`: Checking for doschk" 1>&2 > + rm -f "${wwwdir}"/ari.doschk.* > + fnchange_lst=3D"${srcdir}"/gdb/config/djgpp/fnchange.lst > + fnchange_awk=3D"${wwwdir}"/ari.doschk.awk > + doschk_in=3D"${wwwdir}"/ari.doschk.in > + doschk_out=3D"${wwwdir}"/ari.doschk.out > + doschk_bug=3D"${wwwdir}"/ari.doschk.bug > + doschk_char=3D"${wwwdir}"/ari.doschk.char > + > + # Transform fnchange.lst into fnchange.awk. The program DJTAR > + # does a textual substitution of each file name using the list. > + # Generate an awk script that does the equivalent - matches an > + # exact line and then outputs the replacement. > + > + sed -e 's;@[^@]*@[/]*\([^ ]*\) @[^@]*@[/]*\([^ ]*\);\$0 =3D=3D "\1" { print > "\2"\; next\; };' \ > + < "${fnchange_lst}" > "${fnchange_awk}" > + echo '{ print }' >> "${fnchange_awk}" > + > + # Do the raw analysis - transform the list of files into the DJGPP > + # equivalents putting it in the .in file > + ( cd "${srcdir}" && find * \ > + -name '*.info-[0-9]*' -prune \ > + -o -name tcl -prune \ > + -o -name itcl -prune \ > + -o -name tk -prune \ > + -o -name libgui -prune \ > + -o -name tix -prune \ > + -o -name dejagnu -prune \ > + -o -name expect -prune \ > + -o -type f -print ) \ > + | $AWK -f ${fnchange_awk} > ${doschk_in} > + > + # Start with a clean slate > + rm -f ${doschk_bug} > + > + # Check for any invalid characters. > + grep '[\+\,\;\=3D\[\]\|\<\>\\\"\:\?\*]' < ${doschk_in} > ${doschk_ch= ar} > + # ari.*.bug: :: : : > + sed < ${doschk_char} >> ${doschk_bug} \ > + -e s'/$/:0: dos: DOSCHK: Invalid DOS character/' > + > + # Magic to map ari.doschk.out to ari.doschk.bug goes here > + doschk < ${doschk_in} > ${doschk_out} > + cat ${doschk_out} | $AWK >> ${doschk_bug} ' > +BEGIN { > + state =3D 1; > + invalid_dos =3D state++; bug[invalid_dos] =3D "invalid DOS file name= "; > category[invalid_dos] =3D "dos"; > + same_dos =3D state++; bug[same_dos] =3D "DOS 8.3"; > category[same_dos] =3D "dos"; > + same_sysv =3D state++; bug[same_sysv] =3D "SysV"; > + long_sysv =3D state++; bug[long_sysv] =3D "long SysV"; > + internal =3D state++; bug[internal] =3D "internal doschk"; > category[internal] =3D "internal"; > + state =3D 0; > +} > +/^$/ { state =3D 0; next; } > +/^The .* not valid DOS/ { state =3D invalid_dos; next; } > +/^The .* same DOS/ { state =3D same_dos; next; } > +/^The .* same SysV/ { state =3D same_sysv; next; } > +/^The .* too long for SysV/ { state =3D long_sysv; next; } > +/^The .* / { state =3D internal; next; } > + > +NF =3D=3D 0 { next } > + > +NF =3D=3D 3 { name =3D $1 ; file =3D $3 } > +NF =3D=3D 1 { file =3D $1 } > +NF > 3 && $2 =3D=3D "-" { file =3D $1 ; name =3D gensub(/^.* - /, "", 1)= } > + > +state =3D=3D same_dos { > + # ari.*.bug: :: : : > + print file ":0: " category[state] ": " \ > + name " " bug[state] " " " dup: " \ > + " DOSCHK - the names " name " and " file " resolve to the same" \ > + " file on a " bug[state] \ > + " system.
For DOS, this can be fixed by modifying the file" \ > + " fnchange.lst." > + next > +} > +state =3D=3D invalid_dos { > + # ari.*.bug: :: : : > + print file ":0: " category[state] ": " name ": DOSCHK - " name > + next > +} > +state =3D=3D internal { > + # ari.*.bug: :: : : > + print file ":0: " category[state] ": " bug[state] ": DOSCHK - a " \ > + bug[state] " problem" > +} > +' > +fi > + > + > + > +if ${check_werror_p} && test -d "${srcdir}" > +then > + echo "`date`: Checking Makefile.in for non- -Werror rules" > + rm -f ${wwwdir}/ari.werror.* > + cat "${srcdir}/${project}/Makefile.in" | $AWK > > ${wwwdir}/ari.werror.bug ' > +BEGIN { > + count =3D 0 > + cont_p =3D 0 > + full_line =3D "" > +} > +/^[-_[:alnum:]]+\.o:/ { > + file =3D gensub(/.o:.*/, "", 1) ".c" > +} > + > +/[^\\]\\$/ { gsub (/\\$/, ""); full_line =3D full_line $0; cont_p =3D 1; next; > } > +cont_p { $0 =3D full_line $0; cont_p =3D 0; full_line =3D ""; } > + > +/\$\(COMPILE\.pre\)/ { > + print file " has line " $0 > + if (($0 !~ /\$\(.*ERROR_CFLAGS\)/) && ($0 !~ /\$\(INTERNAL_CFLAGS\)/)) > { > + # ari.*.bug: :: : : > + print "'"${project}"'/" file ":0: info: Werror: The file is not > being compiled with -Werror" > + } > +} > +' > +fi > + > + > +# From the warnings, generate the doc and indexed bug files > +if ${update_doc_p} > +then > + cd ${wwwdir} > + rm -f ari.doc ari.idx ari.doc.bug > + # Generate an extra file containing all the bugs that the ARI can > detect. > + /bin/sh ${aridir}/gdb_ari.sh -Werror -Wall --print-idx --print-doc >> > ari.doc.bug > + cat ari.*.bug | $AWK > ari.idx ' > +BEGIN { > + FS=3D": *" > +} > +{ > + # ari.*.bug: :: : : > + file =3D $1 > + line =3D $2 > + category =3D $3 > + bug =3D $4 > + if (! (bug in cat)) { > + cat[bug] =3D category > + # strip any trailing .... (supplement) > + doc[bug] =3D gensub(/ \([^\)]*\)$/, "", 1, $5) > + count[bug] =3D 0 > + } > + if (file !=3D "") { > + count[bug] +=3D 1 > + # ari.*.idx: :: > + print bug ":" file ":" category > + } > + # Also accumulate some categories as obsolete > + if (category =3D=3D "deprecated") { > + # ari.*.idx: :: > + if (file !=3D "") { > + print category ":" file ":" "obsolete" > + } > + #count[category]++ > + #doc[category] =3D "Contains " category " code" > + } > +} > +END { > + i =3D 0; > + for (bug in count) { > + # ari.*.doc: ::: > + print bug ":" count[bug] ":" cat[bug] ":" doc[bug] >> "ari.doc" > + } > +} > +' > +fi > + > + > +# print_toc BIAS MIN_COUNT CATEGORIES TITLE > + > +# Print a table of contents containing the bugs CATEGORIES. If the > +# BUG count >=3D MIN_COUNT print it in the table-of-contents. If > +# MIN_COUNT is non -ve, also include a link to the table.Adjust the > +# printed BUG count by BIAS. > + > +all=3D > + > +print_toc () > +{ > + bias=3D"$1" ; shift > + min_count=3D"$1" ; shift > + > + all=3D" $all $1 " > + categories=3D"" > + for c in $1; do > + categories=3D"${categories} categories[\"${c}\"] =3D 1 ;" > + done > + shift > + > + title=3D"$@" ; shift > + > + echo "

" >> ${newari} > + echo "" | tr '[A-Z]' '[a-z]' >> ${newari} > + echo "

${title}

" >> ${newari} > + cat >> ${newari} # description > + > + cat >> ${newari} < +

> + > + > +EOF > + # ari.*.doc: ::: > + cat ${wwwdir}/ari.doc \ > + | sort -t: +1rn -2 +0d \ > + | $AWK >> ${newari} ' > +BEGIN { > + FS=3D":" > + '"$categories"' > + MIN_COUNT =3D '${min_count}' > + BIAS =3D '${bias}' > + total =3D 0 > + nr =3D 0 > +} > +{ > + # ari.*.doc: ::: > + bug =3D $1 > + count =3D $2 > + category =3D $3 > + doc =3D $4 > + if (count < MIN_COUNT) next > + if (!(category in categories)) next > + nr +=3D 1 > + total +=3D count > + printf "" > + printf "" > + printf "", bug, count + BIAS > + } else { > + printf "%d", count + BIAS > + } > + printf "" > + printf "", doc > + printf "" > + print "" > +} > +END { > + print "" > +} > +' > +cat >> ${newari} < +
BUGTotal align=3Dleft>Description
", bug > + printf "%s", gensub(/_/, " ", "g", bug) > + printf "" > + if (count > 0 && MIN_COUNT >=3D 0) { > + printf "%d%s
" nr " valign=3Dtop>" total "
> +

> +EOF > +} > + > + > +print_table () > +{ > + categories=3D"" > + for c in $1; do > + categories=3D"${categories} categories[\"${c}\"] =3D 1 ;" > + done > + # Remember to prune the dir prefix from projects files > + # ari.*.idx: :: > + cat ${wwwdir}/ari.idx | $AWK >> ${newari} ' > +function qsort (table, > + middle, tmp, left, nr_left, right, nr_right, result) { > + middle =3D "" > + for (middle in table) { break; } > + nr_left =3D 0; > + nr_right =3D 0; > + for (tmp in table) { > + if (tolower(tmp) < tolower(middle)) { > + nr_left++ > + left[tmp] =3D tmp > + } else if (tolower(tmp) > tolower(middle)) { > + nr_right++ > + right[tmp] =3D tmp > + } > + } > + #print "qsort " nr_left " " middle " " nr_right > "/dev/stderr" > + result =3D "" > + if (nr_left > 0) { > + result =3D qsort(left) SUBSEP > + } > + result =3D result middle > + if (nr_right > 0) { > + result =3D result SUBSEP qsort(right) > + } > + return result > +} > +function print_heading (where, bug_i) { > + print "" > + print "" > + print "File" > + print "Total" > + print "" > + for (bug_i =3D 1; bug_i <=3D nr_bug; bug_i++) { > + bug =3D i2bug[bug_i]; > + printf "" > + # The title names are offset by one. Otherwize, when the browser > + # jumps to the name it leaves out half the relevant column. > + #printf " ", bug > + printf " ", i2bug[bug_i-1] > + printf "", bug > + printf "%s", gensub(/_/, " ", "g", bug) > + printf "\n" > + printf "\n" > + } > + #print "" > + printf " \n", i2bug[bug_i-1] > + print "Total" > + print "File" > + print "" > +} > +function print_totals (where, bug_i) { > + print "Totals" > + printf "" > + printf "%s", total > + printf ">" > + printf "\n" > + print ""; > + for (bug_i =3D 1; bug_i <=3D nr_bug; bug_i++) { > + bug =3D i2bug[bug_i]; > + printf "" > + printf "" > + printf "%d", bug, bug_total[bug] > + printf ""; > + printf "^", prev_file[bug, where], bug > + printf "v", next_file[bug, where], bug > + printf " ", where, bug > + printf ""; > + print "" > + } > + print "" > + printf "" > + printf "%s", total > + printf "<" > + printf "\n" > + print "Totals" > + print "" > +} > +BEGIN { > + FS =3D ":" > + '"${categories}"' > + nr_file =3D 0; > + nr_bug =3D 0; > +} > +{ > + # ari.*.idx: :: > + bug =3D $1 > + file =3D $2 > + category =3D $3 > + # Interested in this > + if (!(category in categories)) next > + # Totals > + db[bug, file] +=3D 1 > + bug_total[bug] +=3D 1 > + file_total[file] +=3D 1 > + total +=3D 1 > +} > +END { > + > + # Sort the files and bugs creating indexed lists. > + nr_bug =3D split(qsort(bug_total), i2bug, SUBSEP); > + nr_file =3D split(qsort(file_total), i2file, SUBSEP); > + > + # Dummy entries for first/last > + i2file[0] =3D 0 > + i2file[-1] =3D -1 > + i2bug[0] =3D 0 > + i2bug[-1] =3D -1 > + > + # Construct a cycle of next/prev links. The file/bug "0" and "-1" > + # are used to identify the start/end of the cycle. Consequently, > + # prev(0) =3D -1 (prev of start is the end) and next(-1) =3D 0 (next > + # of end is the start). > + > + # For all the bugs, create a cycle that goes to the prev / next file. > + for (bug_i =3D 1; bug_i <=3D nr_bug; bug_i++) { > + bug =3D i2bug[bug_i] > + prev =3D 0 > + prev_file[bug, 0] =3D -1 > + next_file[bug, -1] =3D 0 > + for (file_i =3D 1; file_i <=3D nr_file; file_i++) { > + file =3D i2file[file_i] > + if ((bug, file) in db) { > + prev_file[bug, file] =3D prev > + next_file[bug, prev] =3D file > + prev =3D file > + } > + } > + prev_file[bug, -1] =3D prev > + next_file[bug, prev] =3D -1 > + } > + > + # For all the files, create a cycle that goes to the prev / next bug. > + for (file_i =3D 1; file_i <=3D nr_file; file_i++) { > + file =3D i2file[file_i] > + prev =3D 0 > + prev_bug[file, 0] =3D -1 > + next_bug[file, -1] =3D 0 > + for (bug_i =3D 1; bug_i <=3D nr_bug; bug_i++) { > + bug =3D i2bug[bug_i] > + if ((bug, file) in db) { > + prev_bug[file, bug] =3D prev > + next_bug[file, prev] =3D bug > + prev =3D bug > + } > + } > + prev_bug[file, -1] =3D prev > + next_bug[file, prev] =3D -1 > + } > + > + print "" > + print "" > + print_heading(0); > + print "" > + print_totals(0); > + print "" > + > + for (file_i =3D 1; file_i <=3D nr_file; file_i++) { > + file =3D i2file[file_i]; > + pfile =3D gensub(/^'${project}'\//, "", 1, file) > + print "" > + print "" > + print "" > + printf "\n" > + print "" > + for (bug_i =3D 1; bug_i <=3D nr_bug; bug_i++) { > + bug =3D i2bug[bug_i]; > + if ((bug, file) in db) { > + printf "" > + print "" > + } else { > + print "" > + #print "" > + } > + } > + print "" > + printf "\n" > + print "" > + print "" > + } > + > + print "" > + print_totals(-1) > + print "" > + print_heading(-1); > + print "" > + print "" > + print "
" pfile "" > + printf "%s", file_total[file] > + printf ">", file, next_bug[file, 0] > + printf "" > + printf "%d", bug, db[bug, file] > + printf "^", prev_file[bug, file], bug > + printf "v", next_file[bug, file], bug > + printf " ", file, bug > + printf " " > + printf "%s", file_total[file] > + printf "<", file, prev_bug[file, -1] > + printf "" pfile "
" > + print "" > +} > +' > +} > + > + > +# Make the scripts available > +cp ${aridir}/gdb_*.sh ${wwwdir} > + > +# Compute the ARI index - ratio of zero vs non-zero problems. > +indexes=3D`awk ' > +BEGIN { > + FS=3D":" > +} > +{ > + # ari.*.doc: ::: > + bug =3D $1; count =3D $2; category =3D $3; doc =3D $4 > + > + if (bug ~ /^legacy_/) legacy++ > + if (bug ~ /^deprecated_/) deprecated++ > + > + if (category !~ /^gdbarch$/) { > + bugs +=3D count > + } > + if (count =3D=3D 0) { > + oks++ > + } > +} > +END { > + #print "tests/ok:", nr / ok > + #print "bugs/tests:", bugs / nr > + #print "bugs/ok:", bugs / ok > + print bugs / ( oks + legacy + deprecated ) > +} > +' ${wwwdir}/ari.doc` > + > +# Merge, generating the ARI tables. > +if ${update_web_p} > +then > + echo "Create the ARI table" 1>&2 > + oldari=3D${wwwdir}/old.html > + ari=3D${wwwdir}/index.html > + newari=3D${wwwdir}/new.html > + rm -f ${newari} ${newari}.gz > + cat <> ${newari} > + > + > +A.R. Index for GDB version ${version} > + > + > + > +

A.R. Index for GDB version ${version}

> + > + > + > + > + > +

${indexes}

> +

You can not take this seriously!

> + > +
> +Also available: > +most recent branch > +| > +current > +| > +last release > +
> + > +
> +Last updated: `date -u` > +
> +EOF > + > + print_toc 0 1 "internal regression" Critical < +Things previously eliminated but returned. This should always be empty. > +EOF > + > + print_table "regression code comment obsolete gettext" > + > + print_toc 0 0 code Code < +Coding standard problems, portability problems, readability problems. > +EOF > + > + print_toc 0 0 comment Comments < +Problems concerning comments in source files. > +EOF > + > + print_toc 0 0 gettext GetText < +Gettext related problems. > +EOF > + > + print_toc 0 -1 dos DOS 8.3 File Names < +File names with problems on 8.3 file systems. > +EOF > + > + print_toc -2 -1 deprecated Deprecated < +Mechanisms that have been replaced with something better, simpler, > +cleaner; or are no longer required by core-GDB. New code should not > +use deprecated mechanisms. Existing code, when touched, should be > +updated to use non-deprecated mechanisms. See obsolete and deprecate. > +(The declaration and definition are hopefully excluded from count so > +zero should indicate no remaining uses). > +EOF > + > + print_toc 0 0 obsolete Obsolete < +Mechanisms that have been replaced, but have not yet been marked as > +such (using the deprecated_ prefix). See deprecate and deprecated. > +EOF > + > + print_toc 0 -1 deprecate Deprecate < +Mechanisms that are a candidate for being made obsolete. Once core > +GDB no longer depends on these mechanisms and/or there is a > +replacement available, these mechanims can be deprecated (adding the > +deprecated prefix) obsoleted (put into category obsolete) or deleted. > +See obsolete and deprecated. > +EOF > + > + print_toc -2 -1 legacy Legacy < +Methods used to prop up targets using targets that still depend on > +deprecated mechanisms. (The method's declaration and definition are > +hopefully excluded from count). > +EOF > + > + print_toc -2 -1 gdbarch Gdbarch < +Count of calls to the gdbarch set methods. (Declaration and > +definition hopefully excluded from count). > +EOF > + > + print_toc 0 -1 macro Macro < +Breakdown of macro definitions (and #undef) in configuration files. > +EOF > + > + print_toc 0 0 regression Fixed < +Problems that have been expunged from the source code. > +EOF > + > + # Check for invalid categories > + for a in $all; do > + alls=3D"$alls all[$a] =3D 1 ;" > + done > + cat ari.*.doc | $AWK >> ${newari} ' > +BEGIN { > + FS =3D ":" > + '"$alls"' > +} > +{ > + # ari.*.doc: ::: > + bug =3D $1 > + count =3D $2 > + category =3D $3 > + doc =3D $4 > + if (!(category in all)) { > + print "" category ": no documentation
" > + } > +} > +' > + > + cat >> ${newari} < +
> +Input files: > +`( cd ${wwwdir} && ls ari.*.bug ari.idx ari.doc ) | while read f > +do > + echo "${f}" > +done` > +
> + > +
> +Scripts: > +`( cd ${wwwdir} && ls *.sh ) | while read f > +do > + echo "${f}" > +done` > +
> + > + > + > + > +EOF > + > + for i in . .. ../..; do > + x=3D${wwwdir}/${i}/index.sh > + if test -x $x; then > + $x ${newari} > + break > + fi > + done > + > + gzip -c -v -9 ${newari} > ${newari}.gz > + > + cp ${ari} ${oldari} > + cp ${ari}.gz ${oldari}.gz > + cp ${newari} ${ari} > + cp ${newari}.gz ${ari}.gz > + > +fi # update_web_p > + > +# ls -l ${wwwdir} > + > +exit 0