1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-26 10:25:32 +02:00

Bug 468492: Add _Decimal types.

- Types added: _Decimal32, _Decimal64, _Decimal128.

Change-Id: I9660dfa16f860b5fd31cf028812f1ab464b18709
Signed-off-by: Roberto Oliveira <rdutra@linux.vnet.ibm.com>
This commit is contained in:
Roberto Oliveira 2015-05-29 10:12:19 -03:00 committed by Sergey Prigogin
parent 7454dc2db5
commit cfe522bc39
21 changed files with 259 additions and 25 deletions

View 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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -433,6 +433,27 @@ public class GCCCompleteParseExtensionsTest extends AST2TestBase {
parseGPP(code); 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 { // struct waldo {
// } __attribute__((__aligned__((1)))); // } __attribute__((__aligned__((1))));
public void test__attribute__aligned_bug400204() throws Exception { public void test__attribute__aligned_bug400204() throws Exception {

View 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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -659,6 +659,15 @@ public class ASTStringUtil {
case IASTSimpleDeclSpecifier.t_float128: case IASTSimpleDeclSpecifier.t_float128:
buffer.append(GCCKeywords.cp__float128).append(' '); buffer.append(GCCKeywords.cp__float128).append(' ');
break; 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: case IASTSimpleDeclSpecifier.t_bool:
if (simpleDeclSpec instanceof ICASTSimpleDeclSpecifier) { if (simpleDeclSpec instanceof ICASTSimpleDeclSpecifier) {
buffer.append(Keywords.cBOOL).append(' '); buffer.append(Keywords.cBOOL).append(' ');

View 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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -787,6 +787,30 @@ public class ASTSignatureUtil {
result.append(GCCKeywords.__FLOAT128); result.append(GCCKeywords.__FLOAT128);
needSpace = true; needSpace = true;
break; 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: case IASTSimpleDeclSpecifier.t_void:
if (needSpace) { if (needSpace) {
result.append(SPACE); result.append(SPACE);

View 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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -328,6 +328,18 @@ public class ASTTypeUtil {
if (needSpace) result.append(SPACE); if (needSpace) result.append(SPACE);
result.append(GCCKeywords.__FLOAT128); result.append(GCCKeywords.__FLOAT128);
break; 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: case eInt:
if (needSpace) result.append(SPACE); if (needSpace) result.append(SPACE);
result.append(Keywords.INT); result.append(Keywords.INT);

View 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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -112,6 +112,24 @@ public interface IASTSimpleDeclSpecifier extends IASTDeclSpecifier {
*/ */
public static final int t_float128 = 14; 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 * @since 5.1
*/ */

View 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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -24,7 +24,9 @@ public interface IBasicType extends IType {
enum Kind { enum Kind {
eUnspecified, eVoid, eChar, eWChar, eInt, eFloat, eDouble, eUnspecified, eVoid, eChar, eWChar, eInt, eFloat, eDouble,
eBoolean, eChar16, eChar32, /** @since 5.4 */ eNullPtr, 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 */ /** @since 5.2 */

View 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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * 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. * Configures the preprocessor for parsing c-sources as accepted by gcc.
*/ */
public class GCCScannerExtensionConfiguration extends GNUScannerExtensionConfiguration { 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 final int VERSION_4_7 = version(4, 7);
private static GCCScannerExtensionConfiguration CONFIG= new GCCScannerExtensionConfiguration(); 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); 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) { if (version >= VERSION_4_7) {
return CONFIG_4_7; return CONFIG_4_7;
} }
if (version >= VERSION_4_2) {
return CONFIG_4_2;
}
} catch (Exception e) { } catch (Exception e) {
// Fall-back to the default configuration. // Fall-back to the default configuration.
} }
@ -67,6 +72,11 @@ public class GCCScannerExtensionConfiguration extends GNUScannerExtensionConfigu
addMacro("__null", "(void *)0"); addMacro("__null", "(void *)0");
addMacro("__builtin_offsetof(T,m)", "((size_t) &((T *)0)->m)"); 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) { if (version >= VERSION_4_7) {
addKeyword(GCCKeywords.cp__float128, IGCCToken.t__float128); addKeyword(GCCKeywords.cp__float128, IGCCToken.t__float128);
addKeyword(GCCKeywords.cp__int128, IGCCToken.t__int128); addKeyword(GCCKeywords.cp__int128, IGCCToken.t__int128);

View 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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * 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++. * Configures the preprocessor for c++-sources as accepted by g++.
*/ */
public class GPPScannerExtensionConfiguration extends GNUScannerExtensionConfiguration { 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_3 = version(4, 3);
private static final int VERSION_4_6 = version(4, 6); private static final int VERSION_4_6 = version(4, 6);
private static final int VERSION_4_7 = version(4, 7); private static final int VERSION_4_7 = version(4, 7);
private static GPPScannerExtensionConfiguration CONFIG= new GPPScannerExtensionConfiguration(); 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_3= new GPPScannerExtensionConfiguration(VERSION_4_3);
private static GPPScannerExtensionConfiguration CONFIG_4_6= new GPPScannerExtensionConfiguration(VERSION_4_6); private static GPPScannerExtensionConfiguration CONFIG_4_6= new GPPScannerExtensionConfiguration(VERSION_4_6);
private static GPPScannerExtensionConfiguration CONFIG_4_7= new GPPScannerExtensionConfiguration(VERSION_4_7); 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) { if (version >= VERSION_4_3) {
return CONFIG_4_3; return CONFIG_4_3;
} }
if (version >= VERSION_4_2) {
return CONFIG_4_2;
}
} catch (Exception e) { } catch (Exception e) {
// Fall-back to the default configuration. // 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)))"); 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_COMPLEX, IToken.t__Complex);
addKeyword(Keywords.c_IMAGINARY, IToken.t__Imaginary); 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 // Type-traits supported by gcc 4.3
if (version >= VERSION_4_3) { if (version >= VERSION_4_3) {
addKeyword(GCCKeywords.cp__has_nothrow_assign, IGCCToken.tTT_has_nothrow_assign); addKeyword(GCCKeywords.cp__has_nothrow_assign, IGCCToken.tTT_has_nothrow_assign);

View 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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -31,6 +31,12 @@ public class GCCKeywords {
public static final String __FLOAT128 = "__float128"; public static final String __FLOAT128 = "__float128";
/** @since 5.9 */ /** @since 5.9 */
public static final String __FINAL = "__final"; 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[] public static final char[]
cpTYPEOF = TYPEOF.toCharArray(), cpTYPEOF = TYPEOF.toCharArray(),
@ -90,4 +96,10 @@ public class GCCKeywords {
/** @since 5.9 */ /** @since 5.9 */
public static final char[] public static final char[]
cp__FINAL= __FINAL.toCharArray(); cp__FINAL= __FINAL.toCharArray();
/** @since 5.10 */
public static final char[]
cp_decimal32= _DECIMAL32.toCharArray(),
cp_decimal64= _DECIMAL64.toCharArray(),
cp_decimal128= _DECIMAL128.toCharArray();
} }

View 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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * 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_is_final= FIRST_RESERVED_IGCCToken + 27;
/** @since 5.6 */ int tTT_underlying_type= FIRST_RESERVED_IGCCToken + 28; /** @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;
} }

View 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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -2622,6 +2622,9 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
case IToken.t__Imaginary: case IToken.t__Imaginary:
case IGCCToken.t__int128: case IGCCToken.t__int128:
case IGCCToken.t__float128: case IGCCToken.t__float128:
case IGCCToken.t_decimal32:
case IGCCToken.t_decimal64:
case IGCCToken.t_decimal128:
case IToken.t_signed: case IToken.t_signed:
case IToken.t_unsigned: case IToken.t_unsigned:
case IToken.t_decltype: case IToken.t_decltype:

View 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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -130,6 +130,9 @@ public abstract class ArithmeticConversion {
case eDouble: case eDouble:
case eFloat: case eFloat:
case eFloat128: case eFloat128:
case eDecimal32:
case eDecimal64:
case eDecimal128:
case eUnspecified: case eUnspecified:
case eVoid: case eVoid:
case eNullPtr: case eNullPtr:
@ -242,6 +245,9 @@ public abstract class ArithmeticConversion {
case eDouble: case eDouble:
case eFloat: case eFloat:
case eFloat128: case eFloat128:
case eDecimal32:
case eDecimal64:
case eDecimal128:
case eNullPtr: case eNullPtr:
assert false; assert false;
} }
@ -294,7 +300,8 @@ public abstract class ArithmeticConversion {
private boolean isLongDouble(IType type) { private boolean isLongDouble(IType type) {
if (type instanceof IBasicType) { if (type instanceof IBasicType) {
final IBasicType bt= (IBasicType) type; 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; return false;
} }
@ -302,7 +309,7 @@ public abstract class ArithmeticConversion {
private static boolean isDouble(IType type) { private static boolean isDouble(IType type) {
if (type instanceof IBasicType) { if (type instanceof IBasicType) {
final IBasicType bt= (IBasicType) type; final IBasicType bt= (IBasicType) type;
return bt.getKind() == Kind.eDouble; return bt.getKind() == Kind.eDouble || bt.getKind() == Kind.eDecimal64;
} }
return false; return false;
} }
@ -310,7 +317,7 @@ public abstract class ArithmeticConversion {
private static boolean isFloat(IType type) { private static boolean isFloat(IType type) {
if (type instanceof IBasicType) { if (type instanceof IBasicType) {
final IBasicType bt= (IBasicType) type; final IBasicType bt= (IBasicType) type;
return bt.getKind() == Kind.eFloat; return bt.getKind() == Kind.eFloat || bt.getKind() == Kind.eDecimal32;
} }
return false; return false;
} }

View 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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * 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_complex_long_double;
public final SizeAndAlignment sizeof_float128; public final SizeAndAlignment sizeof_float128;
public final SizeAndAlignment sizeof_complex_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; private final IASTTranslationUnit ast;
@ -144,6 +147,9 @@ public class SizeofCalculator {
sizeof_complex_long_double = getSizeOfPair(sizeof_long_double); sizeof_complex_long_double = getSizeOfPair(sizeof_long_double);
sizeof_float128 = size_16; // GCC does not define __SIZEOF_FLOAT128__ sizeof_float128 = size_16; // GCC does not define __SIZEOF_FLOAT128__
sizeof_complex_float128 = getSizeOfPair(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() { private SizeofCalculator() {
@ -167,6 +173,9 @@ public class SizeofCalculator {
sizeof_complex_long_double = null; sizeof_complex_long_double = null;
sizeof_float128 = size_16; sizeof_float128 = size_16;
sizeof_complex_float128 = getSizeOfPair(sizeof_float128); sizeof_complex_float128 = getSizeOfPair(sizeof_float128);
sizeof_decimal32 = size_4;
sizeof_decimal64 = size_8;
sizeof_decimal128 = size_16;
ast = null; ast = null;
} }
@ -233,6 +242,12 @@ public class SizeofCalculator {
(type.isLong() ? sizeof_complex_long_double : sizeof_complex_double); (type.isLong() ? sizeof_complex_long_double : sizeof_complex_double);
case eFloat128: case eFloat128:
return type.isComplex() ? sizeof_complex_float128 : sizeof_float128; 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: case eWChar:
return sizeof_wchar_t; return sizeof_wchar_t;
case eChar16: case eChar16:

View 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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -106,6 +106,12 @@ public class CASTSimpleDeclSpecifier extends CASTBaseDeclSpecifier implements IC
return t_float; return t_float;
case eFloat128: case eFloat128:
return t_float; return t_float;
case eDecimal32:
return t_decimal32;
case eDecimal64:
return t_decimal64;
case eDecimal128:
return t_decimal128;
case eInt: case eInt:
return t_int; return t_int;
case eInt128: case eInt128:

View 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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -75,6 +75,12 @@ public class CBasicType implements ICBasicType, ISerializableType {
return Kind.eFloat; return Kind.eFloat;
case IASTSimpleDeclSpecifier.t_float128: case IASTSimpleDeclSpecifier.t_float128:
return Kind.eFloat128; 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: case IASTSimpleDeclSpecifier.t_int:
return Kind.eInt; return Kind.eInt;
case IASTSimpleDeclSpecifier.t_int128: case IASTSimpleDeclSpecifier.t_int128:
@ -218,6 +224,9 @@ public class CBasicType implements ICBasicType, ISerializableType {
case eNullPtr: case eNullPtr:
case eInt128: case eInt128:
case eFloat128: case eFloat128:
case eDecimal32:
case eDecimal64:
case eDecimal128:
// Null pointer type cannot be expressed wit ha simple decl specifier. // Null pointer type cannot be expressed wit ha simple decl specifier.
break; break;
} }

View 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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -1042,6 +1042,27 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
encounteredRawType= true; encounteredRawType= true;
endOffset= consume().getEndOffset(); endOffset= consume().getEndOffset();
break; 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: case IToken.t_signed:
if (encounteredTypename) if (encounteredTypename)
break declSpecifiers; break declSpecifiers;

View 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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -93,6 +93,12 @@ public class CPPASTSimpleDeclSpecifier extends CPPASTBaseDeclSpecifier
return t_float; return t_float;
case eFloat128: case eFloat128:
return t_float128; return t_float128;
case eDecimal32:
return t_decimal32;
case eDecimal64:
return t_decimal64;
case eDecimal128:
return t_decimal128;
case eInt: case eInt:
return t_int; return t_int;
case eInt128: case eInt128:

View 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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -115,6 +115,12 @@ public class CPPBasicType implements ICPPBasicType, ISerializableType {
return Kind.eFloat; return Kind.eFloat;
case IASTSimpleDeclSpecifier.t_float128: case IASTSimpleDeclSpecifier.t_float128:
return Kind.eFloat128; 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: case IASTSimpleDeclSpecifier.t_int:
return Kind.eInt; return Kind.eInt;
case IASTSimpleDeclSpecifier.t_int128: case IASTSimpleDeclSpecifier.t_int128:
@ -295,6 +301,9 @@ public class CPPBasicType implements ICPPBasicType, ISerializableType {
case eNullPtr: case eNullPtr:
case eInt128: case eInt128:
case eFloat128: case eFloat128:
case eDecimal32:
case eDecimal64:
case eDecimal128:
// Null pointer type cannot be expressed wit ha simple decl specifier. // Null pointer type cannot be expressed wit ha simple decl specifier.
break; break;
} }

View file

@ -3098,6 +3098,27 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
encounteredRawType= true; encounteredRawType= true;
endOffset= consume().getEndOffset(); endOffset= consume().getEndOffset();
break; 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: case IToken.t_void:
if (encounteredTypename) if (encounteredTypename)
break declSpecifiers; break declSpecifiers;

View 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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -597,6 +597,9 @@ class BuiltinOperators {
case eDouble: case eDouble:
case eFloat: case eFloat:
case eFloat128: case eFloat128:
case eDecimal32:
case eDecimal64:
case eDecimal128:
return true; return true;
case eBoolean: case eBoolean:
case eChar: case eChar:
@ -625,6 +628,9 @@ class BuiltinOperators {
case eDouble: case eDouble:
case eFloat: case eFloat:
case eFloat128: case eFloat128:
case eDecimal32:
case eDecimal64:
case eDecimal128:
case eInt: case eInt:
case eInt128: case eInt128:
case eWChar: case eWChar:
@ -653,6 +659,9 @@ class BuiltinOperators {
case eDouble: case eDouble:
case eFloat: case eFloat:
case eFloat128: case eFloat128:
case eDecimal32:
case eDecimal64:
case eDecimal128:
case eUnspecified: case eUnspecified:
case eVoid: case eVoid:
case eNullPtr: case eNullPtr:

View 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 * Rapperswil, University of applied sciences and others
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * 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; return Keywords.DOUBLE;
case IASTSimpleDeclSpecifier.t_float128: case IASTSimpleDeclSpecifier.t_float128:
return GCCKeywords.__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: case IASTSimpleDeclSpecifier.t_bool:
return isCpp ? Keywords.BOOL : Keywords._BOOL; return isCpp ? Keywords.BOOL : Keywords._BOOL;