Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
-
db3276bb
by Sylvain Henry at 2025-09-11T11:27:28-04:00
-
11eeeba7
by Sylvain Henry at 2025-09-11T11:27:28-04:00
7 changed files:
- testsuite/tests/ffi/should_run/T1288_c.c
- testsuite/tests/ffi/should_run/T1288_ghci_c.c
- testsuite/tests/ffi/should_run/T2276_c.c
- testsuite/tests/ffi/should_run/T2276_ghci_c.c
- testsuite/tests/ghci/scripts/T7388.hs
- testsuite/tests/ghci/scripts/T7388.script
- testsuite/tests/th/T16180.hs
Changes:
| ... | ... | @@ -3,4 +3,5 @@ |
| 3 | 3 | void test(int arg)
|
| 4 | 4 | {
|
| 5 | 5 | printf("The argument passed was %i\n", arg );
|
| 6 | + fflush(NULL);
|
|
| 6 | 7 | } |
| ... | ... | @@ -3,4 +3,5 @@ |
| 3 | 3 | void test(int arg)
|
| 4 | 4 | {
|
| 5 | 5 | printf("The argument passed was %i\n", arg );
|
| 6 | + fflush(NULL);
|
|
| 6 | 7 | } |
| ... | ... | @@ -3,4 +3,5 @@ |
| 3 | 3 | void test(int arg)
|
| 4 | 4 | {
|
| 5 | 5 | printf("The argument passed was %i\n", arg );
|
| 6 | + fflush(NULL);
|
|
| 6 | 7 | } |
| ... | ... | @@ -3,4 +3,5 @@ |
| 3 | 3 | void test(int arg)
|
| 4 | 4 | {
|
| 5 | 5 | printf("The argument passed was %i\n", arg );
|
| 6 | + fflush(NULL);
|
|
| 6 | 7 | } |
| ... | ... | @@ -2,5 +2,7 @@ |
| 2 | 2 | module T7388 where
|
| 3 | 3 | |
| 4 | 4 | import Foreign.C
|
| 5 | +import Foreign.Ptr
|
|
| 5 | 6 | |
| 6 | 7 | foreign import capi "stdio.h printf" printfb :: CString -> CInt -> IO ()
|
| 8 | +foreign import capi "stdio.h fflush" fflushb :: Ptr () -> IO () |
| 1 | 1 | :l T7388
|
| 2 | 2 | withCString "I am a working CApi FFI call\n" $ \str -> printfb str 0
|
| 3 | +-- don't forget to flush, otherwise when ghc is statically linked, the C stdout
|
|
| 4 | +-- buffer is never flushed.
|
|
| 5 | +fflushb nullPtr |
| ... | ... | @@ -23,10 +23,19 @@ $(do |
| 23 | 23 | , "_mydata:"
|
| 24 | 24 | , ".ascii \"Hello world\\0\""
|
| 25 | 25 | ]
|
| 26 | +#elif defined(mingw32_HOST_OS)
|
|
| 27 | + [ ".global \"mydata\""
|
|
| 28 | + , "mydata:"
|
|
| 29 | + , ".ascii \"Hello world\\0\""
|
|
| 30 | + ]
|
|
| 26 | 31 | #else
|
| 27 | 32 | [ ".global \"mydata\""
|
| 28 | 33 | , "mydata:"
|
| 29 | 34 | , ".ascii \"Hello world\\0\""
|
| 35 | + -- make recent linkers happy by explicitly not requiring an executable
|
|
| 36 | + -- stack. Without this section we get:
|
|
| 37 | + -- warning: <file>: missing .note.GNU-stack section implies executable stack
|
|
| 38 | + , ".section .note.GNU-stack,\"\",@progbits"
|
|
| 30 | 39 | ]
|
| 31 | 40 | #endif
|
| 32 | 41 | return [])
|