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