Skip to content

Commit 258c98a

Browse files
committed
std.stdio: remove redundant version declarations
1 parent 9e1e8e7 commit 258c98a

File tree

1 file changed

+22
-27
lines changed

1 file changed

+22
-27
lines changed

std/stdio.d

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -122,17 +122,12 @@ alias KeepTerminator = Flag!"keepTerminator";
122122

123123
version (CRuntime_Microsoft)
124124
{
125-
version = MICROSOFT_STDIO;
126125
}
127126
else version (CRuntime_DigitalMars)
128127
{
129-
// Specific to the way Digital Mars C does stdio
130-
version = DIGITAL_MARS_STDIO;
131128
}
132129
else version (CRuntime_Glibc)
133130
{
134-
// Specific to the way Gnu C does stdio
135-
version = GCC_IO;
136131
}
137132
else version (CRuntime_Bionic)
138133
{
@@ -220,7 +215,7 @@ version (Posix)
220215
static import core.sys.posix.stdio; // getdelim, flockfile
221216
}
222217

223-
version (DIGITAL_MARS_STDIO)
218+
version (CRuntime_DigitalMars)
224219
{
225220
private alias _FPUTC = _fputc_nlock;
226221
private alias _FPUTWC = _fputwc_nlock;
@@ -229,7 +224,7 @@ version (DIGITAL_MARS_STDIO)
229224
private alias _FLOCK = __fp_lock;
230225
private alias _FUNLOCK = __fp_unlock;
231226

232-
// Alias for MICROSOFT_STDIO compatibility.
227+
// Alias for CRuntime_Microsoft compatibility.
233228
// @@@DEPRECATED_2.107@@@
234229
// Rename this back to _setmode once the deprecation phase has ended.
235230
private alias __setmode = setmode;
@@ -267,7 +262,7 @@ version (DIGITAL_MARS_STDIO)
267262
~ "std.stdio and will be removed afer 2.107")
268263
fileno_t _fileno(FILE* f) { return f._file; }
269264
}
270-
else version (MICROSOFT_STDIO)
265+
else version (CRuntime_Microsoft)
271266
{
272267
private alias _FPUTC = _fputc_nolock;
273268
private alias _FPUTWC = _fputwc_nolock;
@@ -277,7 +272,7 @@ else version (MICROSOFT_STDIO)
277272
private alias _FUNLOCK = _unlock_file;
278273

279274
// @@@DEPRECATED_2.107@@@
280-
// Remove this once the deprecation phase for DIGITAL_MARS_STDIO has ended.
275+
// Remove this once the deprecation phase for CRuntime_DigitalMars has ended.
281276
private alias __setmode = _setmode;
282277

283278
// @@@DEPRECATED_2.107@@@
@@ -305,7 +300,7 @@ else version (MICROSOFT_STDIO)
305300
~ "std.stdio and will be removed afer 2.107")
306301
alias FUNLOCK = _unlock_file;
307302
}
308-
else version (GCC_IO)
303+
else version (CRuntime_Glibc)
309304
{
310305
private alias _FPUTC = fputc_unlocked;
311306
private alias _FPUTWC = fputwc_unlocked;
@@ -419,7 +414,7 @@ private extern (C) @nogc nothrow
419414
{
420415
pragma(mangle, _FPUTC.mangleof) int trustedFPUTC(int ch, _iobuf* h) @trusted;
421416

422-
version (DIGITAL_MARS_STDIO)
417+
version (CRuntime_DigitalMars)
423418
pragma(mangle, _FPUTWC.mangleof) int trustedFPUTWC(int ch, _iobuf* h) @trusted;
424419
else
425420
pragma(mangle, _FPUTWC.mangleof) int trustedFPUTWC(wchar_t ch, _iobuf* h) @trusted;
@@ -598,7 +593,7 @@ Throws: `ErrnoException` if the file could not be opened.
598593
name);
599594

600595
// MSVCRT workaround (https://issues.dlang.org/show_bug.cgi?id=14422)
601-
version (MICROSOFT_STDIO)
596+
version (CRuntime_Microsoft)
602597
{
603598
setAppendWin(stdioOpenmode);
604599
}
@@ -726,7 +721,7 @@ Throws: `ErrnoException` in case of error.
726721
}
727722
_p = cast(Impl*) enforce(malloc(Impl.sizeof), "Out of memory");
728723
initImpl(handle, name, 1, isPopened);
729-
version (MICROSOFT_STDIO)
724+
version (CRuntime_Microsoft)
730725
{
731726
setAppendWin(stdioOpenmode);
732727
}
@@ -761,7 +756,7 @@ Throws: `ErrnoException` in case of error.
761756
}
762757
}
763758

764-
version (MICROSOFT_STDIO)
759+
version (CRuntime_Microsoft)
765760
{
766761
private void setAppendWin(scope const(char)[] stdioOpenmode) @safe
767762
{
@@ -894,7 +889,7 @@ Params:
894889
auto modez = stdioOpenmode.tempCString();
895890
detach();
896891

897-
version (DIGITAL_MARS_STDIO)
892+
version (CRuntime_DigitalMars)
898893
{
899894
// This is a re-implementation of DMC's fdopen, but without the
900895
// mucking with the file descriptor. POSIX standard requires the
@@ -945,7 +940,7 @@ Throws: `ErrnoException` in case of error.
945940
import std.format : format;
946941

947942
// Create file descriptors from the handles
948-
version (DIGITAL_MARS_STDIO)
943+
version (CRuntime_DigitalMars)
949944
auto fd = _handleToFD(handle, FHND_DEVICE);
950945
else // MSVCRT
951946
{
@@ -1190,7 +1185,7 @@ Throws: `ErrnoException` if the file is not opened or the call to `fread` fails.
11901185
immutable fileno_t fd = .fileno(_p.handle);
11911186
immutable mode = .__setmode(fd, _O_BINARY);
11921187
scope(exit) .__setmode(fd, mode);
1193-
version (DIGITAL_MARS_STDIO)
1188+
version (CRuntime_DigitalMars)
11941189
{
11951190
import core.atomic : atomicOp;
11961191

@@ -1288,7 +1283,7 @@ Throws: `ErrnoException` if the file is not opened or if the call to `fwrite` fa
12881283
.__setmode(fd, _O_BINARY);
12891284
}
12901285

1291-
version (DIGITAL_MARS_STDIO)
1286+
version (CRuntime_DigitalMars)
12921287
{
12931288
import core.atomic : atomicOp;
12941289

@@ -2351,7 +2346,7 @@ Returns the underlying operating system `HANDLE` (Windows only).
23512346
version (Windows)
23522347
@property HANDLE windowsHandle()
23532348
{
2354-
version (DIGITAL_MARS_STDIO)
2349+
version (CRuntime_DigitalMars)
23552350
return _fdToHandle(fileno);
23562351
else
23572352
return cast(HANDLE)_get_osfhandle(fileno);
@@ -3147,7 +3142,7 @@ is empty, throws an `Exception`. In case of an I/O error throws
31473142
file_ = f;
31483143
FILE* fps = f._p.handle;
31493144

3150-
version (MICROSOFT_STDIO)
3145+
version (CRuntime_Microsoft)
31513146
{
31523147
// Microsoft doesn't implement fwide. Instead, there's the
31533148
// concept of ANSI/UNICODE mode. fputc doesn't work in UNICODE
@@ -3388,7 +3383,7 @@ is empty, throws an `Exception`. In case of an I/O error throws
33883383
{
33893384
fileno_t fd;
33903385
int oldMode;
3391-
version (DIGITAL_MARS_STDIO)
3386+
version (CRuntime_DigitalMars)
33923387
ubyte oldInfo;
33933388
}
33943389

@@ -3410,7 +3405,7 @@ is empty, throws an `Exception`. In case of an I/O error throws
34103405
.fflush(fps); // before changing translation mode
34113406
fd = .fileno(fps);
34123407
oldMode = .__setmode(fd, _O_BINARY);
3413-
version (DIGITAL_MARS_STDIO)
3408+
version (CRuntime_DigitalMars)
34143409
{
34153410
import core.atomic : atomicOp;
34163411

@@ -3431,7 +3426,7 @@ is empty, throws an `Exception`. In case of an I/O error throws
34313426
version (Windows)
34323427
{
34333428
.fflush(fps); // before restoring translation mode
3434-
version (DIGITAL_MARS_STDIO)
3429+
version (CRuntime_DigitalMars)
34353430
{
34363431
// https://issues.dlang.org/show_bug.cgi?id=4243
34373432
__fhnd_info[fd] = oldInfo;
@@ -3889,7 +3884,7 @@ void main()
38893884
return setlocale(LC_CTYPE, loc.ptr).fromStringz.endsWith(loc);
38903885
});
38913886
scope(exit) () @trusted { setlocale(LC_CTYPE, oldCt); } ();
3892-
version (DIGITAL_MARS_STDIO) // DM can't handle Unicode above U+07FF.
3887+
version (CRuntime_DigitalMars) // DM can't handle Unicode above U+07FF.
38933888
{
38943889
alias strs = AliasSeq!("\u07FE", "\u07FF"w);
38953890
}
@@ -3899,7 +3894,7 @@ void main()
38993894
}
39003895
{
39013896
auto f = File(deleteme, "w");
3902-
version (MICROSOFT_STDIO)
3897+
version (CRuntime_Microsoft)
39033898
{
39043899
() @trusted { __setmode(fileno(f.getFP()), _O_U8TEXT); } ();
39053900
}
@@ -5539,7 +5534,7 @@ private struct LockedFile
55395534
// Private implementation of readln
55405535
private size_t readlnImpl(FILE* fps, ref char[] buf, dchar terminator, File.Orientation orientation) @safe
55415536
{
5542-
version (DIGITAL_MARS_STDIO)
5537+
version (CRuntime_DigitalMars)
55435538
return () @trusted {
55445539
auto lf = LockedFile(fps);
55455540
ReadlnAppender app;
@@ -5652,7 +5647,7 @@ private size_t readlnImpl(FILE* fps, ref char[] buf, dchar terminator, File.Orie
56525647
buf = app.data;
56535648
return buf.length;
56545649
}();
5655-
else version (MICROSOFT_STDIO)
5650+
else version (CRuntime_Microsoft)
56565651
{
56575652
auto lf = LockedFile(fps);
56585653

0 commit comments

Comments
 (0)