[cfe-dev] -fdiagnostics-format= I have a quesiton about -fshow-column

Andrew Fish afish at apple.com
Fri May 20 09:25:27 PDT 2011


I updated the -fdiagnostics-format implementation based on the feedback, and added a test case. When adding support for columns for msvc I ran into the issue that -fshow-column was not supported, as implied by the documentation, so I had to also fix that in the patch. I added -fshow-column to the test case, since it was obviously missing.

The default behavior for -fms-extensions folks is the same as before.

-fdiagnostics-format=clang/msvc/vi: Changes diagnostic output format to better match IDEs and command line tools.
This option controls the output format of the filename, line number, and column printed in diagnostic messages. The default for this option is clang. If ifms-extensions is set then the default is changed to msvc and -fno-show-column is also set.
For example, a format string warning will produce these three renditions based on the setting of this option, the fourth rendition shows default output when -fms-extensions is set:

  t.c:3:11: warning: conversion specifies type 'char *' but the argument has type 'int'
  t.c(3,11) : warning: conversion specifies type 'char *' but the argument has type 'int'  
  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'  


In this code from ParseDiagnosticArgs():

    if (Args.hasArg(OPT_fms_extensions)) {
      Opts.Format = DiagnosticOptions::Msvc;
      Opts.ShowColumn = Args.hasArg(OPT_fshow_column);
    } else 
      Opts.Format = DiagnosticOptions::Clang;

The call to Args.hasArg(OPT_fshow_column) always seems to return 0? Does this mean I did not add -fshow-column correctly?

This works as expected:
>/Users/fish/work/Clang2/build/Release/bin/clang -fsyntax-only  -ccc-host-triple x86_64-pc-win32 diag-format.c 
diag-format.c(28) :  warning: extra tokens at end of #endif directive [-Wextra-tokens]
#endif bad // extension!
       ^
       //
1 warning generated.

This  works:
>/Users/fish/work/Clang2/build/Release/bin/clang -fsyntax-only  -fdiagnostics-format=msvc -ccc-host-triple x86_64-pc-win32 diag-format.c 
diag-format.c(28,7) :  warning: extra tokens at end of #endif directive [-Wextra-tokens]
#endif bad // extension!
       ^
       //
1 warning generated.

This one does not:
>/Users/fish/work/Clang2/build/Release/bin/clang -fsyntax-only  -ccc-host-triple x86_64-pc-win32 -fshow-column diag-format.c 
diag-format.c(28) :  warning: extra tokens at end of #endif directive [-Wextra-tokens]
#endif bad // extension!
       ^
       //
1 warning generated.

So what am I missing?

Andrew Fish




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


More information about the cfe-dev mailing list