aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/src
AgeCommit message (Collapse)Author
2014-06-05BER: Eliminate dialyzer warnings for specialized decode functionsBjörn Gustavsson
2014-06-05BER: Eliminate dialyzer warning for encoding of BIT STRINGsBjörn Gustavsson
2014-06-05BER: Optimize encoding of ENUMERATEDBjörn Gustavsson
This will also eliminate a dialyzer warning.
2014-06-05BER: Remove a redundant clause in encoding of open typesBjörn Gustavsson
The clause is just an optimization for a (extremly rare) special case. Removing it will eliminate a dialyzer warning.
2014-06-05(U)PER: Fix decoding of named INTEGERBjörn Gustavsson
2014-06-05(U)PER: Fix encoding of a semi-constrained, named INTEGERBjörn Gustavsson
The code generator would crash.
2014-06-05(U)PER: Optimize handling of named BIT STRING with a lower zero boundBjörn Gustavsson
If a named BIT STRING has a lower size bound of 0, treat it the same way as if there was no constraint for the purposes of trailing zero bits. That change will eliminate a dialyzer warning.
2014-06-05PER: Optimize encoding of character strings with simple rangesBjörn Gustavsson
The encoder for the following type would generate a dialyzer warning: Ns ::= NumericString (FROM ("0"|"1"|"2"|"3"|"4"|"5"|"6"|"7"|"8"|"9")) Optimize this case to make it slightly faster as well as eliminate the dialyzer warning.
2014-06-05PER: Remove unnecessary clause for handling DEFAULTBjörn Gustavsson
2014-06-05(U)PER: Suppress dialyzer warnings for complete/1Björn Gustavsson
2014-06-05Correct OCTET STRING default when legacy_erlang_types is activeBjörn Gustavsson
The default value for an OCTET STRING when legacy_erlang_types was active would be a binary instead of a list.
2014-06-05Remove old DEFAULT-checking code made obsolete in the previous commitBjörn Gustavsson
2014-06-05Rewrite the code for testing DEFAULT for DERBjörn Gustavsson
The old code for testing DEFAULT values is messy, inefficient, and causes dialyzer warnings.
2014-05-06BER: Optimize decoding of ENUMERATEDBjörn Gustavsson
2014-05-06BER: Suppress dialyzer warnings for encode_bit_string/4Björn Gustavsson
We don't want to touch the code used for encoding BIT STRINGs when 'legacy_erl_types' is active, since it will be removed within two or three major releases. But we do want to suppress the dialyzer warnings in the meantime. The easiest way is to call encode_bit_string/4 with unknown types from an exported function that is never actually called like this: -export(['dialyzer-suppressions'/0]). 'dialyzer-suppressions'(Arg) -> {A,B,C,D} = Arg, encode_bit_string(A, B, C, D), ok.
2014-04-29BER: Inline testing of constraints when decodingBjörn Gustavsson
Calling library routines for validation of constraints may cause dialyzer warnings if some type of constraints handled by the library routine are not used in a specific ASN.1 module. To avoid those warnings (and slightly speed up the decoding), inline the constraint checking.
2014-04-16Refactor gen_dec_prim/3 to facilitate future optimizationsBjörn Gustavsson
2014-04-16Remove unused arguments for asn1ct_gen_ber_bin_v2:gen_dec_prim()Björn Gustavsson
Make the source code a little bit cleaner.
2014-04-16Add missing newline in -export()Björn Gustavsson
A newline was forgotten.
2014-03-21Protect generated .hrl files from multiple inclusionsBjörn Gustavsson
2014-03-20Introduce runtime_dependencies in .app filesRickard Green
Most dependencies introduced are exactly the dependencies to other applications found by xref. That is, there might be real dependencies missing. There might also be pure debug dependencies listed that probably should be removed. Each application has to be manually inspected in order to ensure that all real dependencies are listed. All dependencies introduced are to application versions used in OTP 17.0. This since the previously used version scheme wasn't designed for this, and in order to minimize the work of introducing the dependencies.
2014-02-28Clean up reporting of errors in IMPORTSBjörn Gustavsson
2014-02-28asn1ct_check: Clean up error checking for INSTANCE OFBjörn Gustavsson
This will also eliminate a dialyzer warning for unmatched returns, and increase the coverage.
2014-02-28asn1ct_check: Rewrite error checking for INTEGER and BIT STRINGBjörn Gustavsson
The error checking code for INTEGER and BIT STRING was broken, since it built an error tuple that was never returned. Rewrite the error checking code, sharing most of the code between INTEGER and BIT STRING. Make sure that we test for both duplicated names and number, as well as for negative bit numbers for BIT STRING. This rewrite will eliminate two dialyzer warnings for unmatched returns.
2014-02-28asn1ct_check: Remove unreachable clauses handling {identifier,_,_}Björn Gustavsson
A named number list as used for ENUMERATED and INTEGER can never have an {identifier,...} tuple in its third position like this: {'NamedNumber',Id,{identifier,_,_}} because asn1ct_parser2:parse_NamedNumber/1 will always replace an identifier tuple with an #Externaluereference{} record.
2014-02-28asn1ct_check: Let asn1_error/3 throw its resultBjörn Gustavsson
Since most calls to asn1_error/3 throw its result, it makes more sense to let asn1_error/3 itself throw the error tuple. Add the return_asn1_error/3 to return the error tuple to use when we don't want to throw it.
2014-02-24Merge branch 'bjorn/asn1/deprecations/OTP-11731'Björn Gustavsson
* bjorn/asn1/deprecations/OTP-11731: Remove or de-emphasize references to the deprecated asn1rt module Deprecate asn1 functions
2014-02-24Merge branch 'schlagert/fix_basic_appups'Siri Hansen
* schlagert/fix_basic_appups: Dynamically configure typer_SUITE according to environment Disable hipe_SUITE when environment doesn't support it Make hipe non-upgradable by setting appup file empty Fix missing module on hipe app file template Add test suites performing app and appup file checks Introduce appup test utility Fix library application appup files Fix non-library appup files according to issue #240 OTP-11744
2014-02-21Deprecate asn1 functionsBjörn Gustavsson
Those asn1 functions are no longer needed because they all have better alternatives.
2014-02-20Merge branch 'bjorn/asn1/cleanup/OTP-11727'Björn Gustavsson
* bjorn/asn1/cleanup/OTP-11727: asn1ct_check: Use a return value to silence a dialyzer warning asn1ct_check: Remove useless call to check_integer/3 asn1ct_check: Correct error handling for illegal OCTET STRING values asn1ct: Silence dialyzer warnings for unmatched returns asn1ct_table: Remove unused flexibility in table creation asn1ct_table: Silence a dialyzer warning for unmatched return asn1ct_gen: Silence dialyzer warnings for unmatched returns asn1ct_value: Silence a dialyzer warning for unmatched return asn1ct_tok: Check return value from file:close/1
2014-02-18Fix library application appup filesTobias Schlager
As discussed in issue #240 *all* OTP library applications use the '.*' wildcard as up and down version. This makes library applications always up- and downgradeable. Using the wildcard version obsoletes all maintenance tasks regarding library applications' appup files. Additionally, it prevents upgrade problems caused by automatically included application dependencies when using reltool to create releases. Missing copyright headers are now consistently present.
2014-02-13Correct subtyping of extensible ENUMERATEDBjörn Gustavsson
Attempting to subtype an extensible ENUMERATED like this: BaseType ::= { foo, bar, ... } SubType ::= BaseType ( foo ) would fail to compile with a message that 'foo' was undefined. Reported-by: Morten Nygaard Åsnes
2014-01-31asn1ct_check: Use a return value to silence a dialyzer warningBjörn Gustavsson
Unfortunately the code in question is not covered by our test suites, but it should be correct to do the same thing as in the clause above.
2014-01-31asn1ct_check: Remove useless call to check_integer/3Björn Gustavsson
check_integer/3 can check nothing for an INTEGER without any named values. Remove the useless call to silence a dialyzer warning for unmatched return.
2014-01-31asn1ct_check: Correct error handling for illegal OCTET STRING valuesBjörn Gustavsson
The value for an OCTET STRING must be specified as either a bstring or an hstring. Everything else (including character strings) is illegal. This correction also removes the offending code that caused an unmatched return warning from dialyzer.
2014-01-31asn1ct: Silence dialyzer warnings for unmatched returnsBjörn Gustavsson
2014-01-31asn1ct_table: Remove unused flexibility in table creationBjörn Gustavsson
Unused flexibility complicates the code and can hide bugs. new/1 is never called with a table name that already exists, so we should remove the code that allows for that. That will increase the coverage of asn1ct_table to 100%. Also remove the new/2 and new_reuse/2 functions which are never called externally.
2014-01-31asn1ct_table: Silence a dialyzer warning for unmatched returnBjörn Gustavsson
Change the code so that delete/1 always returns 'true'. While at it, also remove the TODO comment and explain in a comment why we want to keep the delete/1 function.
2014-01-31asn1ct_gen: Silence dialyzer warnings for unmatched returnsBjörn Gustavsson
2014-01-31asn1ct_value: Silence a dialyzer warning for unmatched returnBjörn Gustavsson
2014-01-31asn1ct_tok: Check return value from file:close/1Björn Gustavsson
This will silence a dialyzer warning for unmatched return.
2014-01-24Fix open typesBjörn Gustavsson
2014-01-24Fix OCTET STRINGBjörn Gustavsson
2014-01-24Fix BIT STRINGBjörn Gustavsson
2014-01-24Add legacy_erlang_typesBjörn Gustavsson
2014-01-20Optimize code surrounding calls to complete/1Björn Gustavsson
complete/1 is used when encoding open types (as well as in the encode/2 function in a generated module). The use of complete/1 for encoding open types used to be optimized in two different places. One place was in the alignment optimization pass, where we attempted to replace the call to complete/1 with a call to iolist_to_binary/1. That optimization was taken out in a previous commit that introduced the {list,_,_} intermediate instruction. The other place was when creating the intermediate representation for the encoding of the open type. When attempting to wrap primitive types in an open type, we would attempt to optimize the encoding of the length decscriptor. We will remove that optimization in this commit. Since the previous two optimizations did not optimize encoding of open types as much as we would want, we will introduce a new optimization in a separate pass that will go further than the previous optimizations.
2014-01-20asn1ct_imm: Add the intermediate instruction {list,List,Dst}Björn Gustavsson
The {list,List,Dst} instruction gives us as general way to capture the building of something into a variable. That will make inlining of intermediate code much easier. It also allows us to eliminate the versions of the apply, call_gen, and cond instructions that takes a target variable. Also remove the optimization in the alignment optimization pass that attempts to replace calls to complete/1 with calls to iolist_to_binary/1. That optimization will not work anymore without rewriting, so we will remove it in this commit and introcude a more powerful optimization in a future commit.
2014-01-20Generate intermediate code that is easier to optimizeBjörn Gustavsson
Instead of generating: {assign,Dst,"element(2, Val)"} generate: {call,erlang,element,[2,{var,"Val"}],Dst} The latter expression is easier to understand since there is no need to parse a string which may contain an arbitrary expression. While at it, also discontinue the practice to treat "naked" atoms as variables. A variable must always be given as {var,String}.
2014-01-20asn1ct_imm: Add the {set,{var,Src},{var,Dst}} instructionBjörn Gustavsson
The {assign,Dst,Src} instruction is difficult to cope with when doing advanced optimizations, since its source argument is a string which may contain any expression. Instead of changing how {assign,_,_} works, we will introduce new instructions that can be used instead of {assign,_}, and remove {assign,_,_} in a later commit when it is no longer used. The first new instruction we will introduce is: {set,{var,Src},{var,Dst}} It is useful for common sub-expression elemination among other things. For the moment, we will only allow a variable as a source argument, but we could extend it in the future to allow constants as well.
2014-01-20Keep type information in the apply intermediate instructionBjörn Gustavsson
To facilitate inlining of apply calls in the intermediate format.