Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorAnton Leherbauer2008-04-17 09:43:54 -0400
committerAnton Leherbauer2008-04-17 09:43:54 -0400
commit93ddce74360f7124fa8d7e01f86920c83c41b847 (patch)
tree243ba956117b1f1a8ad369be5fbafbff9ac4d102 /core
parent70db16224a500660dae478be9bc44045f29ee08c (diff)
downloadorg.eclipse.cdt-93ddce74360f7124fa8d7e01f86920c83c41b847.tar.gz
org.eclipse.cdt-93ddce74360f7124fa8d7e01f86920c83c41b847.tar.xz
org.eclipse.cdt-93ddce74360f7124fa8d7e01f86920c83c41b847.zip
Fix warnings
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CIndenter.java15
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/FastCPartitionScanner.java36
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/asm/AsmPartitionScanner.java30
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/BestMatchHover.java4
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CEditorTextHoverProxy.java2
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CInformationProvider.java1
6 files changed, 58 insertions, 30 deletions
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CIndenter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CIndenter.java
index ab5e31ac092..2840a592545 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CIndenter.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CIndenter.java
@@ -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;
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/FastCPartitionScanner.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/FastCPartitionScanner.java
index e3a5ef74109..ac8c517ea22 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/FastCPartitionScanner.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/FastCPartitionScanner.java
@@ -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;
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/asm/AsmPartitionScanner.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/asm/AsmPartitionScanner.java
index 140deba5cb8..5419db52f8d 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/asm/AsmPartitionScanner.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/asm/AsmPartitionScanner.java
@@ -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;
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/BestMatchHover.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/BestMatchHover.java
index f6e7e88bfda..7919bb0b129 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/BestMatchHover.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/BestMatchHover.java
@@ -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) {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CEditorTextHoverProxy.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CEditorTextHoverProxy.java
index 29744c30338..b76604737b9 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CEditorTextHoverProxy.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CEditorTextHoverProxy.java
@@ -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()) {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CInformationProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CInformationProvider.java
index 32a40bf411a..8f84d911bc9 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CInformationProvider.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CInformationProvider.java
@@ -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);

Back to the top