mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Removed warnings.
This commit is contained in:
parent
9f21cf4d4a
commit
787b5dfcc3
8 changed files with 262 additions and 334 deletions
|
@ -385,15 +385,13 @@ public class DeclarationWrapper implements IDeclaratorOwner
|
|||
throw new ASTSemanticException( (IProblem)null );
|
||||
return createFieldASTNode(declarator, false );
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isFunction)
|
||||
return createFunctionASTNode(declarator, false);
|
||||
else
|
||||
if( declarator.hasFunctionBody() )
|
||||
throw new ASTSemanticException( (IProblem)null );
|
||||
return createVariableASTNode(declarator, false);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* @param declarator
|
||||
|
@ -418,19 +416,13 @@ public class DeclarationWrapper implements IDeclaratorOwner
|
|||
{
|
||||
if( isFunction)
|
||||
return createMethodASTNode(declarator, true);
|
||||
else
|
||||
return createFieldASTNode(declarator, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isFunction)
|
||||
return createFunctionASTNode(declarator, true);
|
||||
else
|
||||
return createVariableASTNode(declarator, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
List convertedParms = createParameterList( declarator.getParameters() );
|
||||
IASTAbstractDeclaration abs = null;
|
||||
abs =
|
||||
|
@ -450,18 +442,15 @@ public class DeclarationWrapper implements IDeclaratorOwner
|
|||
getStartingOffset(), getStartingLine(), d
|
||||
.getNameStartOffset(), d.getNameEndOffset(), d
|
||||
.getNameLine());
|
||||
else {
|
||||
|
||||
if( isWithinClass )
|
||||
return astFactory.createField( scope, nameDuple, auto, d.getInitializerClause(), d.getBitFieldExpression(), abs, mutable, extern, register, staticc, getStartingOffset(), getStartingLine(), d.getNameStartOffset(), d.getNameEndOffset(), d.getNameLine(), d.getConstructorExpression(), ((IASTClassSpecifier)scope).getCurrentVisibilityMode() );
|
||||
else
|
||||
|
||||
return astFactory.createVariable( scope, nameDuple, auto, d.getInitializerClause(), d.getBitFieldExpression(), abs, mutable, extern, register, staticc, getStartingOffset(), getStartingLine(), d.getNameStartOffset(), d.getNameEndOffset(), d.getNameLine(), d.getConstructorExpression() );
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new BacktrackException();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -147,7 +147,6 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
public IToken consume(int type) throws EndOfFileException, BacktrackException {
|
||||
if (LT(1) == type)
|
||||
return consume();
|
||||
else
|
||||
throw backtrack;
|
||||
}
|
||||
|
||||
|
@ -565,8 +564,6 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
declarator.addPointerOperator(ASTPointerOperator.RESTRICT_POINTER);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( extension.isValidCVModifier( language, IToken.t_restrict ))
|
||||
{
|
||||
result = consume( IToken.t_restrict );
|
||||
|
@ -574,7 +571,7 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
break;
|
||||
}
|
||||
throw backtrack;
|
||||
}
|
||||
|
||||
|
||||
default :
|
||||
if( extension.isValidCVModifier( language, LT(1)))
|
||||
|
@ -925,7 +922,6 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
throw backtrack;
|
||||
}
|
||||
}
|
||||
else
|
||||
return firstExpression;
|
||||
}
|
||||
|
||||
|
@ -1199,8 +1195,6 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
backup(mark);
|
||||
return firstExpression;
|
||||
}
|
||||
else
|
||||
{
|
||||
IASTExpression.Kind expressionKind = null;
|
||||
switch (t.getType())
|
||||
{
|
||||
|
@ -1244,7 +1238,6 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
logException( "relationalExpression::createExpression()", e ); //$NON-NLS-1$
|
||||
throw backtrack;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default :
|
||||
if( extension.isValidRelationalExpressionStart(language, LT(1)))
|
||||
|
@ -2548,16 +2541,11 @@ public class ExpressionParser implements IExpressionParser, IParserData {
|
|||
try
|
||||
{
|
||||
if( t instanceof INumericToken )
|
||||
{
|
||||
return astFactory.createExpression(
|
||||
IASTExpression.Kind.PRIMARY_INTEGER_LITERAL,
|
||||
((INumericToken)t).getIntegerValue(), isHex);
|
||||
}
|
||||
else
|
||||
{
|
||||
return astFactory.createExpression( scope, IASTExpression.Kind.PRIMARY_INTEGER_LITERAL, null, null, null, null, null, t.getImage(), null );
|
||||
}
|
||||
}
|
||||
catch (ASTSemanticException e1)
|
||||
{
|
||||
throw backtrack;
|
||||
|
|
|
@ -267,13 +267,8 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
astUD.acceptElement(requestor);
|
||||
return astUD;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw backtrack;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean typeName = false;
|
||||
setCompletionValues(scope, CompletionKind.TYPE_REFERENCE, Key.POST_USING );
|
||||
|
||||
|
@ -281,7 +276,6 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
{
|
||||
typeName = true;
|
||||
consume(IToken.t_typename);
|
||||
|
||||
}
|
||||
|
||||
setCompletionValues(scope, CompletionKind.TYPE_REFERENCE, Key.NAMESPACE_ONLY );
|
||||
|
@ -318,11 +312,8 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
setCompletionValues(scope, getCompletionKindForDeclaration(scope, null), Key.DECLARATION );
|
||||
return declaration;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw backtrack;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Implements Linkage specification in the ANSI C++ grammar.
|
||||
|
@ -391,8 +382,8 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
linkage.exitScope( requestor );
|
||||
return linkage;
|
||||
}
|
||||
else // single declaration
|
||||
{
|
||||
// single declaration
|
||||
|
||||
IASTLinkageSpecification linkage;
|
||||
try
|
||||
{
|
||||
|
@ -411,7 +402,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
declaration(linkage, null, null);
|
||||
linkage.exitScope( requestor );
|
||||
return linkage;
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
*
|
||||
|
@ -464,8 +455,6 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
|
||||
return templateInstantiation;
|
||||
}
|
||||
else
|
||||
{
|
||||
consume(IToken.tLT);
|
||||
if (LT(1) == IToken.tGT)
|
||||
{
|
||||
|
@ -493,7 +482,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
templateSpecialization.exitScope(requestor);
|
||||
return templateSpecialization;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -1110,8 +1099,6 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
}
|
||||
return declaration;
|
||||
}
|
||||
else
|
||||
{
|
||||
IASTDeclaration declaration = (IASTDeclaration)i.next();
|
||||
endDeclaration( declaration );
|
||||
declaration.enterScope( requestor );
|
||||
|
@ -1131,9 +1118,6 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
return declaration;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -1155,7 +1139,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
logException( "simpleDeclaration:createTypeSpecDeclaration", e1 ); //$NON-NLS-1$
|
||||
throw backtrack;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -3203,9 +3187,7 @@ public abstract class Parser extends ExpressionParser implements IParser
|
|||
protected void handleClassSpecifier( IASTClassSpecifier classSpecifier ) throws EndOfFileException
|
||||
{
|
||||
cleanupLastToken();
|
||||
if( classSpecifier instanceof IASTOffsetableNamedElement )
|
||||
handleOffsetableNamedElement( classSpecifier );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -41,16 +41,14 @@ public class ParserMessages {
|
|||
* @return
|
||||
*/
|
||||
public static String getString(String key) {
|
||||
if( resourceBundle == null ){
|
||||
if( resourceBundle == null )
|
||||
return '#' + key +'#';
|
||||
} else {
|
||||
try {
|
||||
return resourceBundle.getString(key);
|
||||
} catch (MissingResourceException e) {
|
||||
return '!' + key + '!';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a string from the resource bundle and formats it with the argument
|
||||
|
|
|
@ -154,22 +154,25 @@ public class QuickParseCallback extends NullSourceElementRequestor implements IQ
|
|||
|
||||
// case 3: 1 is null
|
||||
if( currentMacro == null )
|
||||
{
|
||||
if( currentDeclaration.getStartingOffset() < currentInclusion.getStartingOffset() )
|
||||
return updateDeclarationIterator();
|
||||
else
|
||||
return updateInclusionIterator();
|
||||
}
|
||||
|
||||
if( currentInclusion == null )
|
||||
{
|
||||
if( currentDeclaration.getStartingOffset() < currentMacro.getStartingOffset() )
|
||||
return updateDeclarationIterator();
|
||||
else
|
||||
return updateMacroIterator();
|
||||
}
|
||||
|
||||
if( currentDeclaration == null )
|
||||
{
|
||||
if( currentInclusion.getStartingOffset() < currentMacro.getStartingOffset() )
|
||||
return updateInclusionIterator();
|
||||
else
|
||||
return updateMacroIterator();
|
||||
}
|
||||
|
||||
// case 4: none are null
|
||||
if( currentInclusion.getStartingOffset() < currentMacro.getStartingOffset() &&
|
||||
|
|
|
@ -496,13 +496,8 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
iterator.next();
|
||||
return pst.getCompilationUnit();
|
||||
}
|
||||
else
|
||||
{
|
||||
return scopeToSymbol(currentScope);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
protected IContainerSymbol scopeToSymbol(IASTScope currentScope)
|
||||
{
|
||||
if( currentScope instanceof ASTScope )
|
||||
|
@ -935,8 +930,8 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
{
|
||||
ASTNode referenced = (definition != null) ? definition : declaration;
|
||||
if( referenced instanceof IASTMethod )
|
||||
|
||||
return new ASTMethodReference( offset, referenceElementName, (IASTMethod)referenced );
|
||||
else
|
||||
return new ASTFunctionReference( offset, referenceElementName, (IASTFunction)referenced );
|
||||
}
|
||||
else if( ( symbol.getType() == TypeInfo.t_type ) ||
|
||||
|
@ -1279,10 +1274,8 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
// assert lhsInfo != null : "Malformed Expression";
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
return startingScope;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Conditional Expression conversion
|
||||
|
|
|
@ -56,12 +56,9 @@ public class BranchTracker {
|
|||
|
||||
return taken;
|
||||
}
|
||||
else
|
||||
{
|
||||
branches.push( FALSE );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean queryCurrentBranchForElif()
|
||||
{
|
||||
|
|
|
@ -400,7 +400,6 @@ public class Scanner implements IScanner {
|
|||
// multiline comment
|
||||
if (skipOverMultilineComment())
|
||||
break;
|
||||
else
|
||||
c = getChar( true );
|
||||
continue;
|
||||
} else {
|
||||
|
@ -851,14 +850,9 @@ public class Scanner implements IScanner {
|
|||
{
|
||||
c = getChar();
|
||||
if( c == '#' )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ungetChar( c );
|
||||
}
|
||||
}
|
||||
|
||||
ungetChar( c );
|
||||
return false;
|
||||
|
@ -922,12 +916,9 @@ public class Scanner implements IScanner {
|
|||
// consume \ \r \n and then continue
|
||||
return getChar(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// consume the \ \r and then continue
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
if (c == '\n')
|
||||
{
|
||||
|
@ -1024,7 +1015,6 @@ public class Scanner implements IScanner {
|
|||
} else if( c == '.' ){
|
||||
if( getChar() == '.' )
|
||||
return newConstantToken( IToken.tELLIPSIS );
|
||||
else
|
||||
handleProblem( IProblem.SCANNER_BAD_FLOATING_POINT, null, beginOffset, false, true );
|
||||
} else {
|
||||
ungetChar( c );
|
||||
|
@ -1502,7 +1492,6 @@ public class Scanner implements IScanner {
|
|||
if( buff == null ) return null;
|
||||
continue; // back to top of loop
|
||||
}
|
||||
else
|
||||
ungetChar( next );
|
||||
}
|
||||
break;
|
||||
|
@ -1540,13 +1529,10 @@ public class Scanner implements IScanner {
|
|||
|
||||
if (tokenTypeObject != null)
|
||||
return newConstantToken(((Integer) tokenTypeObject).intValue());
|
||||
else
|
||||
{
|
||||
if( scannerExtension.isExtensionKeyword( scannerData.getLanguage(), ident ) )
|
||||
return newExtensionToken( scannerExtension.createExtensionToken(scannerData, ident ));
|
||||
return newToken(IToken.tIDENTIFIER, ident);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param token
|
||||
|
@ -2023,8 +2009,6 @@ public class Scanner implements IScanner {
|
|||
c = getChar();
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
token = processKeywordOrIdentifier( secondBuffer, pasting );
|
||||
if (token == null)
|
||||
{
|
||||
|
@ -2033,13 +2017,9 @@ public class Scanner implements IScanner {
|
|||
}
|
||||
return token;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ungetChar( next );
|
||||
handleProblem( IProblem.SCANNER_BAD_CHARACTER, ucnBuffer.toString(), getCurrentOffset(), false, true, throwExceptionOnBadCharacterRead );
|
||||
}
|
||||
}
|
||||
|
||||
handleProblem( IProblem.SCANNER_BAD_CHARACTER, new Character( (char)c ).toString(), getCurrentOffset(), false, true, throwExceptionOnBadCharacterRead );
|
||||
c = getChar();
|
||||
|
@ -2259,11 +2239,10 @@ public class Scanner implements IScanner {
|
|||
{
|
||||
return newToken( IToken.tSTRING, buff.toString());
|
||||
|
||||
} else {
|
||||
}
|
||||
handleProblem( IProblem.SCANNER_UNBOUNDED_STRING, null, beginOffset, false, true );
|
||||
c = getChar();
|
||||
continue;
|
||||
}
|
||||
|
||||
} else {
|
||||
switch (c) {
|
||||
|
@ -2776,7 +2755,7 @@ public class Scanner implements IScanner {
|
|||
if( c == '\n' ){
|
||||
c = getChar();
|
||||
continue;
|
||||
} else {
|
||||
}
|
||||
StringBuffer potentialErrorMessage = new StringBuffer( POUND_DEFINE );
|
||||
ungetChar( c );
|
||||
potentialErrorMessage.append( buffer );
|
||||
|
@ -2784,7 +2763,6 @@ public class Scanner implements IScanner {
|
|||
potentialErrorMessage.append( (char)c );
|
||||
handleProblem( IProblem.PREPROCESSOR_INVALID_MACRO_DEFN, potentialErrorMessage.toString(), beginning, false, true);
|
||||
return;
|
||||
}
|
||||
} else if( c == '\r' || c == '\n' || c == NOCHAR ){
|
||||
StringBuffer potentialErrorMessage = new StringBuffer( POUND_DEFINE );
|
||||
potentialErrorMessage.append( buffer );
|
||||
|
@ -3110,7 +3088,7 @@ public class Scanner implements IScanner {
|
|||
if( index == -1 ){
|
||||
handleProblem( IProblem.PREPROCESSOR_MACRO_USAGE_ERROR, expansion.getName(), getCurrentOffset(), false, true );
|
||||
return;
|
||||
} else {
|
||||
}
|
||||
buffer.append('\"');
|
||||
String value = (String)parameterValuesForStringizing.elementAt(index);
|
||||
char val [] = value.toCharArray();
|
||||
|
@ -3134,7 +3112,7 @@ public class Scanner implements IScanner {
|
|||
}
|
||||
}
|
||||
buffer.append('\"');
|
||||
}
|
||||
|
||||
} else {
|
||||
switch( t.getType() )
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue