Skip to content

Commit

Permalink
I fixed Codegen.generate_buitin_function to always use 'fabs' instead…
Browse files Browse the repository at this point in the history
… of 'abs', no matter what type

the argument has. I did some tests and it seems to work on any compiler.
All the tests go.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@2248 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Mar 25, 2006
1 parent 471a0af commit 908f266
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Compiler/Codegen.rml
Expand Up @@ -2533,6 +2533,17 @@ relation generate_builtin_function: (Exp.Exp,int) => (CFunction,string,int) =
generate_builtin_function( Exp.CALL(Absyn.IDENT("max"),[s1,s2],false,true),tnr)
=> (cfn,tvar,tnr3)

rule Exp.typeof(s1) => tp &
exp_type_str(tp,false) => tp_str &
generate_expression(s1,tnr) => (cfn1,var1,tnr1) &
generate_temp_decl(tp_str,tnr1) => (tdecl,tvar,tnr2) &
c_add_variables(cfn1,[tdecl]) => cfn2 &
Util.string_append_list([tvar," = fabs(", var1, ");"])
=> stmt &
c_add_statements(cfn2,[stmt]) => cfn
-----------------------
generate_builtin_function( Exp.CALL(Absyn.IDENT("abs"),[s1],false,true),tnr)
=> (cfn,tvar,tnr2)

end

Expand Down

0 comments on commit 908f266

Please sign in to comment.