| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Hopefully these are more robust to NFS malfunction than BSD flock-style
locks. See #13945.
Test Plan: Validate via @simonpj
Reviewers: austin, hvr
Subscribers: rwbarton, thomie, erikd, simonpj
GHC Trac Issues: #13945
Differential Revision: https://phabricator.haskell.org/D4129
|
|
|
|
|
|
|
|
| |
Reviewers: austin, hvr
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3875
|
|
|
|
| |
Our new CPP linter enforces this.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: austin, hvr, bgamari
Reviewed By: bgamari
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3484
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The previous implementation swapped the buffer size with the byte to be
set, essentially resulting in an uninitialized buffer.
Test Plan: Validate on Windows
Reviewers: austin, hvr
Subscribers: rwbarton, thomie
GHC Trac Issues: #13599
Differential Revision: https://phabricator.haskell.org/D3478
|
|
|
|
|
|
|
|
| |
Reviewers: austin, hvr, bgamari
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3345
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Trac issues: #13194
Reviewers: austin, hvr, erikd, bgamari, dfeuer, duncan
Subscribers: DemiMarie, dfeuer, thomie
Differential Revision: https://phabricator.haskell.org/D3090
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The bug is that the check `if (size - w > count)` should be
`if (size - w >= count)` instead (`>=` instead of `>`),
because we can do the write all fine if it fits exactly.
This allows us to do 1 instead of 2 write syscalls the case it fits.
An example of when this matters is when an application writes output
in chunks that are a fraction of the handle buffer size.
For example, assume the buffer size is 8 KB, and the application writes
four 2 KB chunks.
Until now, this would result in 3 copies to the handle buffer, but
the 4th one would not be allowed in by `size - w > count`
(because `size - w == count` is the case), so we'd end up with a write
syscall of only 6 KB data instead of 8 KB, thus creating more syscalls
overall.
Implementing this fix (switching to `size - w >= count`), we also have
to flush the buffer if we fill it completely.
If we made only the changes described so far, that would have the
unintended side effect that writes of the size equal to the handle
buffer size (`count == size`) suddenly also go to the handle buffer
first: The data would first be copied to the handle buffer, and then
immediately get flushed to the underlying FD. We don't want that extra
`memcpy`, because it'd be unnecessary: The point of handle buffering is
to coalesce smaller writes, and there are no smaller writes in this
case. For example, if you specify 8 KB buffers (which menas you want
your data to be written out in 8 KB blocks), and you get data that's
already 8 KB in size, you can write that out as an 8 KB straight away,
zero-copy fashion. For this reason, adding to the handle buffer now got
an additional condition `count < size`. That way, writes equal to the
buffer size go straight to the FD, as they did before this commit.
Reviewers: simonmar, austin, hvr, bgamari
Reviewed By: simonmar
Subscribers: mpickering, thomie
Differential Revision: https://phabricator.haskell.org/D3117
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Until now, any `hPutBuf` that wrote `>= the handle buffer size` would
trigger an unnecessary `write("")` system call before the actual write
system call.
This is fixed by making sure that we never flush an empty handle buffer:
Only flush `when (w > 0)`.
Reviewers: simonmar, austin, hvr, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D3119
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add @since annotations to instances in `base`.
Test Plan:
* ./validate # some commets shouldn't break the build
* review the annotations for absurdities.
Reviewers: ekmett, goldfire, RyanGlScott, austin, hvr, bgamari
Reviewed By: RyanGlScott, hvr, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2277
GHC Trac Issues: #11767
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These are cases in the standard library that may benefit from the
strictness signature of catchException and where we know that the action
won't bottom.
Test Plan: Validate, carefully consider changed callsites
Reviewers: austin, hvr
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1972
|
|
|
|
| |
Fixes #4248.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This introduces "freezing," an operation which prevents further
locations from being appended to a CallStack. Library authors may want
to prevent CallStacks from exposing implementation details, as a matter
of hygiene. For example, in
```
head [] = error "head: empty list"
ghci> head []
*** Exception: head: empty list
CallStack (from implicit params):
error, called at ...
```
including the call-site of `error` in `head` is not strictly necessary
as the error message already specifies clearly where the error came
from.
So we add a function `freezeCallStack` that wraps an existing CallStack,
preventing further call-sites from being pushed onto it. In other words,
```
pushCallStack callSite (freezeCallStack callStack) = freezeCallStack callStack
```
Now we can define `head` to not produce a CallStack at all
```
head [] =
let ?callStack = freezeCallStack emptyCallStack
in error "head: empty list"
ghci> head []
*** Exception: head: empty list
CallStack (from implicit params):
error, called at ...
```
---
1. We add the `freezeCallStack` and `emptyCallStack` and update the
definition of `CallStack` to support this functionality.
2. We add `errorWithoutStackTrace`, a variant of `error` that does not
produce a stack trace, using this feature. I think this is a sensible
wrapper function to provide in case users want it.
3. We replace uses of `error` in base with `errorWithoutStackTrace`. The
rationale is that base does not export any functions that use CallStacks
(except for `error` and `undefined`) so there's no way for the stack
traces (from Implicit CallStacks) to include user-defined functions.
They'll only contain the call to `error` itself. As base already has a
good habit of providing useful error messages that name the triggering
function, the stack trace really just adds noise to the error. (I don't
have a strong opinion on whether we should include this third commit,
but the change was very mechanical so I thought I'd include it anyway in
case there's interest)
4. Updates tests in `array` and `stm` submodules
Test Plan: ./validate, new test is T11049
Reviewers: simonpj, nomeata, goldfire, austin, hvr, bgamari
Reviewed By: simonpj
Subscribers: thomie
Projects: #ghc
Differential Revision: https://phabricator.haskell.org/D1628
GHC Trac Issues: #11049
|
|
|
|
|
|
|
| |
* hSetEcho, hGetEcho and hIsTerminalDevice are part of the Haskell2010
report (but not Haskell98)
* there are great `Note`s in GHC.IO.Handle.Types. Link to them.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This replaces some occurences of `-f(no-)warn` with the new `-W`-aliases
introduced via 2206fa8cdb120932 / #11218, in cases which are guaranteed
to be invoked with recent enough GHC (i.e. the stage1+ GHC).
After this commit, mostly the compiler and the testsuite remain using
`-f(wo-)warn...` because the compiler needs to be bootstrappable with
older GHCs, while for the testsuite it's convenient to be able to quickly
compare the behavior to older GHCs (which may not support the new flags yet).
The compiler-part can be updated to use the new flags once GHC 8.3 development
starts.
Reviewed By: quchen
Differential Revision: https://phabricator.haskell.org/D1637
|
|
|
|
|
|
|
|
|
|
|
| |
Semi-closedness is mentioned in the Haskell report, so lets not hide it
from users.
Reviewers: austin, hvr, bgamari
Reviewed By: bgamari
Differential Revision: https://phabricator.haskell.org/D1624
|
|
|
|
|
|
|
|
|
|
|
| |
Thanks to #9858 `Typeable` doesn't need to be explicitly derived anymore.
This also makes `AutoDeriveTypeable` redundant, as well as some imports of
`Typeable` (removal of whose may be beneficial to #9707). This commit
removes several such now redundant use-sites in `base`.
Reviewed By: austin, ekmett
Differential Revision: https://phabricator.haskell.org/D712
|
|
|
|
|
|
| |
Starting with Haddock 2.16 there's a new built-in support for since-annotations
Note: This exposes a bug in the `@since` implementation (see e.g. `Data.Bits`)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Fixes #9236. My testing indicates that this does *not* lead to problems with
broken pipes and such, but further testing is required. It found
a bug in haddock; I've submitted a pull request upstream.
Reviewers: ekmett, austin
Reviewed By: ekmett, austin
Subscribers: rwbarton, thomie, carter, simonmar
Differential Revision: https://phabricator.haskell.org/D327
GHC Trac Issues: #9236
|
|
|
|
| |
...several modules in `base` recently touched by me
|
|
|
|
|
|
|
|
|
| |
This allows several modules to avoid importing Control.Monad and thus break
import cycles that manifest themselves when implementing #9586
Reviewed By: austin, ekmett
Differential Revision: https://phabricator.haskell.org/D222
|
|
|
|
|
|
|
| |
This is preparatory work for reintroducing SPECIALISEs that were lost
in d94de87252d0fe2ae97341d186b03a2fbe136b04
Differential Revision: https://phabricator.haskell.org/D214
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a first step towards addressing #9111
This results in the following additional Typeable (exported) instances
being generated (list was compiled by diff'ing hoogle txt output):
instance Typeable CFile
instance Typeable 'CFile
instance Typeable CFpos
instance Typeable 'CFpos
instance Typeable CJmpBuf
instance Typeable 'CJmpBuf
instance Typeable ChItem
instance Typeable QSem
instance Typeable ID
instance Typeable 'ID
instance Typeable CONST
instance Typeable Qi
instance Typeable Qr
instance Typeable Mp
instance Typeable ConstrRep
instance Typeable Fixity
instance Typeable 'Prefix
instance Typeable 'Infix
instance Typeable Constr
instance Typeable DataType
instance Typeable DataRep
instance Typeable Data
instance Typeable HasResolution
instance Typeable IsList
Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This removes language pragmas from Haskell modules which are implicitly
active with `default-language: Haskell2010`. Specifically, the following
language extension pragmas are removed by this commit:
- PatternGuards
- ForeignFunctionInterface
- EmptyDataDecls
- NoBangPatterns
Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
The now obsolete (and redundant) `#hide` pragmas have been superseded by
`{-# OPTIONS_HADDOCK hide #-}` pragmas which are used by most of the
affected modules anyway.
This commit also adds proper `{-# OPTIONS_HADDOCK hide #-}` pragmas to
`GHC.Desugar` and `GHC.IO.Encoding.Iconv` which had only the ineffective
`#hide` annotation.
Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
|
|
|
|
|
|
|
|
|
|
| |
This commit retroactively adds `/Since: 4.4.0.0/` annotations to symbols
newly added/exposed in `base-4.4.0.0` (as shipped with GHC 7.2.1).
See also 6368362f which adds the respective annotation for symbols newly
added in `base-4.7.0.0` (that goes together with GHC 7.8.1).
Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Because MultiByteToWideChar/WideCharToMultiByte have a rather unhelpful
interface, we have to use a lot of binary searching tricks to get them
to match the iconv-like interface that GHC requires.
Even though the resulting encodings are slow, it does at least mean that we
now support all of Window's code pages. What's more, since these codecs are
basically only used for console output there probably won't be a huge volume
of text to deal with in the common case, so speed is less of a worry.
Note that we will still use GHC's faster table-based custom codec for supported
SBCSs.
|
|
|
|
| |
Quite a few lines have changed but that is mostly comments.
|
|
|
|
| |
path instead
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Right now, we only have
data AsyncException
= StackOverflow
| HeapOverflow
| ThreadKilled
| ...
so it is not possible to add another async exception. For instance,
the Timeout exception in System.Timeout should really be an async
exception.
This patch adds a superclass for all async exceptions:
data SomeAsyncException = forall e . Exception e => SomeAsyncException e
deriving Typeable
and makes the existing AsyncException and Timeout children of
SomeAsyncException in the hierarchy.
|
| |
|
|
|
|
|
|
| |
When there is data in a handle buffer, never fetch more than the
available number of elements, since that can cause a blocking read on
Windows.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
This replaces the previous scheme (which used lone surrogates). The reason is that
there is Haskell software in the wild (i.e. the text package) that chokes on Char values
that do not represent Unicode characters.
This new approach will not work correctly if the reserved private-use characters are
actually encountered in the input, but we expect this to be rare.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
patch series fixes #5061, #1414, #3309, #3308, #3307, #4006 and #4855.
The major changes are:
1) Make Foreign.C.String.*CString use the locale encoding
This change follows the FFI specification in Haskell 98, which
has never actually been implemented before.
The functions exported from Foreign.C.String are partially-applied
versions of those from GHC.Foreign, which allows the user to supply
their own TextEncoding.
We also introduce foreignEncoding as the name of the text encoding
that follows the FFI appendix in that it transliterates encoding
errors.
2) I also changed the code so that mkTextEncoding always tries the
native-Haskell decoders in preference to those from iconv, even on
non-Windows. The motivation here is simply that it is better for
compatibility if we do this, and those are the ones you get for
the utf* and latin1* predefined TextEncodings anyway.
3) Implement surrogate-byte error handling mode for TextEncoding
This implements PEP383-like behaviour so that we are able to
roundtrip byte strings through Strings without loss of information.
The withFilePath function now uses this encoding to get to/from CStrings,
so any code that uses that will get the right PEP383 behaviour automatically.
4) Implement three other coding failure modes: ignore, throw error, transliterate
These mimic the behaviour of the GNU Iconv extensions.
|
| |
|
| |
|
|
|
|
| |
like openFile, but opens the file without O_NONBLOCK
|