www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - format of error messages

reply =?UTF-8?B?VGhvbWFzIEvDvGhuZQ==?= writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The format of the error messages are currently:

gdc-0.10:
# nocompile/char_05.d:3: cannot implicitly convert expression -1 of type
# int to char

dmd-118:
# nocompile/char_05.d(3): cannot implicitly convert expression (-1) of
# type int to char

Wouldn't it be realy usefull for both compilers to use the same format
to denote source files and line nummers?

Thomas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (MingW32)

iD8DBQFCPSWR3w+/yD4P9tIRAicCAJsHqNjWVd5gIWZ9BeHlmTIxKfMf2wCgmqmB
RaPxTG/SxmB7w+ZunyFNTVA=
=NKBM
-----END PGP SIGNATURE-----
Mar 19 2005
parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Thomas Kühne wrote:

 Wouldn't it be realy usefull for both compilers to use the same format
 to denote source files and line nummers?

GDC uses the same error format as GCC does, maybe DMD just uses the DMC error format ? I guess the "dmd" wrapper script could also filter the compiler output to match ? Since they already take different arguments, I meant. (no real hope of making them the same) Now it uses: (this is Perl)
     my $result = system( cmd);
     errorExit if $result & 0xff; # Give up if can't exec or gdc exited with a
signal

This can be changed to reroute the gdc STDOUT and STDERR, and then do some filtering on them ? (it would probably have to be done using pipes, to avoid waiting until it is done for any output...) Then use a regexp of something like s/^([\w\/\.]+)\:(\d+)\:/$1($2):/; To make "dmd" use the DMD error style, and "gdc" continue to use GCC style ? Another thing is that both compilers now use $DFLAGS, but that they have varying syntax for those params... $DC (=gdc) should probably use $DCFLAGS or something ? Since $DMD (=dmd) have already claimed $DFLAGS, I mean. --anders
Mar 20 2005
parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
 I guess the "dmd" wrapper script could
 also filter the compiler output to match ?

 This can be changed to reroute the gdc STDOUT
 and STDERR, and then do some filtering on them ?
 (it would probably have to be done using pipes,
 to avoid waiting until it is done for any output...)

On second thought, using filters is probably overkill. DMD: (mars.c)
 char *Loc::toChars()
 {
     OutBuffer buf;
     char *p;
 
     if (filename)
     {
 	buf.printf("%s", filename);
     }
 
     if (linnum)
 	buf.printf("(%d)", linnum);
     buf.writeByte(0);
     return (char *)buf.extractData();
 }

GDC: (gcc-mars.cc)
 char *Loc::toChars()
 {
     OutBuffer buf;
 
     if (filename)
     {
 	buf.printf("%s", filename);
     }
 
     if (linnum)
 	buf.printf(":%d", linnum);
     buf.writeByte(0);
     return (char *)buf.extractData();
 }

Seems like a better way here would be to add some kind of flag to GDC, to toggle how you want the error output ? And have it default to GCC-style for GDC, and then add a new "-ferror-style=dmd" (or something) param to the "dmd" wrapper ? Something like: if (linnum) { if (global.params.dmdErrorStyle) buf.printf("(%d)", linnum); else buf.printf(":%d", linnum); } The rest is up to David :-) --anders PS. Speaking of filters, a lot of the previous "dfilter" hacks are scheduled for inclusion in future Doxygen... (http://www.prowiki.org/wiki4d/wiki.cgi?DoxygenIssues)
Mar 20 2005
parent Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Anders F Björklund schrieb am Sun, 20 Mar 2005 10:45:18 +0100:
 I guess the "dmd" wrapper script could
 also filter the compiler output to match ?

 This can be changed to reroute the gdc STDOUT
 and STDERR, and then do some filtering on them ?
 (it would probably have to be done using pipes,
 to avoid waiting until it is done for any output...)

On second thought, using filters is probably overkill. DMD: (mars.c)
 char *Loc::toChars()
 {
     OutBuffer buf;
     char *p;
 
     if (filename)
     {
 	buf.printf("%s", filename);
     }
 
     if (linnum)
 	buf.printf("(%d)", linnum);
     buf.writeByte(0);
     return (char *)buf.extractData();
 }

GDC: (gcc-mars.cc)
 char *Loc::toChars()
 {
     OutBuffer buf;
 
     if (filename)
     {
 	buf.printf("%s", filename);
     }
 
     if (linnum)
 	buf.printf(":%d", linnum);
     buf.writeByte(0);
     return (char *)buf.extractData();
 }


in additon: html.c Html:error(const char*)
 Seems like a better way here would be to add some kind
 of flag to GDC, to toggle how you want the error output ?

 And have it default to GCC-style for GDC, and then add a new
 "-ferror-style=dmd" (or something) param to the "dmd" wrapper ?

 Something like:
      if (linnum)
      {
        if (global.params.dmdErrorStyle)
   	buf.printf("(%d)", linnum);
        else
   	buf.printf(":%d", linnum);
      }

 The rest is up to David :-)

Defenitly a good idea. Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCPzWf3w+/yD4P9tIRAueTAKCoKlL6Z657a2Qyg5TcGsBdRJTFDwCfbdVA +68aX5vl0yXU+EMExuBQXeE= =pKlz -----END PGP SIGNATURE-----
Mar 21 2005