From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16018 invoked by alias); 11 Mar 2011 09:56:52 -0000 Received: (qmail 16007 invoked by uid 22791); 11 Mar 2011 09:56:50 -0000 X-SWARE-Spam-Status: No, hits=-1.0 required=5.0 tests=AWL,BAYES_00,MSGID_MULTIPLE_AT,SARE_SUB_GETRID,TW_BJ X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.156) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 11 Mar 2011 09:56:45 +0000 Received: from md2.u-strasbg.fr (md2.u-strasbg.fr [IPv6:2001:660:2402::187]) by mailhost.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id p2B9uQwu003163 ; Fri, 11 Mar 2011 10:56:27 +0100 (CET) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from mailserver.u-strasbg.fr (ms5.u-strasbg.fr [130.79.204.14]) by md2.u-strasbg.fr (8.14.4/jtpda-5.5pre1) with ESMTP id p2B9uQSk068805 ; Fri, 11 Mar 2011 10:56:26 +0100 (CET) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from E6510Muller (gw-ics.u-strasbg.fr [130.79.210.225]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.4/jtpda-5.5pre1) with ESMTP id p2B9uO3P030077 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) ; Fri, 11 Mar 2011 10:56:25 +0100 (CET) (envelope-from pierre.muller@ics-cnrs.unistra.fr) From: "Pierre Muller" To: "'Joel Brobecker'" , "'Maxim Grigoriev'" Cc: References: <4D798969.8070309@tensilica.com> <20110311064501.GA30306@adacore.com> In-Reply-To: <20110311064501.GA30306@adacore.com> 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 Message-ID: <001e01cbdfd2$96205a60$c2610f20$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit x-cr-hashedpuzzle: BbkJ BpLq EK83 EO1P FSeR HU48 Srzf TUJt Ul8s Vcvu Vv6l Ys4L bleU b0bK b/67 c709;3;YgByAG8AYgBlAGMAawBlAHIAQABhAGQAYQBjAG8AcgBlAC4AYwBvAG0AOwBnAGQAYgAtAHAAYQB0AGMAaABlAHMAQABzAG8AdQByAGMAZQB3AGEAcgBlAC4AbwByAGcAOwBtAGEAeABpAG0AQAB0AGUAbgBzAGkAbABpAGMAYQAuAGMAbwBtAA==;Sosha1_v1;7;{D8FF0C6D-40B8-4F6E-A894-BEF16D0B4B50};cABpAGUAcgByAGUALgBtAHUAbABsAGUAcgBAAGkAYwBzAC0AYwBuAHIAcwAuAHUAbgBpAHMAdAByAGEALgBmAHIA;Fri, 11 Mar 2011 09:56:20 GMT;WwBSAEYAQQBdACAATgBlAHcAIAByAHUAbABlAHMAIABmAG8AcgAgAEEAUgBJACAAKAB3AGEAcwAgACAAWwBjAG8AbQBtAGkAdABdACAARwBlAHQAIAByAGkAZAAgAG8AZgAgAGIAdQBpAGwAZAAgAHcAYQByAG4AaQBuAGcAcwAgAG8AbgAgAHgAdABlAG4AcwBhAC0AdABkAGUAcAAuAGMAKQA= x-cr-puzzleid: {D8FF0C6D-40B8-4F6E-A894-BEF16D0B4B50} Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-03/txt/msg00656.txt.bz2 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 \