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 - > 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; specifically: libcpp/include/line-map.h and libcpp/line-map.c but there's also: gcc/input.c 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 input.c). 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! Dave