This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] gdbadmin/ss/gdb_ari.sh update UCASE rule


> From: "Pierre Muller" <muller@ics.u-strasbg.fr>
> Date: Tue, 14 Apr 2009 23:49:33 +0200
> 
> The current UCASE rule 
> triggers lost of false warnings 
> as for instance
> 
> gdb/breakpoint.c:8522: code: UCASE function: Function name is uppercase.
> 
> gdb/breakpoint.c:8520: /* Create a vector of all tracepoints.  */
> gdb/breakpoint.c:8521: 
> gdb/breakpoint.c:8522: VEC(breakpoint_p) *
> gdb/breakpoint.c:8523: all_tracepoints ()
> gdb/breakpoint.c:8524: {
> 
> I propose a rule that only looks for:
> a function name starting with a capital letter at the start 
> of the line, followed by a open brace, optionally parameters, a closing
> brace and nothing else (apart from spaces)

Wouldn't it be better to apply this test only on lines immediately
preceding a line that begins with a left brace?  I believe we already
have a rule whereby each function needs to begin as follows:

  TYPE
  NAME (PARAMETERS)
  {

So we want to have the second line, and only that line, be subject to
the "UCASE function" test, right?  The false positive that you are
trying to resolve trips on the first line, which is not what we want.
OTOH, the replacement you suggest:

> -/^[A-Z][[:alnum:]_]*[[:space:]]*\(/ {
> +/^[A-Z][[:alnum:]_]*[[:space:]]*\([^()]*\)[[:space:]]*$/ {

seems to catch cases such

  NAME (PARAMETERS)

without any context, so it could easily trip on unrelated source
lines, because it does not guarantee that this is a function
definition.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]