<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"Book Antiqua";
panose-1:2 4 6 2 5 3 5 3 3 4;}
@font-face
{font-family:Menlo;
panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.apple-converted-space
{mso-style-name:apple-converted-space;}
span.EmailStyle18
{mso-style-type:personal;
font-family:"Book Antiqua",serif;
color:#943634;
font-weight:normal;
font-style:normal;
text-decoration:none none;}
span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Book Antiqua",serif;
color:#943634;
font-weight:normal;
font-style:normal;
text-decoration:none none;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-IE link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'>Hi again. I have solved the problem that I was having but it is obscure so I will explain here.<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'>Turns out that the problem I am having is a consequence of Windows versus Cygwin paths. Running the same scenario on Linux is fine (after I had an example with something worth reporting).<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'>In summary the issue is the path that is passed using ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>-o</span><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'>’ to the Visual Studio built ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>clang.exe</span><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'>’ which only understands Windows paths, but at line #1490 in ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>scan-build</span><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'>’ the path is constructed using:<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>$Options{OutputDir} = abs_path($OutDir);<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'>In my case the path for ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>-o check</span><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'>’ becomes:<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>/src/tests/ScanBuild/check<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'>But in my Cygwin setup, ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>/src/</span><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'>’ is actually a ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>mount</span><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'>’ of the directory ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>S:\Projects\</span><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'>’ - I use mounts so that my scripts are portable across Linux and Windows systems. I tend to live in the ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>bash</span><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'>’ shell on Windows and Linux. If I was passing the path to ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>clang.exe</span><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'>’ from a Makefile, I would typically use ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>cygpath -m</span><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'>’ to get the Windows path, but because this is happening in the generic ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>scan-build</span><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'>’ Perl wrapper, it passes the Linux/Cygwin version of the path, but to the VS built ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>clang.exe</span><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'>’.<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'>So the data for the reports “is” being created by ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>clang</span><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'>’, but it is being placed at:<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>D:\src\tests\ScanBuild\check<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'>which is not the same place. The when ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>scan-build</span><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'>’ tries to collate the data and generate the report, the directory Perl looks in is empty. I can fix this, I just need to swot up my OS Perl knowledge and I should be able to fix it. I may need to do something similar in ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>ccc-analyzer</span><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'>’. I will feedback any changes that may be useful to others once I have it figured out.<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'>Thanks for your help, I would never have found this if you hadn’t given me good pointers to prove that I could generate the PList files.<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'> MartinO<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#002060;mso-fareast-language:EN-US'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri",sans-serif'>From:</span></b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri",sans-serif'> Martin J. O'Riordan [mailto:martin.oriordan@movidius.com] <br><b>Sent:</b> 12 November 2016 20:36<br><b>To:</b> 'ganna@apple.com' <ganna@apple.com><br><b>Cc:</b> 'Aleksei Sidorin' <a.sidorin@samsung.com>; 'cfe-dev' <cfe-dev@lists.llvm.org><br><b>Subject:</b> RE: [cfe-dev] Learning how to use and deploy 'scan-build'<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>Thanks Anna,<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>Actually there was a typo in my message and I actually had the identifier ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>zero</span><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>’ not the constant ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>0</span><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>’:<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>int main () {<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'> int zero = 0;<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'> return 5 / zero;<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>}<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>but I have changed this to just contain:<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>int foo () {<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'> int x = 0;<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'> return 5/x;<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>}<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>Compiling this as:<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>clang++ --analyze testScanBuild.cpp<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>does report the warning, and creates the file ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>testScanBuild.plist</span><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>’ which on inspection appears to contain the expected diagnostic information, and compiling it as:<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>clang++ -c testScanBuild.cpp<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>does not produce a warning (no ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>-Wall</span><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>’ option).<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>I just changed my Makefile to simply:<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>build: testScanBuild.o<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>%o.%cpp:<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'> $(CXX) -c $<</span><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'><o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>and:<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>scan-build --use-cc clang --use-cxx clang++ -v -v -v -o check --keep-empty make build<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>I had not realised that the analyzers would not produce a report if the compiler already warned.<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>Thanks again,<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'> MartinO<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#943634;mso-fareast-language:EN-US'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri",sans-serif'>From:</span></b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri",sans-serif'> <a href="mailto:ganna@apple.com">ganna@apple.com</a> [<a href="mailto:ganna@apple.com">mailto:ganna@apple.com</a>] <br><b>Sent:</b> 12 November 2016 19:54<br><b>To:</b> <a href="mailto:Martin.ORiordan@Movidius.com">Martin.ORiordan@Movidius.com</a><br><b>Cc:</b> Aleksei Sidorin <<a href="mailto:a.sidorin@samsung.com">a.sidorin@samsung.com</a>>; cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>><br><b>Subject:</b> Re: [cfe-dev] Learning how to use and deploy 'scan-build'<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Please, use the examples I provided in the previous email. The analyzer tries to avoid reporting the issues that can be found by the compiler.<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Menlo",serif'>Annas-MBP-3:compiler-rt anna$ clang --analyze ~/tmp/ex.c<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><b><span style='font-size:8.5pt;font-family:"Menlo",serif'>/Users/anna/tmp/ex.c:6:11: <span style='color:#D53BD3'>warning: </span>Division by zero</span></b><span style='font-size:8.5pt;font-family:"Menlo",serif'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Menlo",serif'> return 5/x + 5/0;<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><b><span style='font-size:8.5pt;font-family:"Menlo",serif;color:#34BC26'> ~^~</span></b><span style='font-size:8.5pt;font-family:"Menlo",serif;color:#34BC26'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Menlo",serif'>1 warning generated.<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Menlo",serif'>Annas-MBP-3:compiler-rt anna$ clang -fsyntax-only ~/tmp/ex.c<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><b><span style='font-size:8.5pt;font-family:"Menlo",serif'>/Users/anna/tmp/ex.c:6:17: <span style='color:#D53BD3'>warning: </span>division by zero is undefined [-Wdivision-by-zero]</span></b><span style='font-size:8.5pt;font-family:"Menlo",serif'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Menlo",serif'> return 5/x + 5/0;<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><b><span style='font-size:8.5pt;font-family:"Menlo",serif;color:#34BC26'> ^~</span></b><span style='font-size:8.5pt;font-family:"Menlo",serif;color:#34BC26'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Menlo",serif'>1 warning generated.<o:p></o:p></span></p></div><div><p class=MsoNormal><o:p> </o:p></p></div></div></div></div></body></html>