diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-02-01 02:00:25 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-02-01 02:00:25 -0700 |
| commit | b3459f64e795118c4c12890ed0fec75638b74a2c (patch) | |
| tree | d5730790d1b61f71a606e30023d68cc36071cce4 /test/run_tests.cpp | |
| parent | 6b2e29c6ac58d5f4370828bfa0f54b83d1931a97 (diff) | |
| download | zig-b3459f64e795118c4c12890ed0fec75638b74a2c.tar.gz zig-b3459f64e795118c4c12890ed0fec75638b74a2c.zip | |
parseh understands macros which alias global fn ptr vars
Diffstat (limited to 'test/run_tests.cpp')
| -rw-r--r-- | test/run_tests.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp index 89a6a9bee9..b244e9ab8a 100644 --- a/test/run_tests.cpp +++ b/test/run_tests.cpp @@ -2109,18 +2109,15 @@ Foo fun(Foo *a); "pub const Foo = c_void;", "pub extern fn fun(a: ?&c_void);"); - add_parseh_case("ignore #define for non-const", R"SOURCE( -struct Foo { - int x; -}; + add_parseh_case("generate inline func for #define global extern fn", R"SOURCE( extern void (*fn_ptr)(void); -#define Foo fn_ptr - )SOURCE", 3, - "pub type c_void = u8;", - "pub const Foo = struct_Foo;", - R"OUTPUT(export struct struct_Foo { - x: c_int, -})OUTPUT"); +#define foo fn_ptr + )SOURCE", 2, + "pub extern var fn_ptr: ?extern fn();", + R"SOURCE(#attribute("inline") +pub fn foo() { + (fn_ptr ?? (unreachable){})() +})SOURCE"); } static void print_compiler_invocation(TestCase *test_case) { |
