aboutsummaryrefslogtreecommitdiff
path: root/libphobos/src/std/stdio.d
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2021-12-05 17:11:12 +0100
committerIain Buclaw <ibuclaw@gdcproject.org>2021-12-09 00:58:58 +0100
commit0fb57034770aa20adced4d176f34ca611c2945bf (patch)
tree1f5735c8b4f25aa4a290e5ae8124713c24f98359 /libphobos/src/std/stdio.d
parentc15aa46cca0649b68613d3292cf71c7cc57ef78f (diff)
downloadgcc-0fb57034770aa20adced4d176f34ca611c2945bf.zip
gcc-0fb57034770aa20adced4d176f34ca611c2945bf.tar.gz
gcc-0fb57034770aa20adced4d176f34ca611c2945bf.tar.bz2
d: Merge upstream dmd 568496d5b, druntime 178c44ff, phobos 574bf883b.
D front-end changes: - Import dmd v2.098.0 - New ImportC module for compiling preprocessed C11 code into D. - New -ftransition=in switch. - Improved handling of new 'noreturn' type. Druntime changes: - Import druntime v2.098.0 - Fix broken import in core.sys.linux.perf_event module (PR103558). Phobos changes: - Import phobos v2.098.0 - All sources are now compiled with -fpreview=fieldwise. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 568496d5b. * Make-lang.in (D_FRONTEND_OBJS): Add d/common-file.o, d/common-outbuffer.o, d/common-string.o, d/file_manager.o, d/importc.o. Remove d/root-outbuffer.o. (d/common-%.o): New recipe. * d-builtins.cc (build_frontend_type): Update for new front-end interface. (d_build_d_type_nodes): Set noreturn_type_node. * d-codegen.cc (d_build_call): Don't call function if one of the arguments is type 'noreturn'. (build_vthis_function): Propagate TYPE_QUAL_VOLATILE from original function type. * d-frontend.cc (eval_builtin): Update signature. (getTypeInfoType): Likewise. (toObjFile): New function. * d-gimplify.cc (d_gimplify_call_expr): Always evaluate arguments from left to right. * d-lang.cc (d_handle_option): Handle OPT_ftransition_in. (d_parse_file): Don't generate D main if it is declared in user code. * d-tree.h (CALL_EXPR_ARGS_ORDERED): Remove. (enum d_tree_index): Add DTI_BOTTOM_TYPE. (noreturn_type_node): New. * decl.cc (apply_pragma_crt): Remove. (DeclVisitor::visit): Update for new front-end interface. (DeclVisitor::visit (PragmaDeclaration *)): Don't handle crt_constructor and crt_destructor pragmas. (DeclVisitor::visit (VarDeclaration *)): Don't generate declarations of type 'noreturn'. (DeclVisitor::visit (FuncDeclaration *)): Stop adding parameters when 'noreturn' type has been encountered. (get_symbol_decl): Set DECL_STATIC_CONSTRUCTOR and DECL_STATIC_DESTRUCTOR on decl node if requested. (aggregate_initializer_decl): Update for new front-end interface. * expr.cc (ExprVisitor::visit (CallExp *)): Always use the 'this' object as the result of calling any constructor function. (ExprVisitor::visit): Update for new front-end interface. * gdc.texi (Runtime Options): Document -fmain and -ftransition=in. * lang.opt (ftransition=in): New option. * modules.cc (get_internal_fn): Update for new front-end interface. * types.cc (TypeVisitor::visit): Likewise. (TypeVisitor::visit (TypeNoreturn *)): Return noreturn_type_node. (TypeVisitor::visit (TypeFunction *)): Stop adding parameters when 'notreturn' type has been encountered. Qualify function types that return 'noreturn' as TYPE_QUAL_VOLATILE. libphobos/ChangeLog: PR d/103558 * libdruntime/MERGE: Merge upstream druntime 178c44ff. * libdruntime/Makefile.am (DRUNTIME_DSOURCES_LINUX): Add core/sys/linux/syscalls.d. (DRUNTIME_DSOURCES_OPENBSD): Add core/sys/openbsd/pthread_np.d. * libdruntime/Makefile.in: Regenerate. * src/MERGE: Merge upstream phobos 574bf883b. * src/Makefile.am (D_EXTRA_DFLAGS): Add -fpreview=fieldwise. * src/Makefile.in: Regenerate. * testsuite/libphobos.exceptions/assert_fail.d: Update test. * testsuite/libphobos.betterc/test22336.d: New test.
Diffstat (limited to 'libphobos/src/std/stdio.d')
-rw-r--r--libphobos/src/std/stdio.d52
1 files changed, 21 insertions, 31 deletions
diff --git a/libphobos/src/std/stdio.d b/libphobos/src/std/stdio.d
index a88beb8..d3097d5 100644
--- a/libphobos/src/std/stdio.d
+++ b/libphobos/src/std/stdio.d
@@ -281,17 +281,14 @@ else version (GENERIC_IO)
nothrow:
@nogc:
- private int _FPUTC(int c, _iobuf* fp) { return fputc(c, cast(shared) fp); }
- private int _FPUTWC(wchar_t c, _iobuf* fp)
+ extern (C) private
{
- import core.stdc.wchar_ : fputwc;
- return fputwc(c, cast(shared) fp);
- }
- private int _FGETC(_iobuf* fp) { return fgetc(cast(shared) fp); }
- private int _FGETWC(_iobuf* fp)
- {
- import core.stdc.wchar_ : fgetwc;
- return fgetwc(cast(shared) fp);
+ static import core.stdc.wchar_;
+
+ pragma(mangle, fputc.mangleof) int _FPUTC(int c, _iobuf* fp);
+ pragma(mangle, core.stdc.wchar_.fputwc.mangleof) int _FPUTWC(wchar_t c, _iobuf* fp);
+ pragma(mangle, fgetc.mangleof) int _FGETC(_iobuf* fp);
+ pragma(mangle, core.stdc.wchar_.fgetwc.mangleof) int _FGETWC(_iobuf* fp);
}
version (Posix)
@@ -307,27 +304,19 @@ else version (GENERIC_IO)
// @@@DEPRECATED_2.107@@@
deprecated("internal function fputc_unlocked was unintentionally available "
~ "from std.stdio and will be removed afer 2.107")
- int fputc_unlocked(int c, _iobuf* fp) { return fputc(c, cast(shared) fp); }
+ extern (C) pragma(mangle, fputc.mangleof) int fputc_unlocked(int c, _iobuf* fp);
// @@@DEPRECATED_2.107@@@
deprecated("internal function fputwc_unlocked was unintentionally available "
~ "from std.stdio and will be removed afer 2.107")
- int fputwc_unlocked(wchar_t c, _iobuf* fp)
- {
- import core.stdc.wchar_ : fputwc;
- return fputwc(c, cast(shared) fp);
- }
+ extern (C) pragma(mangle, core.stdc.wchar_.fputwc.mangleof) int fputwc_unlocked(wchar_t c, _iobuf* fp);
// @@@DEPRECATED_2.107@@@
deprecated("internal function fgetc_unlocked was unintentionally available "
~ "from std.stdio and will be removed afer 2.107")
- int fgetc_unlocked(_iobuf* fp) { return fgetc(cast(shared) fp); }
+ extern (C) pragma(mangle, fgetc.mangleof) int fgetc_unlocked(_iobuf* fp);
// @@@DEPRECATED_2.107@@@
deprecated("internal function fgetwc_unlocked was unintentionally available "
~ "from std.stdio and will be removed afer 2.107")
- int fgetwc_unlocked(_iobuf* fp)
- {
- import core.stdc.wchar_ : fgetwc;
- return fgetwc(cast(shared) fp);
- }
+ extern (C) pragma(mangle, core.stdc.wchar_.fgetwc.mangleof) int fgetwc_unlocked(_iobuf* fp);
// @@@DEPRECATED_2.107@@@
deprecated("internal alias FPUTC was unintentionally available from "
@@ -363,6 +352,16 @@ else
static assert(0, "unsupported C I/O system");
}
+private extern (C) @nogc nothrow
+{
+ pragma(mangle, _FPUTC.mangleof) int trustedFPUTC(int ch, _iobuf* h) @trusted;
+
+ version (DIGITAL_MARS_STDIO)
+ pragma(mangle, _FPUTWC.mangleof) int trustedFPUTWC(int ch, _iobuf* h) @trusted;
+ else
+ pragma(mangle, _FPUTWC.mangleof) int trustedFPUTWC(wchar_t ch, _iobuf* h) @trusted;
+}
+
static if (__traits(compiles, core.sys.posix.stdio.getdelim))
{
extern(C) nothrow @nogc
@@ -3183,16 +3182,7 @@ is empty, throws an `Exception`. In case of an I/O error throws
/// ditto
void put(C)(scope C c) @safe if (isSomeChar!C || is(C : const(ubyte)))
{
- import std.traits : Parameters;
import std.utf : decodeFront, encode, stride;
- static auto trustedFPUTC(int ch, _iobuf* h) @trusted
- {
- return _FPUTC(ch, h);
- }
- static auto trustedFPUTWC(Parameters!_FPUTWC[0] ch, _iobuf* h) @trusted
- {
- return _FPUTWC(ch, h);
- }
static if (c.sizeof == 1)
{