1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-29 11:55:40 +02:00

Fix warnings

This commit is contained in:
Anton Leherbauer 2008-04-17 13:43:54 +00:00
parent 70db16224a
commit 93ddce7436
6 changed files with 58 additions and 30 deletions

View file

@ -904,6 +904,7 @@ public final class CIndenter {
int pos= fPosition; int pos= fPosition;
if (!skipScope()) if (!skipScope())
fPosition= pos; fPosition= pos;
return skipToStatementStart(danglingElse, false);
case Symbols.TokenSEMICOLON: case Symbols.TokenSEMICOLON:
// this is the 90% case: after a statement block // this is the 90% case: after a statement block
// the end of the previous statement / block previous.end // the end of the previous statement / block previous.end
@ -992,12 +993,14 @@ public final class CIndenter {
fPosition= offset; fPosition= offset;
fLine= line; fLine= line;
// else: fall through to default // else: fall through to default
return skipToPreviousListItemOrListStart();
case Symbols.TokenCOMMA: case Symbols.TokenCOMMA:
// inside a list of some type // inside a list of some type
// easy if there is already a list item before with its own indentation - we just align // easy if there is already a list item before with its own indentation - we just align
// if not: take the start of the list ( LPAREN, LBRACE, LBRACKET ) and either align or // if not: take the start of the list ( LPAREN, LBRACE, LBRACKET ) and either align or
// indent by list-indent // indent by list-indent
return skipToPreviousListItemOrListStart();
default: default:
// inside whatever we don't know about: similar to the list case: // inside whatever we don't know about: similar to the list case:
// if we are inside a continued expression, then either align with a previous line that has indentation // if we are inside a continued expression, then either align with a previous line that has indentation
@ -1207,6 +1210,11 @@ public final class CIndenter {
if (isInBlock) if (isInBlock)
mayBeMethodBody= READ_PARENS; mayBeMethodBody= READ_PARENS;
// fall thru // fall thru
pos= fPreviousPos;
if (skipScope())
break;
else
return pos;
case Symbols.TokenRBRACKET: case Symbols.TokenRBRACKET:
case Symbols.TokenGREATERTHAN: case Symbols.TokenGREATERTHAN:
pos= fPreviousPos; pos= fPreviousPos;
@ -1284,6 +1292,7 @@ public final class CIndenter {
return false; return false;
} }
// fall thru // fall thru
continue;
case Symbols.TokenDOUBLECOLON: case Symbols.TokenDOUBLECOLON:
case Symbols.TokenOTHER: case Symbols.TokenOTHER:
continue; continue;
@ -1495,10 +1504,14 @@ public final class CIndenter {
if (!isGenericStarter(getTokenContent())) if (!isGenericStarter(getTokenContent()))
break; break;
// fall thru // fall thru
if (skipScope(Symbols.TokenLESSTHAN, Symbols.TokenGREATERTHAN))
return true;
break;
case Symbols.TokenQUESTIONMARK: case Symbols.TokenQUESTIONMARK:
case Symbols.TokenGREATERTHAN: case Symbols.TokenGREATERTHAN:
if (skipScope(Symbols.TokenLESSTHAN, Symbols.TokenGREATERTHAN)) if (skipScope(Symbols.TokenLESSTHAN, Symbols.TokenGREATERTHAN))
return true; return true;
break;
} }
// <> are harder to detect - restore the position if we fail // <> are harder to detect - restore the position if we fail
fPosition= storedPosition; fPosition= storedPosition;
@ -1765,6 +1778,8 @@ public final class CIndenter {
switch (fToken) { switch (fToken) {
case Symbols.TokenRBRACE: case Symbols.TokenRBRACE:
skipScope(); // and fall thru skipScope(); // and fall thru
skipToStatementStart(false, false);
return fToken == Symbols.TokenDO;
case Symbols.TokenSEMICOLON: case Symbols.TokenSEMICOLON:
skipToStatementStart(false, false); skipToStatementStart(false, false);
return fToken == Symbols.TokenDO; return fToken == Symbols.TokenDO;

View file

@ -32,7 +32,7 @@ import org.eclipse.cdt.ui.text.doctools.IDocCommentOwner;
public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPartitions { public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPartitions {
// states // states
private static final int CCODE= 0; private static final int CCODE= 0;
private static final int SINGLE_LINE_COMMENT= 1; private static final int SINGLE_LINE_COMMENT= 1;
private static final int MULTI_LINE_COMMENT= 2; private static final int MULTI_LINE_COMMENT= 2;
private static final int CHARACTER= 3; private static final int CHARACTER= 3;
@ -61,7 +61,7 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
/** The length of the last returned token. */ /** The length of the last returned token. */
private int fTokenLength; private int fTokenLength;
/** The state of the scanner. */ /** The state of the scanner. */
private int fState; private int fState;
/** The last significant characters read. */ /** The last significant characters read. */
private int fLast; private int fLast;
@ -214,6 +214,8 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
if (fLast != BACKSLASH && fLast != BACKSLASH_CR && fLast != BACKSLASH_BACKSLASH) { if (fLast != BACKSLASH && fLast != BACKSLASH_CR && fLast != BACKSLASH_BACKSLASH) {
return postFix(fState); return postFix(fState);
} }
consume();
continue;
default: default:
consume(); consume();
@ -298,7 +300,7 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
} }
} }
// states // states
switch (fState) { switch (fState) {
case CCODE: case CCODE:
switch (ch) { switch (ch) {
@ -347,7 +349,7 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
} }
case '"': case '"':
fLast= NONE; // ignore fLast fLast= NONE; // ignore fLast
if (fTokenLength > 0 ) { if (fTokenLength > 0 ) {
return preFix(CCODE, STRING, NONE, 1); return preFix(CCODE, STRING, NONE, 1);
} else { } else {
@ -371,6 +373,8 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
} }
} }
// fallthrough // fallthrough
consume();
break;
default: default:
consume(); consume();
break; break;
@ -410,7 +414,9 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
break; break;
} }
} }
consume();
break;
case '"': case '"':
if (fLast != BACKSLASH) { if (fLast != BACKSLASH) {
fState= PREPROCESSOR_STRING; fState= PREPROCESSOR_STRING;
@ -457,7 +463,7 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
default: default:
consume(); consume();
break; break;
} }
break; break;
@ -484,7 +490,7 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
case STRING: case STRING:
switch (ch) { switch (ch) {
case '\"': case '\"':
if (fLast != BACKSLASH) { if (fLast != BACKSLASH) {
return postFix(STRING); return postFix(STRING);
@ -516,8 +522,8 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
} }
break; break;
} }
} }
} }
private static final int getLastLength(int last) { private static final int getLastLength(int last) {
switch (last) { switch (last) {
@ -538,12 +544,12 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
case BACKSLASH_BACKSLASH: case BACKSLASH_BACKSLASH:
return 2; return 2;
} }
} }
private final void consume() { private final void consume() {
fTokenLength++; fTokenLength++;
fLast= NONE; fLast= NONE;
} }
private final IToken postFix(int state) { private final IToken postFix(int state) {
@ -554,7 +560,7 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
fTokenLength++; fTokenLength++;
fLast= NONE; fLast= NONE;
fState= newState; fState= newState;
fPrefixLength= 0; fPrefixLength= 0;
return fTokens[interceptTokenState(state)]; return fTokens[interceptTokenState(state)];
} }
@ -625,7 +631,7 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
// restart at beginning of partition // restart at beginning of partition
fState= CCODE; fState= CCODE;
} else { } else {
fState= getState(contentType); fState= getState(contentType);
} }
try { try {
@ -649,7 +655,7 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
fDocument= document; fDocument= document;
fScanner.setRange(document, offset, length); fScanner.setRange(document, offset, length);
fTokenOffset= offset; fTokenOffset= offset;
fTokenLength= 0; fTokenLength= 0;
fPrefixLength= 0; fPrefixLength= 0;
fLast= NONE; fLast= NONE;
fState= CCODE; fState= CCODE;
@ -685,7 +691,7 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
private int interceptTokenState(int proposedTokenState) { private int interceptTokenState(int proposedTokenState) {
if(fOwner!=null) { if(fOwner!=null) {
switch(proposedTokenState) { switch(proposedTokenState) {
case MULTI_LINE_COMMENT: case MULTI_LINE_COMMENT:
if(fOwner.getMultilineConfiguration().isDocumentationComment(fDocument, fTokenOffset, fTokenLength)) if(fOwner.getMultilineConfiguration().isDocumentationComment(fDocument, fTokenOffset, fTokenLength))
return MULTI_LINE_DOC_COMMENT; return MULTI_LINE_DOC_COMMENT;
break; break;

View file

@ -82,7 +82,7 @@ public final class AsmPartitionScanner implements IPartitionTokenScanner, ICPart
/** The length of the last returned token. */ /** The length of the last returned token. */
private int fTokenLength; private int fTokenLength;
/** The state of the scanner. */ /** The state of the scanner. */
private int fState; private int fState;
/** The last significant character read. */ /** The last significant character read. */
private int fLast; private int fLast;
@ -247,7 +247,8 @@ public final class AsmPartitionScanner implements IPartitionTokenScanner, ICPart
if (fLast != BACKSLASH && fLast != BACKSLASH_CR && fLast != BACKSLASH_BACKSLASH) { if (fLast != BACKSLASH && fLast != BACKSLASH_CR && fLast != BACKSLASH_BACKSLASH) {
return postFix(fState); return postFix(fState);
} }
consume();
continue;
default: default:
consume(); consume();
continue; continue;
@ -335,7 +336,7 @@ public final class AsmPartitionScanner implements IPartitionTokenScanner, ICPart
} }
} }
// states // states
switch (fState) { switch (fState) {
case CCODE: case CCODE:
if (fLast == NONE) { if (fLast == NONE) {
@ -408,7 +409,7 @@ public final class AsmPartitionScanner implements IPartitionTokenScanner, ICPart
} }
case '"': case '"':
fLast= NONE; // ignore fLast fLast= NONE; // ignore fLast
if (fTokenLength > 0 ) { if (fTokenLength > 0 ) {
return preFix(CCODE, STRING, NONE, 1); return preFix(CCODE, STRING, NONE, 1);
} else { } else {
@ -431,7 +432,8 @@ public final class AsmPartitionScanner implements IPartitionTokenScanner, ICPart
break; break;
} }
} }
// fallthrough consume();
break;
default: default:
consume(); consume();
break; break;
@ -492,7 +494,7 @@ public final class AsmPartitionScanner implements IPartitionTokenScanner, ICPart
default: default:
consume(); consume();
break; break;
} }
break; break;
@ -513,7 +515,7 @@ public final class AsmPartitionScanner implements IPartitionTokenScanner, ICPart
default: default:
consume(); consume();
break; break;
} }
break; break;
@ -549,8 +551,8 @@ public final class AsmPartitionScanner implements IPartitionTokenScanner, ICPart
} }
break; break;
} }
} }
} }
private static final int getLastLength(int last) { private static final int getLastLength(int last) {
switch (last) { switch (last) {
@ -571,19 +573,19 @@ public final class AsmPartitionScanner implements IPartitionTokenScanner, ICPart
case BACKSLASH_BACKSLASH: case BACKSLASH_BACKSLASH:
return 2; return 2;
} }
} }
private final void consume() { private final void consume() {
fTokenLength++; fTokenLength++;
fLast= NONE; fLast= NONE;
} }
private final IToken postFix(int state) { private final IToken postFix(int state) {
fTokenLength++; fTokenLength++;
fLast= NONE; fLast= NONE;
fState= CCODE; fState= CCODE;
fPrefixLength= 0; fPrefixLength= 0;
return fTokens[state]; return fTokens[state];
} }
@ -635,7 +637,7 @@ public final class AsmPartitionScanner implements IPartitionTokenScanner, ICPart
// restart at beginning of partition // restart at beginning of partition
fState= CCODE; fState= CCODE;
} else { } else {
fState= getState(contentType); fState= getState(contentType);
} }
try { try {
@ -653,7 +655,7 @@ public final class AsmPartitionScanner implements IPartitionTokenScanner, ICPart
fScanner.setRange(document, offset, length); fScanner.setRange(document, offset, length);
fTokenOffset= offset; fTokenOffset= offset;
fTokenLength= 0; fTokenLength= 0;
fPrefixLength= 0; fPrefixLength= 0;
fLast= NONE; fLast= NONE;
fState= CCODE; fState= CCODE;

View file

@ -62,7 +62,7 @@ public class BestMatchHover extends AbstractCEditorTextHover {
if (!PreferenceConstants.ID_BESTMATCH_HOVER.equals(hoverDescs[i].getId())) if (!PreferenceConstants.ID_BESTMATCH_HOVER.equals(hoverDescs[i].getId()))
fTextHoverSpecifications.add(hoverDescs[i]); fTextHoverSpecifications.add(hoverDescs[i]);
} }
} }
private void checkTextHovers() { private void checkTextHovers() {
if (fTextHoverSpecifications.size() == 0) if (fTextHoverSpecifications.size() == 0)
@ -88,6 +88,7 @@ public class BestMatchHover extends AbstractCEditorTextHover {
/* /*
* @see ITextHover#getHoverInfo(ITextViewer, IRegion) * @see ITextHover#getHoverInfo(ITextViewer, IRegion)
*/ */
@SuppressWarnings("deprecation")
@Override @Override
public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) { public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) {
@ -113,6 +114,7 @@ public class BestMatchHover extends AbstractCEditorTextHover {
/* /*
* @see org.eclipse.jface.text.ITextHoverExtension2#getHoverInfo2(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion) * @see org.eclipse.jface.text.ITextHoverExtension2#getHoverInfo2(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion)
*/ */
@SuppressWarnings("deprecation")
@Override @Override
public Object getHoverInfo2(ITextViewer textViewer, IRegion hoverRegion) { public Object getHoverInfo2(ITextViewer textViewer, IRegion hoverRegion) {

View file

@ -64,6 +64,7 @@ public class CEditorTextHoverProxy extends AbstractCEditorTextHover {
/* /*
* @see ITextHover#getHoverInfo(ITextViewer, IRegion) * @see ITextHover#getHoverInfo(ITextViewer, IRegion)
*/ */
@SuppressWarnings("deprecation")
@Override @Override
public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) { public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) {
if (ensureHoverCreated()) if (ensureHoverCreated())
@ -77,6 +78,7 @@ public class CEditorTextHoverProxy extends AbstractCEditorTextHover {
* @see org.eclipse.jface.text.ITextHoverExtension2#getHoverInfo2(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion) * @see org.eclipse.jface.text.ITextHoverExtension2#getHoverInfo2(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion)
* @since 5.0 * @since 5.0
*/ */
@SuppressWarnings("deprecation")
@Override @Override
public Object getHoverInfo2(ITextViewer textViewer, IRegion hoverRegion) { public Object getHoverInfo2(ITextViewer textViewer, IRegion hoverRegion) {
if (ensureHoverCreated()) { if (ensureHoverCreated()) {

View file

@ -104,6 +104,7 @@ public class CInformationProvider implements IInformationProvider, IInformationP
/* /*
* @see IInformationProvider#getInformation(ITextViewer, IRegion) * @see IInformationProvider#getInformation(ITextViewer, IRegion)
*/ */
@SuppressWarnings("deprecation")
public String getInformation(ITextViewer textViewer, IRegion subject) { public String getInformation(ITextViewer textViewer, IRegion subject) {
if (fImplementation != null) { if (fImplementation != null) {
String s= fImplementation.getHoverInfo(textViewer, subject); String s= fImplementation.getHoverInfo(textViewer, subject);