mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 14:12:10 +02:00
bug 319512: compilation warnings
This commit is contained in:
parent
459affd72f
commit
6fc9f2b2bf
3 changed files with 48 additions and 63 deletions
|
@ -11,10 +11,10 @@
|
|||
|
||||
package org.eclipse.cdt.managedbuilder.internal.scannerconfig;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.eclipse.cdt.build.internal.core.scannerconfig2.CfgScannerConfigProfileManager;
|
||||
|
@ -63,7 +63,7 @@ public class ManagedBuildCPathEntryContainer implements IPathEntryContainer {
|
|||
private static final String TRACE_HEADER = "PathEntryContainer trace ["; //$NON-NLS-1$
|
||||
|
||||
private ITarget defaultTarget;
|
||||
private Vector entries;
|
||||
private Vector<IPathEntry> entries;
|
||||
private IProject project;
|
||||
private ManagedBuildInfo info;
|
||||
public static boolean VERBOSE = false;
|
||||
|
@ -81,27 +81,22 @@ public class ManagedBuildCPathEntryContainer implements IPathEntryContainer {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a new path container for the managed buildd project.
|
||||
*
|
||||
* @param info the build information associated with the project
|
||||
* Creates a new path container for the managed build project.
|
||||
*/
|
||||
public ManagedBuildCPathEntryContainer(IProject project) {
|
||||
super();
|
||||
this.project = project;
|
||||
entries = new Vector();
|
||||
entries = new Vector<IPathEntry>();
|
||||
}
|
||||
|
||||
protected void addDefinedSymbols(Map definedSymbols) {
|
||||
protected void addDefinedSymbols(Map<String, String> definedSymbols) {
|
||||
// Add a new macro entry for each defined symbol
|
||||
Iterator keyIter = definedSymbols.keySet().iterator();
|
||||
while (keyIter.hasNext()) {
|
||||
Set<String> macros = definedSymbols.keySet();
|
||||
for (String macro : macros) {
|
||||
boolean add = true;
|
||||
String macro = (String) keyIter.next();
|
||||
String value = (String) definedSymbols.get(macro);
|
||||
String value = definedSymbols.get(macro);
|
||||
// Make sure the current entries do not contain a duplicate
|
||||
Iterator entryIter = entries.listIterator();
|
||||
while (entryIter.hasNext()) {
|
||||
IPathEntry entry = (IPathEntry) entryIter.next();
|
||||
for (IPathEntry entry : entries) {
|
||||
if (entry.getEntryKind() == IPathEntry.CDT_MACRO) {
|
||||
if (((IMacroEntry)entry).getMacroName().equals(macro) &&
|
||||
((IMacroEntry)entry).getMacroValue().equals(value)) {
|
||||
|
@ -118,11 +113,9 @@ public class ManagedBuildCPathEntryContainer implements IPathEntryContainer {
|
|||
|
||||
}
|
||||
|
||||
protected void addIncludePaths(List paths) {
|
||||
protected void addIncludePaths(List<String> paths) {
|
||||
// A little checking is needed to avoid adding duplicates
|
||||
Iterator pathIter = paths.listIterator();
|
||||
while (pathIter.hasNext()) {
|
||||
String path = (String) pathIter.next();
|
||||
for (String path : paths) {
|
||||
IPathEntry entry = CoreModel.newIncludeEntry(Path.EMPTY, Path.EMPTY, new Path(path), true);
|
||||
if (!entries.contains(entry)) {
|
||||
entries.add(entry);
|
||||
|
@ -138,9 +131,8 @@ public class ManagedBuildCPathEntryContainer implements IPathEntryContainer {
|
|||
final IScannerConfigBuilderInfo2 buildInfo = ScannerConfigProfileManager.
|
||||
createScannerConfigBuildInfo2(ManagedBuilderCorePlugin.getDefault().getPluginPreferences(),
|
||||
profileInstance.getProfile().getId(), false);
|
||||
List providerIds = buildInfo.getProviderIdList();
|
||||
for (Iterator i = providerIds.iterator(); i.hasNext(); ) {
|
||||
final String providerId = (String) i.next();
|
||||
List<String> providerIds = buildInfo.getProviderIdList();
|
||||
for (final String providerId : providerIds) {
|
||||
final IExternalScannerInfoProvider esiProvider = profileInstance.createExternalScannerInfoProvider(providerId);
|
||||
|
||||
// Set the arguments for the provider
|
||||
|
@ -175,13 +167,13 @@ public class ManagedBuildCPathEntryContainer implements IPathEntryContainer {
|
|||
info = (ManagedBuildInfo) ManagedBuildManager.getBuildInfo(project);
|
||||
if (info == null) {
|
||||
ManagedBuildCPathEntryContainer.outputError(project.getName(), "Build information is null"); //$NON-NLS-1$
|
||||
return (IPathEntry[])entries.toArray(new IPathEntry[entries.size()]);
|
||||
return entries.toArray(new IPathEntry[entries.size()]);
|
||||
}
|
||||
IConfiguration defaultConfig = info.getDefaultConfiguration();
|
||||
if (defaultConfig == null) {
|
||||
// The build information has not been loaded yet
|
||||
ManagedBuildCPathEntryContainer.outputError(project.getName(), "Build information has not been loaded yet"); //$NON-NLS-1$
|
||||
return (IPathEntry[])entries.toArray(new IPathEntry[entries.size()]);
|
||||
return entries.toArray(new IPathEntry[entries.size()]);
|
||||
}
|
||||
// get the associated scanner config discovery profile id
|
||||
String scdProfileId = ManagedBuildManager.getScannerInfoProfileId(defaultConfig);
|
||||
|
@ -213,10 +205,10 @@ public class ManagedBuildCPathEntryContainer implements IPathEntryContainer {
|
|||
ManagedBuildCPathEntryContainer.outputTrace(project.getName(), "Path entries set using built-in definitions from " + defaultConfig.getName()); //$NON-NLS-1$
|
||||
} else {
|
||||
ManagedBuildCPathEntryContainer.outputError(project.getName(), "Configuration is null"); //$NON-NLS-1$
|
||||
return (IPathEntry[])entries.toArray(new IPathEntry[entries.size()]);
|
||||
return entries.toArray(new IPathEntry[entries.size()]);
|
||||
}
|
||||
}
|
||||
return (IPathEntry[])entries.toArray(new IPathEntry[entries.size()]);
|
||||
return entries.toArray(new IPathEntry[entries.size()]);
|
||||
} // end synchronized
|
||||
}
|
||||
|
||||
|
@ -234,9 +226,6 @@ public class ManagedBuildCPathEntryContainer implements IPathEntryContainer {
|
|||
return new Path("org.eclipse.cdt.managedbuilder.MANAGED_CONTAINER"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/**
|
||||
* @param values
|
||||
*/
|
||||
private void addEntries(IPathEntry[] values) {
|
||||
if (values == null) return;
|
||||
for (int i=0; i<values.length; i++) {
|
||||
|
|
|
@ -41,12 +41,10 @@ public interface IManagedScannerInfoCollector extends IScannerInfoCollector {
|
|||
*
|
||||
* @return a <code>List</code> of built-in compiler include search paths.
|
||||
*/
|
||||
public List getIncludePaths();
|
||||
public List<String> getIncludePaths();
|
||||
|
||||
/**
|
||||
* Sets the <code>IProject</code> for the receiver.
|
||||
*
|
||||
* @param project
|
||||
*/
|
||||
public void setProject(IProject project);
|
||||
}
|
||||
|
|
|
@ -189,7 +189,6 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
|||
|
||||
for (ICLanguageSettingEntry entry : entries) {
|
||||
if (((CMacroEntry) entry).getName().equals(symbol)) {
|
||||
int flags = entry.getFlags();
|
||||
symbolFound = true; // it's already there, so don't set it
|
||||
break;
|
||||
}
|
||||
|
@ -269,11 +268,11 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
|||
}
|
||||
}
|
||||
|
||||
public Map getPathInfoMap() {
|
||||
public Map<IResource, PathInfo> getPathInfoMap() {
|
||||
synchronized (fLock) {
|
||||
IPerFileDiscoveredPathInfo2 info1 = getPerFileInfo1();
|
||||
if (info1 != null) {
|
||||
Map map = new HashMap();
|
||||
Map<IResource, PathInfo> map = new HashMap<IResource, PathInfo>();
|
||||
map.putAll(info1.getPathInfoMap());
|
||||
map.putAll(fInfo2.getPathInfoMap());
|
||||
return map;
|
||||
|
@ -383,7 +382,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
|||
}
|
||||
}
|
||||
|
||||
public Map getSymbols(IPath path) {
|
||||
public Map<String, String> getSymbols(IPath path) {
|
||||
synchronized (fLock) {
|
||||
|
||||
Map<String, String> symbols = new HashMap<String, String>();
|
||||
|
@ -439,7 +438,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
|||
return fInfo2.getSerializable();
|
||||
}
|
||||
|
||||
public Map getSymbols() {
|
||||
public Map<String, String> getSymbols() {
|
||||
synchronized (fLock) {
|
||||
return fInfo1.getSymbols();
|
||||
}
|
||||
|
@ -630,9 +629,8 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
|||
// get the command
|
||||
CCommandDSC cmd = getCommand(path);
|
||||
if (cmd != null && cmd.isDiscovered()) {
|
||||
List symbols = cmd.getSymbols();
|
||||
for (Iterator i = symbols.iterator(); i.hasNext();) {
|
||||
String symbol = (String) i.next();
|
||||
List<String> symbols = cmd.getSymbols();
|
||||
for (String symbol : symbols) {
|
||||
String key = ScannerConfigUtil.getSymbolKey(symbol);
|
||||
String value = ScannerConfigUtil.getSymbolValue(symbol);
|
||||
definedSymbols.put(key, value);
|
||||
|
@ -1520,7 +1518,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector#getIncludePaths()
|
||||
*/
|
||||
public List getIncludePaths() {
|
||||
public List<String> getIncludePaths() {
|
||||
synchronized (fLock) {
|
||||
List<String> pathStrings = new LinkedList<String>();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue