This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFC] Fix false ARI messages
- From: "Pierre Muller" <muller at ics dot u-strasbg dot fr>
- To: <gdb-patches at sourceware dot org>
- Cc: "'Daniel Jacobowitz'" <drow at false dot org>
- Date: Fri, 13 Feb 2009 17:06:56 +0100
- Subject: [RFC] Fix false ARI messages
The AR Index on current HEAD sources
show several regressions compared to
last release.
http://sourceware.org/gdb/current/ari/
But noted that two of them
(use of false and true)
are false warnings because they originate
from ada-lex.l file.
I also found out that many
"if assignment" warnings were due to
macros containing complete if () then {} else {}
code.
#define YY_INPUT(BUF, RESULT, MAX_SIZE) \
if ( *lexptr == '\000' ) \
(RESULT) = YY_NULL; \
else \
{ \
*(BUF) = *lexptr; \
(RESULT) = 1; \
lexptr += 1; \
}
The proposed change might miss some
real errors like
if (((test == NULL)|| (test1 == NULL)) && (test2 = NULL)) {
But I don't know enough of awk and regexp
to be able to write down a regular expression
that is able to count brace level...
In fact, ideally, we should concatenate all lines
of an "if" statement until we get back to
the top level closing brace.
Any advice from a fluent awk-speaker?
Pierre Muller
Pascal language support maintainer for GDB
There is no ChangeLog in that directory, should we introduce one?
ChangeLog entry would be:
2009-02-13 Pierre Muller <muller@ics.u-strasbg.fr>
* gdb_ari.sh ("Boolean" rule): Exclude lex and yacc sources.
("false" rule, "true" rule): Ditto.
("if assignment" rule): Do not consider any assignment coming
after a closing brace.
$ cvs diff -u gdb_ari.sh
Index: gdb_ari.sh
===================================================================
RCS file: /cvs/gdbadmin/ss/gdb_ari.sh,v
retrieving revision 1.77
diff -u -r1.77 gdb_ari.sh
--- gdb_ari.sh 24 Oct 2007 20:24:55 -0000 1.77
+++ gdb_ari.sh 13 Feb 2009 15:42:29 -0000
@@ -1364,7 +1364,9 @@
category["boolean"] = ari_regression
}
/(^|[^_[:alnum:]])boolean([^_[:alnum:]]|$)/ {
- fail("boolean")
+ if (is_yacc_or_lex == 0) {
+ fail("boolean")
+ }
}
BEGIN { doc["false"] = "\
@@ -1372,7 +1374,9 @@
category["false"] = ari_regression
}
/(^|[^_[:alnum:]])false([^_[:alnum:]]|$)/ {
- fail("false")
+ if (is_yacc_or_lex == 0) {
+ fail("false")
+ }
}
BEGIN { doc["true"] = "\
@@ -1380,7 +1384,9 @@
category["true"] = ari_regression
}
/(^|[^_[:alnum:]])true([^_[:alnum:]]|$)/ {
- fail("true")
+ if (is_yacc_or_lex == 0) {
+ fail("true")
+ }
}
BEGIN { doc["if assignment"] = "\
@@ -1388,7 +1394,7 @@
standard discourages this)"
category["if assignment"] = ari_code
}
-/ if .* = / {
+/(^|[^_[:alnum:]])if *\((\([^)]*\)|)*[^)]* = / {
fail("if assignment")
}