mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-30 21:55:31 +02:00
Bug 444577 - __int128_t / __uint128_t not supported (GCC)
Change-Id: I3213c7a6ad034c2fac2c96d2e9f88c38d101ed09
This commit is contained in:
parent
4f70ea542a
commit
9763d3b058
2 changed files with 24 additions and 4 deletions
|
@ -11183,6 +11183,19 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
parseAndCheckBindings(getAboveComment(), CPP, true);
|
||||
}
|
||||
|
||||
// // __int128_t and __uint128_t are available but are not keywords.
|
||||
// void a() {
|
||||
// __int128_t s;
|
||||
// __uint128_t t;
|
||||
// }
|
||||
// void b() {
|
||||
// int __int128_t;
|
||||
// int __uint128_t;
|
||||
// }
|
||||
public void testGCCIntBuiltins_444577() throws Exception {
|
||||
parseAndCheckBindings(getAboveComment(), CPP, true);
|
||||
}
|
||||
|
||||
// template <typename T>
|
||||
// struct underlying_type {
|
||||
// typedef __underlying_type(T) type;
|
||||
|
|
|
@ -84,8 +84,8 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
|||
|
||||
private void initialize() {
|
||||
// Symbols for all parsers
|
||||
fTypeMap= new HashMap<String, IType>();
|
||||
fBindingList= new ArrayList<IBinding>();
|
||||
fTypeMap= new HashMap<>();
|
||||
fBindingList= new ArrayList<>();
|
||||
addStdBuiltins();
|
||||
if (fGnu) {
|
||||
addGnuBuiltins();
|
||||
|
@ -103,6 +103,10 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
|||
}
|
||||
|
||||
private void addGnuBuiltins() {
|
||||
// Undocumented GCC built-ins also supported by Clang.
|
||||
typedef("__int128", "__int128_t");
|
||||
typedef("unsigned __int128", "__uint128_t");
|
||||
|
||||
// Used in stdtypes.h, mentioned in the manual but not defined in there.
|
||||
typedef("va_list", "__builtin_va_list");
|
||||
function("void*", "__builtin_va_start", "va_list", "...");
|
||||
|
@ -501,13 +505,13 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
|||
private IType createType(final String type) {
|
||||
String tstr= type;
|
||||
if (fCpp && tstr.endsWith("&")) {
|
||||
final String nested = tstr.substring(0, tstr.length()-1).trim();
|
||||
final String nested = tstr.substring(0, tstr.length() - 1).trim();
|
||||
return new CPPReferenceType(toType(nested), false);
|
||||
}
|
||||
if (tstr.equals("FILE*")) {
|
||||
return toType("void*");
|
||||
} else if (tstr.endsWith("*")) {
|
||||
final String nested = tstr.substring(0, tstr.length()-1).trim();
|
||||
final String nested = tstr.substring(0, tstr.length() - 1).trim();
|
||||
final IType nt= toType(nested);
|
||||
return fCpp ? new CPPPointerType(nt) : new CPointerType(nt, 0);
|
||||
}
|
||||
|
@ -557,6 +561,9 @@ public class GCCBuiltinSymbolProvider implements IBuiltinBindingsProvider {
|
|||
} else if (tstr.equals("int")) {
|
||||
Kind kind = Kind.eInt;
|
||||
t = fCpp ? new CPPBasicType(kind, q) : new CBasicType(kind, q);
|
||||
} else if (tstr.equals("__int128")) {
|
||||
Kind kind = Kind.eInt128;
|
||||
t = fCpp ? new CPPBasicType(kind, q) : new CBasicType(kind, q);
|
||||
} else if (tstr.equals("float")) {
|
||||
Kind kind = Kind.eFloat;
|
||||
t = fCpp ? new CPPBasicType(kind, q) : new CBasicType(kind, q);
|
||||
|
|
Loading…
Add table
Reference in a new issue