# HG changeset patch # User timkelly # Date 1265049522 21600 # Node ID 3f37e327885c19118bd4cd19a54afc5998038e9d # Parent 1c39209db82fa4f58ffc9bd35de34e1772bc94e1 Fix bug 10450. Merge from default. diff -r 1c39209db82f -r 3f37e327885c builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/TestEpocEngineHelper.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"); + } + } + } } diff -r 1c39209db82f -r 3f37e327885c builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java --- 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; + } } diff -r 1c39209db82f -r 3f37e327885c builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildConfiguration.java --- 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 buildConfig = new ArrayList(); + List normalMakMakePaths = new ArrayList(); + List testMakMakePaths = new ArrayList(); + 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; + } } diff -r 1c39209db82f -r 3f37e327885c project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/cpp/epoc/engine/model/mmp/EMMPStatement.java --- 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$