From 402fe1f632f7e6075e0810dcff2d8432b65352d2 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Fri, 15 May 2020 13:51:32 +0100 Subject: Add static to registers if -static is passed This was the final missing step for me to link two almost identical C files generated from sail into the same library. --- src/jib/c_backend.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/jib/c_backend.ml b/src/jib/c_backend.ml index 080be248..40d784ca 100644 --- a/src/jib/c_backend.ml +++ b/src/jib/c_backend.ml @@ -2050,7 +2050,7 @@ let codegen_alloc = function let codegen_def' ctx = function | CDEF_reg_dec (id, ctyp, _) -> string (Printf.sprintf "// register %s" (string_of_id id)) ^^ hardline - ^^ string (Printf.sprintf "%s %s;" (sgen_ctyp ctyp) (sgen_id id)) + ^^ string (Printf.sprintf "%s%s %s;" (if !opt_static then "static " else "") (sgen_ctyp ctyp) (sgen_id id)) | CDEF_spec (id, _, arg_ctyps, ret_ctyp) -> let static = if !opt_static then "static " else "" in -- cgit v1.2.3