1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Add missing switch cases.

This commit is contained in:
Sergey Prigogin 2012-11-25 11:07:20 -08:00
parent fc1e9a4225
commit 54d378990c
3 changed files with 29 additions and 25 deletions

View file

@ -1,13 +1,13 @@
/*******************************************************************************
* Copyright (c) 2005, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
* Copyright (c) 2005, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Devin Steffler (IBM Rational Software) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Contributors:
* Devin Steffler (IBM Rational Software) - Initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c;
@ -24,8 +24,8 @@ import org.eclipse.core.runtime.CoreException;
public class CBasicType implements ICBasicType, ISerializableType {
private final Kind fKind;
private int fModifiers = 0;
private IASTExpression value = null;
private int fModifiers;
private IASTExpression value;
public CBasicType(Kind kind, int modifiers, IASTExpression value) {
if (kind == Kind.eUnspecified) {
@ -124,16 +124,16 @@ public class CBasicType implements ICBasicType, ISerializableType {
if (obj instanceof ITypedef)
return obj.isSameType(this);
if (!(obj instanceof ICBasicType)) return false;
if (!(obj instanceof ICBasicType))
return false;
ICBasicType cObj = (ICBasicType)obj;
if (fKind != cObj.getKind()) {
if (fKind != cObj.getKind())
return false;
}
if (fKind == Kind.eInt) {
//signed int and int are equivalent
// Signed int and int are equivalent
return (fModifiers & ~IS_SIGNED) == (cObj.getModifiers() & ~IS_SIGNED);
} else {
return (fModifiers == cObj.getModifiers());
@ -146,7 +146,7 @@ public class CBasicType implements ICBasicType, ISerializableType {
try {
t = (IType) super.clone();
} catch (CloneNotSupportedException e) {
//not going to happen
// Not going to happen
}
return t;
}
@ -157,17 +157,11 @@ public class CBasicType implements ICBasicType, ISerializableType {
return value;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.ICBasicType#isComplex()
*/
@Override
public boolean isComplex() {
return (fModifiers & IS_COMPLEX) != 0;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.c.ICBasicType#isImaginary()
*/
@Override
public boolean isImaginary() {
return (fModifiers & IS_IMAGINARY) != 0;
@ -222,6 +216,8 @@ public class CBasicType implements ICBasicType, ISerializableType {
case eUnspecified:
return t_unspecified;
case eNullPtr:
case eInt128:
case eFloat128:
// Null pointer type cannot be expressed wit ha simple decl specifier.
break;
}

View file

@ -277,6 +277,8 @@ public class CPPBasicType implements ICPPBasicType, ISerializableType {
case eUnspecified:
return t_unspecified;
case eNullPtr:
case eInt128:
case eFloat128:
// Null pointer type cannot be expressed wit ha simple decl specifier.
break;
}

View file

@ -586,22 +586,24 @@ class BuiltinOperators {
return type instanceof ICPPPointerToMemberType;
}
private boolean isBoolean(IType type) {
private static boolean isBoolean(IType type) {
return type instanceof IBasicType && ((IBasicType) type).getKind() == Kind.eBoolean;
}
private boolean isFloatingPoint(IType type) {
private static boolean isFloatingPoint(IType type) {
if (type instanceof IBasicType) {
IBasicType.Kind kind= ((IBasicType) type).getKind();
switch (kind) {
case eDouble:
case eFloat:
case eFloat128:
return true;
case eBoolean:
case eChar:
case eChar16:
case eChar32:
case eInt:
case eInt128:
case eWChar:
case eUnspecified:
case eVoid:
@ -612,7 +614,7 @@ class BuiltinOperators {
return false;
}
private boolean isArithmetic(IType type) {
private static boolean isArithmetic(IType type) {
if (type instanceof IBasicType) {
IBasicType.Kind kind= ((IBasicType) type).getKind();
switch (kind) {
@ -622,7 +624,9 @@ class BuiltinOperators {
case eChar32:
case eDouble:
case eFloat:
case eFloat128:
case eInt:
case eInt128:
case eWChar:
return true;
case eUnspecified:
@ -634,7 +638,7 @@ class BuiltinOperators {
return false;
}
private boolean isIntegral(IType type) {
private static boolean isIntegral(IType type) {
if (type instanceof IBasicType) {
IBasicType.Kind kind= ((IBasicType) type).getKind();
switch (kind) {
@ -643,10 +647,12 @@ class BuiltinOperators {
case eChar16:
case eChar32:
case eInt:
case eInt128:
case eWChar:
return true;
case eDouble:
case eFloat:
case eFloat128:
case eUnspecified:
case eVoid:
case eNullPtr: