aboutsummaryrefslogtreecommitdiff
path: root/gcc/d/dmd/tokens.d
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2023-03-05 01:47:19 +0100
committerIain Buclaw <ibuclaw@gdcproject.org>2023-03-16 17:29:57 +0100
commit8da8c7d337123b28fdeb539a283d00732118712e (patch)
tree74096a23b9e2f64a7e25ec1e8d4d3b1d8934842e /gcc/d/dmd/tokens.d
parentc5e2c3dd6afcf9b152df72b30e205b0180c0afd5 (diff)
downloadgcc-8da8c7d337123b28fdeb539a283d00732118712e.zip
gcc-8da8c7d337123b28fdeb539a283d00732118712e.tar.gz
gcc-8da8c7d337123b28fdeb539a283d00732118712e.tar.bz2
d: Merge upstream dmd, druntime 4ca4140e58, phobos 454dff14d.
D front-end changes: - Import dmd v2.103.0-beta.1. - Using `alias this' for classes has been deprecated. - The feature `-fpreview=dip25` is now enabled by default. - The compile-time traits `isVirtualFunction' and `getVirtualFunctions' have been deprecated. D runtime changes: - Import druntime v2.103.0-beta.1. Phobos changes: - Import phobos v2.103.0-beta.1. - Updated unicode grapheme walking updated to conform to Unicode version 15. - Improved friendliness of error messages when instantiating `std.algorithm.iteration.joiner' and `std.algorithm.sorting.sort' with wrong inputs. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 4ca4140e58. * dmd/VERSION: Bump version to v2.103.0-beta.1. * Make-lang.in (D_FRONTEND_OBJS): Add d/errorsink.o. * d-ctfloat.cc (CTFloat::sprint): Update signature for new front-end interface. * d-frontend.cc (getTypeInfoType): Likewise. * d-lang.cc (d_handle_option): Remove handling of -fpreview=dip25 and -frevert=dip25. (d_post_options): Remove enabling of sealed references language feature when scoped pointers is enabled. * d-tree.h (create_typeinfo): Update signature. * decl.cc (DeclVisitor::finish_vtable): Update for new front-end interface. (DeclVisitor::visit (VarDeclaration *)): Likewise. (DeclVisitor::visit (FuncDeclaration *)): Check skipCodegen to see if front-end explicitly requested not to generate code. * expr.cc (ExprVisitor::visit (NewExp *)): Update for new front-end interface. * lang.opt (fpreview=dip25): Remove. (frevert=dip25): Remove. * modules.cc (layout_moduleinfo_fields): Update for new front-end interface. (layout_moduleinfo): Likewise. * runtime.def (NEWCLASS): Remove. * toir.cc (IRVisitor::visit (IfStatement *)): Don't generate IR for if statement list when condition is `__ctfe'. * typeinfo.cc (create_typeinfo): Add generate parameter. * types.cc (layout_aggregate_members): Update for new front-end interface. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 4ca4140e58. * libdruntime/Makefile.am (DRUNTIME_DSOURCES): Add core/factory.d. * libdruntime/Makefile.in: Regenerate. * src/MERGE: Merge upstream phobos 454dff14d. * testsuite/libphobos.hash/test_hash.d: Update test. * testsuite/libphobos.shared/finalize.d: Update test. * libdruntime/core/factory.d: New file. gcc/testsuite/ChangeLog: * gdc.dg/torture/simd23084.d: New test. * gdc.dg/torture/simd23085.d: New test. * gdc.dg/torture/simd23218.d: New test.
Diffstat (limited to 'gcc/d/dmd/tokens.d')
-rw-r--r--gcc/d/dmd/tokens.d45
1 files changed, 27 insertions, 18 deletions
diff --git a/gcc/d/dmd/tokens.d b/gcc/d/dmd/tokens.d
index b3cd2d3..aec3a77 100644
--- a/gcc/d/dmd/tokens.d
+++ b/gcc/d/dmd/tokens.d
@@ -269,11 +269,13 @@ enum TOK : ubyte
_Thread_local,
// C only extended keywords
+ _assert,
_import,
__cdecl,
__declspec,
__stdcall,
__pragma,
+ __int128,
__attribute__,
}
@@ -579,11 +581,13 @@ private immutable TOK[] keywords =
TOK._Thread_local,
// C only extended keywords
+ TOK._assert,
TOK._import,
TOK.__cdecl,
TOK.__declspec,
TOK.__stdcall,
TOK.__pragma,
+ TOK.__int128,
TOK.__attribute__,
];
@@ -612,7 +616,9 @@ static immutable TOK[TOK.max + 1] Ckeywords =
restrict, return_, int16, signed, sizeof_, static_, struct_, switch_, typedef_,
union_, unsigned, void_, volatile, while_, asm_, typeof_,
_Alignas, _Alignof, _Atomic, _Bool, _Complex, _Generic, _Imaginary, _Noreturn,
- _Static_assert, _Thread_local, _import, __cdecl, __declspec, __stdcall, __pragma, __attribute__ ];
+ _Static_assert, _Thread_local,
+ _import, __cdecl, __declspec, __stdcall, __pragma, __int128, __attribute__,
+ _assert ];
foreach (kw; Ckwds)
tab[kw] = cast(TOK) kw;
@@ -878,11 +884,13 @@ extern (C++) struct Token
TOK._Thread_local : "_Thread_local",
// C only extended keywords
+ TOK._assert : "__check",
TOK._import : "__import",
TOK.__cdecl : "__cdecl",
TOK.__declspec : "__declspec",
TOK.__stdcall : "__stdcall",
TOK.__pragma : "__pragma",
+ TOK.__int128 : "__int128",
TOK.__attribute__ : "__attribute__",
];
@@ -942,16 +950,17 @@ nothrow:
extern (C++) const(char)* toChars() const
{
- __gshared char[3 + 3 * floatvalue.sizeof + 1] buffer;
+ const bufflen = 3 + 3 * floatvalue.sizeof + 1;
+ __gshared char[bufflen] buffer;
const(char)* p = &buffer[0];
switch (value)
{
case TOK.int32Literal:
- sprintf(&buffer[0], "%d", cast(int)intvalue);
+ snprintf(&buffer[0], bufflen, "%d", cast(int)intvalue);
break;
case TOK.uns32Literal:
case TOK.wchar_tLiteral:
- sprintf(&buffer[0], "%uU", cast(uint)unsvalue);
+ snprintf(&buffer[0], bufflen, "%uU", cast(uint)unsvalue);
break;
case TOK.wcharLiteral:
case TOK.dcharLiteral:
@@ -960,36 +969,36 @@ nothrow:
OutBuffer buf;
buf.writeSingleCharLiteral(cast(dchar) intvalue);
buf.writeByte('\0');
- p = buf.extractSlice().ptr;
+ p = buf.extractChars();
}
break;
case TOK.int64Literal:
- sprintf(&buffer[0], "%lldL", cast(long)intvalue);
+ snprintf(&buffer[0], bufflen, "%lldL", cast(long)intvalue);
break;
case TOK.uns64Literal:
- sprintf(&buffer[0], "%lluUL", cast(ulong)unsvalue);
+ snprintf(&buffer[0], bufflen, "%lluUL", cast(ulong)unsvalue);
break;
case TOK.float32Literal:
- CTFloat.sprint(&buffer[0], 'g', floatvalue);
+ CTFloat.sprint(&buffer[0], bufflen, 'g', floatvalue);
strcat(&buffer[0], "f");
break;
case TOK.float64Literal:
- CTFloat.sprint(&buffer[0], 'g', floatvalue);
+ CTFloat.sprint(&buffer[0], bufflen, 'g', floatvalue);
break;
case TOK.float80Literal:
- CTFloat.sprint(&buffer[0], 'g', floatvalue);
+ CTFloat.sprint(&buffer[0], bufflen, 'g', floatvalue);
strcat(&buffer[0], "L");
break;
case TOK.imaginary32Literal:
- CTFloat.sprint(&buffer[0], 'g', floatvalue);
+ CTFloat.sprint(&buffer[0], bufflen, 'g', floatvalue);
strcat(&buffer[0], "fi");
break;
case TOK.imaginary64Literal:
- CTFloat.sprint(&buffer[0], 'g', floatvalue);
+ CTFloat.sprint(&buffer[0], bufflen, 'g', floatvalue);
strcat(&buffer[0], "i");
break;
case TOK.imaginary80Literal:
- CTFloat.sprint(&buffer[0], 'g', floatvalue);
+ CTFloat.sprint(&buffer[0], bufflen, 'g', floatvalue);
strcat(&buffer[0], "Li");
break;
case TOK.string_:
@@ -1006,7 +1015,7 @@ nothrow:
if (postfix)
buf.writeByte(postfix);
buf.writeByte(0);
- p = buf.extractSlice().ptr;
+ p = buf.extractChars();
}
break;
case TOK.identifier:
@@ -1116,7 +1125,7 @@ unittest
{
writeCharLiteral(buf, d);
}
- assert(buf.extractSlice() == `a\n\r\t\b\f\0\x11\u7233\U00017233`);
+ assert(buf[] == `a\n\r\t\b\f\0\x11\u7233\U00017233`);
}
/**
@@ -1147,11 +1156,11 @@ unittest
{
OutBuffer buf;
writeSingleCharLiteral(buf, '\'');
- assert(buf.extractSlice() == `'\''`);
+ assert(buf[] == `'\''`);
buf.reset();
writeSingleCharLiteral(buf, '"');
- assert(buf.extractSlice() == `'"'`);
+ assert(buf[] == `'"'`);
buf.reset();
writeSingleCharLiteral(buf, '\n');
- assert(buf.extractSlice() == `'\n'`);
+ assert(buf[] == `'\n'`);
}