summaryrefslogtreecommitdiff
path: root/libraries/base/include
Commit message (Collapse)AuthorAgeFilesLines
* Add the Ix class to Foreign C integral typesHécate Moonlight2022-02-041-1/+1
| | | | Related CLC proposal is here: https://github.com/haskell/core-libraries-committee/issues/30
* base: Add CTYPE pragmas to all foreign typesBen Gamari2022-01-191-12/+9
| | | | | | | Fixes #15531 by ensuring that we know the corresponding C type for all marshalling wrappers. Closes #15531.
* Hadrian: fix windows cross-build (#20657)Sylvain Henry2021-11-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many small things to fix: * Hadrian: platform triple is "x86_64-w64-mingw32" and this wasn't recognized by Hadrian (note "w64" instead of "unknown") * Hadrian was using the build platform ("isWindowsHost") to detect the use of the Windows toolchain, which was wrong. We now use the "targetOs" setting. * Hadrian was doing the same thing for Darwin so we fixed both at once, even if cross-compilation to Darwin is unlikely to happen afaik (cf "osxHost" vs "osxTarget" changes) * Hadrian: libffi name was computed in two different places and one of them wasn't taking the different naming on Windows into account. * Hadrian was passing "-Irts/include" when building the stage1 compiler leading to the same error as in #18143 (which is using make). stage1's RTS is stage0's one so mustn't do this. * Hadrian: Windows linker doesn't seem to support "-zorigin" so we don't pass it (similarly to Darwin) * Hadrian: hsc2hs in cross-compilation mode uses a trick (taken from autoconf): it defines "static int test_array[SOME_EXPR]" where SOME_EXPR is a constant expression. However GCC reports an error because SOME_EXPR is supposedly not constant. This is fixed by using another method enabled with the `--via-asm` flag of hsc2hs. It has been fixed in `make` build system (5f6fcf7808b16d066ad0fb2068225b3f2e8363f7) but not in Hadrian. * Hadrian: some packages are specifically built only on Windows but they shouldn't be when building a cross-compiler (`touchy` and `ghci-wrapper`). We now correctly detect this case and disable these packages. * Base: we use `iNVALID_HANDLE_VALUE` in a few places. It fixed some hsc2hs issues before we switched to `--via-asm` (see above). I've kept these changes are they make the code nicer. * Base: `base`'s configure tries to detect if it is building for Windows but for some reason the `$host_alias` value is `x86_64-windows` in my case and it wasn't properly detected. * Base: libraries/base/include/winio_structs.h imported "Windows.h" with a leading uppercase. It doesn't work on case-sensitive systems when cross-compiling so we have to use "windows.h". * RTS: rts/win32/ThrIOManager.c was importin "rts\OSThreads.h" but this path isn't valid when cross-compiling. We replaced "\" with "/". * DeriveConstants: this tool derives the constants from the target RTS header files. However these header files define `StgAsyncIOResult` only when `mingw32_HOST_OS` is set hence it seems we have to set it explicitly. Note that deriveConstants is called more than once (why? there is only one target for now so it shouldn't) and in the second case this value is correctly defined (probably coming indirectly from the import of "rts/PosixSource.h"). A better fix would probably be to disable the unneeded first run of deriveconstants.
* base: Update Unicode database to 14.0Ben Gamari2021-10-031-2/+2
| | | | Closes #20404.
* Ensure that newtype deriving strategy is used for CTypesSylvain Henry2021-08-091-12/+6
|
* base: Update Unicode data to 13.0.0Ben Gamari2021-05-111-2/+2
| | | | (cherry picked from commit d22e087f7bf74341c4468f11b4eb0273033ca931)
* winio: core threaded I/O managerTamar Christina2020-07-151-0/+40
|
* winio: Multiple refactorings and support changes.Tamar Christina2020-07-151-2/+1
|
* winio: Implement new Console APITamar Christina2020-07-151-0/+3
|
* winio: Refactor Buffer structures to be able to track async operationsTamar Christina2020-07-151-0/+12
|
* base: Update Unicode database to 12.1.0Ben Gamari2020-02-121-2/+2
| | | | | Using `curl https://www.unicode.org/Public/12.1.0/ucd/UnicodeData.txt | libraries/base/cbits/ubconfc 12.1.0`.
* base: Expose GHC.Unicode.unicodeVersionBen Gamari2020-02-121-0/+7
| | | | | | | | | | | | | This exposes a Data.Version.Version representing the version of the Unicode database used by `base`. This should clear up some confusion I have seen in tickets regarding with which Unicode versions a given GHC can be expected to work. While in town I also regenerated (but did not update) the Unicode database with database 12.0.0. Strangely, the file cited in the README no longer existed. Consequently, I used https://www.unicode.org/Public/12.0.0/ucd/UnicodeData.txt and was slightly surprised to find that there were a few changes.
* Use C99 Fixed width types to avoid hack in base's configureJohn Ericson2019-09-011-10/+7
| | | | Define MD5Context in terms of `uint*_t` and don't use `HsFFI.h`.
* Remove MAX_PATH restrictions from RTS, I/O manager and various utilitiesTamar Christina2018-03-311-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This shims out fopen and sopen so that they use modern APIs under the hood along with namespaced paths. This lifts the MAX_PATH restrictions from Haskell programs and makes the new limit ~32k. There are only some slight caveats that have been documented. Some utilities have not been upgraded such as lndir, since all these things are different cabal packages I have been forced to copy the source in different places which is less than ideal. But it's the only way to keep sdist working. Test Plan: ./validate Reviewers: hvr, bgamari, erikd, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie, carter GHC Trac Issues: #10822 Differential Revision: https://phabricator.haskell.org/D4416
* fdReady: Use C99 bools / CBool in signatureNiklas Hambüchen2017-12-111-2/+3
| | | | | | | | | | Reviewers: bgamari, Phyx, austin, hvr, simonmar Reviewed By: bgamari Subscribers: syd, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D4041
* base: fdReady(): Fix timeouts > ~49 days overflowing. Fixes #14262.Niklas Hambüchen2017-11-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On 64-bit UNIX and Windows, Haskell `Int` has 64 bits but C `int msecs` has 32 bits, resulting in an overflow. This commit fixes it by switching fdReady() to take int64_t, into which a Haskell `Int` will always fit. (Note we could not switch to `long long` because that is 32 bit on 64-bit Windows machines.) Further, to be able to actually wait longer than ~49 days, we put loops around the waiting syscalls (they all accept only 32-bit integers). Note the timer signal would typically interrupt the syscalls before the ~49 days are over, but you can run Haskell programs without the timer signal, an we want it to be correct in all cases. Reviewers: bgamari, austin, hvr, NicolasT, Phyx Reviewed By: bgamari, Phyx Subscribers: syd, Phyx, rwbarton, thomie GHC Trac Issues: #14262 Differential Revision: https://phabricator.haskell.org/D4011
* Prefer #if defined to #ifdefBen Gamari2017-04-282-34/+34
| | | | Our new CPP linter enforces this.
* cpp: Use #pragma once instead of #ifndef guardsBen Gamari2017-04-236-28/+7
| | | | | | | | | | | | | | This both says what we mean and silences a bunch of spurious CPP linting warnings. This pragma is supported by all CPP implementations which we support. Reviewers: austin, erikd, simonmar, hvr Reviewed By: simonmar Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3482
* test for HAVE_CLOCK_GETTIME definednessGabor Greif2017-04-051-1/+1
|
* Properly introduce CTimer to System.Posix.TypesRyan Scott2017-01-151-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In ffc2327070dbb664bdb407a804121eacb2a7c734, an attempt was made at adding a Haskell wrapper around the C `timer_t` type. Unfortunately, GHC's autoconf macros weren't sophisticated enough at the time to properly detect that `timer_t` is represented by a `void *` (i.e., a pointer) on most OSes. This is a second attempt at `CTimer`, this time using `AC_COMPILE_IFELSE` to detect if a type is a pointer type by compiling the following program: ``` type val; *val; ``` This also only derives a small subset of class instances for `CTimer` that are known to be compatible with `Ptr` using a new `OPAQUE_TYPE_WITH_CTYPE` macro. Test Plan: ./validate Reviewers: erikd, hvr, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2952 GHC Trac Issues: #12795, #12998
* base: Add more POSIX types (fixes #12795)Daniel Gröber2016-12-151-2/+8
| | | | | | | | | | | | | | Test Plan: validate Reviewers: hvr, austin, RyanGlScott, bgamari Reviewed By: RyanGlScott, bgamari Subscribers: RyanGlScott, thomie, erikd Differential Revision: https://phabricator.haskell.org/D2664 GHC Trac Issues: #12795
* Eliminate some unsafeCoerce#s with deriving strategiesRyan Scott2016-10-011-23/+8
| | | | | | | | | | | | | | | Currently, `Foreign.C.Types`, `Foreign.Ptr`, and `System.Posix.Types` define `Read` and `Show` instances for the newtypes in those modules by using `unsafeCoerce#`. We can clean up this hack by using the `newtype` deriving strategy. Reviewers: hvr, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2556
* Change runtime linker to perform lazy loading of symbols/sectionsTamar Christina2016-04-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Runtime Linker is currently eagerly loading all object files on all platforms which do not use the system linker for `GHCi`. The problem with this approach is that it requires all symbols to be found. Even those of functions never used/called. This makes the number of libraries required to link things like `mingwex` quite high. To work around this the `rts` was relying on a trick. It itself was compiled with `MingW64-w`'s `GCC`. So it was already linked against `mingwex`. As such, it re-exported the symbols from itself. While this worked it made it impossible to link against `mingwex` in user libraries. And with this means no `C99` code could ever run in `GHCi` on Windows without having the required symbols re-exported from the rts. Consequently this rules out a large number of packages on Windows. SDL2, HMatrix etc. After talking with @rwbarton I have taken the approach of loading entire object files when a symbol is needed instead of doing the dependency tracking on a per symbol basis. This is a lot less fragile and a lot less complicated to implement. The changes come down to the following steps: 1) modify the linker to and introduce a new state for ObjectCode: `Needed`. A Needed object is one that is required for the linking to succeed. The initial set consists of all Object files passed as arguments to the link. 2) Change `ObjectCode`'s to be indexed but not initialized or resolved. This means we know where we would load the symbols, but haven't actually done so. 3) Mark any `ObjectCode` belonging to `.o` passed as argument as required: ObjectState `NEEDED`. 4) During `Resolve` object calls, mark all `ObjectCode` containing the required symbols as `NEEDED` 5) During `lookupSymbol` lookups, (which is called from `linkExpr` and `linkDecl` in `GHCI.hs`) is the symbol is in a not-yet-loaded `ObjectCode` then load the `ObjectCode` on demand and return the address of the symbol. Otherwise produce an unresolved symbols error as expected. 6) On `unloadObj` we then change the state of the object and remove it's symbols from the `reqSymHash` table so it can be reloaded. This change affects all platforms and OSes which use the runtime linker. It seems there are no real perf tests for `GHCi`, but performance shouldn't be impacted much. We gain a lot of time not loading all `obj` files, and we lose some time in `lookupSymbol` when we're finding sections that have to be loaded. The actual finding itself is O(1) (Assuming the hashtnl is perfect) It also consumes slighly more memory as instead of storing just the address of a symbol I also store some other information, like if the symbol is weak or not. This change will break any packages relying on renamed POSIX functions that were re-named and re-exported by the rts. Any packages following the proper naming for functions as found on MSDN will work fine. Test Plan: ./validate on all platforms which use the Runtime linker. Reviewers: thomie, rwbarton, simonmar, erikd, bgamari, austin, hvr Reviewed By: erikd Subscribers: kgardas, gridaphobe, RyanGlScott, simonmar, rwbarton, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D1805 GHC Trac Issues: #11223
* Scrap IRIX supportHerbert Valerio Riedel2016-03-281-1/+1
| | | | | | | | | | | | | | | | Long time ago, IRIX was way ahead of its time in the last century with its SMP capabilities of scaling up to 1024 processors and other features such as XFS or OpenGL that originated in IRIX and live on to this day in other operating systems. However, IRIX's last software update was in 2006 and support ended around 2013 according to [1], so it's considered an extinct platform by now. So this commit message is effectively an obituary for GHC's IRIX support. R.I.P. IRIX [1]: https://en.wikipedia.org/wiki/IRIX
* Delete _MSC_VER when not necessary, fix #10511Bernard Desmyter2015-06-121-2/+2
| | | | | | | Simplify some preprocessor expressions involving `_MSC_VER` because `_WIN32` is always defined when `_MSC_VER` is. Differential Revision: https://phabricator.haskell.org/D981
* Removes all occurrences of __MINGW32__ (#10485)Thomas Miedema2015-06-111-11/+11
| | | | | | | | | | In Haskell files, replace `__MINGW32__` by `mingw32_HOST_OS`. In .c and .h files, delete `__MINGW32__` when `_WIN32` is also tested because `_WIN32` is always defined when `__MINGW32__` is. Also replace `__MINGW32__` by `_WIN32` when used standalone for consistency. Differential Revision: https://phabricator.haskell.org/D971
* base: drop redundant Typeable derivingsHerbert Valerio Riedel2015-03-071-1/+1
| | | | | | | | | | | 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
* Remove deprecated libraries/base/include/Typeable.hThomas Miedema2015-02-091-31/+0
| | | | | | | | | | | | Test Plan: I grepped for other references, there were none. Reviewers: ekmett, hvr, austin Reviewed By: austin Subscribers: ekmett, thomie, carter Differential Revision: https://phabricator.haskell.org/D483
* fix _FILE_OFFSET_BITS redefined warning on Solaris/i386 platformKarel Gardas2015-02-051-1/+1
| | | | | | | | | | | | | | | | | | Summary: The problem with Solaris is that system header files include /usr/include/sys/feature_tests.h header file and it tests if _FILE_OFFSET_BITS define is defined. If not, it defines it to 32 which is in conflict with 64 which we need for large file support. The solution is easy, always include own header files before system header files. Reviewers: hvr, austin Reviewed By: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D644
* Remove obsolete Data.OldTypeable (#9639)Michael Karg2014-10-181-29/+0
| | | | | | | | | | | | This finally removes the `Data.OldTypeable` module (which has been deprecated in 7.8), from `base`, compiler and testsuite. The deprecated `Typeable{1..7}` aliases in `Data.Typeable` are not removed yet in order to give existing code a bit more time to adapt. Reviewed By: hvr, dreixel Differential Revision: https://phabricator.haskell.org/D311
* Refactor to avoid need for `Unicode.hs-boot`Herbert Valerio Riedel2014-10-111-12/+13
| | | | | | | | | | | This avoids the import-cycle caused by the import of `Foreign.C.Types` by using `Int` instead of `CInt` for the Unicode classification functions. This refactoring also allows to remove a couple of `fromIntegral`s. Reviewed By: rwbarton, ekmett Differential Revision: https://phabricator.haskell.org/D328
* Derive `FiniteBits` for integral newtype wrappersHerbert Valerio Riedel2014-01-301-1/+1
| | | | | | | | | | | | | | When `FiniteBits` was introduced in cddc9024e67a6d4c01bb190839d0134af8c907e0 only the standard Haskell 2010 finite-size integral types were given a `FiniteBits` instance, however, since also a DEPRECATION warning was put in place (as per 701d9ed4b2bec5922709a91bfb625881d7dd47f0) for `bitSize` which might point people to to `FiniteBits`, it seems sensible to derive `FiniteBits` for all integral newtype wrappers as well. N.B.: This makes `Integer` the only type in `base` with a `Bits` instance but no `FiniteBits` instance. Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
* Remove obsolete `include/Nhc98BaseConfig.h`Herbert Valerio Riedel2013-09-281-46/+0
| | | | | | This is a left-over from f231a01d2217d31 Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
* Make `<Typeable.h>` obsolete and refactor away its useHerbert Valerio Riedel2013-09-172-15/+11
| | | | | | | | | | | With GHC 7.8's PolyKinds the macros in `<Typeable.h>` are no longer of any use, and their use is clearly obsolete. The sites using those macros are replaced by auto-derivations of `Typeable` instances. This reduces reliance on the CPP extension and the compile dependency on `Typeable.h` in a couple of modules. Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
* Constant-fold `__GLASGOW_HASKELL__` CPP conditionalsHerbert Valerio Riedel2013-09-174-352/+0
| | | | | | | | | | Now that HUGS and NHC specific code has been removed, this commit "folds" the now redundant `#if((n)def)`s containing `__GLASGOW_HASKELL__`. This renders `base` officially GHC only. This commit also removes redundant `{-# LANGUAGE CPP #-}`. Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
* Add an __hsbase_ prefix to the MD5 symbols (#7914)Simon Marlow2013-05-211-4/+4
|
* Remove nhc98-specific files and contentIan Lynagh2013-02-151-4/+0
|
* Implement poly-kinded TypeableJose Pedro Magalhaes2013-02-122-7/+130
| | | | | | | | | | | | | | This patch makes the Data.Typeable.Typeable class work with arguments of any kind. In particular, this removes the Typeable1..7 class hierarchy, greatly simplyfing the whole Typeable story. Also added is the AutoDeriveTypeable language extension, which will automatically derive Typeable for all types and classes declared in that module. Since there is now no good reason to give handwritten instances of the Typeable class, those are ignored (for backwards compatibility), and a warning is emitted. The old, kind-* Typeable class is now called OldTypeable, and lives in the Data.OldTypeable module. It is deprecated, and should be removed in some future version of GHC.
* GHC.Windows: more error support (guards, system error strings)Joey Adams2012-11-171-0/+1
| | | | | | | | | | | | | | | This changes the output of throwGetLastError to include the system error message, rather than the message of our fictitious errno. It also adds several definitions to GHC.Windows, mostly from the Win32 package. The exceptions are: * getErrorMessage: returns a String, unlike in System.Win32.Types, where it returns an LPWSTR. * errCodeToIOError: new * c_maperrno_func: new
* Use CAPI to make the C wrapper for keventIan Lynagh2012-10-151-13/+0
|
* FFI wrapper for kevent()Iku Iwasa2012-10-041-0/+13
|
* Adapt to NetBSD's struct keventIku Iwasa2012-10-041-0/+6
|
* Use in-process file locking on Windows (#4363)Paolo Capriotti2012-05-081-2/+2
|
* Don't include sys/timeb.h on FreeBSD.Geoffrey Mainland2012-04-251-1/+1
| | | | | sys/timeb.h is deprecated on FreeBSD meaning validation fails quite early without this patch.
* Replace getUSecOfDay with monotonic timer (#5865)Paolo Capriotti2012-04-171-1/+1
|
* Define monotonic time function for Darwin.Paolo Capriotti2012-04-171-0/+3
|
* Use monotonic time in Event/Manager.hs.Paolo Capriotti2012-04-162-0/+8
|
* Move nocldstop from HsBase.h to HsUnix.hIan Lynagh2012-02-261-3/+0
|
* Use CAPI for lseekIan Lynagh2012-02-261-14/+0
|
* Remove another unused definitionIan Lynagh2012-02-261-2/+0
|