MantisBT - KWStyle
View Issue Details
0010872KWStylepublic2010-06-24 16:392010-06-25 11:02
Brad Davis 
Brad Davis 
normalminoralways
resolvedfixed 
0010872: Comment symbols in strings (i.e., not comments) are parsed incorrectly as comments
Much of the style checking is done on the buffer m_BufferNoComment.

This buffer contained the text of the file but with all comments removed.

The algorithm for removing the comments was flawed in the following sense: comment-ish strings within double quotes were incorrectly interpreted as comments.

I have added a test that reveals the problem and a fix and will soon push this fix (once I have a mantis number).
Here is an example that will trigger problems:


A()
{
  f("//");
}

B()
{
  g("//");
}

C()
{
}
No tags attached.
Issue History
2010-06-24 16:39Brad DavisNew Issue
2010-06-25 09:08Brad DavisNote Added: 0021166
2010-06-25 10:27Brad DavisNote Added: 0021170
2010-06-25 10:29Brad DavisNote Added: 0021171
2010-06-25 11:02Brad DavisStatusnew => resolved
2010-06-25 11:02Brad DavisResolutionopen => fixed
2010-06-25 11:02Brad DavisAssigned To => Brad Davis

Notes
(0021166)
Brad Davis   
2010-06-25 09:08   
Patch is pending access to git repo.
(0021170)
Brad Davis   
2010-06-25 10:27   
Author: Brad Davis <brad.davis@kitware.com> 2010-06-24 16:44:31
Committer: Brad Davis <brad.davis@kitware.com> 2010-06-25 10:27:09
Parent: 9b5163c00ca6784f362151960ba700f5d23134a8 (KWSys Nightly Date Stamp)
Branches: master, remotes/origin/master
Follows:
Precedes:

    BUG: refs 0010872; fix parsing of comments in strings
    
    Comment-ish symbols like // and /* were incorrectly being looked for
    inside strings (e.g., "//"). This led to multiple problems since much
    kwsytle processing happens on a buffer with the comments stripped
    away.
    
    E.g.,
    
    f("//");
    
    was being checked as
    
    f("
(0021171)
Brad Davis   
2010-06-25 10:29   
Need to get stronger mantis permissions to mark this as resolved.