public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/31754]  New: Include character count along line in error messages main.cpp:5:38
@ 2007-04-29 12:55 jg at jguk dot org
  2007-04-29 15:45 ` [Bug other/31754] Include column number " pinskia at gcc dot gnu dot org
                   ` (23 more replies)
  0 siblings, 24 replies; 26+ messages in thread
From: jg at jguk dot org @ 2007-04-29 12:55 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1923 bytes --]

Often we have compile errors on long lines of code, it is time-consuming to
find the actual character offset on the long line which is causing the error.
Sometimes it is even necessary to separate out long if(..) statements, so we
can figure out which part of the long line has the problem in the error
message.

Could gcc indicate the character offset along the line? Not sure how easy this
would be to do, but perhaps the code which is generating the error has the
character offset along the line.

For example, see this obvious example code build below:
$ g++ -Wall -o t main.cpp
main.cpp: In function ‘int main()’:
main.cpp:9: error: wrong type argument to unary minus


character 38 is the start of the erroneous unary minus, so the error message
could be clearer as:
$ g++ -Wall -o t main.cpp
main.cpp: In function ‘int main()’:
main.cpp:9:38 error: wrong type argument to unary minus

Example program follows:
========================
// g++ -Wall -o t main.cpp
#include <string.h>
#include <cstdio>
int main()
{
        char * buf0;
        char * buf1;
        char * buf2;
        if((buf0 = strdup("buf0")) && (buf1 +- strdup("buf1")) && (buf2 =
strdup("buf2")))
        {
                printf("All strings duplicated\n");
        }

        return 0;
}
=============================

I am running GNU C++ version 4.1.2 20060928 (prerelease) (Ubuntu
4.1.1-13ubuntu5) (i486-linux-gnu)


-- 
           Summary: Include character count along line in error messages
                    main.cpp:5:38
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jg at jguk dot org
 GCC build triplet: i486-linux-gnu
  GCC host triplet: i486-linux-gnu
GCC target triplet: i486-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31754


^ permalink raw reply	[flat|nested] 26+ messages in thread
[parent not found: <bug-31754-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2012-04-12 21:24 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-29 12:55 [Bug other/31754] New: Include character count along line in error messages main.cpp:5:38 jg at jguk dot org
2007-04-29 15:45 ` [Bug other/31754] Include column number " pinskia at gcc dot gnu dot org
2007-10-26  5:36 ` tromey at gcc dot gnu dot org
2008-06-16 11:14 ` dseketel at redhat dot com
2008-06-16 11:15 ` dseketel at redhat dot com
2008-06-18 18:25 ` dseketel at redhat dot com
2008-06-18 19:21 ` dseketel at redhat dot com
2008-06-20  9:54 ` dseketel at redhat dot com
2008-06-20 12:05 ` dseketel at redhat dot com
2008-06-26 12:39 ` dseketel at redhat dot com
2008-06-27 21:32 ` dseketel at redhat dot com
2008-06-28  1:00 ` jg at jguk dot org
2008-06-30 17:51 ` dseketel at redhat dot com
2008-06-30 17:53 ` dseketel at redhat dot com
2008-06-30 17:55 ` dseketel at redhat dot com
2008-07-01 16:30 ` dseketel at redhat dot com
2008-07-10 14:38 ` dodji at gcc dot gnu dot org
2008-07-11 12:55 ` dodji at gcc dot gnu dot org
2008-07-11 16:34 ` dodji at gcc dot gnu dot org
2008-07-11 16:36 ` dodji at gcc dot gnu dot org
2008-07-11 16:37 ` dodji at gcc dot gnu dot org
2008-07-11 16:51 ` [Bug c++/31754] Improve column number accuracy in error messages dodji at gcc dot gnu dot org
2008-07-21 16:33 ` manu at gcc dot gnu dot org
2009-08-05 12:10 ` manu at gcc dot gnu dot org
2010-02-22 17:46 ` dodji at gcc dot gnu dot org
     [not found] <bug-31754-4@http.gcc.gnu.org/bugzilla/>
2012-04-12 21:24 ` manu 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).