Skip to content
Snippets Groups Projects
Commit 4b986d0e authored by erwan's avatar erwan
Browse files

soc2c: the c code was wrong in presence of user type defined using extern types.

The previous change fixed program that contains type decl such as :
type t1;
type t2 = t1;

but not

type t1;
type t2 = t1^2 ;

or

type t2 = { xxx : t1^2 ; yyy : t1^2} ;

And now it works.

To fix it, I have include the _ext.h file into the lustre_type.h one.
parent b207aa9d
No related branches found
No related tags found
No related merge requests found
OASISFormat: 0.4
Name: lustre-v6
Version: 1.689
Version: 1.690
Synopsis: The Lustre V6 Verimag compiler
Description: This package contains:
(1) lus2lic: the (current) name of the compiler (and interpreter via -exec).
......
(** Automatically generated from Makefile *)
let tool = "lus2lic"
let branch = "master"
let commit = "689"
let sha_1 = "d4fdee068416fe85a1809b1b47b93284d06bba32"
let commit = "690"
let sha_1 = "b207aa9d94a6bea80d498dc748401eea1130284c"
let str = (branch ^ "." ^ commit ^ " (" ^ sha_1 ^ ")")
let maintainer = "jahier@imag.fr"
(* Time-stamp: <modified the 05/05/2017 (at 14:16) by Erwan Jahier> *)
(* Time-stamp: <modified the 05/05/2017 (at 15:38) by Erwan Jahier> *)
(* let put (os: out_channel) (fmt:('a, unit, string, unit) format4) : 'a = *)
......@@ -876,6 +876,12 @@ let (f : Lv6MainArgs.t -> Soc.key -> Soc.tbl -> LicPrg.t -> unit) =
let consts_c_oc = open_out "lustre_consts.c" in
let cfiles_acc = ["lustre_consts.c"; cfile] in
let const_def_h, const_def_c = constdef licprg in
let assign_ext_types_list = (Soc2cGenAssign.gen_used_types socs) in
let main_soc = Soc.SocMap.find msoc stbl in
(* Generate ext files if necessary *)
let needs_cfile, needs_hfile =
Soc2cExtern.gen_files main_soc stbl licprg ext_cfile ext_hfile hfile
in
Lv6util.entete consts_h_oc "/*" "*/" ;
output_string consts_h_oc const_def_h;
Lv6util.entete consts_c_oc "/*" "*/" ;
......@@ -895,7 +901,8 @@ typedef float _float;
#define _true 1
#endif
// end of _SOC2C_PREDEF_TYPES
// User typedef
"^(if needs_hfile then "#include \""^ base ^"_ext.h\"" else "")^
"// User typedef
#ifndef _"^base^"_TYPES
#define _"^base^"_TYPES\n");
output_string types_h_oc (user_typedef licprg);
......@@ -903,11 +910,6 @@ typedef float _float;
try
let putc s = output_string occ s in
let puth s = output_string och s in
let main_soc = Soc.SocMap.find msoc stbl in
(* Generate ext files if necessary *)
let needs_cfile, needs_hfile =
Soc2cExtern.gen_files main_soc stbl licprg ext_cfile ext_hfile hfile
in
Lv6util.entete occ "/*" "*/" ;
Lv6util.entete och "/*" "*/";
if Lv6MainArgs.global_opt.Lv6MainArgs.gen_wcet then (
......@@ -947,13 +949,14 @@ typedef float _float;
let cfiles_acc = List.fold_left (soc2c 2 och occ stbl msoc) cfiles_acc socs in
puth "/////////////////////////////////////////////////\n";
let l = (Soc2cGenAssign.gen_used_types socs) in
if l <> [] then (
if assign_ext_types_list <> [] then (
output_string types_h_oc "// Defining array and extern types assignments \n";
if Lv6MainArgs.global_opt.Lv6MainArgs.gen_wcet then
List.iter (fun t -> output_string types_h_oc (Soc2cGenAssign.f_forloop t)) l
List.iter (fun t -> output_string types_h_oc (Soc2cGenAssign.f_forloop t))
assign_ext_types_list
else
List.iter (fun t -> output_string types_h_oc (Soc2cGenAssign.f t)) l
List.iter (fun t -> output_string types_h_oc (Soc2cGenAssign.f t))
assign_ext_types_list
);
puth "#endif\n";
flush occ; close_out occ;
......
==> lus2lic0.sum <==
Test Run By jahier on Fri May 5 14:48:31
Test Run By jahier on Fri May 5 15:41:17
Native configuration is x86_64-unknown-linux-gnu
=== lus2lic0 tests ===
......@@ -64,7 +64,7 @@ XFAIL: Test bad programs (assert): test_lus2lic_no_node should_fail/assert/lecte
XFAIL: Test bad programs (assert): test_lus2lic_no_node should_fail/assert/s.lus
==> lus2lic1.sum <==
Test Run By jahier on Fri May 5 14:48:32
Test Run By jahier on Fri May 5 15:41:18
Native configuration is x86_64-unknown-linux-gnu
=== lus2lic1 tests ===
......@@ -398,7 +398,7 @@ PASS: sh multipar.sh
PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c multipar.lus {}
==> lus2lic2.sum <==
Test Run By jahier on Fri May 5 14:49:40
Test Run By jahier on Fri May 5 15:42:25
Native configuration is x86_64-unknown-linux-gnu
=== lus2lic2 tests ===
......@@ -738,7 +738,7 @@ PASS: sh zzz2.sh
PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c zzz2.lus {}
==> lus2lic3.sum <==
Test Run By jahier on Fri May 5 14:50:52
Test Run By jahier on Fri May 5 15:43:37
Native configuration is x86_64-unknown-linux-gnu
=== lus2lic3 tests ===
......@@ -1243,7 +1243,7 @@ PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node multipar.lus {}
==> lus2lic4.sum <==
Test Run By jahier on Fri May 5 14:52:50
Test Run By jahier on Fri May 5 15:45:35
Native configuration is x86_64-unknown-linux-gnu
=== lus2lic4 tests ===
......@@ -1760,14 +1760,14 @@ PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node zzz2.lus {}
# of unexpected failures 6
===============================
# Total number of failures: 23
lus2lic0.log:testcase ./lus2lic.tests/test0.exp completed in 1 seconds
lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 67 seconds
lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 72 seconds
lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 117 seconds
lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 63 seconds
lus2lic0.log:testcase ./lus2lic.tests/test0.exp completed in 0 seconds
lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 66 seconds
lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 71 seconds
lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 118 seconds
lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 62 seconds
* Ref time:
0.06user 0.01system 5:22.26elapsed 0%CPU (0avgtext+0avgdata 5584maxresident)k
96inputs+0outputs (0major+6151minor)pagefaults 0swaps
0.04user 0.03system 5:19.60elapsed 0%CPU (0avgtext+0avgdata 5604maxresident)k
128inputs+0outputs (0major+6159minor)pagefaults 0swaps
* Quick time (-j 4):
0.07user 0.00system 2:03.28elapsed 0%CPU (0avgtext+0avgdata 5572maxresident)k
160inputs+0outputs (0major+6170minor)pagefaults 0swaps
0.05user 0.02system 2:01.94elapsed 0%CPU (0avgtext+0avgdata 5616maxresident)k
64inputs+0outputs (0major+6157minor)pagefaults 0swaps
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