1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

Compiler warnings.

This commit is contained in:
Sergey Prigogin 2008-04-16 05:55:28 +00:00
parent 645efee68a
commit 4698f4d97f
2 changed files with 33 additions and 44 deletions

View file

@ -27,9 +27,11 @@ import org.eclipse.core.runtime.OperationCanceledException;
public class FindBinding {
public static class DefaultBindingBTreeComparator implements IBTreeComparator {
protected PDOM pdom;
public DefaultBindingBTreeComparator(PDOM pdom) {
this.pdom = pdom;
}
public int compare(int record1, int record2) throws CoreException {
IString nm1 = PDOMNamedNode.getDBName(pdom, record1);
IString nm2 = PDOMNamedNode.getDBName(pdom, record2);
@ -60,6 +62,7 @@ public class FindBinding {
fConstants = constants;
fLocalToFile= localToFile;
}
// IBTreeVisitor
public int compare(int record) throws CoreException {
IString nm1 = PDOMNamedNode.getDBName(fPdom, record);
@ -116,21 +119,21 @@ public class FindBinding {
}
}
public static class NestedBindingsBTreeComparator extends DefaultBindingBTreeComparator implements IBTreeComparator {
public static class NestedBindingsBTreeComparator extends DefaultBindingBTreeComparator {
protected PDOMLinkage linkage;
public NestedBindingsBTreeComparator(PDOMLinkage linkage) {
super(linkage.pdom);
this.linkage= linkage;
}
@Override
public int compare(int record1, int record2) throws CoreException {
int cmp= super.compare(record1, record2); // compare names
if (cmp == 0) { // any order will do.
if (record1 < record2) {
return -1;
}
else if (record1 > record2) {
} else if (record1 > record2) {
return 1;
}
}

View file

@ -50,7 +50,6 @@ import org.eclipse.core.runtime.CoreException;
* Represents a file containing names.
*
* @author Doug Schaefer
*
*/
public class PDOMFile implements IIndexFragmentFile {
private final PDOM pdom;
@ -136,7 +135,7 @@ public class PDOMFile implements IIndexFragmentFile {
* Directly changes this record's internal location string. The format
* of this string is unspecified in general and is determined by the
* associated IIndexLocationConverter
* @param newName
* @param internalLocation
* @throws CoreException
*/
public void setInternalLocation(String internalLocation) throws CoreException {
@ -237,8 +236,7 @@ public class PDOMFile implements IIndexFragmentFile {
PDOMMacro pdomMacro = new PDOMMacro(pdom, container, macro, this);
if (lastMacro == null) {
setFirstMacro(pdomMacro);
}
else {
} else {
lastMacro.setNextMacro(pdomMacro);
}
lastMacro= pdomMacro;
@ -283,8 +281,7 @@ public class PDOMFile implements IIndexFragmentFile {
PDOMMacroReferenceName macroName = (PDOMMacroReferenceName) fname;
if (lastMacroName == null) {
setFirstMacroReference(macroName);
}
else {
} else {
lastMacroName.setNextInFile(macroName);
}
lastMacroName= macroName;
@ -302,14 +299,12 @@ public class PDOMFile implements IIndexFragmentFile {
if (binding instanceof IMacroBinding) {
return createPDOMMacroReferenceName(linkage, name);
}
else {
PDOMBinding pdomBinding = linkage.addBinding(name);
if (pdomBinding != null) {
final PDOMName result= new PDOMName(pdom, name, this, pdomBinding, caller);
linkage.onCreateName(this, name, result);
return result;
}
}
} catch (CoreException e) {
CCorePlugin.log(e);
}
@ -396,8 +391,7 @@ public class PDOMFile implements IIndexFragmentFile {
}
if (lastInclude == null) {
setFirstInclude(pdomInclude);
}
else {
} else {
lastInclude.setNextInIncludes(pdomInclude);
}
lastInclude= pdomInclude;
@ -411,8 +405,7 @@ public class PDOMFile implements IIndexFragmentFile {
setFirstIncludedBy(include);
include.setNextInIncludedBy(firstIncludedBy);
firstIncludedBy.setPrevInIncludedBy(include);
}
else {
} else {
PDOMInclude secondIncludedBy= firstIncludedBy.getNextInIncludedBy();
if (secondIncludedBy != null) {
include.setNextInIncludedBy(secondIncludedBy);
@ -458,8 +451,7 @@ public class PDOMFile implements IIndexFragmentFile {
if (nameOffset >= offset) {
if (nameOffset + name.getNodeLength() <= offset+length) {
result.add(name);
}
else if (name.isReference()) {
} else if (name.isReference()) {
// names are ordered, but callers are inserted before
// their references
break;
@ -472,8 +464,7 @@ public class PDOMFile implements IIndexFragmentFile {
if (nameOffset >= offset) {
if (nameOffset + name.getNodeLength() <= offset+length) {
result.add(name.getDefinition());
}
else {
} else {
break;
}
}
@ -483,8 +474,7 @@ public class PDOMFile implements IIndexFragmentFile {
if (nameOffset >= offset) {
if (nameOffset + name.getNodeLength() <= offset+length) {
result.add(name);
}
else {
} else {
break;
}
}
@ -547,7 +537,6 @@ public class PDOMFile implements IIndexFragmentFile {
return records;
}
@SuppressWarnings("hiding")
public int compare(int record) throws CoreException {
IString name = db.getString(db.getInt(record + PDOMFile.LOCATION_REPRESENTATION));
int cmp= name.compare(rawKey, true);
@ -557,7 +546,6 @@ public class PDOMFile implements IIndexFragmentFile {
return cmp;
}
@SuppressWarnings("hiding")
public boolean visit(int record) throws CoreException {
if (linkageID >= 0) {
this.record = record;
@ -565,11 +553,9 @@ public class PDOMFile implements IIndexFragmentFile {
}
if (this.record == 0) {
this.record= record;
}
else if (this.records == null) {
} else if (this.records == null) {
this.records= new int[] {this.record, record};
}
else {
} else {
int[] cpy= new int[this.records.length+1];
System.arraycopy(this.records, 0, cpy, 0, this.records.length);
cpy[cpy.length-1]= record;