1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

bug 319512: compilation warnings

This commit is contained in:
Andrew Gvozdev 2010-07-21 04:21:38 +00:00
parent 6fc9f2b2bf
commit b64329ba17

View file

@ -26,7 +26,7 @@ import java.util.Vector;
import org.eclipse.cdt.build.core.scannerconfig.ICfgScannerConfigBuilderInfo2Set; import org.eclipse.cdt.build.core.scannerconfig.ICfgScannerConfigBuilderInfo2Set;
import org.eclipse.cdt.build.internal.core.scannerconfig.CfgDiscoveredPathManager.PathInfoCache; import org.eclipse.cdt.build.internal.core.scannerconfig.CfgDiscoveredPathManager.PathInfoCache;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.ErrorParserManager;
import org.eclipse.cdt.core.settings.model.CIncludePathEntry; import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
import org.eclipse.cdt.core.settings.model.CLibraryFileEntry; import org.eclipse.cdt.core.settings.model.CLibraryFileEntry;
import org.eclipse.cdt.core.settings.model.CLibraryPathEntry; import org.eclipse.cdt.core.settings.model.CLibraryPathEntry;
@ -81,16 +81,13 @@ import org.eclipse.cdt.managedbuilder.macros.BuildMacroException;
import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider; import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider;
import org.eclipse.cdt.managedbuilder.macros.IConfigurationBuildMacroSupplier; import org.eclipse.cdt.managedbuilder.macros.IConfigurationBuildMacroSupplier;
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceDelta; import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
import org.osgi.framework.Version; import org.osgi.framework.Version;
import org.osgi.service.prefs.Preferences;
public class Configuration extends BuildObject implements IConfiguration, IBuildPropertiesRestriction, IBuildPropertyChangeListener, IRealBuildObjectAssociation { public class Configuration extends BuildObject implements IConfiguration, IBuildPropertiesRestriction, IBuildPropertyChangeListener, IRealBuildObjectAssociation {
@ -135,7 +132,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
// private Boolean isPerResourceDiscovery; // private Boolean isPerResourceDiscovery;
private ICfgScannerConfigBuilderInfo2Set cfgScannerInfo; private ICfgScannerConfigBuilderInfo2Set cfgScannerInfo;
private boolean isPreferenceConfig; private boolean isPreferenceConfig;
private List excludeList; private List<IPath> excludeList;
//property name for holding the rebuild state //property name for holding the rebuild state
private static final String REBUILD_STATE = "rebuildState"; //$NON-NLS-1$ private static final String REBUILD_STATE = "rebuildState"; //$NON-NLS-1$
@ -195,7 +192,6 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
* *
* @param projectType The <code>ProjectType</code> the configuration will be added to. * @param projectType The <code>ProjectType</code> the configuration will be added to.
* @param element The element from the manifest that contains the configuration information. * @param element The element from the manifest that contains the configuration information.
* @param managedBuildRevision
*/ */
public Configuration(ProjectType projectType, IManagedConfigElement element, String managedBuildRevision) { public Configuration(ProjectType projectType, IManagedConfigElement element, String managedBuildRevision) {
this.projectType = projectType; this.projectType = projectType;
@ -224,8 +220,8 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
// Load the children // Load the children
IManagedConfigElement[] configElements = element.getChildren(); IManagedConfigElement[] configElements = element.getChildren();
List srcPathList = new ArrayList(); List<IPath> srcPathList = new ArrayList<IPath>();
excludeList = new ArrayList(); excludeList = new ArrayList<IPath>();
for (int l = 0; l < configElements.length; ++l) { for (int l = 0; l < configElements.length; ++l) {
IManagedConfigElement configElement = configElements[l]; IManagedConfigElement configElement = configElements[l];
if (configElement.getName().equals(IToolChain.TOOL_CHAIN_ELEMENT_NAME)) { if (configElement.getName().equals(IToolChain.TOOL_CHAIN_ELEMENT_NAME)) {
@ -245,8 +241,8 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
} else if (configElement.getName().equals(SupportedProperties.SUPPORTED_PROPERTIES)){ } else if (configElement.getName().equals(SupportedProperties.SUPPORTED_PROPERTIES)){
loadProperties(configElement); loadProperties(configElement);
} else if (SOURCE_ENTRIES.equals(configElement.getName())){ } else if (SOURCE_ENTRIES.equals(configElement.getName())){
List seList = LanguageSettingEntriesSerializer.loadEntriesList(new ManagedConfigStorageElement(configElement), ICSettingEntry.SOURCE_PATH); List<ICSettingEntry> seList = LanguageSettingEntriesSerializer.loadEntriesList(new ManagedConfigStorageElement(configElement), ICSettingEntry.SOURCE_PATH);
sourceEntries = (ICSourceEntry[])seList.toArray(new ICSourceEntry[seList.size()]); sourceEntries = seList.toArray(new ICSourceEntry[seList.size()]);
} }
} }
@ -291,9 +287,9 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
setDirty(false); setDirty(false);
} }
private static ICSourceEntry[] createSourceEntries(ICSourceEntry[] curEntries, List pathList, List excludeList){ private static ICSourceEntry[] createSourceEntries(ICSourceEntry[] curEntries, List<IPath> pathList, List<IPath> excludeList){
for(int i = 0; i < excludeList.size(); i++){ for(int i = 0; i < excludeList.size(); i++){
IPath path = (IPath)excludeList.get(i); IPath path = excludeList.get(i);
if(path.segmentCount() == 0) if(path.segmentCount() == 0)
excludeList.remove(i); excludeList.remove(i);
} }
@ -306,11 +302,11 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
return curEntries; return curEntries;
int pathSize = pathList.size(); int pathSize = pathList.size();
Map map = new LinkedHashMap(); Map<IPath, ICSourceEntry> map = new LinkedHashMap<IPath, ICSourceEntry>();
for(int i = 0; i < pathSize; i++){ for(int i = 0; i < pathSize; i++){
IPath path = (IPath)pathList.get(i); IPath path = pathList.get(i);
ICSourceEntry entry = (ICSourceEntry)map.get(path); ICSourceEntry entry = map.get(path);
if(entry == null) if(entry == null)
entry = new CSourceEntry(path, null, ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED); entry = new CSourceEntry(path, null, ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED);
@ -319,7 +315,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
map.put(path, entry); map.put(path, entry);
} }
return (ICSourceEntry[])map.values().toArray(new ICSourceEntry[map.size()]); return map.values().toArray(new ICSourceEntry[map.size()]);
} }
/** /**
@ -406,8 +402,8 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
managedProject.addConfiguration(this); managedProject.addConfiguration(this);
ICStorageElement configElements[] = element.getChildren(); ICStorageElement configElements[] = element.getChildren();
List srcPathList = new ArrayList(); List<IPath> srcPathList = new ArrayList<IPath>();
excludeList = new ArrayList(); excludeList = new ArrayList<IPath>();
for (int i = 0; i < configElements.length; ++i) { for (int i = 0; i < configElements.length; ++i) {
ICStorageElement configElement = configElements[i]; ICStorageElement configElement = configElements[i];
if (configElement.getName().equals(IToolChain.TOOL_CHAIN_ELEMENT_NAME)) { if (configElement.getName().equals(IToolChain.TOOL_CHAIN_ELEMENT_NAME)) {
@ -425,8 +421,8 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
if(p.getPath() != null) if(p.getPath() != null)
srcPathList.add(p.getPath()); srcPathList.add(p.getPath());
} else if (SOURCE_ENTRIES.equals(configElement.getName())){ } else if (SOURCE_ENTRIES.equals(configElement.getName())){
List seList = LanguageSettingEntriesSerializer.loadEntriesList(configElement, ICSettingEntry.SOURCE_PATH); List<ICSettingEntry> seList = LanguageSettingEntriesSerializer.loadEntriesList(configElement, ICSettingEntry.SOURCE_PATH);
sourceEntries = (ICSourceEntry[])seList.toArray(new ICSourceEntry[seList.size()]); sourceEntries = seList.toArray(new ICSourceEntry[seList.size()]);
} }
} }
@ -682,7 +678,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
boolean copyIds = cloneConfig.getId().equals(id); boolean copyIds = cloneConfig.getId().equals(id);
String subId; String subId;
// Resource Configurations // Resource Configurations
Map toolIdMap = new HashMap(); Map<IPath, Map<String, String>> toolIdMap = new HashMap<IPath, Map<String, String>>();
IResourceInfo infos[] = cloneConfig.rcInfos.getResourceInfos(); IResourceInfo infos[] = cloneConfig.rcInfos.getResourceInfos();
for(int i = 0; i < infos.length; i++){ for(int i = 0; i < infos.length; i++){
if(infos[i] instanceof FolderInfo){ if(infos[i] instanceof FolderInfo){
@ -893,9 +889,6 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/** /**
* Persist this configuration to project file. * Persist this configuration to project file.
*
* @param doc
* @param element
*/ */
public void serialize(ICStorageElement element) { public void serialize(ICStorageElement element) {
element.setAttribute(IConfiguration.ID, id); element.setAttribute(IConfiguration.ID, id);
@ -1399,7 +1392,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
set.toArray(result); set.toArray(result);
return result; return result;
} }
return CCorePlugin.getDefault().getAllErrorParsersIDs(); return ErrorParserManager.getErrorParserAvailableIds();
} }
public Set<String> contributeErrorParsers(Set<String> set, boolean includeChildren) { public Set<String> contributeErrorParsers(Set<String> set, boolean includeChildren) {
@ -2185,15 +2178,15 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/** /**
* @param parallel if true, internal builder will use parallel mode * @param parallel if true, internal builder will use parallel mode
*/ */
public void setParallelDef(boolean parallel_def){ public void setParallelDef(boolean parallel){
if(getParallelDef() == parallel_def) if(getParallelDef() == parallel)
return; return;
int num = getParallelNumber(); int num = getParallelNumber();
if(num != 0){ if(num != 0){
setParallelNumber(-num); setParallelNumber(-num);
} else { } else {
if(parallel_def){ if(parallel){
setParallelNumber(-1); setParallelNumber(-1);
} else { } else {
setParallelNumber(1); setParallelNumber(1);
@ -2210,10 +2203,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
} }
/** /**
*
* sets number of Parallel threads * sets number of Parallel threads
*
* @param int
*/ */
public void setParallelNumber(int n){ public void setParallelNumber(int n){
try { try {
@ -2231,23 +2221,23 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
return getBuilder().getParallelizationNum(); return getBuilder().getParallelizationNum();
} }
private Preferences getPreferences(String name){ // private Preferences getPreferences(String name){
if(isTemporary) // if(isTemporary)
return null; // return null;
//
IProject project = (IProject)getOwner(); // IProject project = (IProject)getOwner();
//
if(project == null || !project.exists() || !project.isOpen()) // if(project == null || !project.exists() || !project.isOpen())
return null; // return null;
//
Preferences prefs = new ProjectScope(project).getNode(ManagedBuilderCorePlugin.getUniqueIdentifier()); // Preferences prefs = new ProjectScope(project).getNode(ManagedBuilderCorePlugin.getUniqueIdentifier());
if(prefs != null){ // if(prefs != null){
prefs = prefs.node(getId()); // prefs = prefs.node(getId());
if(prefs != null && name != null) // if(prefs != null && name != null)
prefs = prefs.node(name); // prefs = prefs.node(name);
} // }
return prefs; // return prefs;
} // }
public IResourceInfo[] getResourceInfos() { public IResourceInfo[] getResourceInfos() {
return rcInfos.getResourceInfos(); return rcInfos.getResourceInfos();
@ -2295,7 +2285,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
IResourceInfo info = getResourceInfo(path, false); IResourceInfo info = getResourceInfo(path, false);
IFolderInfo folderInfo = null; IFolderInfo folderInfo = null;
if(info instanceof IFileInfo){ if(info instanceof IFileInfo){
folderInfo = null; // folderInfo = null;
} else if (info instanceof IFolderInfo){ } else if (info instanceof IFolderInfo){
IFolderInfo base = (IFolderInfo)info; IFolderInfo base = (IFolderInfo)info;
folderInfo = createFolderInfo(path, base, id, name); folderInfo = createFolderInfo(path, base, id, name);
@ -2319,7 +2309,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
if(sourceEntries == null || sourceEntries.length == 0){ if(sourceEntries == null || sourceEntries.length == 0){
if(parent != null && sourceEntries == null) if(parent != null && sourceEntries == null)
return parent.getSourceEntries(); return parent.getSourceEntries();
return new ICSourceEntry[]{new CSourceEntry(Path.EMPTY, null, ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED)}; //$NON-NLS-1$ return new ICSourceEntry[]{new CSourceEntry(Path.EMPTY, null, ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED)};
} }
return sourceEntries.clone(); return sourceEntries.clone();
@ -2577,7 +2567,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
} }
public String[] getUserObjects(String extension) { public String[] getUserObjects(String extension) {
Vector objs = new Vector(); Vector<String> objs = new Vector<String>();
ITool tool = calculateTargetTool(); ITool tool = calculateTargetTool();
if(tool == null) if(tool == null)
tool = getToolFromOutputExtension(extension); tool = getToolFromOutputExtension(extension);
@ -2614,11 +2604,11 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
} }
} }
} }
return (String[])objs.toArray(new String[objs.size()]); return objs.toArray(new String[objs.size()]);
} }
public String[] getLibs(String extension) { public String[] getLibs(String extension) {
Vector libs = new Vector(); Vector<String> libs = new Vector<String>();
ITool tool = calculateTargetTool(); ITool tool = calculateTargetTool();
if(tool == null) if(tool == null)
tool = getToolFromOutputExtension(extension); tool = getToolFromOutputExtension(extension);
@ -2668,7 +2658,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
} }
} }
} }
return (String[])libs.toArray(new String[libs.size()]); return libs.toArray(new String[libs.size()]);
} }
public boolean buildsFileType(String srcExt) { public boolean buildsFileType(String srcExt) {
@ -2799,38 +2789,38 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
public String[] getRequiredTypeIds() { public String[] getRequiredTypeIds() {
SupportedProperties props = findSupportedProperties(); SupportedProperties props = findSupportedProperties();
List list = new ArrayList(); List<String> list = new ArrayList<String>();
if(props != null){ if(props != null){
list.addAll(Arrays.asList(props.getRequiredTypeIds())); list.addAll(Arrays.asList(props.getRequiredTypeIds()));
} }
list.addAll(Arrays.asList(((ToolChain)getToolChain()).getRequiredTypeIds())); list.addAll(Arrays.asList(((ToolChain)getToolChain()).getRequiredTypeIds()));
return (String[])list.toArray(new String[list.size()]); return list.toArray(new String[list.size()]);
} }
public String[] getSupportedTypeIds() { public String[] getSupportedTypeIds() {
SupportedProperties props = findSupportedProperties(); SupportedProperties props = findSupportedProperties();
List list = new ArrayList(); List<String> list = new ArrayList<String>();
if(props != null){ if(props != null){
list.addAll(Arrays.asList(props.getSupportedTypeIds())); list.addAll(Arrays.asList(props.getSupportedTypeIds()));
} }
list.addAll(Arrays.asList(((ToolChain)getToolChain()).getSupportedTypeIds())); list.addAll(Arrays.asList(((ToolChain)getToolChain()).getSupportedTypeIds()));
return (String[])list.toArray(new String[list.size()]); return list.toArray(new String[list.size()]);
} }
public String[] getSupportedValueIds(String typeId) { public String[] getSupportedValueIds(String typeId) {
SupportedProperties props = findSupportedProperties(); SupportedProperties props = findSupportedProperties();
List list = new ArrayList(); List<String> list = new ArrayList<String>();
if(props != null){ if(props != null){
list.addAll(Arrays.asList(props.getSupportedValueIds(typeId))); list.addAll(Arrays.asList(props.getSupportedValueIds(typeId)));
} }
list.addAll(Arrays.asList(((ToolChain)getToolChain()).getSupportedValueIds(typeId))); list.addAll(Arrays.asList(((ToolChain)getToolChain()).getSupportedValueIds(typeId)));
return (String[])list.toArray(new String[list.size()]); return list.toArray(new String[list.size()]);
} }
public boolean requiresType(String typeId) { public boolean requiresType(String typeId) {