Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 362562 - [Lexer] Missinterpretation of PR"" as a raw-string literal in inactive code
Summary: [Lexer] Missinterpretation of PR"" as a raw-string literal in inactive code
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-parser (show other bugs)
Version: 8.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 8.1.0   Edit
Assignee: Markus Schorn CLA
QA Contact: Markus Schorn CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-01 07:52 EDT by Hedayat Vatankhah CLA
Modified: 2012-02-23 11:33 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hedayat Vatankhah CLA 2011-11-01 07:52:33 EDT
Build Identifier: I20110613-1736

Unfortunately, I have many issues with CDT 8.0 indexer. It works much worse than CDT 7.0 on my projects. I don't know why, but anyway I have tried to get some error messages. One of the problems which is probably new (since it causes some mistakes which didn't exist in CDT 7.0) is the following example. In this example, It says: unbounded string encountered after #ifdef line:

#define PR ""

void test()
{
#ifdef _DEBUG
        PR"";
#endif
}


int main(int argc, char **argv)
{
    return 0;
}


Reproducible: Always

Steps to Reproduce:
Put the above code in a source file.
Comment 1 Hedayat Vatankhah CLA 2011-11-02 05:35:09 EDT
One more comment: PR"" was the minimal construct that caused this problem. PR prefix is not the only prefix with this problem. The actual word which caused this problem was PRIuPTR"" so it is not limited to PR.
Comment 2 Markus Schorn CLA 2011-11-02 05:43:23 EDT
(In reply to comment #1)
> One more comment: PR"" was the minimal construct that caused this problem. PR
> prefix is not the only prefix with this problem. The actual word which caused
> this problem was PRIuPTR"" so it is not limited to PR.

Yep, any identifier that ends with R will trigger the issue.
Comment 3 Markus Schorn CLA 2011-11-02 05:48:00 EDT
Added testcase and fix.
Comment 4 CDT Genie CLA 2011-11-02 06:23:03 EDT
*** cdt git genie on behalf of Markus Schorn ***

    Bug 362562: Bogus detection of raw strings in inactive code.

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=2ef264d1abe366a3ada5151f09ea99eb28c669d4