Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 362562

Summary: [Lexer] Missinterpretation of PR"" as a raw-string literal in inactive code
Product: [Tools] CDT Reporter: Hedayat Vatankhah <hedayat.fwd+eclipsebz>
Component: cdt-parserAssignee: Markus Schorn <mschorn.eclipse>
Status: RESOLVED FIXED QA Contact: Markus Schorn <mschorn.eclipse>
Severity: normal    
Priority: P3 CC: cdtdoug
Version: 8.0   
Target Milestone: 8.1.0   
Hardware: PC   
OS: Linux   
Whiteboard:

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