<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On May 20, 2011, at 9:25 AM, Andrew Fish wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>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.</div><div><br></div><div>The default behavior for -fms-extensions folks is the same as before.</div><div><br></div><div><dt id="opt_fdiagnostics-show-category" style="color: rgb(34, 34, 34); font-family: 'Lucida Grande', 'Lucida Sans Unicode', Arial, Verdana, Helvetica, sans-serif; line-height: 19px; font-size: small; "><b>-fdiagnostics-format=clang/msvc/vi</b>: Changes diagnostic output format to better match IDEs and command line tools.</dt><dd style="color: rgb(34, 34, 34); font-family: 'Lucida Grande', 'Lucida Sans Unicode', Arial, Verdana, Helvetica, sans-serif; line-height: 19px; font-size: small; ">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.<p>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:</p><pre>  t.c:3:11: warning: conversion specifies type 'char *' but the argument has type 'int'</pre><pre>  t.c(3,11) : warning: conversion specifies type 'char *' but the argument has type 'int'  </pre><pre>  t.c +3:11: warning: conversion specifies type 'char *' but the argument has type 'int' </pre><div><pre>  t.c(3) : warning: conversion specifies type 'char *' but the argument has type 'int'  </pre></div><div><br></div></dd></div><div><br></div><div>In this code from ParseDiagnosticArgs():</div><div><br></div><div><div>    if (Args.hasArg(OPT_fms_extensions)) {</div><div>      Opts.Format = DiagnosticOptions::Msvc;</div><div>      Opts.ShowColumn = Args.hasArg(OPT_fshow_column);</div><div>    } else </div><div>      Opts.Format = DiagnosticOptions::Clang;</div></div><div><br></div><div>The call to Args.hasArg(OPT_fshow_column) always seems to return 0? Does this mean I did not add -fshow-column correctly?</div></div></blockquote><div><br></div><div>hasFlag() is far better than hasArg() for what you're doing, since it handles both the positive (-fshow-column) and negative (-fno-show-column) arguments in one command. For example, I switched the ShowColumn computation to this:</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">  Opts.<span style="color: #518187">ShowColumn</span> = Args.<span style="color: #33595d">hasFlag</span>(<span style="color: #3e217f">OPT_fshow_column</span>,</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">                                 <span style="color: #3e217f">OPT_fno_show_column</span>,</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">                                 <span style="color: #008311">/*Default=*/</span><span style="color: #b930a1">true</span>);</div><div><br></div><div>I committed a slightly-tweaked version of your patch as Clang r131794, where I also got rid of the dependence on -fms-extensions. Thanks so much for working on this!</div><div><br></div></div><div><span class="Apple-tab-span" style="white-space:pre">       </span>- Doug</div></div></body></html>