www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Limit number of compiler error messages

reply "cal" <callumenator gmail.com> writes:
Is there a way to limit the dmd compiler to outputting just the 
first few errors it comes across?
May 19 2012
next sibling parent Don Clugston <dac nospam.com> writes:
On 20/05/12 00:38, cal wrote:
 Is there a way to limit the dmd compiler to outputting just the first
 few errors it comes across?
No, but the intention of DMD is to generate only one error per bug in your code. If you are seeing a large number of useless errors, please report it in bugzilla. http://d.puremagic.com/issues/show_bug.cgi?id=8082 is a good example.
May 22 2012
prev sibling next sibling parent reply Robert Clipsham <robert octarineparrot.com> writes:
On 19/05/2012 23:38, cal wrote:
 Is there a way to limit the dmd compiler to outputting just the first
 few errors it comes across?
As Don said, if there are any useless error messages it is a bug, and needs to be reported at: http://d.puremagic.com/issues/ This said, if you're on a non-Windows platform, you can use the following: <my build command> 2>&1 | head -n <number of lines you want to see> Where <my build command> is your dmd/rdmd/build script command. There's probably something similar you could use on Windows, I don't really know though. -- Robert http://octarineparrot.com/
May 22 2012
parent reply "cal" <callumenator gmail.com> writes:
On Tuesday, 22 May 2012 at 09:50:41 UTC, Robert Clipsham wrote:
 As Don said, if there are any useless error messages it is a 
 bug, and needs to be reported at:

 http://d.puremagic.com/issues/

 This said, if you're on a non-Windows platform, you can use the 
 following:

 <my build command> 2>&1 | head -n <number of lines you want to 
 see>

 Where <my build command> is your dmd/rdmd/build script command. 
 There's probably something similar you could use on Windows, I 
 don't really know though.
They are probably all valid errors, I am porting a rather large C file to D and it takes a few seconds (perhaps 10 seconds) for the compiler to finish listing all the things I haven't fixed up yet, makes the process a bit more tedious is all. No biggy, thought there might be a switch I missed. Interestingly, I don't seem able to redirect the compiler output on Windows, or even pipe it.
May 22 2012
next sibling parent reply Dmitry Olshansky <dmitry.olsh gmail.com> writes:
On 22.05.2012 21:36, cal wrote:
 On Tuesday, 22 May 2012 at 09:50:41 UTC, Robert Clipsham wrote:
 As Don said, if there are any useless error messages it is a bug, and
 needs to be reported at:

 http://d.puremagic.com/issues/

 This said, if you're on a non-Windows platform, you can use the
 following:

 <my build command> 2>&1 | head -n <number of lines you want to see>

 Where <my build command> is your dmd/rdmd/build script command.
 There's probably something similar you could use on Windows, I don't
 really know though.
They are probably all valid errors, I am porting a rather large C file to D and it takes a few seconds (perhaps 10 seconds) for the compiler to finish listing all the things I haven't fixed up yet, makes the process a bit more tedious is all. No biggy, thought there might be a switch I missed. Interestingly, I don't seem able to redirect the compiler output on Windows, or even pipe it.
Check both stdout & stderr. There is something funny with the way they are setup on Windows. -- Dmitry Olshansky
May 22 2012
parent "cal" <callumenator gmail.com> writes:
On Tuesday, 22 May 2012 at 17:47:18 UTC, Dmitry Olshansky wrote:
 Check both stdout & stderr. There is something funny with the 
 way they are setup on Windows.
Ahh... on my home laptop, it must go to stderr, on my work laptop, stdout. Thanks!
May 22 2012
prev sibling parent reply Stewart Gordon <smjg_1998 yahoo.com> writes:
On 22/05/2012 18:36, cal wrote:
<snip>
 <my build command> 2>&1 | head -n <number of lines you want to see>

 Where <my build command> is your dmd/rdmd/build script command. There's
probably
 something similar you could use on Windows, I don't really know though.
By "something similar" do you mean a way of piping stderr, or a head utility? A head utility is trivial to code. Of course, a way to pipe stderr is another matter.
 They are probably all valid errors, I am porting a rather large C file to D
and it takes a
 few seconds (perhaps 10 seconds) for the compiler to finish listing all the
things I
 haven't fixed up yet, makes the process a bit more tedious is all. No biggy,
thought there
 might be a switch I missed.

 Interestingly, I don't seem able to redirect the compiler output on Windows,
or even pipe it.
What version of Windows are you using? Modern versions support 2> to redirect stderr to a file. But 2| doesn't seem to work correspondingly (at least under Vista, don't know about Win7) - by the looks of it it just passes 2 as an argument to the program and pipes stdout as usual. Maybe a utility could be made along similar lines to Rederr (which I published somewhere on these 'groups OUAT).... Stewart.
May 27 2012
parent "cal" <callumenator gmail.com> writes:
On Sunday, 27 May 2012 at 18:31:53 UTC, Stewart Gordon wrote:
 What version of Windows are you using?

 Modern versions support 2> to redirect stderr to a file.  But 
 2| doesn't seem to work correspondingly (at least under Vista, 
 don't know about Win7) - by the looks of it it just passes 2 as 
 an argument to the program and pipes stdout as usual.

 Maybe a utility could be made along similar lines to Rederr 
 (which I published somewhere on these 'groups OUAT)....
Win7. Yeah, using 2> works like you say to redirect, I hadn't tried piping, it might need to be redirected first, something like 2>&1.
May 27 2012
prev sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 5/20/12, cal <callumenator gmail.com> wrote:
 Is there a way to limit the dmd compiler to outputting just the
 first few errors it comes across?
If you're getting a ton of unrelated errors it might be related to this: http://d.puremagic.com/issues/show_bug.cgi?id=8082 I regularly get hundreds of lines of errors due to that issue.
May 22 2012