From 4792b253584ca8d4429e1a353178db8cd0c470f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Wed, 7 Sep 2011 10:00:37 +0200 Subject: sys_pre_expand: Don't duplicate options given in the source code Any compiler options given with a -compile() attribute in source file would be included both at the beginning and the end of the option list for the compiler. Including the options twice is harmless during compilation, but since the options will also be available in Mod:module_info(compile), including them twice will waste memory. Include the options from the source first in the list so that they override options given on the command line. --- lib/compiler/src/sys_pre_expand.erl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'lib/compiler') diff --git a/lib/compiler/src/sys_pre_expand.erl b/lib/compiler/src/sys_pre_expand.erl index 480954adac..dd6f24e21f 100644 --- a/lib/compiler/src/sys_pre_expand.erl +++ b/lib/compiler/src/sys_pre_expand.erl @@ -223,10 +223,8 @@ attribute(export, Es, _L, St) -> St#expand{exports=union(from_list(Es), St#expand.exports)}; attribute(import, Is, _L, St) -> import(Is, St); -attribute(compile, C, _L, St) when is_list(C) -> - St#expand{compile=St#expand.compile ++ C}; -attribute(compile, C, _L, St) -> - St#expand{compile=St#expand.compile ++ [C]}; +attribute(compile, _C, _L, St) -> + St; attribute(Name, Val, Line, St) when is_list(Val) -> St#expand{attributes=St#expand.attributes ++ [{Name,Line,Val}]}; attribute(Name, Val, Line, St) -> -- cgit v1.2.3