Skip to content
Snippets Groups Projects
Commit 6ff83caa authored by Erwan Jahier's avatar Erwan Jahier
Browse files

Soc2c : do not crash if the soc contains reference to extern types.

parent 5b2ddb82
No related branches found
No related tags found
No related merge requests found
(* Time-stamp: <modified the 10/06/2014 (at 15:52) by Erwan Jahier> *) (* Time-stamp: <modified the 10/06/2014 (at 16:01) by Erwan Jahier> *)
(* let put (os: out_channel) (fmt:('a, unit, string, unit) format4) : 'a = *) (* let put (os: out_channel) (fmt:('a, unit, string, unit) format4) : 'a = *)
...@@ -228,7 +228,7 @@ let (type_to_format_string : Data.t -> string) = ...@@ -228,7 +228,7 @@ let (type_to_format_string : Data.t -> string) =
| Bool -> "%d" | Bool -> "%d"
| Int -> "%d" | Int -> "%d"
| Real-> "%g" | Real-> "%g"
| Extern s -> assert false | Extern s -> "%s"
| Enum (s, sl) -> "%d" | Enum (s, sl) -> "%d"
| Struct (sid,_) -> "%s" | Struct (sid,_) -> "%s"
| Array (ty, sz) -> "%s" | Array (ty, sz) -> "%s"
......
(* Time-stamp: <modified the 10/06/2014 (at 11:10) by Erwan Jahier> *) (* Time-stamp: <modified the 10/06/2014 (at 15:57) by Erwan Jahier> *)
open Data open Data
...@@ -23,9 +23,7 @@ and expand_var enum_flag c_access var = match var with ...@@ -23,9 +23,7 @@ and expand_var enum_flag c_access var = match var with
| (vn,Struct(name,fl)) -> | (vn,Struct(name,fl)) ->
expand_profile enum_flag c_access expand_profile enum_flag c_access
(List.map (fun (fn,t) -> vn^(if c_access then "." else "_")^fn,t ) fl) (List.map (fun (fn,t) -> vn^(if c_access then "." else "_")^fn,t ) fl)
| (vn,Extern id) -> | (vn,Extern id) -> [var]
print_string "*** Extern node not yet supported, sorry\n"; flush stdout;
assert false (* finish me! *)
| (vn,Alpha _) -> assert false (* should not occur *) | (vn,Alpha _) -> assert false (* should not occur *)
let (int_to_enum : Data.v -> Soc.ident list -> Data.v) = let (int_to_enum : Data.v -> Soc.ident list -> Data.v) =
......
Test Run By jahier on Tue Jun 10 15:44:46 2014 Test Run By jahier on Tue Jun 10 16:03:22 2014
Native configuration is i686-pc-linux-gnu Native configuration is i686-pc-linux-gnu
=== lus2lic tests === === lus2lic tests ===
...@@ -1379,7 +1379,7 @@ PASS: ./lus2lic {-o /tmp/simple.lic should_work/simple.lus} ...@@ -1379,7 +1379,7 @@ PASS: ./lus2lic {-o /tmp/simple.lic should_work/simple.lus}
PASS: ./lus2lic {-ec -o /tmp/simple.ec should_work/simple.lus} PASS: ./lus2lic {-ec -o /tmp/simple.ec should_work/simple.lus}
PASS: ./myec2c {-o /tmp/simple.c /tmp/simple.ec} PASS: ./myec2c {-o /tmp/simple.c /tmp/simple.ec}
FAIL: Try to compare lus2lic -exec and ecexe: ../utils/test_lus2lic_no_node should_work/simple.lus FAIL: Try to compare lus2lic -exec and ecexe: ../utils/test_lus2lic_no_node should_work/simple.lus
FAIL: Generate c code : ./lus2lic {-2c should_work/simple.lus -n simple} PASS: ./lus2lic {-2c should_work/simple.lus -n simple}
FAIL: Check that the generated C code compiles : gcc simple_simple.c simple_simple_loop.c FAIL: Check that the generated C code compiles : gcc simple_simple.c simple_simple_loop.c
PASS: ./lus2lic {-o /tmp/func_with_body.lic should_work/func_with_body.lus} PASS: ./lus2lic {-o /tmp/func_with_body.lic should_work/func_with_body.lus}
PASS: ./lus2lic {-ec -o /tmp/func_with_body.ec should_work/func_with_body.lus} PASS: ./lus2lic {-ec -o /tmp/func_with_body.ec should_work/func_with_body.lus}
...@@ -1468,9 +1468,9 @@ XPASS: Test bad programs (semantics): lus2lic {-o /tmp/bug.lic should_fail/seman ...@@ -1468,9 +1468,9 @@ XPASS: Test bad programs (semantics): lus2lic {-o /tmp/bug.lic should_fail/seman
=== lus2lic Summary === === lus2lic Summary ===
# of expected passes 1121 # of expected passes 1122
# of unexpected failures 277 # of unexpected failures 276
# of unexpected successes 21 # of unexpected successes 21
# of expected failures 37 # of expected failures 37
testcase ./lus2lic.tests/non-reg.exp completed in 120 seconds testcase ./lus2lic.tests/non-reg.exp completed in 111 seconds
testcase ./lus2lic.tests/progression.exp completed in 0 seconds testcase ./lus2lic.tests/progression.exp completed in 0 seconds
testcase ./lus2lic.tests/non-reg.exp completed in 120 seconds testcase ./lus2lic.tests/non-reg.exp completed in 111 seconds
testcase ./lus2lic.tests/progression.exp completed in 0 seconds testcase ./lus2lic.tests/progression.exp completed in 0 seconds
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment