diff options
author | RyanGlScott <ryan.gl.scott@gmail.com> | 2015-12-19 11:09:52 +0100 |
---|---|---|
committer | Thomas Miedema <thomasmiedema@gmail.com> | 2015-12-19 11:09:59 +0100 |
commit | 2cc5b607df27e702541985f7c4c987806c4ec2a1 (patch) | |
tree | 2ab126c6dccef992bf689a336a3aed6590a7d052 /testsuite/tests/hsc2hs | |
parent | b2670fc47754288224b825a3308b92642ccf7e73 (diff) | |
download | haskell-2cc5b607df27e702541985f7c4c987806c4ec2a1.tar.gz |
Documentation, tests for hsc2hs's new #alignment macro
Adds two tests (one for Trac #4340 and one for Trac #10272), as well as
advice on how to fix your code if `hsc2hs` emits warnings with GHC 8.0
due to a redefinition of `#alignment`. (I also put the advice in the
[GHC 8.0 Migration
Guide](https://ghc.haskell.org/trac/ghc/wiki/Migration/8.0).)
Reviewed By: thomie
Differential Revision: https://phabricator.haskell.org/D1663
GHC Trac Issues: #4340, #10272
Diffstat (limited to 'testsuite/tests/hsc2hs')
-rw-r--r-- | testsuite/tests/hsc2hs/Makefile | 12 | ||||
-rw-r--r-- | testsuite/tests/hsc2hs/T10272.h | 12 | ||||
-rw-r--r-- | testsuite/tests/hsc2hs/T10272.hsc | 6 | ||||
-rw-r--r-- | testsuite/tests/hsc2hs/T10272.stdout | 1 | ||||
-rw-r--r-- | testsuite/tests/hsc2hs/T4340.hsc | 8 | ||||
-rw-r--r-- | testsuite/tests/hsc2hs/T4340.stdout | 1 | ||||
-rw-r--r-- | testsuite/tests/hsc2hs/all.T | 10 |
7 files changed, 50 insertions, 0 deletions
diff --git a/testsuite/tests/hsc2hs/Makefile b/testsuite/tests/hsc2hs/Makefile index ec16b16474..54fa5ad8a0 100644 --- a/testsuite/tests/hsc2hs/Makefile +++ b/testsuite/tests/hsc2hs/Makefile @@ -28,3 +28,15 @@ hsc2hs004: T3837: LANG=C '$(HSC2HS)' $@.hsc '$(TEST_HC)' $(TEST_HC_OPTS) -c $@.hs + +.PHONY: T4340 +T4340: + '$(HSC2HS)' $@.hsc + '$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make $@ + ./$@ + +.PHONY: T10272 +T10272: + '$(HSC2HS)' --cross-compile $@.hsc + '$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make $@ + ./$@ diff --git a/testsuite/tests/hsc2hs/T10272.h b/testsuite/tests/hsc2hs/T10272.h new file mode 100644 index 0000000000..6d8142d909 --- /dev/null +++ b/testsuite/tests/hsc2hs/T10272.h @@ -0,0 +1,12 @@ +#ifndef _T10272_H_ +#define _T10272_H_ + +#include <stdint.h> + +typedef struct { + uint8_t a; + uint64_t b; + uint16_t c; +} eight; + +#endif diff --git a/testsuite/tests/hsc2hs/T10272.hsc b/testsuite/tests/hsc2hs/T10272.hsc new file mode 100644 index 0000000000..c4ff6d180a --- /dev/null +++ b/testsuite/tests/hsc2hs/T10272.hsc @@ -0,0 +1,6 @@ +module Main where + +#include "T10272.h" + +main :: IO () +main = print #{alignment eight} diff --git a/testsuite/tests/hsc2hs/T10272.stdout b/testsuite/tests/hsc2hs/T10272.stdout new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/testsuite/tests/hsc2hs/T10272.stdout @@ -0,0 +1 @@ +8 diff --git a/testsuite/tests/hsc2hs/T4340.hsc b/testsuite/tests/hsc2hs/T4340.hsc new file mode 100644 index 0000000000..5ae9e2a3a9 --- /dev/null +++ b/testsuite/tests/hsc2hs/T4340.hsc @@ -0,0 +1,8 @@ +module Main where + +#include <stdint.h> + +#def typedef struct { uint8_t a; uint64_t b; uint16_t c; } eight; + +main :: IO () +main = print #{alignment eight} diff --git a/testsuite/tests/hsc2hs/T4340.stdout b/testsuite/tests/hsc2hs/T4340.stdout new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/testsuite/tests/hsc2hs/T4340.stdout @@ -0,0 +1 @@ +8 diff --git a/testsuite/tests/hsc2hs/all.T b/testsuite/tests/hsc2hs/all.T index b0957911b6..d4fc69d88d 100644 --- a/testsuite/tests/hsc2hs/all.T +++ b/testsuite/tests/hsc2hs/all.T @@ -25,3 +25,13 @@ test('T3837', run_command, ['$MAKE -s --no-print-directory T3837']) +test('T4340', + [extra_clean(['T4340.hs', 'T4340_hsc_make.c', + 'T4340_hsc.c', 'T4340_hsc.h'])], + run_command, + ['$MAKE -s --no-print-directory T4340']) + +test('T10272', + [extra_clean(['T10272.hs', 'T10272_hsc_make.c'])], + run_command, + ['$MAKE -s --no-print-directory T10272']) |