From 54d378990c2eb356932bd9c226f24f2777b0cbad Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Sun, 25 Nov 2012 11:07:20 -0800 Subject: [PATCH] Add missing switch cases. --- .../core/dom/parser/c/CBasicType.java | 38 +++++++++---------- .../core/dom/parser/cpp/CPPBasicType.java | 2 + .../cpp/semantics/BuiltinOperators.java | 14 +++++-- 3 files changed, 29 insertions(+), 25 deletions(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CBasicType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CBasicType.java index e94f50e43d9..bd3d0b23c36 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CBasicType.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CBasicType.java @@ -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; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPBasicType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPBasicType.java index ca4055b69f9..12a06267a49 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPBasicType.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPBasicType.java @@ -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; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/BuiltinOperators.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/BuiltinOperators.java index 4032094ee4b..4c5ff020493 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/BuiltinOperators.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/BuiltinOperators.java @@ -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: