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]

[RFA] New rules for ARI (was [commit] Get rid of build warnings on xtensa-tdep.c)


  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 \


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