<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" id="owaParaStyle"></style>
</head>
<body fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">
<div style="direction: ltr;">
<div style="direction: ltr;"><br>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;">Hello!</div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;"><br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;">Thank you Daniel for extending the IdenticalExprChecker. Imho these checks are very useful.</div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;"><br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;">About such code:</div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;"><br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;"><span style="font-family:'Segoe UI',Helvetica,Arial,sans-serif">if (foo()) {</span><br style="font-family:'Segoe UI',Helvetica,Arial,sans-serif">
<span style="font-family:'Segoe UI',Helvetica,Arial,sans-serif">        doSomething();</span><br style="font-family:'Segoe UI',Helvetica,Arial,sans-serif">
<span style="font-family:'Segoe UI',Helvetica,Arial,sans-serif">} else if (bar()) {</span><br style="font-family:'Segoe UI',Helvetica,Arial,sans-serif">
<span style="font-family:'Segoe UI',Helvetica,Arial,sans-serif">        /* no action needed */</span><br style="font-family:'Segoe UI',Helvetica,Arial,sans-serif">
<span style="font-family:'Segoe UI',Helvetica,Arial,sans-serif">} else {</span><br style="font-family:'Segoe UI',Helvetica,Arial,sans-serif">
<span style="font-family:'Segoe UI',Helvetica,Arial,sans-serif">        /* FIXME: Implement this. */</span><br style="font-family:'Segoe UI',Helvetica,Arial,sans-serif">
<span style="font-family:'Segoe UI',Helvetica,Arial,sans-serif">}</span></div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;"><br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;">You could warn here. However there will some noise.</div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;"><br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;">In my opinion it is not very rare to have identical blocks of code in if and else blocks by intention. <span style="font-size: 10pt;">My feeling is that for instance MISRA enforce some
 identical blocks because there must always be an empty else if the "else" logic should be to do nothing.</span></div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;"><br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;">Here is one real code example where there are identical blocks by intention. The TODO means that the code could be enhanced but it's fine for now.</div>
<div>https://github.com/danmar/cppcheck/blob/6bfd4af5/lib/checkunusedvar.cpp#L528</div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;"><br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;">I have not tried your patch yet though. I have access to some misra compatible code I could test it on.</div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;"><br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;">Best regards,</div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;">Daniel Marjamäki</div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;"><br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;"><span style="color: gray; font-family: Arial, sans-serif; font-size: 8pt;">..................................................................................................................</span></div>
<div style="color: rgb(0, 0, 0); font-family: Tahoma; font-size: 10pt;">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<p class="MsoNormal" style="margin:0cm 0cm 0pt"><span style="font-family:'Arial','sans-serif'; color:black; font-size:8pt">Daniel Marjamäki
</span><span style="font-family:'Arial','sans-serif'; color:gray; font-size:8pt">Senior Engineer</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-US" style="font-family:'Arial','sans-serif'; color:gray; font-size:8.5pt">Evidente ES East</span><span lang="EN-US" style="font-family:'Arial','sans-serif'; color:gray; font-size:8pt"> AB<span> 
</span>Warfvinges väg 34<span>  </span>SE-112 51 Stockholm<span>  </span>Sweden </span>
</p>
<p class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-US" style="font-family:'Arial','sans-serif'; color:gray; font-size:8pt"></span> </p>
<p class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-GB" style="font-family:'Arial','sans-serif'; color:gray; font-size:8pt">Mobile</span><span lang="EN-GB" style="font-family:'Arial','sans-serif'; color:gray; font-size:8pt">:<span>                
</span>+46 (0)709 12 42 62</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-GB" style="font-family:'Arial','sans-serif'; color:gray; font-size:8pt"></span><span lang="EN-GB" style="font-family:'Arial','sans-serif'; color:gray; font-size:8pt">E-mail:<span>   
</span><span>             <a href="mailto:Daniel.Marjamaki@evidente.se" tabindex="0" target="_blank">
Daniel.Marjamaki</a></span><a href="mailto:Daniel.Marjamaki@evidente.se" tabindex="0" target="_blank">@evidente.se</a><span>     
</span><span>                 </span></span></p>
<p class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-GB" style="font-family:'Arial','sans-serif'; color:gray; font-size:8pt"></span> </p>
<p class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-GB" style="font-family:'Arial','sans-serif'; font-size:8pt">www.evidente.se</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>