Commit graph

682 commits

Author SHA1 Message Date
Martin Nowak
73aa224d60 Merge remote-tracking branch 'upstream/master' into stable 2020-02-24 09:13:22 +01:00
Hiroki Noda
902e49bb66 Fix Issue 20585 - std.stdio.File.open() failure leaves File in invalid
state
2020-02-18 02:21:14 +09:00
MoonlightSentinel
4af7a4353c
Removed deprecated By(Line|Chunk|Record) from std.stdio 2020-01-28 17:29:00 +01:00
Alexandru Militaru
bb62aaca3d Replaced version (unittest) with version (StdUnittest) to avoid unnecessary overhead when compiling with -unittest 2020-01-19 14:05:17 +02:00
Bernhard Seckinger
3271984e52 Fix partially Issue 11809 - unit tests leave behind temporary files 2019-11-13 08:08:13 +01:00
Geod24
20219915b4 Make std.stdio's seek function more restrictive
Value '3' can be a valid value on Linux (`SEEK_DATA`, since 3.18).
The support depends on the kernel version and the libc used.
Hence, make the check common to all platform / runtime.
2019-10-24 15:20:47 +09:00
Vladimir Panteleev
5cb4d927e5 std.stdio: Fix failing unittest with no autodecode
The code compiled and ran, but behaved differently.

The silent breakage was due to the implicit conversion of char to
dchar. Forbidding such conversions would prevent the silent breakage.
2019-08-15 11:59:21 +00:00
Vladimir Panteleev
a15af9cf55
Fix Issue 20129 - AA require with File values gives "Error: return expression expected" in object.d 2019-08-13 20:31:12 +00:00
Charles McAnany
41f28f6270 Clarify that buf can be shortened in readln (#7125)
Clarify that buf can be shortened in readln
merged-on-behalf-of: Vladimir Panteleev <CyberShadow@users.noreply.github.com>
2019-08-06 20:30:04 +02:00
Francesco Mecca
d6cd71bf7b use waitpid for unittest 2019-07-15 18:18:11 +02:00
Vladimir Panteleev
6197b533ed
Fix Issue 19980 - File.byLine skips first line in some cases when used inside map!() 2019-06-17 23:53:04 +00:00
Sebastian Wilzbach
1386fa253f Use selective top-level module imports in std.{stdio,string} 2019-05-23 10:32:49 +02:00
Bastiaan Veelo
a2aa3d3590 Special case enforce against issue 19797, documentation. 2019-04-14 01:04:17 +02:00
The Dlang Bot
28fc0f4ef6
Merge pull request #6913 from CyberShadow/pull-20190318-181608
Fix Issue 19751 - std.stdio.File should not retry fclose after error
merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
2019-03-19 02:17:29 +01:00
Vladimir Panteleev
272b933748
Fix Issue 19751 - std.stdio.File should not retry fclose after error
C fclose is allowed to fail, and some libc implementations do cause it
to fail.

For example, reading on a file opened only for writing, or (in Wine's
MSVCRT implementation) writing on a file opened only for reading sets
an error flag, which then causes fclose to return EOF to signal an
error.

However, all descriptions of the function specify that "whether or not
the call succeeds, the stream shall be disassociated from the file"
and "after the call to fclose(), any use of stream results in
undefined behavior" (POSIX) or similar.

Currently, if File.close throws and is called again (e.g. in a
destructor), it will retry the fclose call. This is undefined behavior
as described above, and may potentially affect an unrelated file.

It also makes it overly difficult to "get rid" of a File instance
associated with a FILE with its error flag set - all attempts at
destroying it will fail and only be eventually retried.
2019-03-18 18:24:56 +00:00
Nathan Sashihara
6ffd4e7f28 Replace imports of core.sys.windows.windows to speed up compilation 2018-12-17 21:03:31 -05:00
The Dlang Bot
656798f2b3
Merge pull request #6717 from ibuclaw/bshedversion
[refactor] posix.mak: Enforce whitespace before opening parenthesis for version …
merged-on-behalf-of: Petar Kirov <ZombineDev@users.noreply.github.com>
2018-09-26 15:39:36 +02:00
Iain Buclaw
10847bcf1d std.stdio: Remove redundant enum declarations 2018-09-22 23:35:10 +02:00
Iain Buclaw
fd5facfe04 posix.mak: Enforce whitespace before opening parenthesis for version conditions 2018-09-22 16:57:24 +02:00
Walter Bright
33cceac7ac switch Digital Mars copyright to D Language Foundation 2018-09-05 13:49:46 -07:00
Basile Burg
db819575f1 Fix issue 11959 - Set private symbols declared in version(unittest) blocks 2018-08-26 10:22:11 +02:00
Jonathan M Davis
7e9a2615f2 Remove unnecessary conflicts in std.stdio.
fopen and popen wrap C functions that exist in druntime, and it's not
uncommon for folks to end up accidentally trying to use the private
functions in std.stdio instead of the ones from druntime - which then
tends to result in questions on D.Learn. There's no reason that either
of these private functions needs to be named the same as the C function
that it wraps. It just causes confusion when folks accidentally try to
use them instead of the C functions.

So, this changes them to _fopen and _popen so that there will be no such
conflict, and the error messages when folks try to call the C functions
but do so incorrectly will not mention std.stdio's internals.
2018-06-28 20:57:59 -06:00
Walter Bright
827dbbb6b1 stdio: add scope 2018-06-09 01:07:56 -07:00
Walter Bright
433d3182c8 all put() functions should have 'scope' parameters 2018-06-08 16:23:37 -07:00
Walter Bright
e8290737e3 LockingTextWriter() should leak its parameter 2018-06-08 02:38:31 -07:00
Sebastian Wilzbach
c324714fde Remove a few cases of underscore escaping 2018-06-04 13:05:01 +02:00
Bastiaan Veelo
e38fa7ddc9
Adapt to description of writef. 2018-05-21 11:57:20 +02:00
Bastiaan Veelo
cf246e1992
Correct documentation for std.stdio.write.
Remove errors in the description: It writes to stdout, not args[0] and it does not use std.conv.to.
Use similar description as std.stdio.File.write.
2018-05-21 11:37:19 +02:00
Martin Nowak
2d4fa13f30 Merge remote-tracking branch 'upstream/stable' into merge_stable 2018-05-02 01:06:55 +02:00
Diederik de Groot
7aa7a2d34e
Fix stdio File.open / resetFile / detach / refcount 2018-04-30 15:31:19 +02:00
aG0aep6G
b771e175d0 only decode when there's a highSurrogate 2018-04-24 07:45:21 +02:00
aG0aep6G
5fa8ba12e2 merge imports 2018-04-23 23:39:23 +02:00
aG0aep6G
bf1b4db8a3 only store the high surrogate, and use \0 to indicate its empty 2018-04-23 23:11:53 +02:00
aG0aep6G
2ab81bcbe7 add comment about the final throw 2018-04-23 23:03:02 +02:00
aG0aep6G
8611e450d8 destroy file_ before possibly throwing 2018-04-23 23:02:21 +02:00
aG0aep6G
d5cc4c5087 fix conversion from wchar to char in LockingTextWriter.put
Fixes the easier part of issue 18789.
2018-04-23 13:43:57 +02:00
Jack Stouffer
e14f89e170 Make references to input ranges a link to isInputRange 2018-04-08 16:19:57 -04:00
Jack Stouffer
db11ea1d25 Added note about thread safety 2018-04-06 08:49:59 -04:00
Jack Stouffer
9410ed02d3 Fix Issue 15768 - std.stdio.trustedStdout accesses __gshared data without synchronization 2018-04-03 09:01:47 -04:00
Sebastian Wilzbach
42894784dd Markdownify Phobos
$(D word) -> `word`
2018-04-02 22:32:47 +02:00
Jonathan Marler
2dd14c6445 Accomodate Enum init deprecation 2018-03-28 04:27:46 -06:00
Sebastian Wilzbach
87301eb1b5 Merge remote-tracking branch 'upstream/stable' into merge_stable 2018-03-25 18:23:14 +02:00
Sebastian Wilzbach
e8d7ec51d3 Fix brace style + typos 2018-03-24 11:31:17 +01:00
MetaLang
9660b9ad88
Fix typos for stderr and stdout doc 2018-03-24 04:06:55 -03:00
Sebastian Wilzbach
a502a4731f Fix Issue 18648 - Document the type of std.stdio.stdin and friends 2018-03-22 21:36:41 +01:00
Martin Nowak
03e2c4947f Merge remote-tracking branch 'upstream/stable' into merge_stable
# Conflicts:
#	changelog/std-file-readText.dd
#	changelog/std-parallelism-fold.dd
2018-03-02 21:32:43 +01:00
Steven Schveighoffer
f3ab08db0f
Fix minor ambiguity 2018-03-02 08:31:19 -05:00
Jack Stouffer
7a26c9505f Update lockingTextWriter docs 2018-03-02 08:18:28 -05:00
Radu Racariu
0641553468
Add uClibc definitions 2018-02-25 18:59:47 +02:00
Martin Nowak
09926f9837 Merge remote-tracking branch 'upstream/stable' into merge_stable 2018-02-23 21:37:12 +01:00