1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-09 09:15:38 +02:00

Compiler warnings.

This commit is contained in:
Sergey Prigogin 2008-04-19 19:35:13 +00:00
parent 4619d45eef
commit fd24289643
6 changed files with 840 additions and 840 deletions

View file

@ -316,7 +316,9 @@ public class IndexProviderManagerTest extends IndexTestBase {
public void testIndexFactoryConfigurationUsage() throws Exception { public void testIndexFactoryConfigurationUsage() throws Exception {
IIndex index; IIndex index;
ICProject cproject= CProjectHelper.createCCProject("IndexFactoryConfigurationUsageTest", IPDOMManager.ID_NO_INDEXER); ICProject cproject = null;
try {
cproject = CProjectHelper.createCCProject("IndexFactoryConfigurationUsageTest", IPDOMManager.ID_NO_INDEXER);
IProject project= cproject.getProject(); IProject project= cproject.getProject();
ICProjectDescription pd= core.getProjectDescription(project); ICProjectDescription pd= core.getProjectDescription(project);
@ -327,7 +329,6 @@ public class IndexProviderManagerTest extends IndexTestBase {
index= CCorePlugin.getIndexManager().getIndex(cproject); index= CCorePlugin.getIndexManager().getIndex(cproject);
CCorePlugin.getIndexManager().joinIndexer(8000, NPM); CCorePlugin.getIndexManager().joinIndexer(8000, NPM);
try {
DPT.reset(DP1); DPT.reset(DP1);
changeConfigRelations(project, ICProjectDescriptionPreferences.CONFIGS_LINK_SETTINGS_AND_ACTIVE); changeConfigRelations(project, ICProjectDescriptionPreferences.CONFIGS_LINK_SETTINGS_AND_ACTIVE);
assertEquals(0, DPT.getProjectsTrace(DP1).size()); assertEquals(0, DPT.getProjectsTrace(DP1).size());

View file

@ -86,7 +86,6 @@ public class CPPTemplateParameter extends PlatformObject implements ICPPTemplate
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding#isGloballyQualified() * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding#isGloballyQualified()
*/ */
public boolean isGloballyQualified() { public boolean isGloballyQualified() {
// TODO Auto-generated method stub
return false; return false;
} }

View file

@ -476,6 +476,7 @@ public class CPPSemantics {
return new CPPScope.CPPScopeProblem(((IProblemBinding)scope).getASTNode(), IProblemBinding.SEMANTIC_BAD_SCOPE, ((IProblemBinding)scope).getNameCharArray()); return new CPPScope.CPPScopeProblem(((IProblemBinding)scope).getASTNode(), IProblemBinding.SEMANTIC_BAD_SCOPE, ((IProblemBinding)scope).getNameCharArray());
return new CPPScope.CPPScopeProblem(name, IProblemBinding.SEMANTIC_BAD_SCOPE, name.toCharArray()); return new CPPScope.CPPScopeProblem(name, IProblemBinding.SEMANTIC_BAD_SCOPE, name.toCharArray());
} }
private static void mergeResults(LookupData data, Object results, boolean scoped) { private static void mergeResults(LookupData data, Object results, boolean scoped) {
if (!data.contentAssist) { if (!data.contentAssist) {
if (results instanceof IBinding) { if (results instanceof IBinding) {
@ -500,9 +501,9 @@ public class CPPSemantics {
CharArrayObjectMap map = null; CharArrayObjectMap map = null;
Object[] objs = null; Object[] objs = null;
if( source instanceof CharArrayObjectMap ) if (source instanceof CharArrayObjectMap) {
map = (CharArrayObjectMap) source; map = (CharArrayObjectMap) source;
else{ } else {
if (source instanceof Object[]) if (source instanceof Object[])
objs = ArrayUtil.trim(Object.class, (Object[]) source); objs = ArrayUtil.trim(Object.class, (Object[]) source);
else else
@ -512,9 +513,11 @@ public class CPPSemantics {
int size = map != null ? map.size() : objs.length; int size = map != null ? map.size() : objs.length;
int resultInitialSize = resultMap.size(); int resultInitialSize = resultMap.size();
for (int i = 0; i < size; i ++) { for (int i = 0; i < size; i ++) {
char [] key = ( map != null ) ? map.keyAt(i) char[] key = (map != null) ?
: ( objs[i] instanceof IBinding) ? ((IBinding)objs[i]).getNameCharArray() map.keyAt(i) :
: ((IASTName)objs[i]).toCharArray(); (objs[i] instanceof IBinding) ?
((IBinding) objs[i]).getNameCharArray() :
((IASTName) objs[i]).toCharArray();
int idx = resultMap.lookup(key); int idx = resultMap.lookup(key);
if (idx == -1) { if (idx == -1) {
resultMap.put(key, (map != null) ? map.get(key) : objs[i]); resultMap.put(key, (map != null) ? map.get(key) : objs[i]);
@ -884,16 +887,14 @@ public class CPPSemantics {
if (binding instanceof ICPPClassType) { if (binding instanceof ICPPClassType) {
IASTNode parent = data.astName.getParent(); IASTNode parent = data.astName.getParent();
if (parent instanceof ICPPASTQualifiedName && if (parent instanceof ICPPASTQualifiedName &&
parent.getPropertyInParent() == IASTFieldReference.FIELD_NAME ) parent.getPropertyInParent() == IASTFieldReference.FIELD_NAME) {
{
ok = true; ok = true;
} }
} }
//it is not ambiguous if they are the same thing and it is static or an enumerator //it is not ambiguous if they are the same thing and it is static or an enumerator
if (binding instanceof IEnumerator || if (binding instanceof IEnumerator ||
(binding instanceof IFunction && ASTInternal.isStatic((IFunction) binding, false)) || (binding instanceof IFunction && ASTInternal.isStatic((IFunction) binding, false)) ||
(binding instanceof IVariable && ((IVariable)binding).isStatic()) ) (binding instanceof IVariable && ((IVariable)binding).isStatic())) {
{
ok = true; ok = true;
} }
if (!ok) if (!ok)
@ -1079,16 +1080,13 @@ public class CPPSemantics {
temp = (IASTName) possible; temp = (IASTName) possible;
else else
temp = ((IASTName[])possible)[++jdx]; temp = ((IASTName[])possible)[++jdx];
while (temp != null) { while (temp != null) {
if ((checkWholeClassScope || declaredBefore(temp, data.astName, isIndexBased)) && if ((checkWholeClassScope || declaredBefore(temp, data.astName, isIndexBased)) &&
(item != blockItem || data.includeBlockItem( item )) ) (item != blockItem || data.includeBlockItem(item))) {
{
if (data.considerConstructors || if (data.considerConstructors ||
!(temp.getParent() instanceof IASTDeclarator && !(temp.getParent() instanceof IASTDeclarator &&
CPPVisitor.isConstructor( scope, (IASTDeclarator) temp.getParent() ) ) ) CPPVisitor.isConstructor(scope, (IASTDeclarator) temp.getParent()))) {
{
found = (IASTName[]) ArrayUtil.append(IASTName.class, found, temp); found = (IASTName[]) ArrayUtil.append(IASTName.class, found, temp);
} }
} }
@ -2009,8 +2007,7 @@ public class CPPSemantics {
((ICPPSpecialization)bestFn).getSpecializedBinding() instanceof ICPPFunctionTemplate); ((ICPPSpecialization)bestFn).getSpecializedBinding() instanceof ICPPFunctionTemplate);
boolean currIsTemplate = (currFn instanceof ICPPSpecialization && boolean currIsTemplate = (currFn instanceof ICPPSpecialization &&
((ICPPSpecialization)currFn).getSpecializedBinding() instanceof ICPPFunctionTemplate); ((ICPPSpecialization)currFn).getSpecializedBinding() instanceof ICPPFunctionTemplate);
if( bestIsTemplate && currIsTemplate ) if (bestIsTemplate && currIsTemplate) {
{
ICPPFunctionTemplate t1 = (ICPPFunctionTemplate) ((ICPPSpecialization)bestFn).getSpecializedBinding(); ICPPFunctionTemplate t1 = (ICPPFunctionTemplate) ((ICPPSpecialization)bestFn).getSpecializedBinding();
ICPPFunctionTemplate t2 = (ICPPFunctionTemplate) ((ICPPSpecialization)currFn).getSpecializedBinding(); ICPPFunctionTemplate t2 = (ICPPFunctionTemplate) ((ICPPSpecialization)currFn).getSpecializedBinding();
int order = CPPTemplates.orderTemplateFunctions(t1, t2); int order = CPPTemplates.orderTemplateFunctions(t1, t2);
@ -2044,7 +2041,6 @@ public class CPPSemantics {
} }
} }
if (ambiguous || bestHasAmbiguousParam) { if (ambiguous || bestHasAmbiguousParam) {
return new ProblemBinding(data.astName, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name()); return new ProblemBinding(data.astName, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name());
} }
@ -2074,8 +2070,9 @@ public class CPPSemantics {
if (o instanceof IType[]) { if (o instanceof IType[]) {
types = (IType[]) o; types = (IType[]) o;
type = types[++idx]; type = types[++idx];
} else } else {
type = (IType) o; type = (IType) o;
}
while (type != null) { while (type != null) {
type = getUltimateType(type, false); type = getUltimateType(type, false);
@ -2419,7 +2416,7 @@ public class CPPSemantics {
else else
binding = null; binding = null;
if( binding != null ) if (binding != null) {
if (binding instanceof ICPPUsingDeclaration) { if (binding instanceof ICPPUsingDeclaration) {
set.addAll(((ICPPUsingDeclaration)binding).getDelegates()); set.addAll(((ICPPUsingDeclaration)binding).getDelegates());
} else if (binding instanceof CPPCompositeBinding) { } else if (binding instanceof CPPCompositeBinding) {
@ -2428,6 +2425,7 @@ public class CPPSemantics {
set.put(binding); set.put(binding);
} }
} }
}
return set.keyArray(IBinding.class); return set.keyArray(IBinding.class);
} }

View file

@ -36,7 +36,6 @@ import org.eclipse.core.runtime.CoreException;
/** /**
* @author Doug Schaefer * @author Doug Schaefer
*
*/ */
public abstract class PDOMBinding extends PDOMNamedNode implements IIndexFragmentBinding { public abstract class PDOMBinding extends PDOMNamedNode implements IIndexFragmentBinding {
public static final PDOMBinding[] EMPTY_PDOMBINDING_ARRAY = {}; public static final PDOMBinding[] EMPTY_PDOMBINDING_ARRAY = {};
@ -72,7 +71,7 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IIndexFragmen
* *
* @param pdom * @param pdom
* @param record * @param record
* @return * @return <code>true</code> if the binding is orphaned.
* @throws CoreException * @throws CoreException
*/ */
public static boolean isOrphaned(PDOM pdom, int record) throws CoreException { public static boolean isOrphaned(PDOM pdom, int record) throws CoreException {
@ -242,7 +241,7 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IIndexFragmen
* For debug purposes only. * For debug purposes only.
* @param linkage * @param linkage
* @param value * @param value
* @return * @return String representation of <code>value</code>.
*/ */
protected static String getConstantNameForValue(PDOMLinkage linkage, int value) { protected static String getConstantNameForValue(PDOMLinkage linkage, int value) {
Class<? extends PDOMLinkage> c= linkage.getClass(); Class<? extends PDOMLinkage> c= linkage.getClass();
@ -269,7 +268,9 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IIndexFragmen
/** /**
* Convenience method to shorten subclass file length * Convenience method to shorten subclass file length
*/ */
protected final void fail() { throw new PDOMNotImplementedError(); } protected final void fail() {
throw new PDOMNotImplementedError("in " + getClass().getCanonicalName()); //$NON-NLS-1$
}
public PDOMName getScopeName() { public PDOMName getScopeName() {
try { try {
@ -356,7 +357,7 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IIndexFragmen
* Compares two PDOMBinding objects in accordance with * Compares two PDOMBinding objects in accordance with
* {@link IIndexFragmentBindingComparator#compare(IIndexFragmentBinding, IIndexFragmentBinding)} * {@link IIndexFragmentBindingComparator#compare(IIndexFragmentBinding, IIndexFragmentBinding)}
* @param other * @param other
* @return * @return comparison result, -1, 0, or 1.
*/ */
public int pdomCompareTo(PDOMBinding other) { public int pdomCompareTo(PDOMBinding other) {
int cmp = comparePDOMBindingQNs(this, other); int cmp = comparePDOMBindingQNs(this, other);
@ -412,7 +413,8 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IIndexFragmen
return getBindings(name, resolve, prefix, null); return getBindings(name, resolve, prefix, null);
} }
public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefix, IIndexFileSet fileSet) throws DOMException { public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefix, IIndexFileSet fileSet)
throws DOMException {
return null; return null;
} }
} }

View file

@ -75,6 +75,6 @@ abstract class PDOMCPPBinding extends PDOMBinding implements ICPPBinding {
} }
public boolean isGloballyQualified() throws DOMException { public boolean isGloballyQualified() throws DOMException {
throw new PDOMNotImplementedError("In " + getClass().getCanonicalName()); //$NON-NLS-1$ throw new PDOMNotImplementedError("in " + getClass().getCanonicalName()); //$NON-NLS-1$
} }
} }

View file

@ -39,7 +39,6 @@ import org.eclipse.core.runtime.CoreException;
/** /**
* @author Bryan Wilkinson * @author Bryan Wilkinson
*
*/ */
class PDOMCPPDeferredClassInstance extends PDOMCPPInstance implements class PDOMCPPDeferredClassInstance extends PDOMCPPInstance implements
ICPPClassType, IPDOMMemberOwner, IIndexType, ICPPDeferredTemplateInstance, ICPPInternalDeferredClassInstance { ICPPClassType, IPDOMMemberOwner, IIndexType, ICPPDeferredTemplateInstance, ICPPInternalDeferredClassInstance {
@ -96,10 +95,11 @@ class PDOMCPPDeferredClassInstance extends PDOMCPPInstance implements
//allow some fuzziness here. //allow some fuzziness here.
if (type instanceof ICPPDeferredTemplateInstance && type instanceof ICPPClassType) { if (type instanceof ICPPDeferredTemplateInstance && type instanceof ICPPClassType) {
ICPPClassTemplate typeClass = (ICPPClassTemplate) ((ICPPDeferredTemplateInstance)type).getSpecializedBinding(); ICPPClassTemplate typeClass = (ICPPClassTemplate) ((ICPPDeferredTemplateInstance)type).getSpecializedBinding();
return (typeClass == classTemplate ); return typeClass == classTemplate;
} else if (type instanceof ICPPClassTemplate && classTemplate == type) { } else if (type instanceof ICPPClassTemplate && classTemplate == type) {
return true; return true;
} else if( type instanceof ICPPTemplateInstance && ((ICPPTemplateInstance)type).getTemplateDefinition() == classTemplate ){ } else if (type instanceof ICPPTemplateInstance &&
((ICPPTemplateInstance)type).getTemplateDefinition() == classTemplate) {
return true; return true;
} }
return false; return false;
@ -111,7 +111,7 @@ class PDOMCPPDeferredClassInstance extends PDOMCPPInstance implements
/** /**
* @param argMap * @param argMap
* @return * @return This class instance re-instantiated with resolved template arguments.
*/ */
public IType instantiate(ObjectMap argMap) { public IType instantiate(ObjectMap argMap) {
IType[] arguments = getArguments(); IType[] arguments = getArguments();