This is the mail archive of the gcc@gcc.gnu.org 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: RFC: Named warnings


On 25-Jan-2003, Segher Boessenkool <segher@koffie.nl> wrote:
> A few ideas:
> 
> Output the warning on the first line, and the description on the
> second line, like this:
> 
> 	bla.c:14:3: warning: conversion-signed-unsigned
> 	bla.c:14:3:    Implicit conversion from signed to unsigned
> 
> Or, with the new flags -Wexplanation and -Wwhy:
> 
> 	bla.c:6:1: warning: comment-multi-line
> 	bla.c:6:1:    (-Wcomment-multi-line was enabled by -Wall)
> 	bla.c:6:1:    ==================================================
> 	bla.c:6:1:    Multi-line comment:
> 	bla.c:6:1:    
> 	bla.c:6:1:    A `//' comment line ends in a `\', which causes
> 	bla.c:6:1:    the next line to be part of that comment as well.
> 	bla.c:6:1:    This is probably not what you want.
> 	bla.c:6:1:    ==================================================

The Mercury compiler uses an approach similar to this.
Most users seem to be happy with it.  But a few
have requested that we provide a mode in which the file
name and line/column number is only printed once, at
the start of the error, rather than once per line:

 	bla.c:14:3: warning: conversion-signed-unsigned
 	               Implicit conversion from signed to unsigned
 	bla.c:6:1: warning: comment-multi-line
 	              (-Wcomment-multi-line was enabled by -Wall)
 	              ==================================================
 	              Multi-line comment:
 	              
 	              A `//' comment line ends in a `\', which causes
 	              the next line to be part of that comment as well.
 	              This is probably not what you want.
 	              ==================================================

This apparently works better in some environments (I forget which --
maybe Emacs?).

Another useful refinement is that if the compiler issues a warning
for which more information is available, it should set
a flag, and if at the end of compilation this flag is set,
it should output an additional final message:

	Recompile with `-Wexplanation' for more information.


-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.


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