- Types added: _Decimal32, _Decimal64, _Decimal128.
Change-Id: I9660dfa16f860b5fd31cf028812f1ab464b18709
Signed-off-by: Roberto Oliveira <rdutra@linux.vnet.ibm.com>
/*******************************************************************************
- * 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
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 {
/*******************************************************************************
- * 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
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(' ');
/*******************************************************************************
- * 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
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);
/*******************************************************************************
- * 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
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);
/*******************************************************************************
- * 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
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
/*******************************************************************************
- * 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
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 */
/*******************************************************************************
- * 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
* 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);
/**
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.
}
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);
/*******************************************************************************
- * 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
* 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);
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.
}
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);
/*******************************************************************************
- * 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
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(),
/** @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();
}
/*******************************************************************************
- * 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
/** @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;
}
/*******************************************************************************
- * 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
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:
/*******************************************************************************
- * 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
case eDouble:
case eFloat:
case eFloat128:
+ case eDecimal32:
+ case eDecimal64:
+ case eDecimal128:
case eUnspecified:
case eVoid:
case eNullPtr:
case eDouble:
case eFloat:
case eFloat128:
+ case eDecimal32:
+ case eDecimal64:
+ case eDecimal128:
case eNullPtr:
assert false;
}
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;
}
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;
}
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;
}
/*******************************************************************************
- * 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
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;
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() {
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;
}
(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:
/*******************************************************************************
- * 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
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:
/*******************************************************************************
- * 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
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:
case eNullPtr:
case eInt128:
case eFloat128:
+ case eDecimal32:
+ case eDecimal64:
+ case eDecimal128:
// Null pointer type cannot be expressed wit ha simple decl specifier.
break;
}
/*******************************************************************************
- * 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
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;
/*******************************************************************************
- * 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
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:
/*******************************************************************************
- * 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
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:
case eNullPtr:
case eInt128:
case eFloat128:
+ case eDecimal32:
+ case eDecimal64:
+ case eDecimal128:
// Null pointer type cannot be expressed wit ha simple decl specifier.
break;
}
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;
/*******************************************************************************
- * 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
case eDouble:
case eFloat:
case eFloat128:
+ case eDecimal32:
+ case eDecimal64:
+ case eDecimal128:
return true;
case eBoolean:
case eChar:
case eDouble:
case eFloat:
case eFloat128:
+ case eDecimal32:
+ case eDecimal64:
+ case eDecimal128:
case eInt:
case eInt128:
case eWChar:
case eDouble:
case eFloat:
case eFloat128:
+ case eDecimal32:
+ case eDecimal64:
+ case eDecimal128:
case eUnspecified:
case eVoid:
case eNullPtr:
/*******************************************************************************
- * 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
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;