summaryrefslogtreecommitdiff
path: root/testsuite/tests/ffi
Commit message (Collapse)AuthorAgeFilesLines
* testsuite: Fix -Wcompat-unqualified-imports issuesBen Gamari2020-02-081-1/+0
|
* Fix typos, via a Levenshtein-style correctorBrian Wignall2020-01-041-1/+1
|
* Prevent -optc arguments from being duplicated in reverse order (#17471)Ryan Scott2019-11-234-0/+20
| | | | | | | | | | | | | | | | | This reverts a part of commit 7bc5d6c6578ab9d60a83b81c7cc14819afef32ba that causes all arguments to `-optc` (and `-optcxx`) to be passed twice to the C/C++ compiler, once in reverse order and then again in the correct order. While passing duplicate arguments is usually harmless it can cause breakage in this pattern, which is employed by Hackage libraries in the wild: ``` ghc Foo.hs foo.c -optc-D -optcFOO ``` As `FOO -D -D FOO` will cause compilers to error. Fixes #17471.
* Windows: Update tarballs to GCC 9.2 and remove MAX_PATH limit.Tamar Christina2019-10-204-10/+8
|
* Expunge #ifdef and #ifndef from the codebaseJohn Ericson2019-07-146-6/+6
| | | | | | | | These are unexploded minds as far as the linter is concerned. I don't want to hit in my MRs by mistake! I did this with `sed`, and then rolled back some changes in the docs, config.guess, and the linter itself.
* testsuite: Mark T7170 as broken on WindowsBen Gamari2019-06-211-1/+4
| | | | Due to #16801.
* testsuite: Ensure that ffi005 output order is predictableBen Gamari2019-06-164-6/+14
| | | | | The libc output buffer wasn't being flushed, making the order system-depedent.
* Implement the -XUnliftedNewtypes extension.Andrew Martin2019-06-144-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | GHC Proposal: 0013-unlifted-newtypes.rst Discussion: https://github.com/ghc-proposals/ghc-proposals/pull/98 Issues: #15219, #1311, #13595, #15883 Implementation Details: Note [Implementation of UnliftedNewtypes] Note [Unifying data family kinds] Note [Compulsory newtype unfolding] This patch introduces the -XUnliftedNewtypes extension. When this extension is enabled, GHC drops the restriction that the field in a newtype must be of kind (TYPE 'LiftedRep). This allows types like Int# and ByteArray# to be used in a newtype. Additionally, coerce is made levity-polymorphic so that it can be used with newtypes over unlifted types. The bulk of the changes are in TcTyClsDecls.hs. With -XUnliftedNewtypes, getInitialKind is more liberal, introducing a unification variable to return the kind (TYPE r0) rather than just returning (TYPE 'LiftedRep). When kind-checking a data constructor with kcConDecl, we attempt to unify the kind of a newtype with the kind of its field's type. When typechecking a data declaration with tcTyClDecl, we again perform a unification. See the implementation note for more on this. Co-authored-by: Richard Eisenberg <rae@richarde.dev>
* testsuite: Skip T493 in ghci way.Ben Gamari2019-06-121-1/+1
| | | | | T493 tests #493, which is an FFI test. FFI tests should be skipped in ghci way.
* testsuite: Omit profasm way for cc017Ben Gamari2019-06-121-1/+2
| | | | cc017 requires TH but we can't load dynamic profiled objects.
* Use a better strategy for determining the offset applied to foreign function ↵Andrew Martin2019-06-0418-0/+304
| | | | arguments that have an unlifted boxed type. We used to use the type of the argument. We now use the type of the foreign function. Add a test to confirm that the roundtrip conversion between an unlifted boxed type and Any is sound in the presence of a foreign function call.
* Reject nested foralls in foreign imports (#16702)Ryan Scott2019-05-313-0/+54
| | | | | | | | This replaces a panic observed in #16702 with a simple error message stating that nested `forall`s simply aren't allowed in the type signature of a `foreign import` (at least, not at present). Fixes #16702.
* Add regression test case for old issue #493Kevin Buhr2019-05-104-0/+61
|
* Add `-optcxx` option (#16477)Yuriy Syrovetskiy2019-04-083-1/+29
|
* Update Trac ticket URLs to point to GitLabRyan Scott2019-03-152-2/+2
| | | | | This moves all URL references to Trac tickets to their corresponding GitLab counterparts.
* testsuite: Use fragile modifier for more testsBen Gamari2019-03-061-4/+2
|
* testsuite: Use makefile_testBen Gamari2019-01-301-4/+4
| | | | | This eliminates most uses of run_command in the testsuite in favor of the more structured makefile_test.
* Revert "Batch merge"Ben Gamari2019-01-301-4/+4
| | | | This reverts commit 76c8fd674435a652c75a96c85abbf26f1f221876.
* Batch mergeBen Gamari2019-01-301-4/+4
|
* testsuite: Skip T1288_ghci in unregisterisedBen Gamari2019-01-271-0/+2
| | | | | As pointed out in #16085, these ghci tests are fragile in the unregisterised way.
* testsuite: Skip ffi018_ghci when unregisterisedBen Gamari2018-12-251-1/+3
| | | | As noted in #16085 this test is fragile in unregisterised compilers.
* Introduce Int16# and Word16#Abhiroop Sarkar2018-11-177-0/+76
| | | | | | | | | | | | This builds off of D4475. Bumps binary submodule. Reviewers: carter, AndreasK, hvr, goldfire, bgamari, simonmar Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D5006
* Add Int8# and Word8#Michal Terepeta2018-11-027-0/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the first step of implementing: https://github.com/ghc-proposals/ghc-proposals/pull/74 The main highlights/changes: primops.txt.pp gets two new sections for two new primitive types for signed and unsigned 8-bit integers (Int8# and Word8 respectively) along with basic arithmetic and comparison operations. PrimRep/RuntimeRep get two new constructors for them. All of the primops translate into the existing MachOPs. For CmmCalls the codegen will now zero-extend the values at call site (so that they can be moved to the right register) and then truncate them back their original width. x86 native codegen needed some updates, since it wasn't able to deal with the new widths, but all the changes are quite localized. LLVM backend seems to just work. This is the second attempt at merging this, after the first attempt in D4475 had to be backed out due to regressions on i386. Bumps binary submodule. Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com> Test Plan: ./validate (on both x86-{32,64}) Reviewers: bgamari, hvr, goldfire, simonmar Subscribers: rwbarton, carter Differential Revision: https://phabricator.haskell.org/D5258
* Revert "Add Int8# and Word8#"Ben Gamari2018-10-097-76/+0
| | | | | | | | | This unfortunately broke i386 support since it introduced references to byte-sized registers that don't exist on that architecture. Reverts binary submodule This reverts commit 5d5307f943d7581d7013ffe20af22233273fba06.
* Add Int8# and Word8#Michal Terepeta2018-10-077-0/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the first step of implementing: https://github.com/ghc-proposals/ghc-proposals/pull/74 The main highlights/changes: - `primops.txt.pp` gets two new sections for two new primitive types for signed and unsigned 8-bit integers (`Int8#` and `Word8` respectively) along with basic arithmetic and comparison operations. `PrimRep`/`RuntimeRep` get two new constructors for them. All of the primops translate into the existing `MachOP`s. - For `CmmCall`s the codegen will now zero-extend the values at call site (so that they can be moved to the right register) and then truncate them back their original width. - x86 native codegen needed some updates, since it wasn't able to deal with the new widths, but all the changes are quite localized. LLVM backend seems to just work. Bumps binary submodule. Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com> Test Plan: ./validate with new tests Reviewers: hvr, goldfire, bgamari, simonmar Subscribers: Abhiroop, dfeuer, rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4475
* Update UnsafeReenter testÖmer Sinan Ağacan2018-09-101-11/+6
| | | | | | | | | | | | | | | Only run the test in non-threaded, compiled mode. It hangs with threaded runtime (which stage 2 compiler uses, so disable it for ghci too). Reviewers: simonmar, alpmestan, bgamari Reviewed By: simonmar Subscribers: rwbarton, carter GHC Trac Issues: #14912 Differential Revision: https://phabricator.haskell.org/D5136
* Fix another batch of `./validate --slow` failuresAlp Mestanogullari2018-05-131-1/+9
| | | | | | | | | | | | | | | | | | | | | | A rather detailed summary can be found at: https://gist.github.com/alpmestan/be82b47bb88b7dc9ff84105af9b1bb82 This doesn't fix all expectation mismatches yet, but we're down to about 20 mismatches with my previous patch and this one, as opposed to ~150 when I got started. Test Plan: ./validate --slow Reviewers: bgamari, erikd, simonmar Reviewed By: simonmar Subscribers: thomie, carter GHC Trac Issues: #14890 Differential Revision: https://phabricator.haskell.org/D4636
* Fix panic for `ByteArray#` arguments in CApiFFI foreign importsHerbert Valerio Riedel2017-10-163-0/+27
| | | | | | | | | | | | | | | | | | | | Declarations such as foreign import capi unsafe "string.h strlen" c_strlen_capi :: ByteArray# -> IO CSize foreign import capi unsafe "string.h memset" c_memset_capi :: MutableByteArray# s -> CInt -> CSize -> IO () would cause GHC to panic because the CApiFFI c-wrapper generator didn't know what C type to use for `(Mutable)ByteArray#` types (unlike the `ccall` codepath). This addresses #9274 Reviewed By: bgamari Differential Revision: https://phabricator.haskell.org/D4092
* Fix #14125 by normalizing data family instances more aggressivelyRyan Scott2017-08-222-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Commit 3540d1e1a23926ce0a8a6ae83a36f5f6b2497ccf inadvertently broke the ability for newtype instances to be used as marshallable types in FFI declarations. The reason is a bit silly: an extra check was added for type synonyms with no type families on the RHS in `normalise_tc_app`, but this check would only skip over type families, not //data// families, since the predicate being used was `not . isTypeFamilyCon`. The fix is simple: just use `not . isFamilyCon` instead so that data families are also skipped by this check. Test Plan: make test TEST=T14125 Reviewers: goldfire, simonpj, austin, bgamari Reviewed By: simonpj Subscribers: rwbarton, thomie GHC Trac Issues: #14125 Differential Revision: https://phabricator.haskell.org/D3865
* Allow bytecode interpreter to make unsafe foreign callsBen Gamari2017-06-276-1/+38
| | | | | | | | | | | | Reviewers: austin, hvr, erikd, simonmar Reviewed By: simonmar Subscribers: rwbarton, thomie GHC Trac Issues: #8281, #13730. Differential Revision: https://phabricator.haskell.org/D3619
* tests: remove extra_files.py (#12223)Reid Barton2017-02-262-4/+5
| | | | | | | | | | | | The script I used is included as testsuite/driver/kill_extra_files.py, though at this point it is for mostly historical interest. Some of the tests in libraries/hpc relied on extra_files.py, so this commit includes an update to that submodule. One test in libraries/process also relies on extra_files.py, but we cannot update that submodule so easily, so for now we special-case it in the test driver.
* Remove clean_cmd and extra_clean usage from .T filesThomas Miedema2017-01-223-72/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | The `clean_cmd` and `extra_clean` setup functions don't do anything. Remove them from .T files. Created using https://github.com/thomie/refactor-ghc-testsuite. This diff is a test for the .T-file parser/processor/pretty-printer in that repository. find . -name '*.T' -exec ~/refactor-ghc-testsuite/Main "{}" \; Tests containing inline comments or multiline strings are not modified. Preparation for #12223. Test Plan: Harbormaster Reviewers: austin, hvr, simonmar, mpickering, bgamari Reviewed By: mpickering Subscribers: mpickering Differential Revision: https://phabricator.haskell.org/D3000 GHC Trac Issues: #12223
* Add HsSyn prettyprinter testsAlan Zimmerman2016-12-078-18/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add prettyprinter tests, which take a file, parse it, pretty print it, re-parse the pretty printed version and then compare the original and new ASTs (ignoring locations) Updates haddock submodule to match the AST changes. There are three issues outstanding 1. Extra parens around a context are not reproduced. This will require an AST change and will be done in a separate patch. 2. Currently if an `HsTickPragma` is found, this is not pretty-printed, to prevent noise in the output. I am not sure what the desired behaviour in this case is, so have left it as before. Test Ppr047 is marked as expected fail for this. 3. Apart from in a context, the ParsedSource AST keeps all the parens from the original source. Something is happening in the renamer to remove the parens around visible type application, causing T12530 to fail, as the dumped splice decl is after the renamer. This needs to be fixed by keeping the parens, but I do not know where they are being removed. I have amended the test to pass, by removing the parens in the expected output. Test Plan: ./validate Reviewers: goldfire, mpickering, simonpj, bgamari, austin Reviewed By: simonpj, bgamari Subscribers: simonpj, goldfire, thomie, mpickering Differential Revision: https://phabricator.haskell.org/D2752 GHC Trac Issues: #3384
* Typos in commentsGabor Greif2016-10-311-1/+1
|
* Check for empty entity string in "prim" foreign importsSylvain HENRY2016-10-141-1/+1
| | | | | | | | | | | | | | | | | | | Foreign imports with "prim" convention require a valid symbol identifier (see linked issue). We check this. Fix line too long Test Plan: Validate Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2563 GHC Trac Issues: #12355
* CodeGen X86: fix unsafe foreign calls wrt inliningSylvain HENRY2016-10-014-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | Foreign calls (unsafe and safe) interact badly with inlining and register passing ABIs (see #11792 and #12614): the inlined code to compute a parameter of the call may overwrite a register already set to pass a preceding parameter. With this patch, we compute all parameters which are not simple expressions before assigning them to fixed registers required by the ABI. Test Plan: - Add test (test both reg and stack parameters) - Validate Reviewers: osa1, bgamari, austin, simonmar Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2263 GHC Trac Issues: #11792, #12614
* Added support for deprecated POSIX functions on Windows.Tamar Christina2016-09-011-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: With the introduction of 8.0.1 We've stopped supporting in GHCi the use of POSIX functions under their deprecated names on Windows. This to be compatible with object and libraries from the most popular compilers on the platform (Microsoft and Intel compilers). However this brings a confusing disparity between the compiled and interpreted behavior since MingW-W64 does support the deprecated names. Also It seems clear that package writers won't update their packages to properly support Windows. As such I have added redirects in the RTS for the deprecated functions as listed on https://msdn.microsoft.com/en-us/library/ms235384.aspx. This won't export the functions (as in, they won't be in the symbol table of compiled code for the RTS.) but we inject them into the symbol table of the dynamic linker at startup. Test Plan: ./validate and make test TEST="ffi017 ffi021" Reviewers: thomie, simonmar, RyanGlScott, bgamari, austin, hvr, erikd Reviewed By: simonmar, bgamari Subscribers: RyanGlScott, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D2500 GHC Trac Issues: #12209, #12497, #12496
* Testsuite: delete dead code + cleanupThomas Miedema2016-06-201-10/+5
| | | | | | * Set config settings directly in mk/test.mk, instead of indirectly in config/ghc * passing --hpcdir for WAY=hpc is unnecessary
* Testsuite: mark tests expect brokenThomas Miedema2016-06-201-2/+4
| | | | | | | | | * CgStaticPointers, GcStaticPointers, ListStaticPointers, TcStaticPointers01, TcStaticPointers02: #12207 * T11535: #12210 * ffi017/ffi021: #12209 * T11108: #11108 * T9646: #9646
* Testsuite: tabs -> spaces [skip ci]Thomas Miedema2016-06-208-77/+77
|
* PPC NCG: Fix float parameter passing on 64-bit.Peter Trommler2016-06-194-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | On Linux 64-bit PowerPC the first 13 floating point parameters are passed in registers. We only passed the first 8 floating point params. The alignment of a floating point single precision value in ELF v1.9 is the second word of a doubleword. For ELF v2 we support only little endian and the least significant word of a doubleword is the first word, so no special handling is required. Add a regression test. Test Plan: validate on powerpc Linux and AIX Reviewers: erikd, hvr, austin, simonmar, bgamari Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2327 GHC Trac Issues: #12134
* Export constructors for IntPtr and WordPtrRyanGlScott2016-05-024-0/+27
| | | | | | | | | | | | | | | | | | | | This finishes what #5529 started by exporting the constructors for `IntPtr` and `WordPtr` from `Foreign.Ptr`, allowing them to be used in `foreign` declarations. Fixes #11983. Test Plan: `make TEST=T11983` Reviewers: simonpj, hvr, bgamari, austin Reviewed By: simonpj Subscribers: simonpj, thomie Differential Revision: https://phabricator.haskell.org/D2142 GHC Trac Issues: #11983
* Print which warning-flag controls an emitted warningMichael Walker2016-02-251-2/+2
| | | | | | | | | | | | | | | | | Both gcc and clang tell which warning flag a reported warning can be controlled with, this patch makes ghc do the same. More generally, this allows for annotated compiler output, where an optional annotation is displayed in brackets after the severity. This also adds a new flag `-f(no-)show-warning-groups` to control whether to show which warning-group (such as `-Wall` or `-Wcompat`) a warning belongs to. This flag is on by default. This implements #10752 Reviewed By: quchen, bgamari, hvr Differential Revision: https://phabricator.haskell.org/D1943
* Testsuite: delete empty files [skip ci]Thomas Miedema2016-02-251-0/+0
|
* Testsuite: delete Windows line endings [skip ci] (#11631)Thomas Miedema2016-02-237-37/+37
|
* Testsuite: delete Windows line endings [skip ci] (#11631)Thomas Miedema2016-02-236-80/+80
|
* Allow CallStacks to be frozenEric Seidel2015-12-231-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Make 'error' include the CCS call stack when profiledSimon Marlow2015-11-132-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The idea here is that this gives a more detailed stack trace in two cases: 1. With `-prof` and `-fprof-auto` 2. In GHCi (see #11047) Example, with an error inserted in nofib/shootout/binary-trees: ``` $ ./Main 3 Main: z CallStack (from ImplicitParams): error, called at Main.hs:67:29 in main:Main CallStack (from -prof): Main.check' (Main.hs:(67,1)-(68,82)) Main.check (Main.hs:63:1-21) Main.stretch (Main.hs:32:35-57) Main.main.c (Main.hs:32:9-57) Main.main (Main.hs:(27,1)-(43,42)) Main.CAF (<entire-module>) ``` This doesn't quite obsolete +RTS -xc, which also attempts to display more information in the case when the error is in a CAF, but I'm exploring other solutions to that. Includes submodule updates. Test Plan: validate Reviewers: simonpj, ezyang, gridaphobe, bgamari, hvr, austin Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1426
* base: use Show for ErrorCall in uncaughtExceptionHandlerEric Seidel2015-09-212-0/+4
| | | | | | | | | | | | | The default top-level exception handler now uses the `Show` instance for `ErrorCall` when printing exceptions, so it will actually print the out-of-band data (e.g. `CallStack`s) in compiled binaries, instead of just printing the error message. This also updates the hpc submodule to fix the test output. Reviewed By: austin, thomie Differential Revision: https://phabricator.haskell.org/D1217
* Testsuite: delete remaining only_compiler_types(['ghc']) setupsThomas Miedema2015-07-142-9/+7
| | | | | No point in pretending other compilers can use the GHC testsuite. This makes the *.T files a bit shorter.