diff options
author | Björn Gustavsson <[email protected]> | 2017-11-10 06:26:51 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2017-11-10 06:51:22 +0100 |
commit | 9fc2d48a6de8b95b0d36c4439bff8e59710f4360 (patch) | |
tree | 6b6784b235c1b886c05968c2dead1eff853aeb8c /lib/compiler/src | |
parent | 4ab56cf93ca4824d087b10085dec5edf64c8be69 (diff) | |
download | otp-9fc2d48a6de8b95b0d36c4439bff8e59710f4360.tar.gz otp-9fc2d48a6de8b95b0d36c4439bff8e59710f4360.tar.bz2 otp-9fc2d48a6de8b95b0d36c4439bff8e59710f4360.zip |
Recognize 'deterministic' when given in a -compile() attribute
The compiler option 'deterministic' was only recognized when given
as an option to the compiler, not when it was specified in a
-compile() attribute in the source file.
https://bugs.erlang.org/browse/ERL-498
Diffstat (limited to 'lib/compiler/src')
-rw-r--r-- | lib/compiler/src/beam_asm.erl | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/compiler/src/beam_asm.erl b/lib/compiler/src/beam_asm.erl index c35efdfc9d..f7c838e392 100644 --- a/lib/compiler/src/beam_asm.erl +++ b/lib/compiler/src/beam_asm.erl @@ -182,7 +182,8 @@ build_file(Code, Attr, Dict, NumLabels, NumFuncs, ExtraChunks, SourceFile, Opts, Essentials1 = [iolist_to_binary(C) || C <- Essentials0], MD5 = module_md5(Essentials1), Essentials = finalize_fun_table(Essentials1, MD5), - {Attributes,Compile} = build_attributes(Opts, SourceFile, Attr, MD5), + {Attributes,Compile} = build_attributes(Opts, CompilerOpts, SourceFile, + Attr, MD5), AttrChunk = chunk(<<"Attr">>, Attributes), CompileChunk = chunk(<<"CInf">>, Compile), @@ -264,16 +265,16 @@ flatten_exports(Exps) -> flatten_imports(Imps) -> list_to_binary(map(fun({M,F,A}) -> <<M:32,F:32,A:32>> end, Imps)). -build_attributes(Opts, SourceFile, Attr, MD5) -> +build_attributes(Opts, CompilerOpts, SourceFile, Attr, MD5) -> Misc0 = case SourceFile of [] -> []; [_|_] -> [{source,SourceFile}] end, - Misc = case member(slim, Opts) of + Misc = case member(slim, CompilerOpts) of false -> Misc0; true -> [] end, - Compile = case member(deterministic, Opts) of + Compile = case member(deterministic, CompilerOpts) of false -> [{options,Opts},{version,?COMPILER_VSN}|Misc]; true -> |