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

Bug 331179

Summary: C/C++ Indexer report error for #error (valid pre-processor directive)
Product: [Tools] CDT Reporter: Sudarshan V <sudarshan.v>
Component: cdt-coreAssignee: Project Inbox <cdt-core-inbox>
Status: RESOLVED INVALID QA Contact: Doug Schaefer <cdtdoug>
Severity: normal    
Priority: P3    
Version: 8.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Snapshot contains the location where IASTProblem is created for valid #error preprocessor directive none

Description Sudarshan V CLA 2010-11-26 01:43:46 EST
Build Identifier:  I20100608-0911

<#error "some text"> is a valid pre-processor statement. When a C-file containing this code fragment is opened in the CEditor, there is an annotation against this code fragment which reports this as invalid. 

This is due to the fact that in the CPreProcessor class, IASTProblem is created always when #error is encountered. This is incorrect.

Reproducible: Always

Steps to Reproduce:
1. Open a C-file in C-Editor containing code fragment #error "some text"
2. Editor shows a C/C++ Indexer Marker Annotation which is incorrect since #error "some text" is a valid pre-processor statement
Comment 1 Sudarshan V CLA 2010-11-26 01:47:39 EST
Created attachment 183901 [details]
Snapshot contains the location where IASTProblem is created for valid #error preprocessor directive

Snapshot contains the location where IASTProblem is created for valid #error preprocessor directive
Comment 2 Markus Schorn CLA 2010-12-02 05:43:41 EST
The directive is valid syntax. However, when an #error directive is found in an active code-branch the program will not compile. Therefore, in such a situation, you do look at a problem that is worth being annotated.