Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 365498 - Strange warning placement for defaulted constructor
Summary: Strange warning placement for defaulted constructor
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-parser (show other bugs)
Version: 8.0.1   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 8.1.2   Edit
Assignee: Nathan Ridge CLA
QA Contact: Markus Schorn CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-02 19:15 EST by Nathan Ridge CLA
Modified: 2013-05-28 19:27 EDT (History)
4 users (show)

See Also:


Attachments
patch that fixes the issue, including tests (1.68 KB, patch)
2012-11-15 04:07 EST, Nathan Ridge CLA
cdtdoug: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nathan Ridge CLA 2011-12-02 19:15:08 EST
When codan gives a gives a warning about a defaulted constructor, such as the following:

// some comment                  <-- WARNING HERE

struct S
{
    int i;
    
    S() = default;
};

The warning is always on the first line of the file rather than the line with the defaulted constructor, regardless of what the first line of the file is.
Comment 1 Nathan Ridge CLA 2012-11-15 04:07:06 EST
Created attachment 223589 [details]
patch that fixes the issue, including tests

The problem was that the parser was not setting the begin offset of the ASTNode representing the defaulted function definition, so the offset was 0, and so Codan placed the warning on the first line of the file.

Attached is a patch that fixes the problem, with tests.
Comment 2 Nathan Ridge CLA 2012-12-05 22:36:42 EST
Patch is now on gerrit: https://git.eclipse.org/r/#/c/9065/
Comment 4 CDT Genie CLA 2013-02-27 11:57:39 EST
*** cdt git genie on behalf of Nathan Ridge ***

    Bug 365498 - Strange warning placement for defaulted constructor
    Change-Id: Ia80fbd9694310aff0900e80cb9175e101c653604
    Reviewed-on: <a  href="https://git.eclipse.org/r/9065">https://git.eclipse.org/r/9065</a>
    Reviewed-by: Sergey Prigogin &lt;eclipse.sprigogin@xxxxxxxxx&gt;
    IP-Clean: Sergey Prigogin &lt;eclipse.sprigogin@xxxxxxxxx&gt;
    Tested-by: Sergey Prigogin &lt;eclipse.sprigogin@xxxxxxxxx&gt;

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=1289cc3a6e98b216ce687901dbc9fcca1c441e30
Comment 5 Doug Schaefer CLA 2013-05-24 10:48:34 EDT
Comment on attachment 223589 [details]
patch that fixes the issue, including tests

Captured with git commit.