This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[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)
- From: "Pierre Muller" <pierre dot muller at ics-cnrs dot unistra dot fr>
- To: "'Joel Brobecker'" <brobecker at adacore dot com>
- Cc: <gdb-patches at sourceware dot org>
- Date: Wed, 13 Mar 2013 15:41:29 +0100
- 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)
- References: <20130310020607.GA11887@sourceware.org> <1363003431.5561.0@abidh-ubunto1104> <007701ce1e66$0383f480$0a8bdd80$@muller@ics-cnrs.unistra.fr> <20130311175838.GI3264@adacore.com>
> -----Message d'origine-----
> De?: gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Joel Brobecker
> Envoyé?: lundi 11 mars 2013 18:59
> À?: Pierre Muller
> Cc?: 'Abid, Hafiz'; gdb-patches@sourceware.org
> Objet?: Re: About New ARI warning Sun Mar 10 02:06:07 UTC 2013 in -D 2013-
> 03-10-gmt
>
> Hi Pierre,
>
> > Should I:
> > 1) modify the comment to also list != and ==
>
> That, or making it more explicit that the list is not exhaustive.
>
> > 2) extend the rule to also check for other binary operators?
>
> I think it would make sense, yes.
Here is a propsoal for this,
it extends the tested binray operator list from
&&, ||, != and ==
to
&&, ||, !=, ==,+, -, / 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
> Thanks again for taking care of this part of the project...
> --
> Joel
ChangeLog entry:
2013-03-13 Pierre Muller <muller@sourceware.org>
* contrib/ari/gdb_ari.sh (OP eol rule): Also check
addition, subtraction, multiplication and division binary operator.
Index: contrib/ari/gdb_ari.sh
===================================================================
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"] = "\
Do not use &&, or || at the end of a line"
category["OP eol"] = ari_code
}
-/(\|\||\&\&|==|!=)[[: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
+/(\|\||\&\&|==|!=|[[:space:]][+\-\/])[[:space:]]*$/ \
+|| /(\(|=)[[: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 >= 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 = 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 = (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 = 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 = (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 = 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 = 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 = (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 = 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 = objfile->global_psymbols.next -
> 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 = objfile->static_psymbols.next -
> 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 = objfile->global_psymbols.next -
> 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 = objfile->static_psymbols.next -
278a294
> gdb/hppa-tdep.c:429: code: OP eol: Do not use &&, or || at the end of a
line
gdb/hppa-tdep.c:429: = 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) == 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) == 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 = (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 *=
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 = xmalloc (((strlen (allargs) + 1) / (unsigned)
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 = 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 = 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 = 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 = 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 = 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 = 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 = 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 = 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 = info.abfd && info.abfd->format ==
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 = info.abfd && info.abfd->format ==
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 = 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 = 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 =
(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 = (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 = ((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 = ((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 = 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 = 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 = 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 = 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 = value_at_lazy (real_type, value_address (argp)
- 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 = (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 = (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 = (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 *= 2) *
> gdb/xcoffread.c:2955: code: OP eol: Do not use &&, or || at the end of a
line
gdb/xcoffread.c:2955: stringtab_offset = symtab_offset +