Review Request 111796: Fix endless recursion in setSpecializedFrom

Andreas Pakulat apaku at gmx.de
Wed Jul 31 18:23:19 UTC 2013



> On July 31, 2013, 4:20 p.m., Milian Wolff wrote:
> > languages/cpp/cppduchain/templatedeclaration.cpp, line 391
> > <http://git.reviewboard.kde.org/r/111796/diff/3/?file=175544#file175544line391>
> >
> >     this doesn't work, it always sets the counter to 1. Use this:
> >     
> >     PushValue<uint> safety(data.specializedFromDepth, data.specializedFromDepth + 1);
> >     
> >     Alternatively, feel free to add another PushValue-like class to pushvalue.h which comes with the semantics you want to have here. Also use that in the other counters then.

Ok, but that means that 2 of the 3 uses of PushValue in templatedeclaration.cpp are currently broken. The only one using that syntax is the one for instantiationDepth.


- Andreas


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/111796/#review36876
-----------------------------------------------------------


On July 31, 2013, 11:16 a.m., Andreas Pakulat wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/111796/
> -----------------------------------------------------------
> 
> (Updated July 31, 2013, 11:16 a.m.)
> 
> 
> Review request for KDevelop.
> 
> 
> Description
> -------
> 
> Fix endless recursion in setSpecializedFrom
> 
> This could be triggered by having the exactly same specialization occur
> twice in a single file. setSpecializedFrom would end up calling itself
> with the same TemplateDeclaration over and over again.
> 
> Adding another recursion counter in the same way that other places already
> have one fixes the problem. Unfortunately I wasn't able to generate a test
> that exhibits the recursion problem.
> 
> BUG: 318492
> 
> Avoid endless recursions in TemplateDeclaration::setSpecializedFrom
> 
> Having two template specializations with the same signature causes an
> endless recursion here. I don't see a reason why a TemplateDeclaration
> should update its 'specializedFrom' stuff if that already is up-to-date.
> So in the case the other->specializedFrom.data() is already what this
> declaration has, there's simply nothing to do.
> 
> 
> This addresses bug 318492.
>     http://bugs.kde.org/show_bug.cgi?id=318492
> 
> 
> Diffs
> -----
> 
>   languages/cpp/cppduchain/templatedeclaration.cpp b35ba13a0eacb5157a921cf96fdc22c091f625e1 
> 
> Diff: http://git.reviewboard.kde.org/r/111796/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Andreas Pakulat
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20130731/4d10e310/attachment-0001.html>


More information about the KDevelop-devel mailing list