1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 02:06: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 class FindBinding {
public static class DefaultBindingBTreeComparator implements IBTreeComparator { public static class DefaultBindingBTreeComparator implements IBTreeComparator {
protected PDOM pdom; protected PDOM pdom;
public DefaultBindingBTreeComparator(PDOM pdom) { public DefaultBindingBTreeComparator(PDOM pdom) {
this.pdom = pdom; this.pdom = pdom;
} }
public int compare(int record1, int record2) throws CoreException { public int compare(int record1, int record2) throws CoreException {
IString nm1 = PDOMNamedNode.getDBName(pdom, record1); IString nm1 = PDOMNamedNode.getDBName(pdom, record1);
IString nm2 = PDOMNamedNode.getDBName(pdom, record2); IString nm2 = PDOMNamedNode.getDBName(pdom, record2);
@ -60,6 +62,7 @@ public class FindBinding {
fConstants = constants; fConstants = constants;
fLocalToFile= localToFile; fLocalToFile= localToFile;
} }
// IBTreeVisitor // IBTreeVisitor
public int compare(int record) throws CoreException { public int compare(int record) throws CoreException {
IString nm1 = PDOMNamedNode.getDBName(fPdom, record); 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; protected PDOMLinkage linkage;
public NestedBindingsBTreeComparator(PDOMLinkage linkage) { public NestedBindingsBTreeComparator(PDOMLinkage linkage) {
super(linkage.pdom); super(linkage.pdom);
this.linkage= linkage; this.linkage= linkage;
} }
@Override @Override
public int compare(int record1, int record2) throws CoreException { public int compare(int record1, int record2) throws CoreException {
int cmp= super.compare(record1, record2); // compare names int cmp= super.compare(record1, record2); // compare names
if (cmp == 0) { // any order will do. if (cmp == 0) { // any order will do.
if (record1 < record2) { if (record1 < record2) {
return -1; return -1;
} } else if (record1 > record2) {
else if (record1 > record2) {
return 1; return 1;
} }
} }

View file

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