public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug testsuite/25996] New: wrap global arrays in namespace
@ 2020-05-15 11:51 vries at gcc dot gnu.org
  2020-05-15 12:24 ` [Bug testsuite/25996] " vries at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2020-05-15 11:51 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=25996

            Bug ID: 25996
           Summary: wrap global arrays in namespace
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: testsuite
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

Created attachment 12543
  --> https://sourceware.org/bugzilla/attachment.cgi?id=12543&action=edit
Generate warning when test-case defines global array

This ( https://sourceware.org/pipermail/gdb-patches/2020-May/168543.html ) is
an example where a test-case defines a global array, which clashes with a
scalar variable with the same name, defined in another test-case.

The way this was fixed was by wrapping the test-case in a namespace and
declaring the variable as a namespace variable using "variable".

It could be a good cleanup to proactively treat all global array vars as such.

I wrote a runtest.exp patch that detects test-cases that define global arrays,
which gives this type of output:
...
$ sed 's%/.*/gdb/testsuite/%%' build/CHECKLOG.gdb | grep WARNING
WARNING: gdb.ada/info_auto_lang.exp defined global array type_in_c
WARNING: gdb.ada/info_auto_lang.exp defined global array var_in_ada
WARNING: gdb.ada/info_auto_lang.exp defined global array rbreak_func_in_c
WARNING: gdb.ada/info_auto_lang.exp defined global array func_in_c
WARNING: gdb.ada/info_auto_lang.exp defined global array type_in_ada
WARNING: gdb.ada/info_auto_lang.exp defined global array rbreak_func_in_ada
WARNING: gdb.ada/info_auto_lang.exp defined global array var_in_c
WARNING: gdb.ada/info_auto_lang.exp defined global array func_in_ada
WARNING: gdb.arch/amd64-byte.exp defined global array byte_regs
WARNING: gdb.arch/amd64-dword.exp defined global array dword_regs
WARNING: gdb.arch/amd64-word.exp defined global array word_regs
WARNING: gdb.arch/i386-biarch-core.exp defined global array corestat
WARNING: gdb.arch/i386-byte.exp defined global array byte_regs
WARNING: gdb.arch/i386-word.exp defined global array word_regs
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-06-12 13:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-15 11:51 [Bug testsuite/25996] New: wrap global arrays in namespace vries at gcc dot gnu.org
2020-05-15 12:24 ` [Bug testsuite/25996] " vries at gcc dot gnu.org
2020-05-15 12:25 ` vries at gcc dot gnu.org
2020-05-15 14:17 ` vries at gcc dot gnu.org
2020-06-12 13:44 ` vries at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).