1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

Fixed compiler warnings.

This commit is contained in:
Sergey Prigogin 2012-03-17 21:57:57 -07:00
parent 0496018fad
commit 4b719a56c7

View file

@ -1671,9 +1671,8 @@ public class CPPSemantics {
dtor.accept(visitor); dtor.accept(visitor);
} }
break; break;
case eEnumeration:
case eClassType: default:
case eTemplateDeclaration:
break; break;
} }
} }
@ -1696,7 +1695,7 @@ public class CPPSemantics {
IASTFunctionDeclarator declarator = functionDef.getDeclarator(); IASTFunctionDeclarator declarator = functionDef.getDeclarator();
if (!((ICPPASTDeclSpecifier) declSpec).isFriend()) { if (!((ICPPASTDeclSpecifier) declSpec).isFriend()) {
// check the function itself // Check the function itself
IASTName declName = ASTQueries.findInnermostDeclarator(declarator).getName(); IASTName declName = ASTQueries.findInnermostDeclarator(declarator).getName();
ASTInternal.addName(scope, declName); ASTInternal.addName(scope, declName);
} }
@ -1710,21 +1709,22 @@ public class CPPSemantics {
declSpec.accept(visitor); declSpec.accept(visitor);
declarator.accept(visitor); declarator.accept(visitor);
break; break;
case eClassType:
case eTemplateDeclaration: default:
case eEnumeration:
break; break;
} }
} }
} }
/** /**
* Perform lookup in nominated namespaces that appear in the given scope. For unqualified lookups the method assumes * Perform lookup in nominated namespaces that appear in the given scope. For unqualified
* that transitive directives have been stored in the lookup-data. For qualified lookups the transitive directives * lookups the method assumes that transitive directives have been stored in the lookup-data.
* are considered if the lookup of the original directive returns empty. * For qualified lookups the transitive directives are considered if the lookup of the original
* directive returns empty.
* @param fileSet * @param fileSet
*/ */
private static void lookupInNominated(LookupData data, IIndexFileSet fileSet, ICPPNamespaceScope scope) throws DOMException { private static void lookupInNominated(LookupData data, IIndexFileSet fileSet,
ICPPNamespaceScope scope) throws DOMException {
List<ICPPNamespaceScope> allNominated= data.usingDirectives.remove(scope); List<ICPPNamespaceScope> allNominated= data.usingDirectives.remove(scope);
while (allNominated != null) { while (allNominated != null) {
for (ICPPNamespaceScope nominated : allNominated) { for (ICPPNamespaceScope nominated : allNominated) {
@ -1740,9 +1740,9 @@ public class CPPSemantics {
found = true; found = true;
} }
// in the qualified lookup we have to nominate the transitive directives only when // In the qualified lookup we have to nominate the transitive directives only when
// the lookup did not succeed. In the qualified case this is done earlier, when the directive // the lookup did not succeed. In the qualified case this is done earlier, when
// is encountered. // the directive is encountered.
if (!found && data.qualified() && !data.contentAssist) { if (!found && data.qualified() && !data.contentAssist) {
if (data.tu != null) { if (data.tu != null) {
data.tu.handleAdditionalDirectives(nominated); data.tu.handleAdditionalDirectives(nominated);
@ -1753,7 +1753,7 @@ public class CPPSemantics {
} }
} }
} }
// retry with transitive directives that may have been nominated in a qualified lookup // Retry with transitive directives that may have been nominated in a qualified lookup
allNominated= data.usingDirectives.remove(scope); allNominated= data.usingDirectives.remove(scope);
} }
} }
@ -1778,11 +1778,11 @@ public class CPPSemantics {
return null; return null;
} }
// bug 238180 // Bug 238180
if (candidate instanceof ICPPClassTemplatePartialSpecialization) if (candidate instanceof ICPPClassTemplatePartialSpecialization)
return null; return null;
// specialization is selected during instantiation // Specialization is selected during instantiation
if (candidate instanceof ICPPTemplateInstance) if (candidate instanceof ICPPTemplateInstance)
candidate= ((ICPPTemplateInstance) candidate).getSpecializedBinding(); candidate= ((ICPPTemplateInstance) candidate).getSpecializedBinding();
@ -1829,7 +1829,7 @@ public class CPPSemantics {
int pointOfDecl= -1; int pointOfDecl= -1;
if (obj instanceof ICPPInternalBinding) { if (obj instanceof ICPPInternalBinding) {
ICPPInternalBinding cpp = (ICPPInternalBinding) obj; ICPPInternalBinding cpp = (ICPPInternalBinding) obj;
// for bindings in global or namespace scope we don't know whether there is a // For bindings in global or namespace scope we don't know whether there is a
// previous declaration in one of the skipped header files. For bindings that // previous declaration in one of the skipped header files. For bindings that
// are likely to be redeclared we need to assume that there is a declaration // are likely to be redeclared we need to assume that there is a declaration
// in one of the headers. // in one of the headers.
@ -1865,7 +1865,8 @@ public class CPPSemantics {
if (pointOfDecl < 0 && nd != null) { if (pointOfDecl < 0 && nd != null) {
ASTNodeProperty prop = nd.getPropertyInParent(); ASTNodeProperty prop = nd.getPropertyInParent();
if (prop == IASTDeclarator.DECLARATOR_NAME || nd instanceof IASTDeclarator) { if (prop == IASTDeclarator.DECLARATOR_NAME || nd instanceof IASTDeclarator) {
// point of declaration for a name is immediately after its complete declarator and before its initializer // Point of declaration for a name is immediately after its complete declarator
// and before its initializer.
IASTDeclarator dtor = (IASTDeclarator)((nd instanceof IASTDeclarator) ? nd : nd.getParent()); IASTDeclarator dtor = (IASTDeclarator)((nd instanceof IASTDeclarator) ? nd : nd.getParent());
while (dtor.getParent() instanceof IASTDeclarator) while (dtor.getParent() instanceof IASTDeclarator)
dtor = (IASTDeclarator) dtor.getParent(); dtor = (IASTDeclarator) dtor.getParent();
@ -1875,7 +1876,8 @@ public class CPPSemantics {
else else
pointOfDecl = ((ASTNode) dtor).getOffset() + ((ASTNode) dtor).getLength(); pointOfDecl = ((ASTNode) dtor).getOffset() + ((ASTNode) dtor).getLength();
} else if (prop == IASTEnumerator.ENUMERATOR_NAME) { } else if (prop == IASTEnumerator.ENUMERATOR_NAME) {
// point of declaration for an enumerator is immediately after it enumerator-definition // Point of declaration for an enumerator is immediately after it
// enumerator-definition
IASTEnumerator enumtor = (IASTEnumerator) nd.getParent(); IASTEnumerator enumtor = (IASTEnumerator) nd.getParent();
if (enumtor.getValue() != null) { if (enumtor.getValue() != null) {
ASTNode exp = (ASTNode) enumtor.getValue(); ASTNode exp = (ASTNode) enumtor.getValue();
@ -1906,7 +1908,7 @@ public class CPPSemantics {
} else if (cpp instanceof ICompositeType || cpp instanceof IEnumeration) { } else if (cpp instanceof ICompositeType || cpp instanceof IEnumeration) {
IScope scope= cpp.getScope(); IScope scope= cpp.getScope();
if (!(scope instanceof ICPPBlockScope) && scope instanceof ICPPNamespaceScope) { if (!(scope instanceof ICPPBlockScope) && scope instanceof ICPPNamespaceScope) {
// if this is not the definition, it may be found in a header. (bug 229571) // If this is not the definition, it may be found in a header. (bug 229571)
if (cpp.getDefinition() == null) { if (cpp.getDefinition() == null) {
return true; return true;
} }
@ -1956,7 +1958,7 @@ public class CPPSemantics {
continue; continue;
} }
// select among those bindings that have been created without problems. // Select among those bindings that have been created without problems.
if (temp instanceof IProblemBinding) if (temp instanceof IProblemBinding)
continue; continue;
@ -1984,7 +1986,7 @@ public class CPPSemantics {
fns = new ObjectSet<ICPPFunction>(2); fns = new ObjectSet<ICPPFunction>(2);
fns.put((ICPPFunction) temp); fns.put((ICPPFunction) temp);
} else if (temp instanceof IType) { } else if (temp instanceof IType) {
// specializations are selected during instantiation // Specializations are selected during instantiation
if (temp instanceof ICPPClassTemplatePartialSpecialization) if (temp instanceof ICPPClassTemplatePartialSpecialization)
continue; continue;
if (temp instanceof ICPPTemplateInstance) { if (temp instanceof ICPPTemplateInstance) {
@ -2213,7 +2215,7 @@ public class CPPSemantics {
return -1; // function from ast return -1; // function from ast
} }
} }
// everything is from the index // Everything is from the index
if (!isReachableFromAst(data.tu, obj)) { if (!isReachableFromAst(data.tu, obj)) {
return -1; // obj not reachable return -1; // obj not reachable
} }