This is the mail archive of the
mailing list for the GCC project.
Re: How to improve the location of a gcc diagnostic
- From: Senthil Kumar Selvaraj <senthil_kumar dot selvaraj at atmel dot com>
- To: David Malcolm <dmalcolm at redhat dot com>
- Cc: <gcc at gcc dot gnu dot org>
- Date: Fri, 24 Jun 2016 10:06:52 +0530
- Subject: Re: How to improve the location of a gcc diagnostic
- Authentication-results: sourceware.org; auth=none
- References: <1466690695 dot 10682 dot 24 dot camel at redhat dot com>
David Malcolm writes:
> A user filed a bug about a bad location in a warning. It was marked as
> an "easyhack" in bugzilla, and I had a go at fixing it.
> I though it may be useful for new GCC developers if I document what I
> did to fix it.
> FWIW, the bug was PR c/71610
> i.e. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71610)
> ("Improve location for "warning: ISO C restricts enumerator values to
> range of 'int' [-Wpedantic]"?").
> Step 1: create a minimal reproducer for the diagnostic
> This was easy for this bug: I copied it from the bug report. Try to
> avoid #include if possible; start with the simplest possible reproducer
> (to minimize effort in the debugger), and work from there.
> If you're working on a bug in our bugzilla it's good to click on the
> "take" button next to "Assignee" to mark yourself as assignee, and to
> set the status to ASSIGNED, so that we don't duplicate effort.
> Step 2: create a file under the relevant subdirectory of gcc/testsuite.
> This will be under one of gcc.dg, g++.dg or c-c++-common. If possible,
> create it under c-c++-common so that we can test both the C and C++
> I created a file called "pr71610.c" under c-c++-common. (If this was
> for a specific warning, the name of the warning may have been better,
> but my case was part of "-Wpedantic", which is too broad for a testcase
> Step 3: run the reproducer under DejaGnu
> With a freshly built gcc, I ran the following from the "gcc" build
> make -jN -k && make check-gcc RUNTESTFLAGS="-v -v dg.exp=pr71610*"
Worth mentioning that you need to configure/make with CXXFLAGS or BOOT_*
flags set to -O0 -g3 so that breakpoints actually work?