This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Help! Regarding bug 49973

On Thu, 2016-02-04 at 02:31 +0530, Prasad Ghangal wrote:
> Hi !
> I am new to gcc. I would like to solve bug
> (Bug 49973 -
> Column
> 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
> -parser.c

Most of gcc's code to handle source locations is in libcpp;
  libcpp/include/line-map.h and
but there's also:

I think the routine you'd need to look at is expand_location, which is
called by:
  #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!

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]