Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
To: "'Joel Brobecker'" <brobecker@adacore.com>,
	       "'Maxim Grigoriev'" <maxim@tensilica.com>
Cc: <gdb-patches@sourceware.org>
Subject: [RFA] New rules for ARI (was  [commit] Get rid of build warnings on xtensa-tdep.c)
Date: Fri, 11 Mar 2011 11:39:00 -0000	[thread overview]
Message-ID: <001e01cbdfd2$96205a60$c2610f20$@muller@ics-cnrs.unistra.fr> (raw)
In-Reply-To: <20110311064501.GA30306@adacore.com>

  Reading Joel's comment, I thought
that the missing 'void' inside braces
should be a gdb_ari.sh output,
so I tried to write a new rule
to find out if functions that have no parameters
do use () instead of (void).

  While at it, I also tried to figure out if
there were calls to functions in first lines
(or prototype declarations with the function name at first line).

  I got 13 "function call in first line"
and 16 "no parameter function"

  I think that most are real errors in the sources:
$ grep -f list-no-param *lines
gdb/breakpoint.c:11955:all_tracepoints ()
gdb/f-exp.y:922:match_string_literal ()
gdb/f-exp.y:954:yylex ()
gdb/m2-exp.y:811:yylex ()
gdb/mep-tdep.c:848:current_me_module ()
gdb/mep-tdep.c:871:current_options ()
gdb/mep-tdep.c:888:current_cop_data_bus_width ()
gdb/mep-tdep.c:897:current_cr_names ()
gdb/mep-tdep.c:909:current_cr_is_float ()
gdb/mep-tdep.c:921:current_ccr_names ()
gdb/objc-exp.y:1221:yylex ()
gdb/p-exp.y:1123:yylex ()
gdb/python/py-evts.c:45:gdbpy_initialize_py_events ()
gdb/python/py-prettyprint.c:397:push_dummy_python_frame ()
gdb/remote.c:3115:send_interrupt_sequence ()
gdb/tracepoint.c:221:current_trace_status ()

$ grep -f list-first *lines
gdb/hppa-tdep.h:244:hppa_init_objfile_priv_data (struct objfile *objfile);
gdb/inferior.h:370:get_displaced_step_closure_by_addr (CORE_ADDR addr);
gdb/objc-exp.y:111:yyparse (void);
gdb/objc-exp.y:114:yylex (void);
gdb/objc-exp.y:117:yyerror (char *);
gdb/objc-exp.y:154:parse_number (char *, int, int, YYSTYPE *);
gdb/p-exp.y:121:yyerror (char *);
gdb/p-exp.y:158:parse_number (char *, int, int, YYSTYPE *);
gdb/python/py-stopevent.h:32:create_breakpoint_event_object (PyObject
*breakpoint);
gdb/python/py-stopevent.h:35:create_signal_event_object (enum target_signal
stop_signal);
gdb/solib-pa64.c:80:read_dynamic_info (asection *dyninfo_sect, dld_cache_t
*dld_cache_p);
gdb/varobj.c:300:varobj_add_child (struct varobj *var, const char *name,
struct value *value);
gdb/varobj.h:171:varobj_set_visualizer (struct varobj *var, const char
*visualizer);
  

OK to add these two new rules?

Pierre Muller, as ARI maintainer...

PS: Most of these ARI warnings should be easy to fix and
this would allow to promote these rule rapidly to ari_regression,
giving them a higher visibility if someone introduces
such code again later.


  
$ cvs diff -u -p gdb_ari.sh
Index: gdb_ari.sh
===================================================================
RCS file: /cvs/gdbadmin/ss/gdb_ari.sh,v
retrieving revision 1.105
diff -u -p -r1.105 gdb_ari.sh
--- gdb_ari.sh  29 Sep 2010 18:56:10 -0000      1.105
+++ gdb_ari.sh  11 Mar 2011 09:43:11 -0000
@@ -561,7 +561,27 @@ Function name starts lower case but has
     possible_FNR = FNR
     editCase_full_line = $0
 }
-
+
+# Only function implementation should be on first line
+BEGIN { doc["function call in first line"] = "\
+Function name in first line should be restricted to function
implementation"
+    category["function call in first line"] = ari_code
+}
+/^[a-z][a-z0-9_]*[[:space:]]*\((|[^*][^()]*)\)[[:space:]]*[^ \t]+/ {
+    fail("function call in first line")
+}
+
+
+# Functions without any parameter should have (void)
+# after their name not simply ().
+BEGIN { doc["no parameter function"] = "\
+Function having no parameter should be declared with funcname (void)."
+    category["no parameter function"] = ari_code
+}
+/^[a-zA-Z][a-z0-9A-Z_]*[[:space:]]*\(\)/ {
+    fail("no parameter function")
+}
+
 BEGIN { doc["hash"] = "\
 Do not use ` #...'\'', instead use `#...'\''(some compilers only correctly
\
 parse a C preprocessor directive when `#'\'' is the first character on \


  reply	other threads:[~2011-03-11  9:56 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-11  4:20 [commit] Get rid of build warnings on xtensa-tdep.c Maxim Grigoriev
2011-03-11  7:59 ` Joel Brobecker
2011-03-11 11:39   ` Pierre Muller [this message]
2011-03-11 14:21     ` [RFA] New rules for ARI (was [commit] Get rid of build warnings on xtensa-tdep.c) Joel Brobecker
2011-03-11 14:51       ` Pierre Muller
     [not found]   ` <41860.1858466447$1299837420@news.gmane.org>
2011-03-11 17:07     ` [RFA] New rules for ARI Tom Tromey
2011-03-16 14:23       ` Joel Brobecker
2011-03-16 14:41         ` Pedro Alves
2011-03-16 15:25           ` Tom Tromey
2011-03-16 15:54             ` Pedro Alves
2011-03-16 16:03               ` Tom Tromey
2011-03-16 16:14                 ` Pedro Alves
2011-03-16 17:11                   ` Tom Tromey
2011-03-16 17:11                     ` Pedro Alves
2011-03-16 17:27                       ` Tom Tromey
2011-03-16 17:42                         ` Pedro Alves
2011-03-16 15:18         ` Tom Tromey
2011-03-11 21:04   ` [commit] Correct style issues in xtensa-tdep.c Maxim Grigoriev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='001e01cbdfd2$96205a60$c2610f20$@muller@ics-cnrs.unistra.fr' \
    --to=pierre.muller@ics-cnrs.unistra.fr \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=maxim@tensilica.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox