[RFA] gdb_ari.sh changes to discard some file types for specific tests

Pierre Muller
2007-10-16T12:41:48Z

UCASE and EditCase tests are currently polluted
by lex and yacc files.
This patch discards those bugs if the source
is a lex or yacc source.
The patch also contains the fixes for xasprintf and xvasprintf
that I already proposed yesterday.

I am new to AWK scripts,
so I am unsure if my changes are
standard.

Is this OK?

Pierre Muller

Pseudo ChangeLog:

2007-10-16 Pierre Muller <muller@ics.u-strasbg.fr>
* gdb_ari.sh (is_yacc_or_lex): New variable.
(FNR == 1): Set is_yacc_or_lex according to FILENAME
pattern matching;
(UCASE): Discard error if is_yacc_or_lex is set.
(editCase): Ditto. Give more precise documentation.
(xasprintf): Add known entries in defs.h and utils.c.
Switch to regression category.
(xvasprintf): Idem.

$ cvs diff -up gdb_ari.sh
Index: gdb_ari.sh
===================================================================
RCS file: /cvs/gdbadmin/ss/gdb_ari.sh,v
retrieving revision 1.75
diff -u -p -r1.75 gdb_ari.sh
--- gdb_ari.sh 10 Oct 2007 11:56:14 -0000 1.75
+++ gdb_ari.sh 16 Oct 2007 12:34:18 -0000
@@ -172,6 +172,13 @@ function fail(bug,supplement) {

FNR == 1 {
seen[FILENAME] = 1
+ if (match(FILENAME, "\\.[ly]$") || match(FILENAME, "-lex\\.c")) {
+ # FILENAME is a lex or yacc source, or a C file generated by lex
+ is_yacc_or_lex = 1
+ }
+ else {
+ is_yacc_or_lex = 0
+ }
}
END {
if (print_idx) {
@@ -455,15 +462,19 @@ Function name is uppercase."
category["UCASE function"] = ari_code
}
/^[A-Z][[:alnum:]_]*[[:space:]]*\(/ {
- fail("UCASE function")
+ if (is_yacc_or_lex == 0) {
+ fail("UCASE function")
+ }
}

BEGIN { doc["editCase function"] = "\
-Function name is uppercase."
+Function name starts lower case but has uppercased letters."
category["editCase function"] = ari_code
}
-/^[a-z][a-z0-0_]*[A-Z][a-z0-9A-Z_]*[[:space:]]*\(/ {
- fail("editCase function")
+/^[a-z][a-z0-9_]*[A-Z][a-z0-9A-Z_]*[[:space:]]*\(/ {
+ if (is_yacc_or_lex == 0) {
+ fail("editCase function")
+ }
}

BEGIN { doc["hash"] = "\
@@ -1300,7 +1311,9 @@ Do not use vasprintf(), instead use xstr

BEGIN { doc["xasprintf"] = "\
Do not use xasprintf(), instead use xstrprintf"
- category["xasprintf"] = ari_code
+ fix("xasprintf", "gdb/defs.h", 1)
+ fix("xasprintf", "gdb/utils.c", 1)
+ category["xasprintf"] = ari_regression
}
/(^|[^_[:alnum:]])xasprintf[[:space:]]*\(/ {
fail("xasprintf")
@@ -1308,7 +1321,9 @@ Do not use xasprintf(), instead use xstr

BEGIN { doc["xvasprintf"] = "\
Do not use xvasprintf(), instead use xstrvprintf"
- category["xvasprintf"] = ari_code
+ fix("xvasprintf", "gdb/defs.h", 1)
+ fix("xvasprintf", "gdb/utils.c", 1)
+ category["xvasprintf"] = ari_regression
}
/(^|[^_[:alnum:]])xvasprintf[[:space:]]*\(/ {
fail("xvasprintf")