diff options
author | Roberto Oliveira | 2015-05-29 13:12:19 +0000 |
---|---|---|
committer | Sergey Prigogin | 2015-05-29 22:03:27 +0000 |
commit | cfe522bc394f1cf4c649c6824e4016357338f548 (patch) | |
tree | 394ba81ace07d6506379c7d5257faedc436c0725 | |
parent | 7454dc2db5a6b3283535a716358dd3ae78c96438 (diff) | |
download | org.eclipse.cdt-cfe522bc394f1cf4c649c6824e4016357338f548.tar.gz org.eclipse.cdt-cfe522bc394f1cf4c649c6824e4016357338f548.tar.xz org.eclipse.cdt-cfe522bc394f1cf4c649c6824e4016357338f548.zip |
Bug 468492: Add _Decimal types.
- Types added: _Decimal32, _Decimal64, _Decimal128.
Change-Id: I9660dfa16f860b5fd31cf028812f1ab464b18709
Signed-off-by: Roberto Oliveira <rdutra@linux.vnet.ibm.com>
21 files changed, 259 insertions, 25 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/GCCCompleteParseExtensionsTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/GCCCompleteParseExtensionsTest.java index 1e281575767..7397abf8147 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/GCCCompleteParseExtensionsTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/GCCCompleteParseExtensionsTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2011 IBM Corporation and others. + * Copyright (c) 2004, 2015 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 @@ -433,6 +433,27 @@ public class GCCCompleteParseExtensionsTest extends AST2TestBase { parseGPP(code); } + // _Decimal32 x; + public void test_Decimal32() throws Exception { + String code= getAboveComment(); + parseGCC(code); + parseGPP(code); + } + + // _Decimal64 x; + public void test_Decimal64() throws Exception { + String code= getAboveComment(); + parseGCC(code); + parseGPP(code); + } + + // _Decimal128 x; + public void test_Decimal128() throws Exception { + String code= getAboveComment(); + parseGCC(code); + parseGPP(code); + } + // struct waldo { // } __attribute__((__aligned__((1)))); public void test__attribute__aligned_bug400204() throws Exception { diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ASTStringUtil.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ASTStringUtil.java index ec8fec08071..a072f706bd3 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ASTStringUtil.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ASTStringUtil.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2014 Wind River Systems, Inc. and others. + * Copyright (c) 2006, 2015 Wind River Systems, Inc. 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 @@ -659,6 +659,15 @@ public class ASTStringUtil { case IASTSimpleDeclSpecifier.t_float128: buffer.append(GCCKeywords.cp__float128).append(' '); break; + case IASTSimpleDeclSpecifier.t_decimal32: + buffer.append(GCCKeywords.cp_decimal32).append(' '); + break; + case IASTSimpleDeclSpecifier.t_decimal64: + buffer.append(GCCKeywords.cp_decimal64).append(' '); + break; + case IASTSimpleDeclSpecifier.t_decimal128: + buffer.append(GCCKeywords.cp_decimal128).append(' '); + break; case IASTSimpleDeclSpecifier.t_bool: if (simpleDeclSpec instanceof ICASTSimpleDeclSpecifier) { buffer.append(Keywords.cBOOL).append(' '); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTSignatureUtil.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTSignatureUtil.java index 948ab6b3998..be490613760 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTSignatureUtil.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTSignatureUtil.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 IBM Corporation and others. + * Copyright (c) 2005, 2015 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 @@ -787,6 +787,30 @@ public class ASTSignatureUtil { result.append(GCCKeywords.__FLOAT128); needSpace = true; break; + case IASTSimpleDeclSpecifier.t_decimal32: + if (needSpace) { + result.append(SPACE); + needSpace = false; + } + result.append(GCCKeywords._DECIMAL32); + needSpace = true; + break; + case IASTSimpleDeclSpecifier.t_decimal64: + if (needSpace) { + result.append(SPACE); + needSpace = false; + } + result.append(GCCKeywords._DECIMAL64); + needSpace = true; + break; + case IASTSimpleDeclSpecifier.t_decimal128: + if (needSpace) { + result.append(SPACE); + needSpace = false; + } + result.append(GCCKeywords._DECIMAL128); + needSpace = true; + break; case IASTSimpleDeclSpecifier.t_void: if (needSpace) { result.append(SPACE); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java index 4faddcf578a..d9f3feaa0f4 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2014 IBM Corporation and others. + * Copyright (c) 2005, 2015 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 @@ -328,6 +328,18 @@ public class ASTTypeUtil { if (needSpace) result.append(SPACE); result.append(GCCKeywords.__FLOAT128); break; + case eDecimal32: + if (needSpace) result.append(SPACE); + result.append(GCCKeywords._DECIMAL32); + break; + case eDecimal64: + if (needSpace) result.append(SPACE); + result.append(GCCKeywords._DECIMAL64); + break; + case eDecimal128: + if (needSpace) result.append(SPACE); + result.append(GCCKeywords._DECIMAL128); + break; case eInt: if (needSpace) result.append(SPACE); result.append(Keywords.INT); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTSimpleDeclSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTSimpleDeclSpecifier.java index b2fae8e79c3..8deb193b2a1 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTSimpleDeclSpecifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTSimpleDeclSpecifier.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2010 IBM Corporation and others. + * Copyright (c) 2004, 2015 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 @@ -113,6 +113,24 @@ public interface IASTSimpleDeclSpecifier extends IASTDeclSpecifier { public static final int t_float128 = 14; /** + * <code>_Decimal32 i;</code> + * @since 5.10 + */ + public static final int t_decimal32 = 15; + + /** + * <code>_Decimal64 i;</code> + * @since 5.10 + */ + public static final int t_decimal64 = 16; + + /** + * <code>_Decimal128 i;</code> + * @since 5.10 + */ + public static final int t_decimal128 = 17; + + /** * @since 5.1 */ @Override diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IBasicType.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IBasicType.java index 86a69376d77..8aa62bc2ec6 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IBasicType.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IBasicType.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2010 IBM Corporation and others. + * Copyright (c) 2004, 2015 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 @@ -24,7 +24,9 @@ public interface IBasicType extends IType { enum Kind { eUnspecified, eVoid, eChar, eWChar, eInt, eFloat, eDouble, eBoolean, eChar16, eChar32, /** @since 5.4 */ eNullPtr, - /** @since 5.5 */ eInt128, /** @since 5.5 */ eFloat128 + /** @since 5.5 */ eInt128, /** @since 5.5 */ eFloat128, + /** @since 5.10 */ eDecimal32, /** @since 5.10 */eDecimal64, + /** @since 5.10 */ eDecimal128; } /** @since 5.2 */ diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/c/GCCScannerExtensionConfiguration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/c/GCCScannerExtensionConfiguration.java index 4ffd8ac64b3..c44e178259c 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/c/GCCScannerExtensionConfiguration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/c/GCCScannerExtensionConfiguration.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2010 IBM Corporation and others. + * Copyright (c) 2004, 2015 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 @@ -24,8 +24,10 @@ import org.eclipse.cdt.core.parser.IScannerInfo; * Configures the preprocessor for parsing c-sources as accepted by gcc. */ public class GCCScannerExtensionConfiguration extends GNUScannerExtensionConfiguration { + private static final int VERSION_4_2 = version(4, 2); private static final int VERSION_4_7 = version(4, 7); private static GCCScannerExtensionConfiguration CONFIG= new GCCScannerExtensionConfiguration(); + private static GCCScannerExtensionConfiguration CONFIG_4_2= new GCCScannerExtensionConfiguration(VERSION_4_2); private static GCCScannerExtensionConfiguration CONFIG_4_7= new GCCScannerExtensionConfiguration(VERSION_4_7); /** @@ -48,6 +50,9 @@ public class GCCScannerExtensionConfiguration extends GNUScannerExtensionConfigu if (version >= VERSION_4_7) { return CONFIG_4_7; } + if (version >= VERSION_4_2) { + return CONFIG_4_2; + } } catch (Exception e) { // Fall-back to the default configuration. } @@ -67,6 +72,11 @@ public class GCCScannerExtensionConfiguration extends GNUScannerExtensionConfigu addMacro("__null", "(void *)0"); addMacro("__builtin_offsetof(T,m)", "((size_t) &((T *)0)->m)"); + if (version >= VERSION_4_2) { + addKeyword(GCCKeywords.cp_decimal32, IGCCToken.t_decimal32); + addKeyword(GCCKeywords.cp_decimal64, IGCCToken.t_decimal64); + addKeyword(GCCKeywords.cp_decimal128, IGCCToken.t_decimal128); + } if (version >= VERSION_4_7) { addKeyword(GCCKeywords.cp__float128, IGCCToken.t__float128); addKeyword(GCCKeywords.cp__int128, IGCCToken.t__int128); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/cpp/GPPScannerExtensionConfiguration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/cpp/GPPScannerExtensionConfiguration.java index 77bf6e8c220..addb207c0f7 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/cpp/GPPScannerExtensionConfiguration.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/cpp/GPPScannerExtensionConfiguration.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2009 IBM Corporation and others. + * Copyright (c) 2004, 2015 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 @@ -27,10 +27,12 @@ import org.eclipse.cdt.core.parser.Keywords; * Configures the preprocessor for c++-sources as accepted by g++. */ public class GPPScannerExtensionConfiguration extends GNUScannerExtensionConfiguration { + private static final int VERSION_4_2 = version(4, 2); private static final int VERSION_4_3 = version(4, 3); private static final int VERSION_4_6 = version(4, 6); private static final int VERSION_4_7 = version(4, 7); private static GPPScannerExtensionConfiguration CONFIG= new GPPScannerExtensionConfiguration(); + private static GPPScannerExtensionConfiguration CONFIG_4_2= new GPPScannerExtensionConfiguration(VERSION_4_2); private static GPPScannerExtensionConfiguration CONFIG_4_3= new GPPScannerExtensionConfiguration(VERSION_4_3); private static GPPScannerExtensionConfiguration CONFIG_4_6= new GPPScannerExtensionConfiguration(VERSION_4_6); private static GPPScannerExtensionConfiguration CONFIG_4_7= new GPPScannerExtensionConfiguration(VERSION_4_7); @@ -58,6 +60,9 @@ public class GPPScannerExtensionConfiguration extends GNUScannerExtensionConfigu if (version >= VERSION_4_3) { return CONFIG_4_3; } + if (version >= VERSION_4_2) { + return CONFIG_4_2; + } } catch (Exception e) { // Fall-back to the default configuration. } @@ -78,7 +83,12 @@ public class GPPScannerExtensionConfiguration extends GNUScannerExtensionConfigu addMacro("__builtin_offsetof(T,m)", "(reinterpret_cast <size_t>(&reinterpret_cast <const volatile char &>(static_cast<T*> (0)->m)))"); addKeyword(Keywords.c_COMPLEX, IToken.t__Complex); addKeyword(Keywords.c_IMAGINARY, IToken.t__Imaginary); - + + if (version >= VERSION_4_2) { + addKeyword(GCCKeywords.cp_decimal32, IGCCToken.t_decimal32); + addKeyword(GCCKeywords.cp_decimal64, IGCCToken.t_decimal64); + addKeyword(GCCKeywords.cp_decimal128, IGCCToken.t_decimal128); + } // Type-traits supported by gcc 4.3 if (version >= VERSION_4_3) { addKeyword(GCCKeywords.cp__has_nothrow_assign, IGCCToken.tTT_has_nothrow_assign); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/GCCKeywords.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/GCCKeywords.java index 9770db2f6b9..b120258240f 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/GCCKeywords.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/GCCKeywords.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2012 IBM Corporation and others. + * Copyright (c) 2002, 2015 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 @@ -31,6 +31,12 @@ public class GCCKeywords { public static final String __FLOAT128 = "__float128"; /** @since 5.9 */ public static final String __FINAL = "__final"; + /** @since 5.10 */ + public static final String _DECIMAL32 = "_Decimal32"; + /** @since 5.10 */ + public static final String _DECIMAL64 = "_Decimal64"; + /** @since 5.10 */ + public static final String _DECIMAL128 = "_Decimal128"; public static final char[] cpTYPEOF = TYPEOF.toCharArray(), @@ -90,4 +96,10 @@ public class GCCKeywords { /** @since 5.9 */ public static final char[] cp__FINAL= __FINAL.toCharArray(); + + /** @since 5.10 */ + public static final char[] + cp_decimal32= _DECIMAL32.toCharArray(), + cp_decimal64= _DECIMAL64.toCharArray(), + cp_decimal128= _DECIMAL128.toCharArray(); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IGCCToken.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IGCCToken.java index bace8d7fe28..673baa3e5fd 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IGCCToken.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IGCCToken.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2011 IBM Corporation and others. + * Copyright (c) 2002, 2015 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 @@ -50,4 +50,8 @@ public interface IGCCToken extends IToken { /** @since 5.6 */ int tTT_is_final= FIRST_RESERVED_IGCCToken + 27; /** @since 5.6 */ int tTT_underlying_type= FIRST_RESERVED_IGCCToken + 28; + + /** @since 5.10 */ int t_decimal32= FIRST_RESERVED_IGCCToken + 29; + /** @since 5.10 */ int t_decimal64= FIRST_RESERVED_IGCCToken + 30; + /** @since 5.10 */ int t_decimal128= FIRST_RESERVED_IGCCToken + 31; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/AbstractGNUSourceCodeParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/AbstractGNUSourceCodeParser.java index 31b635a5318..add2ddf7e9c 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/AbstractGNUSourceCodeParser.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/AbstractGNUSourceCodeParser.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2014 IBM Corporation and others. + * Copyright (c) 2005, 2015 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 @@ -2622,6 +2622,9 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser { case IToken.t__Imaginary: case IGCCToken.t__int128: case IGCCToken.t__float128: + case IGCCToken.t_decimal32: + case IGCCToken.t_decimal64: + case IGCCToken.t_decimal128: case IToken.t_signed: case IToken.t_unsigned: case IToken.t_decltype: diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ArithmeticConversion.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ArithmeticConversion.java index 688df89f853..9bfb114898a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ArithmeticConversion.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ArithmeticConversion.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2014 Wind River Systems, Inc. and others. + * Copyright (c) 2009, 2015 Wind River Systems, Inc. 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 @@ -130,6 +130,9 @@ public abstract class ArithmeticConversion { case eDouble: case eFloat: case eFloat128: + case eDecimal32: + case eDecimal64: + case eDecimal128: case eUnspecified: case eVoid: case eNullPtr: @@ -242,6 +245,9 @@ public abstract class ArithmeticConversion { case eDouble: case eFloat: case eFloat128: + case eDecimal32: + case eDecimal64: + case eDecimal128: case eNullPtr: assert false; } @@ -294,7 +300,8 @@ public abstract class ArithmeticConversion { private boolean isLongDouble(IType type) { if (type instanceof IBasicType) { final IBasicType bt= (IBasicType) type; - return bt.isLong() && bt.getKind() == Kind.eDouble || bt.getKind() == Kind.eFloat128; + return bt.isLong() && bt.getKind() == Kind.eDouble || bt.getKind() == Kind.eFloat128 || + bt.getKind() == Kind.eDecimal128; } return false; } @@ -302,7 +309,7 @@ public abstract class ArithmeticConversion { private static boolean isDouble(IType type) { if (type instanceof IBasicType) { final IBasicType bt= (IBasicType) type; - return bt.getKind() == Kind.eDouble; + return bt.getKind() == Kind.eDouble || bt.getKind() == Kind.eDecimal64; } return false; } @@ -310,7 +317,7 @@ public abstract class ArithmeticConversion { private static boolean isFloat(IType type) { if (type instanceof IBasicType) { final IBasicType bt= (IBasicType) type; - return bt.getKind() == Kind.eFloat; + return bt.getKind() == Kind.eFloat || bt.getKind() == Kind.eDecimal32; } return false; } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/SizeofCalculator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/SizeofCalculator.java index 0be0ea437d7..0daa3168f2d 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/SizeofCalculator.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/SizeofCalculator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2014 Google, Inc and others. + * Copyright (c) 2011, 2015 Google, Inc 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 @@ -76,6 +76,9 @@ public class SizeofCalculator { public final SizeAndAlignment sizeof_complex_long_double; public final SizeAndAlignment sizeof_float128; public final SizeAndAlignment sizeof_complex_float128; + public final SizeAndAlignment sizeof_decimal32; + public final SizeAndAlignment sizeof_decimal64; + public final SizeAndAlignment sizeof_decimal128; private final IASTTranslationUnit ast; @@ -144,6 +147,9 @@ public class SizeofCalculator { sizeof_complex_long_double = getSizeOfPair(sizeof_long_double); sizeof_float128 = size_16; // GCC does not define __SIZEOF_FLOAT128__ sizeof_complex_float128 = getSizeOfPair(sizeof_float128); + sizeof_decimal32 = size_4; // GCC does not define __SIZEOF_DECIMAL32__ + sizeof_decimal64 = size_8; // GCC does not define __SIZEOF_DECIMAL64__ + sizeof_decimal128 = size_16; // GCC does not define __SIZEOF_DECIMAL128__ } private SizeofCalculator() { @@ -167,6 +173,9 @@ public class SizeofCalculator { sizeof_complex_long_double = null; sizeof_float128 = size_16; sizeof_complex_float128 = getSizeOfPair(sizeof_float128); + sizeof_decimal32 = size_4; + sizeof_decimal64 = size_8; + sizeof_decimal128 = size_16; ast = null; } @@ -233,6 +242,12 @@ public class SizeofCalculator { (type.isLong() ? sizeof_complex_long_double : sizeof_complex_double); case eFloat128: return type.isComplex() ? sizeof_complex_float128 : sizeof_float128; + case eDecimal32: + return sizeof_decimal32; + case eDecimal64: + return sizeof_decimal64; + case eDecimal128: + return sizeof_decimal128; case eWChar: return sizeof_wchar_t; case eChar16: diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTSimpleDeclSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTSimpleDeclSpecifier.java index 2c79ac1a182..edaae42e59a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTSimpleDeclSpecifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTSimpleDeclSpecifier.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2011 IBM Corporation and others. + * Copyright (c) 2005, 2015 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 @@ -106,6 +106,12 @@ public class CASTSimpleDeclSpecifier extends CASTBaseDeclSpecifier implements IC return t_float; case eFloat128: return t_float; + case eDecimal32: + return t_decimal32; + case eDecimal64: + return t_decimal64; + case eDecimal128: + return t_decimal128; case eInt: return t_int; case eInt128: 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 e30b0ac1c68..f57f2d7cfc4 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,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 IBM Corporation and others. + * Copyright (c) 2005, 2015 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 @@ -75,6 +75,12 @@ public class CBasicType implements ICBasicType, ISerializableType { return Kind.eFloat; case IASTSimpleDeclSpecifier.t_float128: return Kind.eFloat128; + case IASTSimpleDeclSpecifier.t_decimal32: + return Kind.eDecimal32; + case IASTSimpleDeclSpecifier.t_decimal64: + return Kind.eDecimal64; + case IASTSimpleDeclSpecifier.t_decimal128: + return Kind.eDecimal128; case IASTSimpleDeclSpecifier.t_int: return Kind.eInt; case IASTSimpleDeclSpecifier.t_int128: @@ -218,6 +224,9 @@ public class CBasicType implements ICBasicType, ISerializableType { case eNullPtr: case eInt128: case eFloat128: + case eDecimal32: + case eDecimal64: + case eDecimal128: // 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/c/GNUCSourceParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java index 00754d9978b..2804f055f88 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2014 IBM Corporation and others. + * Copyright (c) 2005, 2015 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 @@ -1042,6 +1042,27 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser { encounteredRawType= true; endOffset= consume().getEndOffset(); break; + case IGCCToken.t_decimal32: + if (encounteredTypename) + break declSpecifiers; + simpleType = IASTSimpleDeclSpecifier.t_decimal32; + encounteredRawType= true; + endOffset= consume().getEndOffset(); + break; + case IGCCToken.t_decimal64: + if (encounteredTypename) + break declSpecifiers; + simpleType = IASTSimpleDeclSpecifier.t_decimal64; + encounteredRawType= true; + endOffset= consume().getEndOffset(); + break; + case IGCCToken.t_decimal128: + if (encounteredTypename) + break declSpecifiers; + simpleType = IASTSimpleDeclSpecifier.t_decimal128; + encounteredRawType= true; + endOffset= consume().getEndOffset(); + break; case IToken.t_signed: if (encounteredTypename) break declSpecifiers; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleDeclSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleDeclSpecifier.java index aa8794d9d77..1809865a257 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleDeclSpecifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleDeclSpecifier.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2014 IBM Corporation and others. + * Copyright (c) 2004, 2015 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 @@ -93,6 +93,12 @@ public class CPPASTSimpleDeclSpecifier extends CPPASTBaseDeclSpecifier return t_float; case eFloat128: return t_float128; + case eDecimal32: + return t_decimal32; + case eDecimal64: + return t_decimal64; + case eDecimal128: + return t_decimal128; case eInt: return t_int; case eInt128: 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 693973ac6f5..d6ce647123f 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2014 IBM Corporation and others. + * Copyright (c) 2004, 2015 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 @@ -115,6 +115,12 @@ public class CPPBasicType implements ICPPBasicType, ISerializableType { return Kind.eFloat; case IASTSimpleDeclSpecifier.t_float128: return Kind.eFloat128; + case IASTSimpleDeclSpecifier.t_decimal32: + return Kind.eDecimal32; + case IASTSimpleDeclSpecifier.t_decimal64: + return Kind.eDecimal64; + case IASTSimpleDeclSpecifier.t_decimal128: + return Kind.eDecimal128; case IASTSimpleDeclSpecifier.t_int: return Kind.eInt; case IASTSimpleDeclSpecifier.t_int128: @@ -295,6 +301,9 @@ public class CPPBasicType implements ICPPBasicType, ISerializableType { case eNullPtr: case eInt128: case eFloat128: + case eDecimal32: + case eDecimal64: + case eDecimal128: // 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/GNUCPPSourceParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java index b0f89a7c55b..db0e813c941 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java @@ -3098,6 +3098,27 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser { encounteredRawType= true; endOffset= consume().getEndOffset(); break; + case IGCCToken.t_decimal32: + if (encounteredTypename) + break declSpecifiers; + simpleType = IASTSimpleDeclSpecifier.t_decimal32; + encounteredRawType= true; + endOffset= consume().getEndOffset(); + break; + case IGCCToken.t_decimal64: + if (encounteredTypename) + break declSpecifiers; + simpleType = IASTSimpleDeclSpecifier.t_decimal64; + encounteredRawType= true; + endOffset= consume().getEndOffset(); + break; + case IGCCToken.t_decimal128: + if (encounteredTypename) + break declSpecifiers; + simpleType = IASTSimpleDeclSpecifier.t_decimal128; + encounteredRawType= true; + endOffset= consume().getEndOffset(); + break; case IToken.t_void: if (encounteredTypename) break declSpecifiers; 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 8e671402479..4f480b04ef8 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2012 Wind River Systems, Inc. and others. + * Copyright (c) 2010, 2015 Wind River Systems, Inc. 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 @@ -597,6 +597,9 @@ class BuiltinOperators { case eDouble: case eFloat: case eFloat128: + case eDecimal32: + case eDecimal64: + case eDecimal128: return true; case eBoolean: case eChar: @@ -625,6 +628,9 @@ class BuiltinOperators { case eDouble: case eFloat: case eFloat128: + case eDecimal32: + case eDecimal64: + case eDecimal128: case eInt: case eInt128: case eWChar: @@ -653,6 +659,9 @@ class BuiltinOperators { case eDouble: case eFloat: case eFloat128: + case eDecimal32: + case eDecimal64: + case eDecimal128: case eUnspecified: case eVoid: case eNullPtr: diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclSpecWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclSpecWriter.java index 9c7e293c67a..1bca8212414 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclSpecWriter.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclSpecWriter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2014 Institute for Software, HSR Hochschule fuer Technik + * Copyright (c) 2008, 2015 Institute for Software, HSR Hochschule fuer Technik * Rapperswil, University of applied sciences and others * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -92,6 +92,12 @@ public class DeclSpecWriter extends NodeWriter { return Keywords.DOUBLE; case IASTSimpleDeclSpecifier.t_float128: return GCCKeywords.__FLOAT128; + case IASTSimpleDeclSpecifier.t_decimal32: + return GCCKeywords._DECIMAL32; + case IASTSimpleDeclSpecifier.t_decimal64: + return GCCKeywords._DECIMAL64; + case IASTSimpleDeclSpecifier.t_decimal128: + return GCCKeywords._DECIMAL128; case IASTSimpleDeclSpecifier.t_bool: return isCpp ? Keywords.BOOL : Keywords._BOOL; |