This is the mail archive of the
mailing list for the GCC project.
Re: Help! Regarding bug 49973
- From: David Malcolm <dmalcolm at redhat dot com>
- To: Prasad Ghangal <prasad dot ghangal at gmail dot com>, gcc at gcc dot gnu dot org
- Date: Wed, 03 Feb 2016 20:27:57 -0500
- Subject: Re: Help! Regarding bug 49973
- Authentication-results: sourceware.org; auth=none
- References: <CAE+uiWb7U8M+cmgg0CewmpOaDEoqc8JCPCMpCf64Tn8Cw-JHZA at mail dot gmail dot com>
On Thu, 2016-02-04 at 02:31 +0530, Prasad Ghangal wrote:
> Hi !
> I am new to gcc. I would like to solve bug
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49973 (Bug 49973 -
> numbers count special characters as multiple columns ). Can somebody
> guide me?
> I tried to debug gcc under gdb. I think I have to change code in c
Most of gcc's code to handle source locations is in libcpp;
but there's also:
I think the routine you'd need to look at is expand_location, which is
#define LOCATION_COLUMN(LOC)((expand_location (LOC)).column)
Most of the code uses columns as a count of *bytes*, starting at 1. I
think the sanest approach may be to retain this idea (store it all as
byte counts), but to just fixup the column number when printing the:
"foo.c:LINE:COLUMN: error: foo" line (i.e. to treat it as a
presentation layer thing, rather than a model thing, if that helps).
This string is built by diagnostic_build_prefix in gcc/input.c.
I imagine that diagnostic-show-locus.c might need some fixing up as
well; it prints the bytes in the input lines, without attempting to
convert them to any encoding (using the cache of source lines in
You might want to try putting a breakpoint on diagnostic_show_locus;
this is the routine the prints the source code when an error/warning
fires; you can go up the stack to see where the diagnostic originated,
and how diagnostics get printed.
Hope this is helpful; good luck!