[cfe-dev] -fdiagnostics-format= design review

Andrew Fish afish at apple.com
Wed May 18 12:38:39 PDT 2011


Doug,

Thanks for the help on this. Please review:

-fdiagnostics-format=none/clang/msvc/vi: Changes diagnostic output format to better match IDEs and command line tools.
This option, which defaults to "none", controls the output format of the filename, line number, and column printed in diagnostic messages. 
For example, a format string warning will produce these three renditions based on the setting of this option:

  t.c:3:11: warning: conversion specifies type 'char *' but the argument has type 'int'
  t.c(3) : warning: conversion specifies type 'char *' but the argument has type 'int'  
  t.c +3: warning: conversion specifies type 'char *' but the argument has type 'int' 

Here is the patch:

I was unclear in CompilerInvocation.cpp if using Args.hasArg(OPT_fms_extensions) is correct. 
Also I'm not sure if my usage of "none" is correct.

In TextDiagnosticPrinter.cpp I removed the suppression of DiagOpts->ShowColumn,  and made the defaults for msvc turn off ShowColumn. As this seemed like a better way to do it? 

So with this patch we have the same defaults as before, but with more control over the diagnostic format from the command line.


Thanks,

Andrew


>~/work/Clang2/build/Release/bin/clang ve.c -S -fdiagnostics-format=vi
ve.c +2:1: error: unknown type name 'asdkjf'
asdkjf  
^
ve.c +2:9: error: expected identifier or '('
asdkjf  
        ^
2 errors generated.
>~/work/Clang2/build/Release/bin/clang ve.c -S -fdiagnostics-format=msvc
ve.c(2) :  error: unknown type name 'asdkjf'
asdkjf  
^
ve.c(2) :  error: expected identifier or '('
asdkjf  
        ^
2 errors generated.
>~/work/Clang2/build/Release/bin/clang ve.c -S -fdiagnostics-format=clang
ve.c:2:1: error: unknown type name 'asdkjf'
asdkjf  
^
ve.c:2:9: error: expected identifier or '('
asdkjf  
        ^
2 errors generated.
>~/work/Clang2/build/Release/bin/clang ve.c -S 
ve.c:2:1: error: unknown type name 'asdkjf'
asdkjf  
^
ve.c:2:9: error: expected identifier or '('
asdkjf  
        ^
2 errors generated.
>~/work/Clang2/build/Release/bin/clang ve.c -S -ccc-host-triple x86_64-pc-win32
ve.c(2) :  error: unknown type name 'asdkjf'
asdkjf  
^
ve.c(2) :  error: expected identifier or '('
asdkjf  
        ^
2 errors generated.
>~/work/Clang2/build/Release/bin/clang ve.c -S -ccc-host-triple x86_64-pc-win32-macho -fdiagnostics-format=clang
ve.c:2:1: error: unknown type name 'asdkjf'
asdkjf  
^
ve.c:2:9: error: expected identifier or '('
asdkjf  
        ^
2 errors generated.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110518/0b0b7b52/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fdiagnostics-formant.patch
Type: application/octet-stream
Size: 6212 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110518/0b0b7b52/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110518/0b0b7b52/attachment-0001.html>


More information about the cfe-dev mailing list