From 6ff83caa7c1530c5fc2cbf41f53c383f5b7725af Mon Sep 17 00:00:00 2001 From: Erwan Jahier <jahier@imag.fr> Date: Tue, 10 Jun 2014 16:11:29 +0200 Subject: [PATCH] Soc2c : do not crash if the soc contains reference to extern types. --- src/soc2c.ml | 4 ++-- src/socVar.ml | 6 ++---- test/lus2lic.sum | 10 +++++----- test/lus2lic.time | 2 +- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/soc2c.ml b/src/soc2c.ml index 810999c0..dc65f11c 100644 --- a/src/soc2c.ml +++ b/src/soc2c.ml @@ -1,4 +1,4 @@ -(* 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 = *) @@ -228,7 +228,7 @@ let (type_to_format_string : Data.t -> string) = | Bool -> "%d" | Int -> "%d" | Real-> "%g" - | Extern s -> assert false + | Extern s -> "%s" | Enum (s, sl) -> "%d" | Struct (sid,_) -> "%s" | Array (ty, sz) -> "%s" diff --git a/src/socVar.ml b/src/socVar.ml index 251c7464..5bf86106 100644 --- a/src/socVar.ml +++ b/src/socVar.ml @@ -1,4 +1,4 @@ -(* 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 @@ -23,9 +23,7 @@ and expand_var enum_flag c_access var = match var with | (vn,Struct(name,fl)) -> expand_profile enum_flag c_access (List.map (fun (fn,t) -> vn^(if c_access then "." else "_")^fn,t ) fl) - | (vn,Extern id) -> - print_string "*** Extern node not yet supported, sorry\n"; flush stdout; - assert false (* finish me! *) + | (vn,Extern id) -> [var] | (vn,Alpha _) -> assert false (* should not occur *) let (int_to_enum : Data.v -> Soc.ident list -> Data.v) = diff --git a/test/lus2lic.sum b/test/lus2lic.sum index 11095150..d1d8b32c 100644 --- a/test/lus2lic.sum +++ b/test/lus2lic.sum @@ -1,4 +1,4 @@ -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 === lus2lic tests === @@ -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: ./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: 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 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} @@ -1468,9 +1468,9 @@ XPASS: Test bad programs (semantics): lus2lic {-o /tmp/bug.lic should_fail/seman === lus2lic Summary === -# of expected passes 1121 -# of unexpected failures 277 +# of expected passes 1122 +# of unexpected failures 276 # of unexpected successes 21 # 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 diff --git a/test/lus2lic.time b/test/lus2lic.time index b44d39a9..5cc34dfe 100644 --- a/test/lus2lic.time +++ b/test/lus2lic.time @@ -1,2 +1,2 @@ -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 -- GitLab