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

Bug 315542

Summary: ParserLanguage knows only about C and CPP
Product: [Tools] CDT Reporter: Alex Blewitt <alex.blewitt>
Component: cdt-coreAssignee: Project Inbox <cdt-core-inbox>
Status: CLOSED DUPLICATE QA Contact: Doug Schaefer <cdtdoug>
Severity: enhancement    
Priority: P3 CC: yevshif
Version: 6.0   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 315539    

Description Alex Blewitt CLA 2010-06-03 04:57:51 EDT
Build Identifier: 

The ParserLanguage has an enum which only knows about C and CPP. Furthermore, the test for 'isCPP' is usually predicated on whether the cppnature is present; there's a lot of code which assumes that if !CPP, then it must be C (as well as vice versa).

Having an enum, rather than using something extensible like an extension point or a string, is counterproductive and results in a closed system for extensibility purposes.

http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ParserLanguage.java?revision=1.5&root=Tools_Project&view=markup

/**
 * Enumeration of base languages supported by CDT.
 */
public enum ParserLanguage {
	
	C {
		@Override public boolean isCPP() { return false; }
		@Override public String toString() { return "C"; } //$NON-NLS-1$
	},
	
	CPP {
		@Override public boolean isCPP() { return true; }
		@Override public String toString() { return "C++"; } //$NON-NLS-1$
	};

	public abstract boolean isCPP();

}


Reproducible: Always
Comment 1 Markus Schorn CLA 2010-06-08 08:20:34 EDT
Should be deprecated.

*** This bug has been marked as a duplicate of bug 162806 ***