mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
Fix warnings
This commit is contained in:
parent
70db16224a
commit
93ddce7436
6 changed files with 58 additions and 30 deletions
|
@ -904,6 +904,7 @@ public final class CIndenter {
|
|||
int pos= fPosition;
|
||||
if (!skipScope())
|
||||
fPosition= pos;
|
||||
return skipToStatementStart(danglingElse, false);
|
||||
case Symbols.TokenSEMICOLON:
|
||||
// this is the 90% case: after a statement block
|
||||
// the end of the previous statement / block previous.end
|
||||
|
@ -992,12 +993,14 @@ public final class CIndenter {
|
|||
fPosition= offset;
|
||||
fLine= line;
|
||||
// else: fall through to default
|
||||
return skipToPreviousListItemOrListStart();
|
||||
|
||||
case Symbols.TokenCOMMA:
|
||||
// inside a list of some type
|
||||
// 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
|
||||
// indent by list-indent
|
||||
return skipToPreviousListItemOrListStart();
|
||||
default:
|
||||
// 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
|
||||
|
@ -1207,6 +1210,11 @@ public final class CIndenter {
|
|||
if (isInBlock)
|
||||
mayBeMethodBody= READ_PARENS;
|
||||
// fall thru
|
||||
pos= fPreviousPos;
|
||||
if (skipScope())
|
||||
break;
|
||||
else
|
||||
return pos;
|
||||
case Symbols.TokenRBRACKET:
|
||||
case Symbols.TokenGREATERTHAN:
|
||||
pos= fPreviousPos;
|
||||
|
@ -1284,6 +1292,7 @@ public final class CIndenter {
|
|||
return false;
|
||||
}
|
||||
// fall thru
|
||||
continue;
|
||||
case Symbols.TokenDOUBLECOLON:
|
||||
case Symbols.TokenOTHER:
|
||||
continue;
|
||||
|
@ -1495,10 +1504,14 @@ public final class CIndenter {
|
|||
if (!isGenericStarter(getTokenContent()))
|
||||
break;
|
||||
// fall thru
|
||||
if (skipScope(Symbols.TokenLESSTHAN, Symbols.TokenGREATERTHAN))
|
||||
return true;
|
||||
break;
|
||||
case Symbols.TokenQUESTIONMARK:
|
||||
case Symbols.TokenGREATERTHAN:
|
||||
if (skipScope(Symbols.TokenLESSTHAN, Symbols.TokenGREATERTHAN))
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
// <> are harder to detect - restore the position if we fail
|
||||
fPosition= storedPosition;
|
||||
|
@ -1765,6 +1778,8 @@ public final class CIndenter {
|
|||
switch (fToken) {
|
||||
case Symbols.TokenRBRACE:
|
||||
skipScope(); // and fall thru
|
||||
skipToStatementStart(false, false);
|
||||
return fToken == Symbols.TokenDO;
|
||||
case Symbols.TokenSEMICOLON:
|
||||
skipToStatementStart(false, false);
|
||||
return fToken == Symbols.TokenDO;
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.eclipse.cdt.ui.text.doctools.IDocCommentOwner;
|
|||
public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPartitions {
|
||||
|
||||
// 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 MULTI_LINE_COMMENT= 2;
|
||||
private static final int CHARACTER= 3;
|
||||
|
@ -61,7 +61,7 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
|||
/** The length of the last returned token. */
|
||||
private int fTokenLength;
|
||||
|
||||
/** The state of the scanner. */
|
||||
/** The state of the scanner. */
|
||||
private int fState;
|
||||
/** The last significant characters read. */
|
||||
private int fLast;
|
||||
|
@ -214,6 +214,8 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
|||
if (fLast != BACKSLASH && fLast != BACKSLASH_CR && fLast != BACKSLASH_BACKSLASH) {
|
||||
return postFix(fState);
|
||||
}
|
||||
consume();
|
||||
continue;
|
||||
|
||||
default:
|
||||
consume();
|
||||
|
@ -298,7 +300,7 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
|||
}
|
||||
}
|
||||
|
||||
// states
|
||||
// states
|
||||
switch (fState) {
|
||||
case CCODE:
|
||||
switch (ch) {
|
||||
|
@ -347,7 +349,7 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
|||
}
|
||||
|
||||
case '"':
|
||||
fLast= NONE; // ignore fLast
|
||||
fLast= NONE; // ignore fLast
|
||||
if (fTokenLength > 0 ) {
|
||||
return preFix(CCODE, STRING, NONE, 1);
|
||||
} else {
|
||||
|
@ -371,6 +373,8 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
|||
}
|
||||
}
|
||||
// fallthrough
|
||||
consume();
|
||||
break;
|
||||
default:
|
||||
consume();
|
||||
break;
|
||||
|
@ -410,7 +414,9 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
consume();
|
||||
break;
|
||||
|
||||
case '"':
|
||||
if (fLast != BACKSLASH) {
|
||||
fState= PREPROCESSOR_STRING;
|
||||
|
@ -457,7 +463,7 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
|||
|
||||
default:
|
||||
consume();
|
||||
break;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -484,7 +490,7 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
|||
|
||||
case STRING:
|
||||
switch (ch) {
|
||||
case '\"':
|
||||
case '\"':
|
||||
if (fLast != BACKSLASH) {
|
||||
return postFix(STRING);
|
||||
|
||||
|
@ -516,8 +522,8 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
|||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final int getLastLength(int last) {
|
||||
switch (last) {
|
||||
|
@ -538,12 +544,12 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
|||
case BACKSLASH_BACKSLASH:
|
||||
return 2;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final void consume() {
|
||||
fTokenLength++;
|
||||
fLast= NONE;
|
||||
fLast= NONE;
|
||||
}
|
||||
|
||||
private final IToken postFix(int state) {
|
||||
|
@ -554,7 +560,7 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
|||
fTokenLength++;
|
||||
fLast= NONE;
|
||||
fState= newState;
|
||||
fPrefixLength= 0;
|
||||
fPrefixLength= 0;
|
||||
return fTokens[interceptTokenState(state)];
|
||||
}
|
||||
|
||||
|
@ -625,7 +631,7 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
|||
// restart at beginning of partition
|
||||
fState= CCODE;
|
||||
} else {
|
||||
fState= getState(contentType);
|
||||
fState= getState(contentType);
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -649,7 +655,7 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
|||
fDocument= document;
|
||||
fScanner.setRange(document, offset, length);
|
||||
fTokenOffset= offset;
|
||||
fTokenLength= 0;
|
||||
fTokenLength= 0;
|
||||
fPrefixLength= 0;
|
||||
fLast= NONE;
|
||||
fState= CCODE;
|
||||
|
@ -685,7 +691,7 @@ public final class FastCPartitionScanner implements IPartitionTokenScanner, ICPa
|
|||
private int interceptTokenState(int proposedTokenState) {
|
||||
if(fOwner!=null) {
|
||||
switch(proposedTokenState) {
|
||||
case MULTI_LINE_COMMENT:
|
||||
case MULTI_LINE_COMMENT:
|
||||
if(fOwner.getMultilineConfiguration().isDocumentationComment(fDocument, fTokenOffset, fTokenLength))
|
||||
return MULTI_LINE_DOC_COMMENT;
|
||||
break;
|
||||
|
|
|
@ -82,7 +82,7 @@ public final class AsmPartitionScanner implements IPartitionTokenScanner, ICPart
|
|||
/** The length of the last returned token. */
|
||||
private int fTokenLength;
|
||||
|
||||
/** The state of the scanner. */
|
||||
/** The state of the scanner. */
|
||||
private int fState;
|
||||
/** The last significant character read. */
|
||||
private int fLast;
|
||||
|
@ -247,7 +247,8 @@ public final class AsmPartitionScanner implements IPartitionTokenScanner, ICPart
|
|||
if (fLast != BACKSLASH && fLast != BACKSLASH_CR && fLast != BACKSLASH_BACKSLASH) {
|
||||
return postFix(fState);
|
||||
}
|
||||
|
||||
consume();
|
||||
continue;
|
||||
default:
|
||||
consume();
|
||||
continue;
|
||||
|
@ -335,7 +336,7 @@ public final class AsmPartitionScanner implements IPartitionTokenScanner, ICPart
|
|||
}
|
||||
}
|
||||
|
||||
// states
|
||||
// states
|
||||
switch (fState) {
|
||||
case CCODE:
|
||||
if (fLast == NONE) {
|
||||
|
@ -408,7 +409,7 @@ public final class AsmPartitionScanner implements IPartitionTokenScanner, ICPart
|
|||
}
|
||||
|
||||
case '"':
|
||||
fLast= NONE; // ignore fLast
|
||||
fLast= NONE; // ignore fLast
|
||||
if (fTokenLength > 0 ) {
|
||||
return preFix(CCODE, STRING, NONE, 1);
|
||||
} else {
|
||||
|
@ -431,7 +432,8 @@ public final class AsmPartitionScanner implements IPartitionTokenScanner, ICPart
|
|||
break;
|
||||
}
|
||||
}
|
||||
// fallthrough
|
||||
consume();
|
||||
break;
|
||||
default:
|
||||
consume();
|
||||
break;
|
||||
|
@ -492,7 +494,7 @@ public final class AsmPartitionScanner implements IPartitionTokenScanner, ICPart
|
|||
|
||||
default:
|
||||
consume();
|
||||
break;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -513,7 +515,7 @@ public final class AsmPartitionScanner implements IPartitionTokenScanner, ICPart
|
|||
|
||||
default:
|
||||
consume();
|
||||
break;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -549,8 +551,8 @@ public final class AsmPartitionScanner implements IPartitionTokenScanner, ICPart
|
|||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final int getLastLength(int last) {
|
||||
switch (last) {
|
||||
|
@ -571,19 +573,19 @@ public final class AsmPartitionScanner implements IPartitionTokenScanner, ICPart
|
|||
case BACKSLASH_BACKSLASH:
|
||||
return 2;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final void consume() {
|
||||
fTokenLength++;
|
||||
fLast= NONE;
|
||||
fLast= NONE;
|
||||
}
|
||||
|
||||
private final IToken postFix(int state) {
|
||||
fTokenLength++;
|
||||
fLast= NONE;
|
||||
fState= CCODE;
|
||||
fPrefixLength= 0;
|
||||
fPrefixLength= 0;
|
||||
return fTokens[state];
|
||||
}
|
||||
|
||||
|
@ -635,7 +637,7 @@ public final class AsmPartitionScanner implements IPartitionTokenScanner, ICPart
|
|||
// restart at beginning of partition
|
||||
fState= CCODE;
|
||||
} else {
|
||||
fState= getState(contentType);
|
||||
fState= getState(contentType);
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -653,7 +655,7 @@ public final class AsmPartitionScanner implements IPartitionTokenScanner, ICPart
|
|||
|
||||
fScanner.setRange(document, offset, length);
|
||||
fTokenOffset= offset;
|
||||
fTokenLength= 0;
|
||||
fTokenLength= 0;
|
||||
fPrefixLength= 0;
|
||||
fLast= NONE;
|
||||
fState= CCODE;
|
||||
|
|
|
@ -62,7 +62,7 @@ public class BestMatchHover extends AbstractCEditorTextHover {
|
|||
if (!PreferenceConstants.ID_BESTMATCH_HOVER.equals(hoverDescs[i].getId()))
|
||||
fTextHoverSpecifications.add(hoverDescs[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void checkTextHovers() {
|
||||
if (fTextHoverSpecifications.size() == 0)
|
||||
|
@ -88,6 +88,7 @@ public class BestMatchHover extends AbstractCEditorTextHover {
|
|||
/*
|
||||
* @see ITextHover#getHoverInfo(ITextViewer, IRegion)
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
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)
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public Object getHoverInfo2(ITextViewer textViewer, IRegion hoverRegion) {
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@ public class CEditorTextHoverProxy extends AbstractCEditorTextHover {
|
|||
/*
|
||||
* @see ITextHover#getHoverInfo(ITextViewer, IRegion)
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) {
|
||||
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)
|
||||
* @since 5.0
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public Object getHoverInfo2(ITextViewer textViewer, IRegion hoverRegion) {
|
||||
if (ensureHoverCreated()) {
|
||||
|
|
|
@ -104,6 +104,7 @@ public class CInformationProvider implements IInformationProvider, IInformationP
|
|||
/*
|
||||
* @see IInformationProvider#getInformation(ITextViewer, IRegion)
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public String getInformation(ITextViewer textViewer, IRegion subject) {
|
||||
if (fImplementation != null) {
|
||||
String s= fImplementation.getHoverInfo(textViewer, subject);
|
||||
|
|
Loading…
Add table
Reference in a new issue