Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Kucera2008-04-09 19:28:36 +0000
committerMike Kucera2008-04-09 19:28:36 +0000
commitfe4712050093d461ee2899732be79a6bf6b9158b (patch)
tree4d4e0ef03d2a0473aba9030fb0c0582446b8b387
parent76beb6c75002ebe752971f973ccb07cec5730d17 (diff)
downloadorg.eclipse.cdt-fe4712050093d461ee2899732be79a6bf6b9158b.tar.gz
org.eclipse.cdt-fe4712050093d461ee2899732be79a6bf6b9158b.tar.xz
org.eclipse.cdt-fe4712050093d461ee2899732be79a6bf6b9158b.zip
fixing warnings in LR parser plugins
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/action/deprecated/C99ResolveParserAction.java7
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/action/deprecated/DeclSpec.java16
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/BaseExtensibleLanguage.java4
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/LPGTokenAdapter.java6
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/BuildASTParserAction.java3
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/c99/C99ASTNodeFactory.java3
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/c99/C99BuildASTParserAction.java2
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/cpp/CPPBuildASTParserAction.java6
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/c99/C99Language.java4
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/cpp/ISOCPPLanguage.java4
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/lpgextensions/AbstractTrialUndoActionProvider.java5
-rw-r--r--lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/lpgextensions/ParserState.java1
12 files changed, 36 insertions, 25 deletions
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/action/deprecated/C99ResolveParserAction.java b/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/action/deprecated/C99ResolveParserAction.java
index e2e729b7458..6953ff43dac 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/action/deprecated/C99ResolveParserAction.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/action/deprecated/C99ResolveParserAction.java
@@ -191,7 +191,6 @@ import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
undoStack.add(new IUndoAction() {
public void undo() {
- if(DEBUG) DebugUtil.printMethodTrace("undo");
bindingScopeStack.removeLast();
symbolTable = symbolTableScopeStack.removeLast();
@@ -1030,7 +1029,7 @@ import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
- public IBinding consumeEnumerator(boolean hasInitializer) {
+ public IBinding consumeEnumerator() {
if(DEBUG) DebugUtil.printMethodTrace();
IToken token = parser.getLeftIToken();
@@ -1206,7 +1205,7 @@ import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
}
-
+ @SuppressWarnings("nls")
public void consumeExpressionConstant(int kind) {
if(DEBUG) DebugUtil.printMethodTrace();
@@ -1407,7 +1406,7 @@ import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
}
- public void consumeExpressionUnaryOperator(int operator) {
+ public void consumeExpressionUnaryOperator() {
if(DEBUG) DebugUtil.printMethodTrace();
// TODO: this is lazy, need to check the actual rules for types and operators
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/action/deprecated/DeclSpec.java b/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/action/deprecated/DeclSpec.java
index e6eeaa5c6dc..a7930076d4b 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/action/deprecated/DeclSpec.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/old/org/eclipse/cdt/internal/core/dom/lrparser/c99/action/deprecated/DeclSpec.java
@@ -15,6 +15,7 @@ import static org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym.*;
import java.util.HashMap;
import java.util.Map;
+import org.eclipse.cdt.core.dom.ast.IBasicType;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.c.ICBasicType;
import org.eclipse.cdt.internal.core.dom.lrparser.c99.C99Parsersym;
@@ -84,26 +85,26 @@ class DeclSpec {
if(type != null)
return type;
if(tokenKindMap.isEmpty()) // there are no type tokens, so it must be implicit int
- return new C99BasicType(ICBasicType.t_int);
+ return new C99BasicType(IBasicType.t_int);
C99BasicType basicType = new C99BasicType();
for(int kind : tokenKindMap.keySet()) {
switch(kind) {
case TK_void:
- basicType.setType(ICBasicType.t_void);
+ basicType.setType(IBasicType.t_void);
break;
case TK_char:
- basicType.setType(ICBasicType.t_char);
+ basicType.setType(IBasicType.t_char);
break;
case TK_int:
- basicType.setType(ICBasicType.t_int);
+ basicType.setType(IBasicType.t_int);
break;
case TK_float:
- basicType.setType(ICBasicType.t_float);
+ basicType.setType(IBasicType.t_float);
break;
case TK_double:
- basicType.setType(ICBasicType.t_double);
+ basicType.setType(IBasicType.t_double);
break;
case TK_long:
boolean isLongLong = count(TK_long) > 1;
@@ -137,8 +138,7 @@ class DeclSpec {
if(isConst || isRestrict || isVolatile)
return new C99QualifierType(basicType, isConst, isVolatile, isRestrict);
- else
- return basicType;
+ return basicType;
}
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/BaseExtensibleLanguage.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/BaseExtensibleLanguage.java
index 832a72c60c1..cf03c867c53 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/BaseExtensibleLanguage.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/BaseExtensibleLanguage.java
@@ -82,6 +82,7 @@ public abstract class BaseExtensibleLanguage extends AbstractLanguage implements
protected abstract ParserLanguage getParserLanguageForPreprocessor();
+ @SuppressWarnings("unchecked")
@Override
public Object getAdapter(Class adapter) {
if (adapter == IPDOMLinkageFactory.class)
@@ -117,7 +118,7 @@ public abstract class BaseExtensibleLanguage extends AbstractLanguage implements
ParserLanguage pl = getParserLanguageForPreprocessor();
IScanner preprocessor = new CPreprocessor(reader, scanInfo, pl, log, config, fileCreator);
preprocessor.setScanComments((options & OPTION_ADD_COMMENTS) != 0);
- preprocessor.setComputeImageLocations((options & AbstractLanguage.OPTION_NO_IMAGE_LOCATIONS) == 0);
+ preprocessor.setComputeImageLocations((options & ILanguage.OPTION_NO_IMAGE_LOCATIONS) == 0);
IParser parser = getParser();
IASTTranslationUnit tu = createASTTranslationUnit(index, preprocessor);
@@ -143,6 +144,7 @@ public abstract class BaseExtensibleLanguage extends AbstractLanguage implements
}
+ @SuppressWarnings("nls")
public IASTCompletionNode getCompletionNode(CodeReader reader,
IScannerInfo scanInfo, ICodeReaderFactory fileCreator,
IIndex index, IParserLogService log, int offset) throws CoreException {
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/LPGTokenAdapter.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/LPGTokenAdapter.java
index 762a9e981be..b0cf39e3b69 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/LPGTokenAdapter.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/LPGTokenAdapter.java
@@ -92,7 +92,7 @@ public class LPGTokenAdapter implements lpg.lpgjavaruntime.IToken {
}
@Deprecated
- public String getValue(char[] arg0) {
+ public String getValue(@SuppressWarnings("unused") char[] arg0) {
return toString();
}
@@ -100,7 +100,7 @@ public class LPGTokenAdapter implements lpg.lpgjavaruntime.IToken {
this.adjunctIndex = adjunctIndex;
}
- public void setEndOffset(int arg0) {
+ public void setEndOffset(@SuppressWarnings("unused") int arg0) {
throw new UnsupportedOperationException();
}
@@ -108,7 +108,7 @@ public class LPGTokenAdapter implements lpg.lpgjavaruntime.IToken {
this.kind = kind;
}
- public void setStartOffset(int arg0) {
+ public void setStartOffset(@SuppressWarnings("unused") int arg0) {
throw new UnsupportedOperationException();
}
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/BuildASTParserAction.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/BuildASTParserAction.java
index 224949acbae..b7a602ddb64 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/BuildASTParserAction.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/BuildASTParserAction.java
@@ -67,6 +67,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCastExpression;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLiteralExpression;
import org.eclipse.cdt.core.dom.lrparser.IParser;
import org.eclipse.cdt.core.dom.lrparser.IParserActionTokenProvider;
+import org.eclipse.cdt.core.parser.IProblem;
import org.eclipse.cdt.core.parser.util.DebugUtil;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
@@ -1442,7 +1443,7 @@ public abstract class BuildASTParserAction {
private void consumeProblem(IASTProblemHolder problemHolder) {
- IASTProblem problem = nodeFactory.newProblem(IASTProblem.SYNTAX_ERROR, new char[0], true);
+ IASTProblem problem = nodeFactory.newProblem(IProblem.SYNTAX_ERROR, new char[0], true);
problemHolder.setProblem(problem);
setOffsetAndLength(problem);
setOffsetAndLength((ASTNode)problemHolder);
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/c99/C99ASTNodeFactory.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/c99/C99ASTNodeFactory.java
index 2886973f8c1..1068c44a089 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/c99/C99ASTNodeFactory.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/c99/C99ASTNodeFactory.java
@@ -210,6 +210,9 @@ public class C99ASTNodeFactory implements IC99ASTNodeFactory {
return new CASTTypeIdInitializerExpression(typeId, list);
}
+ /**
+ * @param operator
+ */
public IASTCastExpression newCastExpression(int operator, IASTTypeId typeId, IASTExpression operand) {
return new CASTCastExpression(typeId, operand);
}
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/c99/C99BuildASTParserAction.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/c99/C99BuildASTParserAction.java
index c9a6806c965..d608746d8cc 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/c99/C99BuildASTParserAction.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/c99/C99BuildASTParserAction.java
@@ -760,7 +760,7 @@ public class C99BuildASTParserAction extends BuildASTParserAction {
IASTCompoundStatement body = (IASTCompoundStatement) astStack.pop();
- IASTDeclaration[] declarations = (IASTDeclaration[]) astStack.topScope().toArray(new IASTDeclaration[0]);
+ IASTDeclaration[] declarations = astStack.topScope().toArray(new IASTDeclaration[0]);
astStack.closeScope();
ICASTKnRFunctionDeclarator decl = (ICASTKnRFunctionDeclarator) astStack.pop();
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/cpp/CPPBuildASTParserAction.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/cpp/CPPBuildASTParserAction.java
index 84631fb06ea..d69aa8cdb04 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/cpp/CPPBuildASTParserAction.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/action/cpp/CPPBuildASTParserAction.java
@@ -104,6 +104,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.OverloadableOperator;
*
* @author Mike Kucera
*/
+@SuppressWarnings("restriction")
public class CPPBuildASTParserAction extends BuildASTParserAction {
@@ -394,7 +395,7 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
}
- @SuppressWarnings("restriction")
+
private static OverloadableOperator getOverloadableOperator(List<IToken> tokens) {
if(tokens.size() == 1) {
// TODO this is a hack that I did to save time
@@ -486,7 +487,7 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
* | '::' operator_function_id
* | '::' template_id
*/
- @SuppressWarnings("restriction")
+
public void consumeGlobalQualifiedId() {
if(TRACE_ACTIONS) DebugUtil.printMethodTrace();
@@ -735,7 +736,6 @@ public class CPPBuildASTParserAction extends BuildASTParserAction {
*
* @param names List of name nodes in reverse order
*/
- @SuppressWarnings("restriction")
private IASTName createQualifiedName(LinkedList<IASTName> names, int startOffset, int endOffset, boolean startsWithColonColon, boolean endsWithColonColon) {
if(!endsWithColonColon && !startsWithColonColon && names.size() == 1)
return names.getFirst(); // its actually an unqualified name
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/c99/C99Language.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/c99/C99Language.java
index 93cd22073d0..4af2d30f458 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/c99/C99Language.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/c99/C99Language.java
@@ -31,6 +31,7 @@ import org.eclipse.cdt.internal.core.dom.parser.c.CASTTranslationUnit;
*
* @author Mike Kucera
*/
+@SuppressWarnings("restriction")
public class C99Language extends BaseExtensibleLanguage {
public static final String PLUGIN_ID = "org.eclipse.cdt.core.lrparser"; //$NON-NLS-1$
@@ -57,7 +58,7 @@ public class C99Language extends BaseExtensibleLanguage {
return TOKEN_MAP;
}
- public IContributedModelBuilder createModelBuilder(ITranslationUnit tu) {
+ public IContributedModelBuilder createModelBuilder(@SuppressWarnings("unused") ITranslationUnit tu) {
return null;
}
@@ -93,7 +94,6 @@ public class C99Language extends BaseExtensibleLanguage {
/**
* Gets the translation unit object and sets the index and the location resolver.
*/
- @SuppressWarnings("restriction")
@Override
protected IASTTranslationUnit createASTTranslationUnit(IIndex index, IScanner preprocessor) {
IASTTranslationUnit tu = C99ASTNodeFactory.DEFAULT_INSTANCE.newTranslationUnit();
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/cpp/ISOCPPLanguage.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/cpp/ISOCPPLanguage.java
index dc3dbf24f47..fc31326f00a 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/cpp/ISOCPPLanguage.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/cpp/ISOCPPLanguage.java
@@ -31,6 +31,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTTranslationUnit;
*
* @author Mike Kucera
*/
+@SuppressWarnings("restriction")
public class ISOCPPLanguage extends BaseExtensibleLanguage {
public static final String PLUGIN_ID = "org.eclipse.cdt.core.lrparser"; //$NON-NLS-1$
@@ -57,7 +58,7 @@ public class ISOCPPLanguage extends BaseExtensibleLanguage {
return TOKEN_MAP;
}
- public IContributedModelBuilder createModelBuilder(ITranslationUnit tu) {
+ public IContributedModelBuilder createModelBuilder(@SuppressWarnings("unused") ITranslationUnit tu) {
return null;
}
@@ -93,7 +94,6 @@ public class ISOCPPLanguage extends BaseExtensibleLanguage {
/**
* Gets the translation unit object and sets the index and the location resolver.
*/
- @SuppressWarnings("restriction")
@Override
protected IASTTranslationUnit createASTTranslationUnit(IIndex index, IScanner preprocessor) {
IASTTranslationUnit tu = CPPASTNodeFactory.DEFAULT_INSTANCE.newTranslationUnit();
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/lpgextensions/AbstractTrialUndoActionProvider.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/lpgextensions/AbstractTrialUndoActionProvider.java
index cff7bb06844..4df42dfe282 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/lpgextensions/AbstractTrialUndoActionProvider.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/lpgextensions/AbstractTrialUndoActionProvider.java
@@ -161,6 +161,7 @@ public abstract class AbstractTrialUndoActionProvider<ACT, RULE_DATA> extends Pr
public static class DeclaredAction<ACT, RULE_DATA> extends Action<ACT, RULE_DATA> {
protected boolean hasUndo = false;
@Override
+ @SuppressWarnings("unused")
public boolean doTrial(ITrialUndoActionProvider<RULE_DATA> provider, ACT action) {
return true;
}
@@ -172,6 +173,7 @@ public abstract class AbstractTrialUndoActionProvider<ACT, RULE_DATA> extends Pr
*/
static final class NullAction<ACT, RULE_DATA> extends Action<ACT, RULE_DATA> {
@Override
+ @SuppressWarnings("unused")
public void doFinal(ITrialUndoActionProvider<RULE_DATA> provider, ACT action) {
// do nothing
}
@@ -180,16 +182,19 @@ public abstract class AbstractTrialUndoActionProvider<ACT, RULE_DATA> extends Pr
static final class BadAction<ACT, RULE_DATA> extends Action<ACT, RULE_DATA> {
@Override
+ @SuppressWarnings("unused")
public void doFinal(ITrialUndoActionProvider<RULE_DATA> provider, ACT action) {
throw new Error(new BadActionException());
}
@Override
+ @SuppressWarnings("unused")
public boolean doTrial(ITrialUndoActionProvider<RULE_DATA> provider, ACT action) {
throw new Error(new BadActionException());
}
@Override
+ @SuppressWarnings("unused")
public void doUndo(ITrialUndoActionProvider<RULE_DATA> provider, ACT action) {
throw new Error(new BadActionException());
}
diff --git a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/lpgextensions/ParserState.java b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/lpgextensions/ParserState.java
index 6760d157454..498b7760e58 100644
--- a/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/lpgextensions/ParserState.java
+++ b/lrparser/org.eclipse.cdt.core.lrparser/src/org/eclipse/cdt/core/dom/lrparser/lpgextensions/ParserState.java
@@ -48,6 +48,7 @@ class ParserState {
/**
* Trial actions that have been executed but not yet committed.
*/
+ @SuppressWarnings("unchecked")
public LinkedList pendingCommits;
public ConfigurationStack configurationStack;

Back to the top