Bug 468492: Add _Decimal types.
authorRoberto Oliveira <rdutra@linux.vnet.ibm.com>
Fri, 29 May 2015 13:12:19 +0000 (10:12 -0300)
committerRoberto Oliveira <rdutra@linux.vnet.ibm.com>
Fri, 29 May 2015 20:51:48 +0000 (17:51 -0300)
- Types added: _Decimal32, _Decimal64, _Decimal128.

Change-Id: I9660dfa16f860b5fd31cf028812f1ab464b18709
Signed-off-by: Roberto Oliveira <rdutra@linux.vnet.ibm.com>
21 files changed:
core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/GCCCompleteParseExtensionsTest.java
core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/ASTStringUtil.java
core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTSignatureUtil.java
core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTTypeUtil.java
core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTSimpleDeclSpecifier.java
core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IBasicType.java
core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/c/GCCScannerExtensionConfiguration.java
core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/parser/cpp/GPPScannerExtensionConfiguration.java
core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/GCCKeywords.java
core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IGCCToken.java
core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/AbstractGNUSourceCodeParser.java
core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ArithmeticConversion.java
core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/SizeofCalculator.java
core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTSimpleDeclSpecifier.java
core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CBasicType.java
core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java
core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleDeclSpecifier.java
core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPBasicType.java
core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/BuiltinOperators.java
core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/astwriter/DeclSpecWriter.java

index 1e28157..7397abf 100644 (file)
@@ -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 {
index ec8fec0..a072f70 100644 (file)
@@ -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(' ');
index 948ab6b..be49061 100644 (file)
@@ -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);
index 4faddcf..d9f3fea 100644 (file)
@@ -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);
index b2fae8e..8deb193 100644 (file)
@@ -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
index 86a6937..8aa62bc 100644 (file)
@@ -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 */
index 4ffd8ac..c44e178 100644 (file)
@@ -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);
index 77bf6e8..addb207 100644 (file)
@@ -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);
index 9770db2..b120258 100644 (file)
@@ -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();
 }
index bace8d7..673baa3 100644 (file)
@@ -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;
 }
index 31b635a..add2ddf 100644 (file)
@@ -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:
index 688df89..9bfb114 100644 (file)
@@ -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;
        }
index 0be0ea4..0daa316 100644 (file)
@@ -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:
index 2c79ac1..edaae42 100644 (file)
@@ -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:
index e30b0ac..f57f2d7 100644 (file)
@@ -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;
                }
index 00754d9..2804f05 100644 (file)
@@ -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;
index aa8794d..1809865 100644 (file)
@@ -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:
index 693973a..d6ce647 100644 (file)
@@ -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;
                }
index b0f89a7..db0e813 100644 (file)
@@ -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;
index 8e67140..4f480b0 100644 (file)
@@ -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:
index 9c7e293..1bca821 100644 (file)
@@ -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;