Age | Commit message (Collapse) | Author |
|
Introduce helper functions to simplify and reduce the size of
gen_encode_constructed_imm/3.
|
|
The to_encoding_order/1 function can be eliminated if we
incorporate its functionality into textual_order/2.
textual_order/2 has a workaround for TermList being longer
than OrderList. Remove the workaround, because the code
being generated would certainly be wrong (better let the compiler
crash and receive a bug report if it happens). The workaround
was not necessary to successfully compile the entire Erlang/OTP
and to run the asn1 test suite.
|
|
As a preparation for future changes, simplify
gen_dec_constructed_imm_2/6 by breaking it apart to two
functions.
|
|
Remove the entire asn1rt module. All functions in it were deprecated in
OTP 17.
In asn1ct, remove the deprecated functions asn1ct:encode/3 and
asn1ct:decode/3. Also remove asn1ct:encode/2, which has not been
formally deprecated but is undocumented.
|
|
When attempting to build multiple ASN.1 modules in parallel (e.g. by
running 'make -j'), the ASN.1 compiler could crash because the names
of the .asn1db files clashed. For example, if A.asn1 and B.asn1 both
import from C.asn1, the compiler would write a C.asn1db file when
compiling A.asn1 and when compiling B.asn1.
We can avoid this problem if the compiler only writes the
module's own .asn1db file. That is, when compiling A.asn1,
the compiler would only write A.asn1db, not C.asn1db. Also,
make sure that we make the write atomic by first writing to
a temporary file that is then renamed.
|
|
Dialyzer complains that three calls to gen_dec_line/7 ignore
the return value. It turns out that when the last argument to
gen_dec_line/7 is 'false', the return value will always be
{[],[]}. Introduce gen_dec_line/6 as helper to make it clear
that we don't ignore a useful return value.
|
|
|
|
* maint:
Fix a few dialyzer warnings
|
|
|
|
* maint:
asn1: Suppress warnings for improper lists in generated code
|
|
|
|
* maint:
PER: Correct compilation of named INTEGERs
|
|
When a constrained INTEGER has more than 16536 values and named
values, the compiler would crash when compiling to the PER
format. Example:
Longitude ::= INTEGER {
oneMicrodegreeEast(10),
oneMicrodegreeWest(-10),
unavailable(1800000001)
} (-1799999999..1800000001)
Reported-by: Ingars
|
|
In most cases, we don't have to seed the random number generator,
as the rand:uniform/1 takes care about that itself.
|
|
Encoding an empty named BIT STRING would fail for BER.
Noticed-by: Svilen Ivanov
|
|
|
|
|
|
* rickard/time_api/OTP-11997: (22 commits)
Update primary bootstrap
inets: Suppress deprecated warning on erlang:now/0
inets: Cleanup of multiple copies of functions Add inets_lib with common functions used by multiple modules
inets: Update comments
Suppress deprecated warning on erlang:now/0
Use new time API and be back-compatible in inets Remove unused functions and removed redundant test
asn1 test SUITE: Eliminate use of now/0
Disable deprecated warning on erlang:now/0 in diameter_lib
Use new time API and be back-compatible in ssh
Replace all calls to now/0 in CT with new time API functions
test_server: Replace usage of erlang:now() with usage of new API
Replace usage of erlang:now() with usage of new API
Replace usage of erlang:now() with usage of new API
Replace usage of erlang:now() with usage of new API
Replace usage of erlang:now() with usage of new API
otp_SUITE: Warn for calls to erlang:now/0
Replace usage of erlang:now() with usage of new API
Multiple timer wheels
Erlang based BIF timer implementation for scalability
Implement ethread events with timeout
...
Conflicts:
bootstrap/bin/start.boot
bootstrap/bin/start_clean.boot
bootstrap/lib/compiler/ebin/beam_asm.beam
bootstrap/lib/compiler/ebin/compile.beam
bootstrap/lib/kernel/ebin/auth.beam
bootstrap/lib/kernel/ebin/dist_util.beam
bootstrap/lib/kernel/ebin/global.beam
bootstrap/lib/kernel/ebin/hipe_unified_loader.beam
bootstrap/lib/kernel/ebin/inet_db.beam
bootstrap/lib/kernel/ebin/inet_dns.beam
bootstrap/lib/kernel/ebin/inet_res.beam
bootstrap/lib/kernel/ebin/os.beam
bootstrap/lib/kernel/ebin/pg2.beam
bootstrap/lib/stdlib/ebin/dets.beam
bootstrap/lib/stdlib/ebin/dets_utils.beam
bootstrap/lib/stdlib/ebin/erl_tar.beam
bootstrap/lib/stdlib/ebin/escript.beam
bootstrap/lib/stdlib/ebin/file_sorter.beam
bootstrap/lib/stdlib/ebin/otp_internal.beam
bootstrap/lib/stdlib/ebin/qlc.beam
bootstrap/lib/stdlib/ebin/random.beam
bootstrap/lib/stdlib/ebin/supervisor.beam
bootstrap/lib/stdlib/ebin/timer.beam
erts/aclocal.m4
erts/emulator/beam/bif.c
erts/emulator/beam/erl_bif_info.c
erts/emulator/beam/erl_db_hash.c
erts/emulator/beam/erl_init.c
erts/emulator/beam/erl_process.h
erts/emulator/beam/erl_thr_progress.c
erts/emulator/beam/utils.c
erts/emulator/sys/unix/sys.c
erts/preloaded/ebin/erlang.beam
erts/preloaded/ebin/erts_internal.beam
erts/preloaded/ebin/init.beam
erts/preloaded/src/erts_internal.erl
lib/common_test/test/ct_hooks_SUITE_data/cth/tests/empty_cth.erl
lib/diameter/src/base/diameter_lib.erl
lib/kernel/src/os.erl
lib/ssh/test/ssh_basic_SUITE.erl
system/doc/efficiency_guide/advanced.xml
|
|
|
|
The BEAM compiler now warns more aggressively for expressions whose
values are not used. For example, the generated Erlang code for
the following ASN.1 code will now cause a warning:
Seq ::= SEQUENCE {
...,
os OCTET STRING (SIZE (17000..30000))
}
The generated Erlang code looks similar to the following:
Enc9@bin = iolist_to_binary(Enc9@output),
Enc9@len = byte_size(Enc9@bin),
[align|encode_fragmented(Enc9@bin, 8)]
The variable Enc9@len is not used and the BEAM compiler will
complain that the value returned from the byte_size/1 call is
not used.
Improve the optimization of the intermediate code to eliminate
the assignment to the unused variable.
|
|
* maint:
asn1ct_gen: Correct generation of .hrl files for multiple ellipses
Fix BER code generation
|
|
|
|
PKIX1Explicit-2009 did not compile.
This commit was cherry-picked from 3ab3b07a already
merged into master.
|
|
* oliv3/math_log2/OTP-12411:
Add math:log2/1
|
|
|
|
|
|
|
|
As currently implemented, there is one call to asn1db:dbget() and
asn1db:dbput() for each type/value definitions in an ASN.1 specification.
If we check for duplicate definitions locally, we can send all
definitions in a single call.
|
|
Three fields ('type','value', and 'vname') are almost unused. They
are set, but almost never read. Eliminate the last remaining uses
and the fields themselves.
|
|
|
|
And while we are at it cleanup and rewrite code to use try catch.
|
|
|
|
|
|
|
|
In the parsing of a value assignment, such as:
value INTEGER ::= 42
there is call to a function called lookahead_assignment/1 that
will ensure that the sequence of tokens that follows the value
is a valid assignment. The problem is that if the next assignment
is a value assignment, that too will look ahead to the next
assignment. That means that the complexity will be quadratic
if there are many value assignments following each other.
The reason for the test in the first place is unclear; my guess
is that it was an attempt to provide better error reporting.
|
|
Errors were reported using a throw like this:
throw({asn1_error,{get_line(hd(Tokens)),get(asn1_module),
[got,get_token(hd(Tokens)),expected,typereference]}}).
The attempt to tell the user what was expected was often mis-leading.
It is time-consuming and non-trival to provide correct information
of what is expected. Therefore, we will not even try. Instead we will
spend more effort to report the token where the error was discovered.
We will replace each throw with a function call:
parse_error(Tokens).
Also add the syntax_SUITE test suite to test error reporting and to
cover all error reporting code. Remove the old c_syntax/1 test case.
Also remove all out-commented code.
|
|
Responsibilities for parse error handling were split between
asn1ct and asn1ct_parser2 in a confusing way. Let asn1ct_parser2
return structured_error tuples in the same way as the check
pass.
|
|
Most uses of 'catch' are not necessary. For example,
parse_or/2 is typically called like this:
case catch parse_or(Tokens, Flist) of
{'EXIT',Reason} ->
exit(Reason);
{asn1_error,_}=AsnErr ->
throw(AsnErr);
Result ->
Result
end.
Since {asn1_error,_} is always thrown (never returned) and
a successful is always returned (never thrown), the 'case' and
the 'catch' are not necessary. The code can be simplified too:
parse_or(Tokens, Flist)
In a few cases, we will need to replace the 'catch' with
'try'...'catch'.
|
|
Use try...catch instead of catch.
|
|
The first position in a token tuple is always an atom, the second
the line number. The code tested the third position.
|
|
In a future commit, we want to tighten what we catch. Therefore,
legitimate parsing errors should always throw a controlled exception,
instead of arbitrarily crashing.
|
|
The parse_Type/1 calls various type parse functions. Most of those
functions return a #type record, but not all of them. If a #type{}
record is not returned, parse_Type/1 will wrap the return value in a
We can simplify the code in parse_Type/1 if we make sure that the
type parsing functions called by parse_Type/1 always return
a #type{} record.
|
|
The TypeFromObject and ValueSetFromObjects grammar productions cannot
be distinguished by the parser without the help of type information
(which the parser does not have). Since the parser attempts to
parse TypeFromObject before ValueSetFromObjects, the parsing of
ValueSetFromObjects will always fail.
|
|
To keep the error reporting code in asn1ct_parser2 simple, we
only want to handle pure syntactic errors. Therefore, move the check
that UNIQUE and DEFAULT are not applied to the same field to
asn1ct_check.
|
|
asn1ct_gen_check.erl was added in 7df687d6.
|
|
|
|
|
|
While we are at it, also remove an unreachable (too many extensions)
error case.
|
|
|
|
|