on master help sign in
Make C codegen fail more.

There was an uncaught case in the C Codegen that allowed partially applied foreign function calls to let through. This should be fixed higher up the toolchain, we add a error statement here as a last resort.

commit93520b44a022127040984cdbe5257d151b255517 authorJan de Muijnck-Hughes <jfdm@st-andrews.ac.uk> dateWed 14 Sep 2016, 08:55 (10 years ago) parentdad4d42
1 file changed+1
src/IRTS/CodegenC.hs+1
src/IRTS/CodegenC.hs+1
@@ -340,6 +340,7 @@ bcc i (FOREIGNCALL l rty (FStr fn) args)
340340 = indent i ++
341341 c_irts (toFType rty) (creg l ++ " = ")
342342 (fn ++ "(" ++ showSep "," (map fcall args) ++ ")") ++ ";\n"
343+bcc i (FOREIGNCALL l rty _ args) = error "Foreign Function calls cannot be partially applied, without being inlined."
343344bcc i (NULL r) = indent i ++ creg r ++ " = NULL;\n" -- clear, so it'll be GCed
344345bcc i (ERROR str) = indent i ++ "fprintf(stderr, " ++ show str ++ "); fprintf(stderr, \"\\n\"); exit(-1);\n"
345346-- bcc i c = error (show c) -- indent i ++ "// not done yet\n"