Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion hs-bindgen/examples/golden/fun_attributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ int square (int) __attribute__ ((const));
// deprecated
// deprecated (msg)

int old_fn () __attribute__ ((deprecated));
int old_fn_deprecated () __attribute__ ((deprecated("Use new_function instead")));

// unavailable
// unavailable (msg)

int old_fn_unavailable () __attribute__((unavailable("Use new_function instead")));

// format (archetype, string-index, first-to-check)

Expand Down
84 changes: 43 additions & 41 deletions hs-bindgen/fixtures/fun_attributes.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1047,18 +1047,18 @@
ForeignImportDecl {
foreignImportName = Name
"@NsVar"
"old_fn",
"old_fn_deprecated",
foreignImportParameters = [],
foreignImportResultType =
NormalResultType
(HsIO (HsPrimType HsPrimCInt)),
foreignImportOrigName =
"hs_bindgen_test_fun_attributes_1040c24c74db8069",
"hs_bindgen_test_fun_attributes_e9647b9c99c68776",
foreignImportCallConv =
CallConvUserlandCAPI
UserlandCapiWrapper {
capiWrapperDefinition =
"signed int hs_bindgen_test_fun_attributes_1040c24c74db8069 (void) { return old_fn(); }",
"signed int hs_bindgen_test_fun_attributes_e9647b9c99c68776 (void) { return old_fn_deprecated(); }",
capiWrapperImport =
"fun_attributes.h"},
foreignImportOrigin = Function
Expand All @@ -1072,7 +1072,8 @@
foreignImportComment = Just
Comment {
commentTitle = Nothing,
commentOrigin = Just "old_fn",
commentOrigin = Just
"old_fn_deprecated",
commentLocation = Just
"fun_attributes.h:46:5",
commentHeaderInfo = Just
Expand Down Expand Up @@ -1170,7 +1171,7 @@
commentOrigin = Just
"my_dgettext",
commentLocation = Just
"fun_attributes.h:57:1",
"fun_attributes.h:62:1",
commentHeaderInfo = Just
HeaderInfo {
headerMainHeaders = NE.fromList
Expand Down Expand Up @@ -1249,7 +1250,7 @@
commentTitle = Nothing,
commentOrigin = Just "fdopen",
commentLocation = Just
"fun_attributes.h:68:9",
"fun_attributes.h:73:9",
commentHeaderInfo = Just
HeaderInfo {
headerMainHeaders = NE.fromList
Expand Down Expand Up @@ -1288,7 +1289,7 @@
commentTitle = Nothing,
commentOrigin = Just "f2",
commentLocation = Just
"fun_attributes.h:72:65",
"fun_attributes.h:77:65",
commentHeaderInfo = Just
HeaderInfo {
headerMainHeaders = NE.fromList
Expand Down Expand Up @@ -1398,7 +1399,7 @@
commentOrigin = Just
"my_memcpy",
commentLocation = Just
"fun_attributes.h:78:1",
"fun_attributes.h:83:1",
commentHeaderInfo = Just
HeaderInfo {
headerMainHeaders = NE.fromList
Expand Down Expand Up @@ -1437,7 +1438,7 @@
commentTitle = Nothing,
commentOrigin = Just "fatal",
commentLocation = Just
"fun_attributes.h:95:6",
"fun_attributes.h:100:6",
commentHeaderInfo = Just
HeaderInfo {
headerMainHeaders = NE.fromList
Expand Down Expand Up @@ -1490,7 +1491,7 @@
commentTitle = Nothing,
commentOrigin = Just "hash",
commentLocation = Just
"fun_attributes.h:103:5",
"fun_attributes.h:108:5",
commentHeaderInfo = Just
HeaderInfo {
headerMainHeaders = NE.fromList
Expand Down Expand Up @@ -1568,7 +1569,7 @@
commentTitle = Nothing,
commentOrigin = Just "mymalloc",
commentLocation = Just
"fun_attributes.h:108:1",
"fun_attributes.h:113:1",
commentHeaderInfo = Just
HeaderInfo {
headerMainHeaders = NE.fromList
Expand Down Expand Up @@ -1607,7 +1608,7 @@
commentTitle = Nothing,
commentOrigin = Just "foobar",
commentLocation = Just
"fun_attributes.h:112:13",
"fun_attributes.h:117:13",
commentHeaderInfo = Just
HeaderInfo {
headerMainHeaders = NE.fromList
Expand Down Expand Up @@ -1648,7 +1649,7 @@
commentOrigin = Just
"core2_func",
commentLocation = Just
"fun_attributes.h:119:5",
"fun_attributes.h:124:5",
commentHeaderInfo = Just
HeaderInfo {
headerMainHeaders = NE.fromList
Expand Down Expand Up @@ -1689,7 +1690,7 @@
commentOrigin = Just
"sse3_func",
commentLocation = Just
"fun_attributes.h:120:5",
"fun_attributes.h:125:5",
commentHeaderInfo = Just
HeaderInfo {
headerMainHeaders = NE.fromList
Expand Down Expand Up @@ -1728,7 +1729,7 @@
commentTitle = Nothing,
commentOrigin = Just "f3",
commentLocation = Just
"fun_attributes.h:124:49",
"fun_attributes.h:129:49",
commentHeaderInfo = Just
HeaderInfo {
headerMainHeaders = NE.fromList
Expand Down Expand Up @@ -1768,7 +1769,7 @@
commentTitle = Nothing,
commentOrigin = Just "fn",
commentLocation = Just
"fun_attributes.h:129:5",
"fun_attributes.h:134:5",
commentHeaderInfo = Just
HeaderInfo {
headerMainHeaders = NE.fromList
Expand Down Expand Up @@ -1808,7 +1809,7 @@
commentTitle = Nothing,
commentOrigin = Just "y",
commentLocation = Just
"fun_attributes.h:135:12",
"fun_attributes.h:140:12",
commentHeaderInfo = Just
HeaderInfo {
headerMainHeaders = NE.fromList
Expand Down Expand Up @@ -1848,7 +1849,7 @@
commentTitle = Nothing,
commentOrigin = Just "x1",
commentLocation = Just
"fun_attributes.h:138:12",
"fun_attributes.h:143:12",
commentHeaderInfo = Just
HeaderInfo {
headerMainHeaders = NE.fromList
Expand Down Expand Up @@ -1888,7 +1889,7 @@
commentTitle = Nothing,
commentOrigin = Just "x2",
commentLocation = Just
"fun_attributes.h:141:12",
"fun_attributes.h:146:12",
commentHeaderInfo = Just
HeaderInfo {
headerMainHeaders = NE.fromList
Expand Down Expand Up @@ -2379,18 +2380,18 @@
ForeignImportDecl {
foreignImportName = Name
"@NsVar"
"old_fn",
"old_fn_deprecated",
foreignImportParameters = [],
foreignImportResultType =
NormalResultType
(HsIO (HsPrimType HsPrimCInt)),
foreignImportOrigName =
"hs_bindgen_test_fun_attributes_febe1b1c3f69ce2f",
"hs_bindgen_test_fun_attributes_c48f18f4f06068eb",
foreignImportCallConv =
CallConvUserlandCAPI
UserlandCapiWrapper {
capiWrapperDefinition =
"signed int hs_bindgen_test_fun_attributes_febe1b1c3f69ce2f (void) { return old_fn(); }",
"signed int hs_bindgen_test_fun_attributes_c48f18f4f06068eb (void) { return old_fn_deprecated(); }",
capiWrapperImport =
"fun_attributes.h"},
foreignImportOrigin = Function
Expand All @@ -2404,7 +2405,8 @@
foreignImportComment = Just
Comment {
commentTitle = Nothing,
commentOrigin = Just "old_fn",
commentOrigin = Just
"old_fn_deprecated",
commentLocation = Just
"fun_attributes.h:46:5",
commentHeaderInfo = Just
Expand Down Expand Up @@ -2502,7 +2504,7 @@
commentOrigin = Just
"my_dgettext",
commentLocation = Just
"fun_attributes.h:57:1",
"fun_attributes.h:62:1",
commentHeaderInfo = Just
HeaderInfo {
headerMainHeaders = NE.fromList
Expand Down Expand Up @@ -2581,7 +2583,7 @@
commentTitle = Nothing,
commentOrigin = Just "fdopen",
commentLocation = Just
"fun_attributes.h:68:9",
"fun_attributes.h:73:9",
commentHeaderInfo = Just
HeaderInfo {
headerMainHeaders = NE.fromList
Expand Down Expand Up @@ -2620,7 +2622,7 @@
commentTitle = Nothing,
commentOrigin = Just "f2",
commentLocation = Just
"fun_attributes.h:72:65",
"fun_attributes.h:77:65",
commentHeaderInfo = Just
HeaderInfo {
headerMainHeaders = NE.fromList
Expand Down Expand Up @@ -2730,7 +2732,7 @@
commentOrigin = Just
"my_memcpy",
commentLocation = Just
"fun_attributes.h:78:1",
"fun_attributes.h:83:1",
commentHeaderInfo = Just
HeaderInfo {
headerMainHeaders = NE.fromList
Expand Down Expand Up @@ -2769,7 +2771,7 @@
commentTitle = Nothing,
commentOrigin = Just "fatal",
commentLocation = Just
"fun_attributes.h:95:6",
"fun_attributes.h:100:6",
commentHeaderInfo = Just
HeaderInfo {
headerMainHeaders = NE.fromList
Expand Down Expand Up @@ -2822,7 +2824,7 @@
commentTitle = Nothing,
commentOrigin = Just "hash",
commentLocation = Just
"fun_attributes.h:103:5",
"fun_attributes.h:108:5",
commentHeaderInfo = Just
HeaderInfo {
headerMainHeaders = NE.fromList
Expand Down Expand Up @@ -2900,7 +2902,7 @@
commentTitle = Nothing,
commentOrigin = Just "mymalloc",
commentLocation = Just
"fun_attributes.h:108:1",
"fun_attributes.h:113:1",
commentHeaderInfo = Just
HeaderInfo {
headerMainHeaders = NE.fromList
Expand Down Expand Up @@ -2939,7 +2941,7 @@
commentTitle = Nothing,
commentOrigin = Just "foobar",
commentLocation = Just
"fun_attributes.h:112:13",
"fun_attributes.h:117:13",
commentHeaderInfo = Just
HeaderInfo {
headerMainHeaders = NE.fromList
Expand Down Expand Up @@ -2980,7 +2982,7 @@
commentOrigin = Just
"core2_func",
commentLocation = Just
"fun_attributes.h:119:5",
"fun_attributes.h:124:5",
commentHeaderInfo = Just
HeaderInfo {
headerMainHeaders = NE.fromList
Expand Down Expand Up @@ -3021,7 +3023,7 @@
commentOrigin = Just
"sse3_func",
commentLocation = Just
"fun_attributes.h:120:5",
"fun_attributes.h:125:5",
commentHeaderInfo = Just
HeaderInfo {
headerMainHeaders = NE.fromList
Expand Down Expand Up @@ -3060,7 +3062,7 @@
commentTitle = Nothing,
commentOrigin = Just "f3",
commentLocation = Just
"fun_attributes.h:124:49",
"fun_attributes.h:129:49",
commentHeaderInfo = Just
HeaderInfo {
headerMainHeaders = NE.fromList
Expand Down Expand Up @@ -3100,7 +3102,7 @@
commentTitle = Nothing,
commentOrigin = Just "fn",
commentLocation = Just
"fun_attributes.h:129:5",
"fun_attributes.h:134:5",
commentHeaderInfo = Just
HeaderInfo {
headerMainHeaders = NE.fromList
Expand Down Expand Up @@ -3140,7 +3142,7 @@
commentTitle = Nothing,
commentOrigin = Just "y",
commentLocation = Just
"fun_attributes.h:135:12",
"fun_attributes.h:140:12",
commentHeaderInfo = Just
HeaderInfo {
headerMainHeaders = NE.fromList
Expand Down Expand Up @@ -3180,7 +3182,7 @@
commentTitle = Nothing,
commentOrigin = Just "x1",
commentLocation = Just
"fun_attributes.h:138:12",
"fun_attributes.h:143:12",
commentHeaderInfo = Just
HeaderInfo {
headerMainHeaders = NE.fromList
Expand Down Expand Up @@ -3220,7 +3222,7 @@
commentTitle = Nothing,
commentOrigin = Just "x2",
commentLocation = Just
"fun_attributes.h:141:12",
"fun_attributes.h:146:12",
commentHeaderInfo = Just
HeaderInfo {
headerMainHeaders = NE.fromList
Expand Down Expand Up @@ -3551,7 +3553,7 @@
ForeignImportDecl {
foreignImportName = Name
"@NsVar"
"hs_bindgen_test_fun_attributes_3add0261fa83e1dd",
"hs_bindgen_test_fun_attributes_17f68fdc3f464b20",
foreignImportParameters = [],
foreignImportResultType =
NormalResultType
Expand All @@ -3560,12 +3562,12 @@
(HsIO
(HsPrimType HsPrimCInt)))),
foreignImportOrigName =
"hs_bindgen_test_fun_attributes_3add0261fa83e1dd",
"hs_bindgen_test_fun_attributes_17f68fdc3f464b20",
foreignImportCallConv =
CallConvUserlandCAPI
UserlandCapiWrapper {
capiWrapperDefinition =
"/* get_old_fn_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_fun_attributes_3add0261fa83e1dd (void)) (void) { return &old_fn; } ",
"/* get_old_fn_deprecated_ptr */ __attribute__ ((const)) signed int (*hs_bindgen_test_fun_attributes_17f68fdc3f464b20 (void)) (void) { return &old_fn_deprecated; } ",
capiWrapperImport =
"fun_attributes.h"},
foreignImportOrigin = Global
Expand Down
Loading
Loading