From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7697 invoked by alias); 13 Mar 2013 14:41:52 -0000 Received: (qmail 7585 invoked by uid 22791); 13 Mar 2013 14:41:50 -0000 X-SWARE-Spam-Status: No, hits=-0.3 required=5.0 tests=AWL,BAYES_50,KHOP_THREADED,MSGID_MULTIPLE_AT,TW_BJ,TW_CP,TW_RG X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.201.42) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 13 Mar 2013 14:41:37 +0000 Received: from md14.u-strasbg.fr (md14.u-strasbg.fr [130.79.200.249]) by mailhost.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id r2DEfXSw062855 ; Wed, 13 Mar 2013 15:41:33 +0100 (CET) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from mailserver.u-strasbg.fr (ms16.u-strasbg.fr [130.79.204.116]) by md14.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id r2DEfWgL025132 ; Wed, 13 Mar 2013 15:41:32 +0100 Received: from E6510Muller (gw-ics.u-strasbg.fr [130.79.210.225]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id r2DEfWLm004501 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) ; Wed, 13 Mar 2013 15:41:32 +0100 (envelope-from pierre.muller@ics-cnrs.unistra.fr) From: "Pierre Muller" To: "'Joel Brobecker'" Cc: References: <20130310020607.GA11887@sourceware.org> <1363003431.5561.0@abidh-ubunto1104> <007701ce1e66$0383f480$0a8bdd80$@muller@ics-cnrs.unistra.fr> <20130311175838.GI3264@adacore.com> In-Reply-To: <20130311175838.GI3264@adacore.com> Subject: [RFA] ARI: Extend binary operator at EOL checks (was: About New ARI warning Sun Mar 10 02:06:07 UTC 2013 in -D 2013-03-10-gmt) Date: Wed, 13 Mar 2013 14:41:00 -0000 Message-ID: <000c01ce1ff8$d93d3260$8bb79720$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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: 2013-03/txt/msg00574.txt.bz2 > -----Message d'origine----- > De=A0: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] De la part de Joel Brobecker > Envoy=E9=A0: lundi 11 mars 2013 18:59 > =C0=A0: Pierre Muller > Cc=A0: 'Abid, Hafiz'; gdb-patches@sourceware.org > Objet=A0: Re: About New ARI warning Sun Mar 10 02:06:07 UTC 2013 in -D 20= 13- > 03-10-gmt >=20 > Hi Pierre, >=20 > > Should I: > > 1) modify the comment to also list !=3D and =3D=3D >=20 > That, or making it more explicit that the list is not exhaustive. >=20 > > 2) extend the rule to also check for other binary operators? >=20 > I think it would make sense, yes. Here is a propsoal for this, it extends the tested binray operator list from &&, ||, !=3D and =3D=3D to &&, ||, !=3D, =3D=3D,+, -, / and *. The * multiplication required a special handling as it is present at the end of line in numerous function definitions like char * any_char_function (args) or other type definitions... I did not (yet) change the document of the ARI because this generates a long list of false ARI changes, thus I plan to do it later so that the true new ARI warnings generated by this change are not shadowed by this. Pierre Muller =20 > Thanks again for taking care of this part of the project... > -- > Joel ChangeLog entry: 2013-03-13 Pierre Muller * contrib/ari/gdb_ari.sh (OP eol rule): Also check addition, subtraction, multiplication and division binary operator. Index: contrib/ari/gdb_ari.sh =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/contrib/ari/gdb_ari.sh,v retrieving revision 1.8 diff -u -p -r1.8 gdb_ari.sh --- contrib/ari/gdb_ari.sh 14 Feb 2013 21:08:35 -0000 1.8 +++ contrib/ari/gdb_ari.sh 13 Mar 2013 14:31:03 -0000 @@ -609,7 +609,11 @@ BEGIN { doc["OP eol"] =3D "\ Do not use &&, or || at the end of a line" category["OP eol"] =3D ari_code } -/(\|\||\&\&|=3D=3D|!=3D)[[:space:]]*$/ { +# * operator needs a special treatment as it can be a +# valid end of line for a pointer type definition +# Only catch case where an assignment or an opening brace is present +/(\|\||\&\&|=3D=3D|!=3D|[[:space:]][+\-\/])[[:space:]]*$/ \ +|| /(\(|=3D)[[:space:]].*[[:space:]]\*[[:space:]]*$/ { fail("OP eol") } This leads to the following list of new warnings, all of them look correct to me: 2a3 > gdb/ada-lang.c:2391: code: OP eol: Do not use &&, or || at the end of a line gdb/ada-lang.c:2391: (1 << (srcBitsLeft >=3D HOST_CHAR_BIT ? HOST_CHAR_BIT : srcBitsLeft)) - 4a6 > gdb/ada-lang.c:8622: code: OP eol: Do not use &&, or || at the end of a line gdb/ada-lang.c:8622: valaddr + 46a49 > gdb/buildsym.c:1146: code: OP eol: Do not use &&, or || at the end of a line gdb/buildsym.c:1146: linetablesize =3D sizeof (struct linetable) + 68a72,75 > gdb/coff-pe-read.c:410: code: OP eol: Do not use &&, or || at the end of a line gdb/coff-pe-read.c:410: secptr =3D (pe_header_offset + 4 + 20 + > gdb/coff-pe-read.c:554: code: OP eol: Do not use &&, or || at the end of a line gdb/coff-pe-read.c:554: unsigned long func_rva =3D pe_as32 (erva + exp_funcbase + > gdb/coff-pe-read.c:672: code: OP eol: Do not use &&, or || at the end of a line gdb/coff-pe-read.c:672: secptr =3D (pe_header_offset + 4 + 20 + > gdb/coffread.c:534: code: OP eol: Do not use &&, or || at the end of a line gdb/coffread.c:534: stringtab_offset =3D symtab_offset + 160a168,169 > gdb/cp-support.c:1180: code: OP eol: Do not use &&, or || at the end of a line gdb/cp-support.c:1180: sym_return_val =3D xmalloc ((sym_return_val_size + = 1) * > gdb/cp-valprint.c:384: code: OP eol: Do not use &&, or || at the end of a line gdb/cp-valprint.c:384: obstack_next_free (&dont_print_statmem_obstack) - 162a172 > gdb/dbxread.c:1246: code: OP eol: Do not use &&, or || at the end of a line gdb/dbxread.c:1246: psymtab_include_list =3D (const char **) alloca (includes_allocated * 168a179 > gdb/dcache.c:380: code: OP eol: Do not use &&, or || at the end of a line gdb/dcache.c:380: db =3D xmalloc (offsetof (struct dcache_block, data= ) + 199a211,214 > gdb/dwarf2read.c:4984: code: OP eol: Do not use &&, or || at the end of a line gdb/dwarf2read.c:4984: pst->n_global_syms =3D objfile->global_psymbols.nex= t - > gdb/dwarf2read.c:4986: code: OP eol: Do not use &&, or || at the end of a line gdb/dwarf2read.c:4986: pst->n_static_syms =3D objfile->static_psymbols.nex= t - > gdb/dwarf2read.c:5412: code: OP eol: Do not use &&, or || at the end of a line gdb/dwarf2read.c:5412: pst->n_global_syms =3D objfile->global_psymbols.nex= t - > gdb/dwarf2read.c:5414: code: OP eol: Do not use &&, or || at the end of a line gdb/dwarf2read.c:5414: pst->n_static_syms =3D objfile->static_psymbols.nex= t - 278a294 > gdb/hppa-tdep.c:429: code: OP eol: Do not use &&, or || at the end of a line gdb/hppa-tdep.c:429: =3D ui->table[index].region_start + 4 * 287a304,311 > gdb/i386-tdep.c:5564: code: OP eol: Do not use &&, or || at the end of a line gdb/i386-tdep.c:5564: I387_ST0_REGNUM (tdep) + > gdb/i386-tdep.c:5631: code: OP eol: Do not use &&, or || at the end of a line gdb/i386-tdep.c:5631: I387_ST0_REGNUM (tdep) + > gdb/i386-tdep.c:5638: code: OP eol: Do not use &&, or || at the end of a line gdb/i386-tdep.c:5638: I387_ST0_REGNUM (tdep) + > gdb/i386-tdep.c:5658: code: OP eol: Do not use &&, or || at the end of a line gdb/i386-tdep.c:5658: I387_ST0_REGNUM (tdep) + > gdb/i386-tdep.c:5665: code: OP eol: Do not use &&, or || at the end of a line gdb/i386-tdep.c:5665: I387_ST0_REGNUM (tdep) + > gdb/i386-tdep.c:5679: code: OP eol: Do not use &&, or || at the end of a line gdb/i386-tdep.c:5679: I387_ST0_REGNUM (tdep) + > gdb/i386-tdep.c:5686: code: OP eol: Do not use &&, or || at the end of a line gdb/i386-tdep.c:5686: I387_ST0_REGNUM (tdep) + > gdb/i386-tdep.c:5704: code: OP eol: Do not use &&, or || at the end of a line gdb/i386-tdep.c:5704: I387_ST0_REGNUM (tdep) + 390a415,416 > gdb/m2-valprint.c:278: code: OP eol: Do not use &&, or || at the end of a line gdb/m2-valprint.c:278: if (TYPE_LENGTH (type) =3D=3D 1 && > gdb/m2-valprint.c:333: code: OP eol: Do not use &&, or || at the end of a line gdb/m2-valprint.c:333: if (TYPE_LENGTH (elttype) =3D=3D 1 && 409a436,437 > gdb/mdebugread.c:2390: code: OP eol: Do not use &&, or || at the end of a line gdb/mdebugread.c:2390: psymtab_include_list =3D (const char **) alloca (includes_allocated * > gdb/mdebugread.c:3094: code: OP eol: Do not use &&, or || at the end of a line gdb/mdebugread.c:3094: alloca ((includes_allocated *=3D 2) * 428a457 > gdb/mips-linux-tdep.c:1018: code: OP eol: Do not use &&, or || at the end of a line gdb/mips-linux-tdep.c:1018: ireg + regs->fp0 + 502a532 > gdb/nto-procfs.c:1102: code: OP eol: Do not use &&, or || at the end of a line gdb/nto-procfs.c:1102: argv =3D xmalloc (((strlen (allargs) + 1) / (unsign= ed) 2 + 2) * 514a545 > gdb/objc-lang.c:1456: code: OP eol: Do not use &&, or || at the end of a line gdb/objc-lang.c:1456: mlist =3D read_memory_unsigned_integer (class_str.methods + 515a547,548 > gdb/opencl-lang.c:990: code: OP eol: Do not use &&, or || at the end of a line gdb/opencl-lang.c:990: memcpy (value_contents_writeable (ret) + > gdb/p-valprint.c:106: code: OP eol: Do not use &&, or || at the end of a line gdb/p-valprint.c:106: extract_unsigned_integer (valaddr + embedded_offset + 522a556 > gdb/ppc-linux-nat.c:897: code: OP eol: Do not use &&, or || at the end of a line gdb/ppc-linux-nat.c:897: regcache_raw_collect (regcache, regno, regs + 525a560,563 > gdb/ppc-sysv-tdep.c:1508: code: OP eol: Do not use &&, or || at the end of a line gdb/ppc-sysv-tdep.c:1508: tdep->ppc_gp0_regnum + > gdb/ppc-sysv-tdep.c:1549: code: OP eol: Do not use &&, or || at the end of a line gdb/ppc-sysv-tdep.c:1549: tdep->ppc_gp0_regnum + > gdb/ppc-sysv-tdep.c:1927: code: OP eol: Do not use &&, or || at the end of a line gdb/ppc-sysv-tdep.c:1927: convert_typed_floating ((const bfd_byte *) writebuf + > gdb/ppc-sysv-tdep.c:1940: code: OP eol: Do not use &&, or || at the end of a line gdb/ppc-sysv-tdep.c:1940: (bfd_byte *) readbuf + 629a668 > gdb/remote-sim.c:689: code: OP eol: Do not use &&, or || at the end of a line gdb/remote-sim.c:689: + strlen (') + strlen (gdb_sysroot) + 678a718,736 > gdb/rs6000-tdep.c:2664: code: OP eol: Do not use &&, or || at the end of a line gdb/rs6000-tdep.c:2664: status =3D regcache_raw_read (regcache, tdep->ppc_fp0_regnum + > gdb/rs6000-tdep.c:2667: code: OP eol: Do not use &&, or || at the end of a line gdb/rs6000-tdep.c:2667: status =3D regcache_raw_read (regcache, tdep->ppc_fp0_regnum + > gdb/rs6000-tdep.c:2686: code: OP eol: Do not use &&, or || at the end of a line gdb/rs6000-tdep.c:2686: regcache_raw_write (regcache, tdep->ppc_fp0_regnum + > gdb/rs6000-tdep.c:2688: code: OP eol: Do not use &&, or || at the end of a line gdb/rs6000-tdep.c:2688: regcache_raw_write (regcache, tdep->ppc_fp0_regnum + > gdb/rs6000-tdep.c:2693: code: OP eol: Do not use &&, or || at the end of a line gdb/rs6000-tdep.c:2693: regcache_raw_write (regcache, tdep->ppc_fp0_regnum + > gdb/rs6000-tdep.c:2695: code: OP eol: Do not use &&, or || at the end of a line gdb/rs6000-tdep.c:2695: regcache_raw_write (regcache, tdep->ppc_fp0_regnum + > gdb/rs6000-tdep.c:2711: code: OP eol: Do not use &&, or || at the end of a line gdb/rs6000-tdep.c:2711: status =3D regcache_raw_read (regcache, tdep->ppc_vr0_regnum + > gdb/rs6000-tdep.c:2717: code: OP eol: Do not use &&, or || at the end of a line gdb/rs6000-tdep.c:2717: status =3D regcache_raw_read (regcache, tdep->ppc_fp0_regnum + > gdb/rs6000-tdep.c:2720: code: OP eol: Do not use &&, or || at the end of a line gdb/rs6000-tdep.c:2720: status =3D regcache_raw_read (regcache, tdep->ppc_vsr0_upper_regnum + > gdb/rs6000-tdep.c:2725: code: OP eol: Do not use &&, or || at the end of a line gdb/rs6000-tdep.c:2725: status =3D regcache_raw_read (regcache, tdep->ppc_fp0_regnum + > gdb/rs6000-tdep.c:2728: code: OP eol: Do not use &&, or || at the end of a line gdb/rs6000-tdep.c:2728: status =3D regcache_raw_read (regcache, tdep->ppc_vsr0_upper_regnum + > gdb/rs6000-tdep.c:2745: code: OP eol: Do not use &&, or || at the end of a line gdb/rs6000-tdep.c:2745: regcache_raw_write (regcache, tdep->ppc_vr0_regnum + > gdb/rs6000-tdep.c:2751: code: OP eol: Do not use &&, or || at the end of a line gdb/rs6000-tdep.c:2751: regcache_raw_write (regcache, tdep->ppc_fp0_regnum + > gdb/rs6000-tdep.c:2753: code: OP eol: Do not use &&, or || at the end of a line gdb/rs6000-tdep.c:2753: regcache_raw_write (regcache, tdep->ppc_vsr0_upper_regnum + > gdb/rs6000-tdep.c:2758: code: OP eol: Do not use &&, or || at the end of a line gdb/rs6000-tdep.c:2758: regcache_raw_write (regcache, tdep->ppc_fp0_regnum + > gdb/rs6000-tdep.c:2760: code: OP eol: Do not use &&, or || at the end of a line gdb/rs6000-tdep.c:2760: regcache_raw_write (regcache, tdep->ppc_vsr0_upper_regnum + > gdb/rs6000-tdep.c:3561: code: OP eol: Do not use &&, or || at the end of a line gdb/rs6000-tdep.c:3561: from_xcoff_exec =3D info.abfd && info.abfd->format= =3D=3D bfd_object && > gdb/rs6000-tdep.c:3564: code: OP eol: Do not use &&, or || at the end of a line gdb/rs6000-tdep.c:3564: from_elf_exec =3D info.abfd && info.abfd->format = =3D=3D bfd_object && > gdb/rs6000-tdep.c:3588: code: OP eol: Do not use &&, or || at the end of a line gdb/rs6000-tdep.c:3588: wordsize =3D info.bfd_arch_info->bits_per_word / 708a767 > gdb/solib-sunos.c:554: code: OP eol: Do not use &&, or || at the end of a line gdb/solib-sunos.c:554: flag_addr =3D debug_addr + (CORE_ADDR) ((char *) &debug_copy.ldd_in_debugger - 814a874,875 > gdb/tui/tui-regs.c:82: code: OP eol: Do not use &&, or || at the end of a line gdb/tui/tui-regs.c:82: num_lines =3D (TUI_DATA_WIN->detail.data_display_info.regs_content_count / > gdb/tui/tui-regs.c:127: code: OP eol: Do not use &&, or || at the end of a line gdb/tui/tui-regs.c:127: TUI_DATA_WIN->detail.data_display_info.regs_column_count) - 825a887,889 > gdb/tui/tui-stack.c:377: code: OP eol: Do not use &&, or || at the end of a line gdb/tui/tui-stack.c:377: start_line =3D (item->locator.line_no= - > gdb/tui/tui-win.c:750: code: OP eol: Do not use &&, or || at the end of a line gdb/tui/tui-win.c:750: else if ((first_win->generic.height + > gdb/tui/tui-win.c:766: code: OP eol: Do not use &&, or || at the end of a line gdb/tui/tui-win.c:766: else if ((first_win->generic.height + 827a892,899 > gdb/tui/tui-win.c:1462: code: OP eol: Do not use &&, or || at the end of a line gdb/tui/tui-win.c:1462: ok =3D ((new_height + > gdb/tui/tui-win.c:1492: code: OP eol: Do not use &&, or || at the end of a line gdb/tui/tui-win.c:1492: ok =3D ((first_win->generic.height + > gdb/tui/tui-win.c:1498: code: OP eol: Do not use &&, or || at the end of a line gdb/tui/tui-win.c:1498: total_height =3D new_height + > gdb/tui/tui-win.c:1499: code: OP eol: Do not use &&, or || at the end of a line gdb/tui/tui-win.c:1499: (first_win->generic.height + > gdb/tui/tui-win.c:1523: code: OP eol: Do not use &&, or || at the end of a line gdb/tui/tui-win.c:1523: total_height =3D new_height + > gdb/tui/tui-win.c:1524: code: OP eol: Do not use &&, or || at the end of a line gdb/tui/tui-win.c:1524: second_win->generic.height + > gdb/tui/tui-win.c:1527: code: OP eol: Do not use &&, or || at the end of a line gdb/tui/tui-win.c:1527: total_height =3D new_height + > gdb/tui/tui-win.c:1528: code: OP eol: Do not use &&, or || at the end of a line gdb/tui/tui-win.c:1528: first_win->generic.height + 829a902 > gdb/tui/tui-winsource.c:118: code: OP eol: Do not use &&, or || at the end of a line gdb/tui/tui-winsource.c:118: sal.line =3D line_or_addr.u.line_no + 860a934 > gdb/valops.c:3641: code: OP eol: Do not use &&, or || at the end of a line gdb/valops.c:3641: new_val =3D value_at_lazy (real_type, value_address (ar= gp) - top + 882a957 > gdb/windows-nat.c:1010: code: OP eol: Do not use &&, or || at the end of a line gdb/windows-nat.c:1010: base =3D (info.HighWord.Bits.BaseHi << 24) + 889a965 > gdb/windows-nat.c:2726: code: OP eol: Do not use &&, or || at the end of a line gdb/windows-nat.c:2726: char *oldini =3D (char *) alloca (strlen (homedir) + 899a976,981 > gdb/xcoffread.c:345: code: OP eol: Do not use &&, or || at the end of a line gdb/xcoffread.c:345: xmalloc (sizeof (struct pending_stabs) + > gdb/xcoffread.c:354: code: OP eol: Do not use &&, or || at the end of a line gdb/xcoffread.c:354: xrealloc ((char *) *stabvector, sizeof (struct pending_stabs) + > gdb/xcoffread.c:480: code: OP eol: Do not use &&, or || at the end of a line gdb/xcoffread.c:480: (sizeof (struct linetable) + > gdb/xcoffread.c:2219: code: OP eol: Do not use &&, or || at the end of a line gdb/xcoffread.c:2219: psymtab_include_list =3D (const char **) alloca (includes_allocated * > gdb/xcoffread.c:2619: code: OP eol: Do not use &&, or || at the end of a line gdb/xcoffread.c:2619: alloca ((includes_allocated *=3D 2) * > gdb/xcoffread.c:2955: code: OP eol: Do not use &&, or || at the end of a line gdb/xcoffread.c:2955: stringtab_offset =3D symtab_offset +