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

compilation warnings

This commit is contained in:
Andrew Gvozdev 2010-04-29 05:00:07 +00:00
parent f068ae1a89
commit 54db699cd8
16 changed files with 74 additions and 95 deletions

View file

@ -63,7 +63,7 @@ public abstract class BaseBOPConsoleParserTests extends BaseTestCase {
fOutputParser.processLine("-c test.c"); // multiline //$NON-NLS-1$
fOutputParser.processLine("gcc -D 'SUM(x, y) = (x) + (y)' -c test.c"); // more complex macro definition //$NON-NLS-1$
List sumSymbols = fCollector.getCollectedScannerInfo(null, ScannerInfoTypes.SYMBOL_DEFINITIONS);
List<String> sumSymbols = fCollector.getCollectedScannerInfo(null, ScannerInfoTypes.SYMBOL_DEFINITIONS);
assertTrue(sumSymbols.contains("MACRO1=1")); //$NON-NLS-1$
assertTrue(sumSymbols.contains("MACRO2=value2")); //$NON-NLS-1$
assertTrue(sumSymbols.contains("MACRO3=")); //$NON-NLS-1$
@ -85,7 +85,7 @@ public abstract class BaseBOPConsoleParserTests extends BaseTestCase {
public void testParsingSymbolDefinitions_bug80271() {
fOutputParser.processLine("gcc -DMACRO1 -I ..\\inc -c ..\\perfilescdtest\\source.c"); // PR 80271 //$NON-NLS-1$
List sumSymbols = fCollector.getCollectedScannerInfo(null, ScannerInfoTypes.SYMBOL_DEFINITIONS);
List<String> sumSymbols = fCollector.getCollectedScannerInfo(null, ScannerInfoTypes.SYMBOL_DEFINITIONS);
assertTrue(sumSymbols.contains("MACRO1=1")); //$NON-NLS-1$
assertTrue(sumSymbols.size() == 1);
}
@ -94,7 +94,7 @@ public abstract class BaseBOPConsoleParserTests extends BaseTestCase {
fOutputParser.processLine("../src/bug186065.cc:8: error: missing terminating \" character"); // PR 80271 //$NON-NLS-1$
fOutputParser.processLine("gcc -DBUG186065_IS_FIXED test.c"); //$NON-NLS-1$
List sumSymbols = fCollector.getCollectedScannerInfo(null, ScannerInfoTypes.SYMBOL_DEFINITIONS);
List<String> sumSymbols = fCollector.getCollectedScannerInfo(null, ScannerInfoTypes.SYMBOL_DEFINITIONS);
assertTrue(sumSymbols.contains("BUG186065_IS_FIXED=1")); //$NON-NLS-1$
assertTrue(sumSymbols.size() == 1);
}
@ -107,7 +107,7 @@ public abstract class BaseBOPConsoleParserTests extends BaseTestCase {
fOutputParser.processLine("/usr/gcc-tool-x -DE test5.c"); //$NON-NLS-1$
fOutputParser.processLine("/usr/gcc/something_else -DF test6.c"); //$NON-NLS-1$
List sumSymbols = fCollector.getCollectedScannerInfo(null, ScannerInfoTypes.SYMBOL_DEFINITIONS);
List<String> sumSymbols = fCollector.getCollectedScannerInfo(null, ScannerInfoTypes.SYMBOL_DEFINITIONS);
assertTrue(sumSymbols.contains("A=1")); //$NON-NLS-1$
assertTrue(sumSymbols.contains("B=1")); //$NON-NLS-1$
assertTrue(sumSymbols.contains("C=1")); //$NON-NLS-1$
@ -121,7 +121,7 @@ public abstract class BaseBOPConsoleParserTests extends BaseTestCase {
fOutputParser.processLine("gcc -DA test1.c; gcc -DB test2.c"); //$NON-NLS-1$
fOutputParser.processLine("nix -DC; gcc -DD test2.c"); //$NON-NLS-1$
List sumSymbols = fCollector.getCollectedScannerInfo(null, ScannerInfoTypes.SYMBOL_DEFINITIONS);
List<String> sumSymbols = fCollector.getCollectedScannerInfo(null, ScannerInfoTypes.SYMBOL_DEFINITIONS);
assertTrue(sumSymbols.contains("A=1")); //$NON-NLS-1$
assertTrue(sumSymbols.contains("B=1")); //$NON-NLS-1$
assertFalse(sumSymbols.contains("C=1")); //$NON-NLS-1$
@ -141,7 +141,7 @@ public abstract class BaseBOPConsoleParserTests extends BaseTestCase {
fOutputParser.processLine("sh -c 'gcc -DAA test1.c; gcc -DBB test2.c'"); //$NON-NLS-1$
fOutputParser.processLine("sh -c 'nix -DCC; gcc -DDD test2.c'"); //$NON-NLS-1$
List sumSymbols = fCollector.getCollectedScannerInfo(null, ScannerInfoTypes.SYMBOL_DEFINITIONS);
List<String> sumSymbols = fCollector.getCollectedScannerInfo(null, ScannerInfoTypes.SYMBOL_DEFINITIONS);
assertTrue(sumSymbols.contains("A=1")); //$NON-NLS-1$
assertTrue(sumSymbols.contains("B=1")); //$NON-NLS-1$
assertTrue(sumSymbols.contains("C=1")); //$NON-NLS-1$

View file

@ -44,6 +44,7 @@ import org.w3c.dom.Element;
* @noextend This class is not intended to be subclassed by clients.
* @noinstantiate This class is not intended to be instantiated by clients.
*/
@Deprecated
public class MakeScannerProvider extends ScannerProvider {
// This is the id of the IScannerInfoProvider extension point entry
@ -102,6 +103,7 @@ public class MakeScannerProvider extends ScannerProvider {
*
* @see org.eclipse.cdt.core.parser.IScannerInfoProvider#getScannerInformation(org.eclipse.core.resources.IResource)
*/
@Override
public IScannerInfo getScannerInformation(IResource resource) {
try {
getMakeScannerInfo(resource.getProject(), true);
@ -118,8 +120,8 @@ public class MakeScannerProvider extends ScannerProvider {
ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(project);
ICStorageElement storage = descriptor.getProjectStorageElement(CDESCRIPTOR_ID);
ArrayList includes = new ArrayList();
ArrayList symbols = new ArrayList();
ArrayList<String> includes = new ArrayList<String>();
ArrayList<String> symbols = new ArrayList<String>();
for (ICStorageElement child : storage.getChildren()) {
if (child.getName().equals(INCLUDE_PATH)) {
// Add the path to the property list
@ -130,21 +132,21 @@ public class MakeScannerProvider extends ScannerProvider {
}
}
MakeScannerInfo info = new MakeScannerInfo(project);
info.setIncludePaths((String[])includes.toArray(new String[includes.size()]));
info.setPreprocessorSymbols((String[])symbols.toArray(new String[symbols.size()]));
info.setIncludePaths(includes.toArray(new String[includes.size()]));
info.setPreprocessorSymbols(symbols.toArray(new String[symbols.size()]));
return info;
}
static void migrateToCPathEntries(MakeScannerInfo info) throws CoreException {
Map symbols = info.getDefinedSymbols();
Map<String, String> symbols = info.getDefinedSymbols();
String[] includes = info.getIncludePaths();
ICProject cProject = CoreModel.getDefault().create(info.getProject());
IPathEntry[] entries = cProject.getRawPathEntries();
List cPaths = new ArrayList(Arrays.asList(entries));
Iterator cpIter = cPaths.iterator();
List<IPathEntry> cPaths = new ArrayList<IPathEntry>(Arrays.asList(entries));
Iterator<IPathEntry> cpIter = cPaths.iterator();
while(cpIter.hasNext()) {
int kind = ((IPathEntry)cpIter.next()).getEntryKind();
int kind = cpIter.next().getEntryKind();
if(kind == IPathEntry.CDT_INCLUDE || kind == IPathEntry.CDT_MACRO) {
cpIter.remove();
}
@ -155,16 +157,15 @@ public class MakeScannerProvider extends ScannerProvider {
cPaths.add(include);
}
}
Iterator syms = symbols.entrySet().iterator();
Iterator<Entry<String, String>> syms = symbols.entrySet().iterator();
while (syms.hasNext()) {
Map.Entry entry = (Entry)syms.next();
IMacroEntry sym = CoreModel.newMacroEntry(info.getProject().getFullPath(), (String)entry.getKey(),
(String)entry.getValue());
Entry<String, String> entry = syms.next();
IMacroEntry sym = CoreModel.newMacroEntry(info.getProject().getFullPath(), entry.getKey(), entry.getValue());
if (!cPaths.contains(sym)) {
cPaths.add(sym);
}
}
cProject.setRawPathEntries((IPathEntry[])cPaths.toArray(new IPathEntry[cPaths.size()]), null);
cProject.setRawPathEntries(cPaths.toArray(new IPathEntry[cPaths.size()]), null);
}
/**

View file

@ -38,6 +38,7 @@ import org.eclipse.core.runtime.QualifiedName;
* @noextend This class is not intended to be subclassed by clients.
* @noinstantiate This class is not intended to be instantiated by clients.
*/
@Deprecated
public class DiscoveredScannerInfoProvider extends ScannerProvider {
// This is the id of the IScannerInfoProvider extension point entry
@ -61,6 +62,7 @@ public class DiscoveredScannerInfoProvider extends ScannerProvider {
*
* @see org.eclipse.cdt.core.parser.IScannerInfoProvider#getScannerInformation(org.eclipse.core.resources.IResource)
*/
@Override
public IScannerInfo getScannerInformation(IResource resource) {
try {
getDiscoveredScannerInfo(resource.getProject(), true);
@ -75,6 +77,7 @@ public class DiscoveredScannerInfoProvider extends ScannerProvider {
* @see org.eclipse.cdt.core.parser.IScannerInfoProvider#subscribe(org.eclipse.core.resources.IResource,
* org.eclipse.cdt.core.parser.IScannerInfoChangeListener)
*/
@Override
public void subscribe(IResource resource, IScannerInfoChangeListener listener) {
super.subscribe(resource, listener);
}
@ -85,6 +88,7 @@ public class DiscoveredScannerInfoProvider extends ScannerProvider {
* @see org.eclipse.cdt.core.parser.IScannerInfoProvider#unsubscribe(org.eclipse.core.resources.IResource,
* org.eclipse.cdt.core.parser.IScannerInfoChangeListener)
*/
@Override
public void unsubscribe(IResource resource, IScannerInfoChangeListener listener) {
super.unsubscribe(resource, listener);
}
@ -107,10 +111,10 @@ public class DiscoveredScannerInfoProvider extends ScannerProvider {
ICProject cProject = CoreModel.getDefault().create(project);
if (cProject != null) {
IPathEntry[] entries = cProject.getRawPathEntries();
List newEntries = new ArrayList(Arrays.asList(entries));
List<IPathEntry> newEntries = new ArrayList<IPathEntry>(Arrays.asList(entries));
if (!newEntries.contains(container)) {
newEntries.add(container);
cProject.setRawPathEntries((IPathEntry[])newEntries.toArray(new IPathEntry[newEntries.size()]), null);
cProject.setRawPathEntries(newEntries.toArray(new IPathEntry[newEntries.size()]), null);
}
}
ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(project);

View file

@ -22,7 +22,6 @@ import org.eclipse.cdt.make.internal.core.MakeMessages;
import org.eclipse.cdt.make.internal.core.scannerconfig.jobs.SCJobsUtil;
import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfileManager;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;

View file

@ -22,7 +22,8 @@ public class ScannerConfigScope {
public static final ScannerConfigScope PROJECT_SCOPE = new ScannerConfigScope("project"); //$NON-NLS-1$
public static final ScannerConfigScope FILE_SCOPE = new ScannerConfigScope("file"); //$NON-NLS-1$
public String toString() {
@Override
public String toString() {
return scope;
}
@ -33,7 +34,8 @@ public class ScannerConfigScope {
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object arg0) {
@Override
public boolean equals(Object arg0) {
if (arg0 == null) return false;
if (arg0 == this) return true;
if (arg0 instanceof ScannerConfigScope) return scope.equals(((ScannerConfigScope)arg0).scope);
@ -42,7 +44,8 @@ public class ScannerConfigScope {
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
public int hashCode() {
@Override
public int hashCode() {
return scope.hashCode();
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007 Intel Corporation and others.
* Copyright (c) 2007, 2010 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -26,18 +26,22 @@ import org.eclipse.core.runtime.IProgressMonitor;
public class MakeConfigurationDataProvider extends CDefaultConfigurationDataProvider {
private static final String STORAGE_ID = "makeConfigDataProvider"; //$NON-NLS-1$
@Override
protected CDataFactory getDataFactory() {
return MakeCDataFactory.getDefault();
}
@Override
protected CDataSerializer getDataSerializer() {
return UserAndDiscoveredEntryDataSerializer.getDefault();
}
@Override
protected String getStorageId() {
return STORAGE_ID;
}
@Override
public CConfigurationData applyConfiguration(
ICConfigurationDescription des,
ICConfigurationDescription baseDescription,
@ -49,6 +53,7 @@ public class MakeConfigurationDataProvider extends CDefaultConfigurationDataProv
return result;
}
@Override
public CConfigurationData loadConfiguration(ICConfigurationDescription des,
IProgressMonitor monitor) throws CoreException {
CConfigurationData result = super.loadConfiguration(des, monitor);

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2006 QNX Software Systems and others.
* Copyright (c) 2000, 2010 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -44,6 +44,7 @@ public class MacroDefinition extends Directive implements IMacroDefinition {
/**
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuffer buffer = new StringBuffer();
buffer.append(getName()).append(" = ").append(getValue()).append('\n'); //$NON-NLS-1$

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2006 QNX Software Systems and others.
* Copyright (c) 2000, 2010 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -29,6 +29,7 @@ public abstract class SpecialRule extends Rule implements ISpecialRule {
return prerequisites;
}
@Override
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append(target).append(':');

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2006 QNX Software Systems and others.
* Copyright (c) 2000, 2010 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -22,6 +22,7 @@ public class Target implements ITarget {
target = t;
}
@Override
public String toString() {
return target;
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2006 QNX Software Systems and others.
* Copyright (c) 2000, 2010 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -57,6 +57,7 @@ public class TargetRule extends Rule implements ITargetRule {
/**
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuffer buffer = new StringBuffer();
buffer.append(getTarget().toString());

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2007 QNX Software Systems and others.
* Copyright (c) 2004, 2010 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -11,10 +11,10 @@
package org.eclipse.cdt.make.internal.core.scannerconfig;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.IPathEntry;
@ -73,17 +73,16 @@ public class DiscoveredPathContainer implements IPathEntryContainer {
private IPathEntry[] computeNewPathEntries() throws CoreException {
IDiscoveredPathInfo info = MakeCorePlugin.getDefault().getDiscoveryManager().getDiscoveredInfo(fProject);
IPath[] includes = info.getIncludePaths();
Map syms = info.getSymbols();
List entries = new ArrayList(includes.length + syms.size());
for (int i = 0; i < includes.length; i++) {
entries.add(CoreModel.newIncludeEntry(Path.EMPTY, Path.EMPTY, includes[i], true));
Map<String, String> syms = info.getSymbols();
List<IPathEntry> entries = new ArrayList<IPathEntry>(includes.length + syms.size());
for (IPath inc : includes) {
entries.add(CoreModel.newIncludeEntry(Path.EMPTY, Path.EMPTY, inc, true));
}
Iterator iter = syms.entrySet().iterator();
while (iter.hasNext()) {
Entry entry = (Entry)iter.next();
entries.add(CoreModel.newMacroEntry(Path.EMPTY, (String)entry.getKey(), (String)entry.getValue()));
Set<Entry<String, String>> entrySet = syms.entrySet();
for (Entry<String, String> entry : entrySet) {
entries.add(CoreModel.newMacroEntry(Path.EMPTY, entry.getKey(), entry.getValue()));
}
return (IPathEntry[])entries.toArray(new IPathEntry[entries.size()]);
return entries.toArray(new IPathEntry[entries.size()]);
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2007 QNX Software Systems and others.
* Copyright (c) 2004, 2010 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -27,6 +27,7 @@ import org.eclipse.core.runtime.Status;
public class DiscoveredPathInitializer extends PathEntryContainerInitializer {
@Override
public void initialize(IPath containerPath, ICProject cProject) throws CoreException {
IProject project = cProject.getProject();
IScannerConfigBuilderInfo2 buildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(project);

View file

@ -1,45 +0,0 @@
/*******************************************************************************
* Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.make.internal.core.scannerconfig.util;
import java.util.ArrayList;
import java.util.List;
/**
* Key - Value (List) pair
*
* @author vhirsl
*/
public class KVList {
String key;
List value;
public KVList(String key) {
this.key = key;
this.value = new ArrayList();
}
/**
* List must not be <code>null</code>.
*/
public KVList(String key, List value) {
this.key = key;
this.value = value;
}
String getKey() {
return key;
}
List getValue() {
return value;
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2007 IBM Corporation and others.
* Copyright (c) 2004, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -37,6 +37,7 @@ public class KVStringPair {
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object arg0) {
if (arg0 != null && arg0.getClass().equals(this.getClass())) {
KVStringPair arg = (KVStringPair) arg0;
@ -47,12 +48,14 @@ public class KVStringPair {
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
return 17 * key.hashCode() + value.hashCode();
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return key + " -> " + value; //$NON-NLS-1$
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2007 IBM Corporation and others.
* Copyright (c) 2004, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -88,6 +88,7 @@ public final class SCDOptionsEnum {
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object arg0) {
if (arg0 == null) return false;
if (arg0 == this) return true;
@ -97,12 +98,14 @@ public final class SCDOptionsEnum {
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
return _enum*17 + 11;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return SCDOPTION_STRING_VALS[_enum];
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2007 IBM Corporation and others.
* Copyright (c) 2004, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -30,7 +30,8 @@ public class GCCSpecsRunSIProvider extends DefaultRunSIProvider {
/* (non-Javadoc)
* @see org.eclipse.cdt.make.internal.core.scannerconfig2.DefaultRunSIProvider#initialize()
*/
protected boolean initialize() {
@Override
protected boolean initialize() {
boolean rc = super.initialize();
if (rc) {
@ -62,11 +63,12 @@ public class GCCSpecsRunSIProvider extends DefaultRunSIProvider {
/* (non-Javadoc)
* @see org.eclipse.cdt.make.internal.core.scannerconfig2.DefaultRunSIProvider#prepareArguments(boolean)
*/
protected String[] prepareArguments(boolean isDefaultCommand) {
@Override
protected String[] prepareArguments(boolean isDefaultCommand) {
if (collector == null)
return fCompileArguments;
List tso = collector.getCollectedScannerInfo(resource.getProject(), ScannerInfoTypes.TARGET_SPECIFIC_OPTION);
List<String> tso = collector.getCollectedScannerInfo(resource.getProject(), ScannerInfoTypes.TARGET_SPECIFIC_OPTION);
if (tso == null || tso.size() == 0) {
return fCompileArguments;
}
@ -83,7 +85,7 @@ public class GCCSpecsRunSIProvider extends DefaultRunSIProvider {
rv = new String[tso.size()];
}
for (int i = 0; i < tso.size(); ++i) {
rv[nTokens + i] = (String) tso.get(i);
rv[nTokens + i] = tso.get(i);
}
return rv;
}