Fix bug 10450. Merge from default. RCL_2_4
authortimkelly
Mon, 01 Feb 2010 12:38:42 -0600
branchRCL_2_4
changeset 855 3f37e327885c
parent 846 1c39209db82f
child 857 d66843399035
Fix bug 10450. Merge from default.
builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestEpocEngineHelper.java
builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java
builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildConfiguration.java
project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/cpp/epoc/engine/model/mmp/EMMPStatement.java
--- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestEpocEngineHelper.java	Thu Jan 28 13:51:00 2010 -0600
+++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestEpocEngineHelper.java	Mon Feb 01 12:38:42 2010 -0600
@@ -185,4 +185,13 @@
 			}
 		}
 	}
+	
+	public void testSTDCPPSupport() throws Exception { 
+		ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(carbideProject); 
+		for (final IPath mmpPath : EpocEngineHelper.getMMPFilesForBuildConfiguration(cpi.getDefaultConfiguration())) { 
+			if (EpocEngineHelper.hasSTDCPPSupport(cpi, mmpPath)){ 
+				fail("Project does not have STDCPP Support"); 
+			}
+		}
+	}
 }
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java	Thu Jan 28 13:51:00 2010 -0600
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java	Mon Feb 01 12:38:42 2010 -0600
@@ -2641,4 +2641,46 @@
 		
 		return paths;
 	}
+	
+	/**
+	 * Check whether or not the project and build for standard C++. 
+	 * The following rules apply:
+	 * 
+	 * 1) If an MMP contains NOSTDCPP then it does not have std C++ support 
+	 * 2) Else If the STDCPP keyword is set it does have std C++ support 
+	 * 3) Else if TARGETTYPE is one of STDEXE|STDDLL|STDLIB it does have std C++ support 
+	 * 4) Else not std C++ support  
+	 * 
+	 * @param cpi
+	 * @param mmpPath
+	 * @return true if the MMP has standard C++ support 
+	 */
+	public static boolean hasSTDCPPSupport(ICarbideProjectInfo projectInfo,
+			IPath relativeMMPPath) {
+
+		Boolean result = (Boolean) EpocEnginePlugin.runWithMMPData(
+				relativeMMPPath, new DefaultMMPViewConfiguration(projectInfo,
+						new AllNodesViewFilter()),
+				new MMPDataRunnableAdapter() {
+					public Object run(IMMPData data) {
+						if (data.getFlags().contains(EMMPStatement.NOSTDCPP)) {
+							return false;
+						} else if (data.getFlags().contains(
+								EMMPStatement.STDCPP)) {
+							return true;
+						}
+						String targetType = data.getSingleArgumentSettings()
+								.get(EMMPStatement.TARGETTYPE);
+						if (targetType != null) {
+							if (targetType.toUpperCase().matches(
+									"STDEXE|STDLIB|STDDLL")) { //$NON-NLS-1$
+								return true;
+							}
+						}
+
+						return false;
+					}
+				});
+		return result != null ? result.booleanValue() : false;
+	}
 }
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildConfiguration.java	Thu Jan 28 13:51:00 2010 -0600
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildConfiguration.java	Mon Feb 01 12:38:42 2010 -0600
@@ -28,12 +28,14 @@
 import org.eclipse.core.resources.IMarker;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.Status;
 
 import com.nokia.carbide.cdt.builder.BuildArgumentsInfo;
 import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin;
+import com.nokia.carbide.cdt.builder.EpocEngineHelper;
 import com.nokia.carbide.cdt.builder.builder.CarbideCPPBuilder;
 import com.nokia.carbide.cdt.builder.project.IBuildArgumentsInfo;
 import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration;
@@ -318,6 +320,10 @@
 			macros.add("NDEBUG"); //$NON-NLS-1$
 		}
 		
+		if (hasSTDCPPSupport()){ 
+			macros.add("__SYMBIAN_STDCPP_SUPPORT__"); 
+		}
+		
 		return macros;
 	}
 
@@ -374,4 +380,24 @@
 	public IROMBuilderInfo getROMBuildInfo() {
 		return romBuilderInfo;
 	}
+	
+	private boolean hasSTDCPPSupport() {
+
+		ICarbideProjectInfo cpi = getCarbideProject();
+		List<ISymbianBuildContext> buildConfig = new ArrayList<ISymbianBuildContext>();
+		List<IPath> normalMakMakePaths = new ArrayList<IPath>();
+		List<IPath> testMakMakePaths = new ArrayList<IPath>();
+		buildConfig.add(this);
+		EpocEngineHelper.getMakMakeFiles(cpi.getAbsoluteBldInfPath(),
+				buildConfig, normalMakMakePaths, testMakMakePaths,
+				new NullProgressMonitor());
+
+		for (IPath mmpPath : normalMakMakePaths) {
+			if (EpocEngineHelper.hasSTDCPPSupport(cpi, mmpPath)) {
+				return true;
+			}
+		}
+
+		return false;
+	} 
 }
--- a/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/cpp/epoc/engine/model/mmp/EMMPStatement.java	Thu Jan 28 13:51:00 2010 -0600
+++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/cpp/epoc/engine/model/mmp/EMMPStatement.java	Mon Feb 01 12:38:42 2010 -0600
@@ -76,6 +76,12 @@
 	 */
 	FEATUREVARIANT("FEATUREVARIANT", IMMPParserConfiguration.FLAG_STATEMENT), //$NON-NLS-1$
 	
+	/**
+	 * @since 2.5 - Added with Symbian^3
+	 */
+	STDCPP("STDCPP", IMMPParserConfiguration.FLAG_STATEMENT), //$NON-NLS-1$ 
+	NOSTDCPP("NOSTDCPP", IMMPParserConfiguration.FLAG_STATEMENT), //$NON-NLS-1$ 
+	
 	HEADER("HEADER", IMMPParserConfiguration.FLAG_STATEMENT, "RESOURCE|BITMAP"), //$NON-NLS-1$ //$NON-NLS-2$
 	HEADERONLY("HEADERONLY", IMMPParserConfiguration.FLAG_STATEMENT, "RESOURCE|BITMAP"), //$NON-NLS-1$ //$NON-NLS-2$