<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-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: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'> ganna@apple.com [mailto:ganna@apple.com] <br><b>Sent:</b> 12 November 2016 19:54<br><b>To:</b> Martin.ORiordan@Movidius.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>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>