mirror of https://gerrit.osmocom.org/asn1c
Merge branch 'master' into 64bit_test
This commit is contained in:
commit
88271a5d7a
|
@ -68,3 +68,6 @@ doc/docsrc/*.xdv
|
|||
# /skeletons/tests/
|
||||
/skeletons/tests/check-*
|
||||
|
||||
#code coverage
|
||||
*.gcno
|
||||
*.gcda
|
||||
|
|
|
@ -2,9 +2,14 @@ language: c
|
|||
compiler:
|
||||
- gcc
|
||||
- clang
|
||||
before_install:
|
||||
- sudo apt-get install -y lcov
|
||||
- gem install coveralls-lcov
|
||||
script:
|
||||
- autoreconf -iv
|
||||
- ./configure --enable-Werror
|
||||
- ./configure --enable-Werror --enable-code-coverage
|
||||
- make -j8
|
||||
- make check
|
||||
- make distcheck
|
||||
after_success:
|
||||
- test "x$CC" = "xgcc" && make code-coverage-capture && coveralls-lcov asn1c-*-coverage.info
|
||||
|
|
15
AUTHORS
15
AUTHORS
|
@ -1,3 +1,16 @@
|
|||
Full list of copyright holders:
|
||||
|
||||
Bartosz Marcinkiewicz <bma@megawatt.com.pl>
|
||||
Bent Nicolaisen <BN@JAI.com>
|
||||
Bi-Ruei, Chiu (brchiu @ github)
|
||||
Daniele Varrazzo <daniele.varrazzo@gmail.com>
|
||||
daa @ github
|
||||
Erika Thorsen (akire @ github)
|
||||
gareins @ github
|
||||
Max Khon (mkhon @ github)
|
||||
Lev Walkin <vlm@lionet.info>
|
||||
mkhon @ github
|
||||
Simo Sorce <simo@redhat.com>
|
||||
theirix @ github
|
||||
Vasil Velichkov (velichkov @ github)
|
||||
Wim L <wiml@omnigroup.com>
|
||||
ymbirtt @ github
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
|
||||
0.9.??:
|
||||
|
||||
0.9.28: 2017-03-26
|
||||
* PER decoding: avoid memory leak on error. By github.com/simo5
|
||||
* Constness patch #46 by Wim L <wiml@omnigroup.com> (41bbf1c..78d604f).
|
||||
Build issues:
|
||||
|
|
2
LICENSE
2
LICENSE
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2003-2016 Lev Walkin <vlm@lionet.info> and contributors.
|
||||
Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info> and contributors.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
@CODE_COVERAGE_RULES@
|
||||
CODE_COVERAGE_IGNORE_PATTERN="tests/*" "lex.yy.c" "y.tab.c" "asn1p_l.l" "asn1p_y.y"
|
||||
|
||||
SUBDIRS = \
|
||||
libasn1parser libasn1fix \
|
||||
libasn1print libasn1compiler \
|
||||
|
@ -9,6 +12,6 @@ SUBDIRS = \
|
|||
|
||||
docsdir = $(datadir)/doc/asn1c
|
||||
|
||||
docs_DATA = README.md FAQ ChangeLog BUGS TODO
|
||||
docs_DATA = README.md INSTALL.md FAQ ChangeLog BUGS TODO
|
||||
|
||||
EXTRA_DIST = README.md FAQ LICENSE BUGS
|
||||
EXTRA_DIST = README.md INSTALL.md FAQ LICENSE BUGS
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
@CODE_COVERAGE_RULES@
|
||||
|
||||
SUBDIRS = . tests
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
@CODE_COVERAGE_RULES@
|
||||
|
||||
SUBDIRS = check-src
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ abs_top_srcdir="${abs_top_srcdir:-$(pwd)/../../}"
|
|||
abs_top_builddir="${abs_top_builddir:-$(pwd)/../../}"
|
||||
|
||||
if echo "$*" | grep -q -- -- ; then
|
||||
TEST_DRIVER=$(echo "$*" | sed -e 's/ -- .*/--/g')
|
||||
TEST_DRIVER=$(echo "$*" | sed -e 's/ -- .*/ -- /g')
|
||||
source_full=$(echo "$*" | sed -e 's/.* //g')
|
||||
else
|
||||
TEST_DRIVER=""
|
||||
|
@ -54,7 +54,7 @@ cat > "$testdir/Makefile" <<EOM
|
|||
# This file is autogenerated by ../$0
|
||||
|
||||
COMMON_FLAGS= -I.
|
||||
CFLAGS = \${COMMON_FLAGS} ${CFLAGS:-} -g -O0
|
||||
CFLAGS = \${COMMON_FLAGS} ${CFLAGS:-} -g -O0 -I ${abs_top_srcdir}/skeletons
|
||||
CPPFLAGS = -DSRCDIR=../${srcdir}
|
||||
CXXFLAGS = \${COMMON_FLAGS} ${CXXFLAGS}
|
||||
|
||||
|
@ -63,12 +63,12 @@ CC ?= ${CC}
|
|||
all: check-executable
|
||||
check-executable: compiled-module *.c*
|
||||
@rm -f *.core
|
||||
\$(CC) \$(CPPFLAGS) \$(CFLAGS) -o check-executable *.c* -lm
|
||||
\$(CC) \$(CPPFLAGS) \$(CFLAGS) -o check-executable *.c* -L${abs_top_builddir}/skeletons/.libs -lasn1cskeletons -lm
|
||||
|
||||
# Compile the corresponding .asn1 spec.
|
||||
compiled-module: ${asn_module} ${abs_top_builddir}/asn1c/asn1c
|
||||
${abs_top_builddir}/asn1c/asn1c \\
|
||||
-S ${abs_top_srcdir}/skeletons \\
|
||||
-S /tmp/do/not/copy/skeletons \\
|
||||
-Wdebug-compiler \\
|
||||
${AFLAGS} ${asn_module}
|
||||
rm -f converter-sample.c
|
||||
|
|
44
configure.ac
44
configure.ac
|
@ -1,12 +1,10 @@
|
|||
AC_INIT([asn1c],[0.9.28],[vlm@lionet.info])
|
||||
AC_INIT([asn1c],[0.9.29],[vlm@lionet.info])
|
||||
|
||||
AC_CONFIG_AUX_DIR(config)
|
||||
AC_CONFIG_HEADER([config.h])
|
||||
AM_INIT_AUTOMAKE([foreign])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
LT_INIT
|
||||
|
||||
dnl Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_CPP
|
||||
|
@ -15,7 +13,12 @@ AC_PROG_LN_S
|
|||
AC_PROG_MAKE_SET
|
||||
AC_PROG_YACC
|
||||
AM_PROG_LEX
|
||||
AC_PATH_PROG(AR, ar, ar, $PATH:/usr/ucb:/usr/ccs/bin) dnl for Solaris
|
||||
dnl locate ar using standard macro (old automake 1.11 does not know about AM_PROG_AR)
|
||||
m4_ifdef([AM_PROG_AR],
|
||||
[AM_PROG_AR],
|
||||
[AC_PATH_PROG(AR, ar, ar, $PATH:/usr/ucb:/usr/ccs/bin)])
|
||||
|
||||
LT_INIT
|
||||
|
||||
dnl If you need to see the details, just run make V=1.
|
||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||
|
@ -75,6 +78,20 @@ AC_ARG_ENABLE(test-Werror,
|
|||
TESTSUITE_CFLAGS="-Werror -W -Wpointer-arith"
|
||||
])
|
||||
|
||||
AX_CODE_COVERAGE
|
||||
AS_IF([test x$enable_code_coverage != xno], [
|
||||
CFLAGS="$CFLAGS $CODE_COVERAGE_CFLAGS"
|
||||
# The CODE_COVERAGE_CPPFLAGS contains -DNDEBUG flag
|
||||
# which removes assert(...) macros from code coverage and improves the
|
||||
# branches score. But when it is defined it results in few
|
||||
# unsed-but-set-variable warnings that are treated as errors in the travis-ci
|
||||
# build because these variables are only used inside assert macros.
|
||||
# error: variable ‘ret’ set but not used [-Werror=unused-but-set-variable]
|
||||
#CPPFLAGS="$CPPFLAGS $CODE_COVERAGE_CPPFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $CODE_COVERAGE_CXXFLAGS"
|
||||
LDFLAGS="$LDFLAGS $CODE_COVERAGE_LDFLAGS"
|
||||
])
|
||||
|
||||
AC_SUBST(ADD_CFLAGS)
|
||||
AC_SUBST(TESTSUITE_CFLAGS)
|
||||
|
||||
|
@ -84,7 +101,14 @@ SKELETONS_CFLAGS="${ADD_CFLAGS} ${SKELETONS_CFLAGS}"
|
|||
AX_CHECK_COMPILE_FLAG([-std=c89],
|
||||
[SKELETONS_CFLAGS="$SKELETONS_CFLAGS -std=c89"])
|
||||
AX_CHECK_COMPILE_FLAG([-Wpedantic],
|
||||
[SKELETONS_CFLAGS="$SKELETONS_CFLAGS -Wpedantic"])
|
||||
[SKELETONS_CFLAGS="$SKELETONS_CFLAGS -Wpedantic"],
|
||||
[
|
||||
dnl When -Wpedantic is not supported try the -pedantic instead. (gcc-4.7)
|
||||
dnl See https://gcc.gnu.org/gcc-4.8/changes.html
|
||||
AX_CHECK_COMPILE_FLAG([-pedantic],
|
||||
[SKELETONS_CFLAGS="$SKELETONS_CFLAGS -pedantic"], [], [-Werror])
|
||||
],
|
||||
[-Werror]) #clang 3.0 prints warning when the flag is not supported
|
||||
AX_CHECK_COMPILE_FLAG([-Wno-duplicate-decl-specifier],
|
||||
[SKELETONS_CFLAGS="$SKELETONS_CFLAGS -Wno-duplicate-decl-specifier"])
|
||||
AC_SUBST(SKELETONS_CFLAGS)
|
||||
|
@ -102,8 +126,14 @@ AC_STRUCT_TM
|
|||
AC_CHECK_TYPE(intmax_t, int64_t)
|
||||
|
||||
dnl Test if we should check features that depend on 64-bitness.
|
||||
AC_CHECK_SIZEOF([void *])
|
||||
AM_CONDITIONAL([TEST_64BIT], [test "$ac_cv_sizeof_void_p" -eq 8])
|
||||
AC_MSG_CHECKING(size of long is longer than 32 bit)
|
||||
AS_VAR_PUSHDEF([WIDE_LONG], [WIDE_LONG])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include "confdefs.h"
|
||||
#include <sys/types.h>
|
||||
]], [[switch (0) case 0: case (sizeof (long) >= 8):;]])],[WIDE_LONG=yes],[WIDE_LONG=no])
|
||||
AC_MSG_RESULT($WIDE_LONG)
|
||||
AM_CONDITIONAL([TEST_64BIT], [test x$WIDE_LONG = xyes])
|
||||
AS_VAR_POPDEF([WIDE_LONG])
|
||||
|
||||
dnl For mingw
|
||||
AC_SEARCH_LIBS(getopt, iberty)
|
||||
|
|
|
@ -39,7 +39,7 @@ is treated as a beginning of a comment line, which is ignored
|
|||
completely.
|
||||
Empty lines are ignored as well.
|
||||
.PP
|
||||
The following example \f[C]enber\f[](1) input demostrates the use of
|
||||
The following example \f[C]enber\f[](1) input demonstrates the use of
|
||||
comments:
|
||||
.PP
|
||||
<C O="0" T="[1]" TL="2" V="2">
|
||||
|
|
|
@ -36,7 +36,7 @@ In particular, the XML style comments are not supported.
|
|||
A hash "**#**" or two dashes "**--**" following a whitespace is treated as a beginning of a comment line, which is ignored completely.
|
||||
Empty lines are ignored as well.
|
||||
|
||||
The following example `enber`(1) input demostrates the use of comments:
|
||||
The following example `enber`(1) input demonstrates the use of comments:
|
||||
|
||||
| \<C O="0" T="[1]" TL="2" V="2">
|
||||
| \<I O="2" T="[1]" TL="2" V="Indefinite">
|
||||
|
|
|
@ -113,7 +113,7 @@ set +x
|
|||
echo ' done; done; fi'
|
||||
echo " @if test -f sample-${ASN1PDU}-1.per ; then \\"
|
||||
echo " for f in sample-*-[1-9].per; do \\"
|
||||
echo ' pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z-]+)-[0-9].*/\1/"`; \'
|
||||
echo ' pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z-]+)-[0-9].*/\\1/"`; \'
|
||||
echo ' for b in 1 17 33 980 8192; do \'
|
||||
echo ' echo "Recoding $$f into DER into XER and back ($$b)..."; \'
|
||||
echo ' ./${TARGET} -b $$b -p $$pdu -iper -oder $$f > ./.tmp.1.$$$$ || exit 3; \'
|
||||
|
|
|
@ -375,7 +375,7 @@ Certificate.c: ../sample.makefile.regen ../rfc3280-*.asn1
|
|||
make
|
||||
|
||||
regen-makefile:
|
||||
ASN1CMDOPTS="" \
|
||||
ASN1CMDOPTS="-fwide-types" \
|
||||
ASN1MODULES="../rfc3280-*.asn1" \
|
||||
ASN1PDU=Certificate \
|
||||
PROGNAME=x509dump \
|
||||
|
|
|
@ -120,6 +120,7 @@ asn1c_lang_C_type_common_INTEGER(arg_t *arg) {
|
|||
struct value2enum *v2e;
|
||||
int map_extensions = (expr->expr_type == ASN_BASIC_INTEGER);
|
||||
int eidx;
|
||||
int saved_target = arg->target->target;
|
||||
|
||||
v2e = alloca((el_count + 1) * sizeof(*v2e));
|
||||
|
||||
|
@ -248,6 +249,8 @@ asn1c_lang_C_type_common_INTEGER(arg_t *arg) {
|
|||
OUT("};\n");
|
||||
}
|
||||
|
||||
REDIR(saved_target);
|
||||
|
||||
return asn1c_lang_C_type_SIMPLE_TYPE(arg);
|
||||
}
|
||||
|
||||
|
@ -256,6 +259,7 @@ asn1c_lang_C_type_BIT_STRING(arg_t *arg) {
|
|||
asn1p_expr_t *expr = arg->expr;
|
||||
asn1p_expr_t *v;
|
||||
int el_count = expr_elements_count(arg, expr);
|
||||
int saved_target = arg->target->target;
|
||||
|
||||
if(el_count) {
|
||||
int eidx = 0;
|
||||
|
@ -283,6 +287,8 @@ asn1c_lang_C_type_BIT_STRING(arg_t *arg) {
|
|||
assert(eidx == el_count);
|
||||
}
|
||||
|
||||
REDIR(saved_target);
|
||||
|
||||
return asn1c_lang_C_type_SIMPLE_TYPE(arg);
|
||||
}
|
||||
|
||||
|
@ -291,14 +297,23 @@ asn1c_lang_C_type_SEQUENCE(arg_t *arg) {
|
|||
asn1p_expr_t *expr = arg->expr;
|
||||
asn1p_expr_t *v;
|
||||
int comp_mode = 0; /* {root,ext=1,root,root,...} */
|
||||
int saved_target = arg->target->target;
|
||||
|
||||
DEPENDENCIES;
|
||||
|
||||
if(arg->embed) {
|
||||
|
||||
/* Use _anonymous_type field to indicate it's called from
|
||||
* asn1c_lang_C_type_SEx_OF() */
|
||||
if (expr->_anonymous_type) {
|
||||
REDIR(OT_FWD_DEFS);
|
||||
OUT("typedef ");
|
||||
}
|
||||
OUT("struct ");
|
||||
out_name_chain(arg, ONC_avoid_keywords);
|
||||
OUT(" {\n");
|
||||
} else {
|
||||
REDIR(OT_TYPE_DECLS);
|
||||
OUT("typedef struct %s {\n",
|
||||
MKID_safe(expr));
|
||||
}
|
||||
|
@ -313,12 +328,24 @@ asn1c_lang_C_type_SEQUENCE(arg_t *arg) {
|
|||
}
|
||||
|
||||
PCTX_DEF;
|
||||
OUT("} %s%s%s", (expr->marker.flags & EM_INDIRECT)?"*":"",
|
||||
|
||||
if (arg->embed && expr->_anonymous_type) {
|
||||
OUT("} %s", (expr->marker.flags & EM_INDIRECT)?"*":"");
|
||||
out_name_chain(arg, ONC_avoid_keywords);
|
||||
OUT("%s;\n", arg->embed ? "" : "_t");
|
||||
|
||||
REDIR(saved_target);
|
||||
|
||||
OUT("%s", (expr->marker.flags & EM_INDIRECT)?"*":"");
|
||||
out_name_chain(arg, ONC_avoid_keywords);
|
||||
} else {
|
||||
OUT("} %s%s%s", (expr->marker.flags & EM_INDIRECT)?"*":"",
|
||||
expr->_anonymous_type ? "" :
|
||||
arg->embed
|
||||
? MKID_safe(expr)
|
||||
: MKID(expr),
|
||||
arg->embed ? "" : "_t");
|
||||
}
|
||||
|
||||
return asn1c_lang_C_type_SEQUENCE_def(arg);
|
||||
}
|
||||
|
@ -337,6 +364,7 @@ asn1c_lang_C_type_SEQUENCE_def(arg_t *arg) {
|
|||
enum tvm_compat tv_mode;
|
||||
int roms_count; /* Root optional members */
|
||||
int aoms_count; /* Additions optional members */
|
||||
int saved_target = arg->target->target;
|
||||
|
||||
/*
|
||||
* Fetch every inner tag from the tag to elements map.
|
||||
|
@ -477,7 +505,7 @@ asn1c_lang_C_type_SEQUENCE_def(arg_t *arg) {
|
|||
emit_type_DEF(arg, expr, tv_mode, tags_count, all_tags_count, elements,
|
||||
ETD_HAS_SPECIFICS);
|
||||
|
||||
REDIR(OT_TYPE_DECLS);
|
||||
REDIR(saved_target);
|
||||
|
||||
return 0;
|
||||
} /* _SEQUENCE_def() */
|
||||
|
@ -489,6 +517,7 @@ asn1c_lang_C_type_SET(arg_t *arg) {
|
|||
long mcount;
|
||||
char *id;
|
||||
int comp_mode = 0; /* {root,ext=1,root,root,...} */
|
||||
int saved_target = arg->target->target;
|
||||
|
||||
DEPENDENCIES;
|
||||
|
||||
|
@ -515,13 +544,18 @@ asn1c_lang_C_type_SET(arg_t *arg) {
|
|||
}
|
||||
OUT("} "); out_name_chain(arg, ONC_noflags); OUT("_PR;\n");
|
||||
|
||||
REDIR(OT_TYPE_DECLS);
|
||||
REDIR(saved_target);
|
||||
|
||||
if(arg->embed) {
|
||||
if (expr->_anonymous_type) {
|
||||
REDIR(OT_FWD_DEFS);
|
||||
OUT("typedef ");
|
||||
}
|
||||
OUT("struct ");
|
||||
out_name_chain(arg, ONC_avoid_keywords);
|
||||
OUT(" {\n");
|
||||
} else {
|
||||
REDIR(OT_TYPE_DECLS);
|
||||
OUT("typedef struct %s {\n",
|
||||
MKID_safe(expr));
|
||||
}
|
||||
|
@ -545,9 +579,21 @@ asn1c_lang_C_type_SET(arg_t *arg) {
|
|||
);
|
||||
|
||||
PCTX_DEF;
|
||||
OUT("} %s%s%s", (expr->marker.flags & EM_INDIRECT)?"*":"",
|
||||
expr->_anonymous_type ? "" : MKID_safe(expr),
|
||||
arg->embed ? "" : "_t");
|
||||
|
||||
if (arg->embed && expr->_anonymous_type) {
|
||||
OUT("} %s", (expr->marker.flags & EM_INDIRECT)?"*":"");
|
||||
out_name_chain(arg, ONC_avoid_keywords);
|
||||
OUT("%s;\n", arg->embed ? "" : "_t");
|
||||
|
||||
REDIR(saved_target);
|
||||
|
||||
OUT("%s", (expr->marker.flags & EM_INDIRECT)?"*":"");
|
||||
out_name_chain(arg, ONC_avoid_keywords);
|
||||
} else {
|
||||
OUT("} %s%s%s", (expr->marker.flags & EM_INDIRECT)?"*":"",
|
||||
expr->_anonymous_type ? "" : MKID_safe(expr),
|
||||
arg->embed ? "" : "_t");
|
||||
}
|
||||
|
||||
return asn1c_lang_C_type_SET_def(arg);
|
||||
}
|
||||
|
@ -565,6 +611,7 @@ asn1c_lang_C_type_SET_def(arg_t *arg) {
|
|||
int all_tags_count;
|
||||
enum tvm_compat tv_mode;
|
||||
char *p;
|
||||
int saved_target = arg->target->target;
|
||||
|
||||
/*
|
||||
* Fetch every inner tag from the tag to elements map.
|
||||
|
@ -598,7 +645,7 @@ asn1c_lang_C_type_SET_def(arg_t *arg) {
|
|||
|
||||
OUT("static asn_TYPE_member_t asn_MBR_%s_%d[] = {\n",
|
||||
MKID(expr), expr->_type_unique_index);
|
||||
|
||||
|
||||
elements = 0;
|
||||
INDENTED(TQ_FOR(v, &(expr->members), next) {
|
||||
if(v->expr_type == A1TC_EXTENSIBLE) {
|
||||
|
@ -692,7 +739,7 @@ asn1c_lang_C_type_SET_def(arg_t *arg) {
|
|||
emit_type_DEF(arg, expr, tv_mode, tags_count, all_tags_count, elements,
|
||||
ETD_HAS_SPECIFICS);
|
||||
|
||||
REDIR(OT_TYPE_DECLS);
|
||||
REDIR(saved_target);
|
||||
|
||||
return 0;
|
||||
} /* _SET_def() */
|
||||
|
@ -701,10 +748,15 @@ int
|
|||
asn1c_lang_C_type_SEx_OF(arg_t *arg) {
|
||||
asn1p_expr_t *expr = arg->expr;
|
||||
asn1p_expr_t *memb = TQ_FIRST(&expr->members);
|
||||
int saved_target = arg->target->target;
|
||||
|
||||
DEPENDENCIES;
|
||||
|
||||
if(arg->embed) {
|
||||
if (expr->_anonymous_type) {
|
||||
REDIR(OT_FWD_DEFS);
|
||||
OUT("typedef ");
|
||||
}
|
||||
OUT("struct ");
|
||||
out_name_chain(arg, ONC_avoid_keywords);
|
||||
OUT(" {\n");
|
||||
|
@ -748,7 +800,8 @@ asn1c_lang_C_type_SEx_OF(arg_t *arg) {
|
|||
if(tmp_memb.Identifier != memb->Identifier)
|
||||
if(0) free(tmp_memb.Identifier);
|
||||
arg->embed--;
|
||||
assert(arg->target->target == OT_TYPE_DECLS);
|
||||
assert(arg->target->target == OT_TYPE_DECLS ||
|
||||
arg->target->target == OT_FWD_DEFS);
|
||||
} else {
|
||||
OUT("%s", asn1c_type_name(arg, memb,
|
||||
(memb->marker.flags & EM_UNRECURSE)
|
||||
|
@ -761,9 +814,21 @@ asn1c_lang_C_type_SEx_OF(arg_t *arg) {
|
|||
INDENT(-1);
|
||||
|
||||
PCTX_DEF;
|
||||
OUT("} %s%s%s", (expr->marker.flags & EM_INDIRECT)?"*":"",
|
||||
expr->_anonymous_type ? "" : MKID_safe(expr),
|
||||
arg->embed ? "" : "_t");
|
||||
|
||||
if (arg->embed && expr->_anonymous_type) {
|
||||
OUT("} %s", (expr->marker.flags & EM_INDIRECT)?"*":"");
|
||||
out_name_chain(arg, ONC_avoid_keywords);
|
||||
OUT("%s;\n", arg->embed ? "" : "_t");
|
||||
|
||||
REDIR(saved_target);
|
||||
|
||||
OUT("%s", (expr->marker.flags & EM_INDIRECT)?"*":"");
|
||||
out_name_chain(arg, ONC_avoid_keywords);
|
||||
} else {
|
||||
OUT("} %s%s%s", (expr->marker.flags & EM_INDIRECT)?"*":"",
|
||||
expr->_anonymous_type ? "" : MKID_safe(expr),
|
||||
arg->embed ? "" : "_t");
|
||||
}
|
||||
|
||||
/*
|
||||
* SET OF/SEQUENCE OF definition
|
||||
|
@ -779,6 +844,7 @@ asn1c_lang_C_type_SEx_OF_def(arg_t *arg, int seq_of) {
|
|||
int tags_count;
|
||||
int all_tags_count;
|
||||
enum tvm_compat tv_mode;
|
||||
int saved_target = arg->target->target;
|
||||
|
||||
/*
|
||||
* Print out the table according to which parsing is performed.
|
||||
|
@ -840,7 +906,7 @@ asn1c_lang_C_type_SEx_OF_def(arg_t *arg, int seq_of) {
|
|||
emit_type_DEF(arg, expr, tv_mode, tags_count, all_tags_count, 1,
|
||||
ETD_HAS_SPECIFICS);
|
||||
|
||||
REDIR(OT_TYPE_DECLS);
|
||||
REDIR(saved_target);
|
||||
|
||||
return 0;
|
||||
} /* _SEx_OF_def() */
|
||||
|
@ -850,6 +916,7 @@ asn1c_lang_C_type_CHOICE(arg_t *arg) {
|
|||
asn1p_expr_t *expr = arg->expr;
|
||||
asn1p_expr_t *v;
|
||||
char *id;
|
||||
int saved_target = arg->target->target;
|
||||
|
||||
DEPENDENCIES;
|
||||
|
||||
|
@ -878,11 +945,16 @@ asn1c_lang_C_type_CHOICE(arg_t *arg) {
|
|||
);
|
||||
OUT("} "); out_name_chain(arg, ONC_noflags); OUT("_PR;\n");
|
||||
|
||||
REDIR(OT_TYPE_DECLS);
|
||||
REDIR(saved_target);
|
||||
|
||||
if(arg->embed) {
|
||||
if (expr->_anonymous_type) {
|
||||
REDIR(OT_FWD_DEFS);
|
||||
OUT("typedef ");
|
||||
}
|
||||
OUT("struct "); out_name_chain(arg, ONC_avoid_keywords); OUT(" {\n");
|
||||
} else {
|
||||
REDIR(OT_TYPE_DECLS);
|
||||
OUT("typedef struct %s {\n", MKID_safe(expr));
|
||||
}
|
||||
|
||||
|
@ -903,12 +975,24 @@ asn1c_lang_C_type_CHOICE(arg_t *arg) {
|
|||
);
|
||||
|
||||
PCTX_DEF;
|
||||
OUT("} %s%s%s", (expr->marker.flags & EM_INDIRECT)?"*":"",
|
||||
expr->_anonymous_type ? "" :
|
||||
arg->embed
|
||||
? MKID_safe(expr)
|
||||
: MKID(expr),
|
||||
arg->embed ? "" : "_t");
|
||||
|
||||
if (arg->embed && expr->_anonymous_type) {
|
||||
OUT("} %s", (expr->marker.flags & EM_INDIRECT)?"*":"");
|
||||
out_name_chain(arg, ONC_avoid_keywords);
|
||||
OUT("%s;\n", arg->embed ? "" : "_t");
|
||||
|
||||
REDIR(saved_target);
|
||||
|
||||
OUT("%s", (expr->marker.flags & EM_INDIRECT)?"*":"");
|
||||
out_name_chain(arg, ONC_avoid_keywords);
|
||||
} else {
|
||||
OUT("} %s%s%s", (expr->marker.flags & EM_INDIRECT)?"*":"",
|
||||
expr->_anonymous_type ? "" :
|
||||
arg->embed
|
||||
? MKID_safe(expr)
|
||||
: MKID(expr),
|
||||
arg->embed ? "" : "_t");
|
||||
}
|
||||
|
||||
return asn1c_lang_C_type_CHOICE_def(arg);
|
||||
}
|
||||
|
@ -924,6 +1008,7 @@ asn1c_lang_C_type_CHOICE_def(arg_t *arg) {
|
|||
int all_tags_count;
|
||||
enum tvm_compat tv_mode;
|
||||
int *cmap = 0;
|
||||
int saved_target = arg->target->target;
|
||||
|
||||
/*
|
||||
* Fetch every inner tag from the tag to elements map.
|
||||
|
@ -1026,7 +1111,7 @@ asn1c_lang_C_type_CHOICE_def(arg_t *arg) {
|
|||
emit_type_DEF(arg, expr, tv_mode, tags_count, all_tags_count, elements,
|
||||
ETD_HAS_SPECIFICS);
|
||||
|
||||
REDIR(OT_TYPE_DECLS);
|
||||
REDIR(saved_target);
|
||||
|
||||
return 0;
|
||||
} /* _CHOICE_def() */
|
||||
|
@ -1081,6 +1166,7 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) {
|
|||
enum tvm_compat tv_mode;
|
||||
enum etd_spec etd_spec;
|
||||
char *p;
|
||||
int saved_target = arg->target->target;
|
||||
|
||||
if(arg->embed) {
|
||||
enum tnfmt tnfmt = TNF_CTYPE;
|
||||
|
@ -1093,13 +1179,15 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) {
|
|||
if(expr->marker.flags & (EM_INDIRECT | EM_UNRECURSE)) {
|
||||
if(terminal_structable(arg, expr)) {
|
||||
tnfmt = TNF_RSAFE;
|
||||
REDIR(OT_FWD_DECLS);
|
||||
OUT("%s;\n",
|
||||
asn1c_type_name(arg, arg->expr, tnfmt));
|
||||
if(saved_target != OT_FWD_DECLS) {
|
||||
REDIR(OT_FWD_DECLS);
|
||||
OUT("%s;\n",
|
||||
asn1c_type_name(arg, arg->expr, tnfmt));
|
||||
}
|
||||
REDIR(saved_target);
|
||||
}
|
||||
}
|
||||
|
||||
REDIR(OT_TYPE_DECLS);
|
||||
|
||||
OUT("%s", asn1c_type_name(arg, arg->expr, tnfmt));
|
||||
if(!expr->_anonymous_type) {
|
||||
|
@ -1143,7 +1231,7 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) {
|
|||
* Type1 ::= Type2
|
||||
*/
|
||||
if(arg->embed && etd_spec == ETD_NO_SPECIFICS) {
|
||||
REDIR(OT_TYPE_DECLS);
|
||||
REDIR(saved_target);
|
||||
return 0;
|
||||
}
|
||||
if((!expr->constraints || (arg->flags & A1C_NO_CONSTRAINTS))
|
||||
|
@ -1165,7 +1253,7 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) {
|
|||
REDIR(OT_CODE);
|
||||
OUT("/* This type is equivalent to %s */\n", type_name);
|
||||
OUT("\n");
|
||||
REDIR(OT_TYPE_DECLS);
|
||||
REDIR(saved_target);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1418,7 +1506,7 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) {
|
|||
}
|
||||
}
|
||||
|
||||
REDIR(OT_TYPE_DECLS);
|
||||
REDIR(saved_target);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -2620,9 +2708,11 @@ emit_include_dependencies(arg_t *arg) {
|
|||
if(memb->marker.flags & (EM_INDIRECT | EM_UNRECURSE)) {
|
||||
if(terminal_structable(arg, memb)) {
|
||||
int saved_target = arg->target->target;
|
||||
REDIR(OT_FWD_DECLS);
|
||||
OUT("%s;\n",
|
||||
asn1c_type_name(arg, memb, TNF_RSAFE));
|
||||
if(saved_target != OT_FWD_DECLS) {
|
||||
REDIR(OT_FWD_DECLS);
|
||||
OUT("%s;\n",
|
||||
asn1c_type_name(arg, memb, TNF_RSAFE));
|
||||
}
|
||||
REDIR(saved_target);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,24 +5,28 @@
|
|||
#include <asn1fix_export.h> /* other exportable stuff from libasn1fix */
|
||||
|
||||
/*
|
||||
* Checks that the given string is not a reserved C/C++ keyword.
|
||||
* ISO/IEC 9899:1999 (C99), A.1.2
|
||||
* Checks that the given string is not a reserved C/C++ keyword [1],[2].
|
||||
* _* keywords not included, since asn1 identifiers cannot begin with hyphen [3]
|
||||
* [1] ISO/IEC 9899:2011 (C11), 6.4.1
|
||||
* [2] ISO/IEC 14882:2014 (C++14), 2.12
|
||||
* [3] ISO/IEC 8824-1:2003 (asn1) 11.3
|
||||
*/
|
||||
static char *res_kwd[] = {
|
||||
"auto", "break", "case", "char", "const", "continue", "default",
|
||||
"do", "double", "else", "enum", "extern", "float", "for", "goto",
|
||||
"if", "inline", "int", "long", "register", "restrict", "return",
|
||||
"short", "signed", "sizeof", "static", "struct", "switch", "typedef",
|
||||
"union", "unsigned", "void", "volatile", "while",
|
||||
"_Bool", "_Complex", "_Imaginary",
|
||||
/* C++ */
|
||||
"class", "explicit", "bool", "mutable",
|
||||
"template", "typeid", "typename", "and", "and_eq",
|
||||
"or", "or_eq", "xor", "xor_eq", "not", "not_eq",
|
||||
"bitor", "compl", "bitand",
|
||||
"const_cast", "dynamic_cast", "reinterpret_cast",
|
||||
"static_cast", "true", "false", "namespace", "using",
|
||||
"throw", "try", "catch"
|
||||
/* C */
|
||||
"auto", "break", "case", "char", "const", "continue", "default", "do",
|
||||
"double", "else", "enum", "extern", "float", "for", "goto", "if",
|
||||
"inline", "int", "long", "register", "restrict", "return", "short",
|
||||
"signed", "sizeof", "static", "struct", "switch", "typedef", "union",
|
||||
"unsigned", "void", "volatile", "while",
|
||||
/* C++ */
|
||||
"alignas", "alignof", "and", "and_eq", "asm", "bitand", "bitor", "bool",
|
||||
"catch", "char16_t", "char32_t", "class", "compl", "const_cast",
|
||||
"constexpr", "decltype", "delete", "delete", "dynamic_cast",
|
||||
"explicit", "export", "false", "friend", "mutable", "namespace", "new",
|
||||
"noexcept", "not", "not_eq", "nullptr", "operator", "or", "or_eq",
|
||||
"private", "protected", "public", "reinterpret_cast", "static_assert",
|
||||
"static_cast", "template", "this", "thread_local", "throw", "true", "try",
|
||||
"typeid", "typename", "using", "virtual", "wchar_t", "xor", "xor_eq"
|
||||
};
|
||||
static int
|
||||
reserved_keyword(const char *str) {
|
||||
|
@ -263,7 +267,7 @@ asn1c_type_name(arg_t *arg, asn1p_expr_t *expr, enum tnfmt _format) {
|
|||
switch(_format) {
|
||||
case TNF_UNMODIFIED:
|
||||
return asn1c_make_identifier(AMI_MASK_ONLY_SPACES,
|
||||
0, exprid ? exprid->Identifier : typename, 0);
|
||||
0, exprid ? exprid->Identifier : typename, (char*)0);
|
||||
case TNF_INCLUDE:
|
||||
return asn1c_make_identifier(
|
||||
AMI_MASK_ONLY_SPACES | AMI_NODELIMITER,
|
||||
|
@ -271,15 +275,15 @@ asn1c_type_name(arg_t *arg, asn1p_expr_t *expr, enum tnfmt _format) {
|
|||
? "\"" : "<"),
|
||||
exprid ? exprid->Identifier : typename,
|
||||
((!stdname || (arg->flags & A1C_INCLUDES_QUOTED))
|
||||
? ".h\"" : ".h>"), 0);
|
||||
? ".h\"" : ".h>"), (char*)0);
|
||||
case TNF_SAFE:
|
||||
return asn1c_make_identifier(0, exprid, typename, 0);
|
||||
return asn1c_make_identifier(0, exprid, typename, (char*)0);
|
||||
case TNF_CTYPE: /* C type */
|
||||
return asn1c_make_identifier(0, exprid,
|
||||
exprid?"t":typename, exprid?0:"t", 0);
|
||||
exprid?"t":typename, exprid?0:"t", (char*)0);
|
||||
case TNF_RSAFE: /* Recursion-safe type */
|
||||
return asn1c_make_identifier(AMI_CHECK_RESERVED, 0,
|
||||
"struct", " ", typename, 0);
|
||||
"struct", " ", typename, (char*)0);
|
||||
}
|
||||
|
||||
assert(!"unreachable");
|
||||
|
|
|
@ -38,6 +38,11 @@ asn1c_compiled_output(arg_t *arg, const char *fmt, ...) {
|
|||
*/
|
||||
if(dst->indented == 0) {
|
||||
int i = dst->indent_level;
|
||||
if (i < 0) {
|
||||
/* fatal error */
|
||||
fprintf(stderr, "target %d : Indent level %d ?!\n", arg->target->target, i);
|
||||
exit(1);
|
||||
}
|
||||
dst->indented = 1;
|
||||
while(i--) {
|
||||
ret = asn1c_compiled_output(arg, "\t");
|
||||
|
|
|
@ -17,6 +17,7 @@ typedef struct compiler_streams {
|
|||
OT_INCLUDES, /* #include files */
|
||||
OT_DEPS, /* Dependencies (other than #includes) */
|
||||
OT_FWD_DECLS, /* Forward declarations */
|
||||
OT_FWD_DEFS, /* Forward definitions */
|
||||
OT_TYPE_DECLS, /* Type declarations */
|
||||
OT_FUNC_DECLS, /* Function declarations */
|
||||
OT_POST_INCLUDE,/* #include after type definition */
|
||||
|
@ -35,7 +36,7 @@ typedef struct compiler_streams {
|
|||
} compiler_streams_t;
|
||||
|
||||
static char *_compiler_stream2str[] __attribute__ ((unused))
|
||||
= { "IGNORE", "INCLUDES", "DEPS", "FWD-DECLS", "TYPE-DECLS", "FUNC-DECLS", "POST-INCLUDE", "CTABLES", "CODE", "CTDEFS", "STAT-DEFS" };
|
||||
= { "IGNORE", "INCLUDES", "DEPS", "FWD-DECLS", "FWD-DEFS", "TYPE-DECLS", "FUNC-DECLS", "POST-INCLUDE", "CTABLES", "CODE", "CTDEFS", "STAT-DEFS" };
|
||||
|
||||
int asn1c_compiled_output(arg_t *arg, const char *fmt, ...);
|
||||
|
||||
|
@ -56,8 +57,6 @@ int asn1c_compiled_output(arg_t *arg, const char *fmt, ...);
|
|||
} while(0)
|
||||
|
||||
#define EMBED(ev) do { \
|
||||
int saved_target = arg->target->target; \
|
||||
REDIR(OT_TYPE_DECLS); \
|
||||
arg->embed++; \
|
||||
INDENTED(arg_t _tmp = *arg; \
|
||||
_tmp.expr = ev; \
|
||||
|
@ -66,8 +65,8 @@ int asn1c_compiled_output(arg_t *arg, const char *fmt, ...);
|
|||
arg->embed--; \
|
||||
if(ev->expr_type != A1TC_EXTENSIBLE) \
|
||||
OUT(";\n"); \
|
||||
assert(arg->target->target == OT_TYPE_DECLS); \
|
||||
REDIR(saved_target); \
|
||||
assert(arg->target->target == OT_TYPE_DECLS || \
|
||||
arg->target->target == OT_FWD_DEFS); \
|
||||
} while(0)
|
||||
|
||||
/* Output a piece of text into a default stream */
|
||||
|
|
|
@ -283,6 +283,7 @@ asn1c_save_streams(arg_t *arg, asn1c_fdeps_t *deps, int optc, char **argv) {
|
|||
safe_fprintf(fp_h, "\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n");
|
||||
SAVE_STREAM(fp_h, OT_DEPS, "Dependencies", 0);
|
||||
SAVE_STREAM(fp_h, OT_FWD_DECLS, "Forward declarations", 0);
|
||||
SAVE_STREAM(fp_h, OT_FWD_DEFS, "Forward definitions", 0);
|
||||
SAVE_STREAM(fp_h, OT_TYPE_DECLS, expr->Identifier, 0);
|
||||
SAVE_STREAM(fp_h, OT_FUNC_DECLS,"Implementation", 0);
|
||||
safe_fprintf(fp_h, "\n#ifdef __cplusplus\n}\n#endif\n");
|
||||
|
@ -305,7 +306,7 @@ asn1c_save_streams(arg_t *arg, asn1c_fdeps_t *deps, int optc, char **argv) {
|
|||
TQ_FOR(ot, &(cs->destination[OT_STAT_DEFS].chunks), next)
|
||||
safe_fwrite(ot->buf, ot->len, 1, fp_c);
|
||||
|
||||
assert(OT_MAX == 11); /* Protection from reckless changes */
|
||||
assert(OT_MAX == 12); /* Protection from reckless changes */
|
||||
|
||||
fclose(fp_c);
|
||||
fclose(fp_h);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
@CODE_COVERAGE_RULES@
|
||||
|
||||
AM_CFLAGS = @ADD_CFLAGS@
|
||||
AM_CPPFLAGS = \
|
||||
|
|
|
@ -673,10 +673,8 @@ _range_canonicalize(asn1cnst_range_t *range) {
|
|||
range->right = tmp;
|
||||
}
|
||||
|
||||
if(range->elements) {
|
||||
free(range->elements);
|
||||
range->elements = 0;
|
||||
}
|
||||
free(range->elements);
|
||||
range->elements = 0;
|
||||
range->el_size = 0;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ asn1f_fetch_tags(asn1p_t *asn, asn1p_module_t *mod, asn1p_expr_t *expr, struct a
|
|||
arg.expr = expr;
|
||||
|
||||
count = asn1f_fetch_tags_impl(&arg, &tags, 0, 0, flags);
|
||||
if(count <= 0 && tags) {
|
||||
if (count <= 0) {
|
||||
free(tags);
|
||||
tags = 0;
|
||||
}
|
||||
|
|
|
@ -23,14 +23,10 @@ void
|
|||
asn1p_constraint_free(asn1p_constraint_t *ct) {
|
||||
if(ct) {
|
||||
|
||||
if(ct->containedSubtype)
|
||||
asn1p_value_free(ct->containedSubtype);
|
||||
if(ct->value)
|
||||
asn1p_value_free(ct->value);
|
||||
if(ct->range_start)
|
||||
asn1p_value_free(ct->range_start);
|
||||
if(ct->range_stop)
|
||||
asn1p_value_free(ct->range_stop);
|
||||
asn1p_value_free(ct->containedSubtype);
|
||||
asn1p_value_free(ct->value);
|
||||
asn1p_value_free(ct->range_start);
|
||||
asn1p_value_free(ct->range_stop);
|
||||
|
||||
if(ct->elements) {
|
||||
while(ct->el_count--) {
|
||||
|
|
|
@ -246,20 +246,13 @@ asn1p_expr_free(asn1p_expr_t *expr) {
|
|||
}
|
||||
|
||||
free(expr->Identifier);
|
||||
if(expr->reference)
|
||||
asn1p_ref_free(expr->reference);
|
||||
if(expr->constraints)
|
||||
asn1p_constraint_free(expr->constraints);
|
||||
if(expr->combined_constraints)
|
||||
asn1p_constraint_free(expr->combined_constraints);
|
||||
if(expr->lhs_params)
|
||||
asn1p_paramlist_free(expr->lhs_params);
|
||||
if(expr->value)
|
||||
asn1p_value_free(expr->value);
|
||||
if(expr->marker.default_value)
|
||||
asn1p_value_free(expr->marker.default_value);
|
||||
if(expr->with_syntax)
|
||||
asn1p_wsyntx_free(expr->with_syntax);
|
||||
asn1p_ref_free(expr->reference);
|
||||
asn1p_constraint_free(expr->constraints);
|
||||
asn1p_constraint_free(expr->combined_constraints);
|
||||
asn1p_paramlist_free(expr->lhs_params);
|
||||
asn1p_value_free(expr->value);
|
||||
asn1p_value_free(expr->marker.default_value);
|
||||
asn1p_wsyntx_free(expr->with_syntax);
|
||||
|
||||
if(expr->data && expr->data_free)
|
||||
expr->data_free(expr->data);
|
||||
|
|
|
@ -27,8 +27,7 @@ asn1p_paramlist_free(asn1p_paramlist_t *pl) {
|
|||
if(pl->params) {
|
||||
int i = pl->params_count;
|
||||
while(i--) {
|
||||
if(pl->params[i].governor)
|
||||
asn1p_ref_free(pl->params[i].governor);
|
||||
asn1p_ref_free(pl->params[i].governor);
|
||||
free(pl->params[i].argument);
|
||||
pl->params[i].governor = 0;
|
||||
pl->params[i].argument = 0;
|
||||
|
@ -82,8 +81,7 @@ asn1p_paramlist_add_param(asn1p_paramlist_t *pl, asn1p_ref_t *gov, char *arg) {
|
|||
pl->params_count++;
|
||||
return 0;
|
||||
} else {
|
||||
if(pl->params[pl->params_count].governor)
|
||||
asn1p_ref_free(pl->params[pl->params_count].governor);
|
||||
asn1p_ref_free(pl->params[pl->params_count].governor);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -430,7 +430,7 @@ typedef union YYSTYPE
|
|||
} tv_nametag;
|
||||
}
|
||||
/* Line 193 of yacc.c. */
|
||||
#line 434 "y.tab.c"
|
||||
#line 434 "asn1p_y.c"
|
||||
YYSTYPE;
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
|
@ -443,7 +443,7 @@ typedef union YYSTYPE
|
|||
|
||||
|
||||
/* Line 216 of yacc.c. */
|
||||
#line 447 "y.tab.c"
|
||||
#line 447 "asn1p_y.c"
|
||||
|
||||
#ifdef short
|
||||
# undef short
|
||||
|
@ -2825,8 +2825,8 @@ yyreduce:
|
|||
checkmem((yyval.a_plist));
|
||||
ret = asn1p_paramlist_add_param((yyval.a_plist), (yyvsp[(1) - (1)].a_parg).governor, (yyvsp[(1) - (1)].a_parg).argument);
|
||||
checkmem(ret == 0);
|
||||
if((yyvsp[(1) - (1)].a_parg).governor) asn1p_ref_free((yyvsp[(1) - (1)].a_parg).governor);
|
||||
if((yyvsp[(1) - (1)].a_parg).argument) free((yyvsp[(1) - (1)].a_parg).argument);
|
||||
asn1p_ref_free((yyvsp[(1) - (1)].a_parg).governor);
|
||||
free((yyvsp[(1) - (1)].a_parg).argument);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -2837,8 +2837,8 @@ yyreduce:
|
|||
(yyval.a_plist) = (yyvsp[(1) - (3)].a_plist);
|
||||
ret = asn1p_paramlist_add_param((yyval.a_plist), (yyvsp[(3) - (3)].a_parg).governor, (yyvsp[(3) - (3)].a_parg).argument);
|
||||
checkmem(ret == 0);
|
||||
if((yyvsp[(3) - (3)].a_parg).governor) asn1p_ref_free((yyvsp[(3) - (3)].a_parg).governor);
|
||||
if((yyvsp[(3) - (3)].a_parg).argument) free((yyvsp[(3) - (3)].a_parg).argument);
|
||||
asn1p_ref_free((yyvsp[(3) - (3)].a_parg).governor);
|
||||
free((yyvsp[(3) - (3)].a_parg).argument);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -4795,7 +4795,7 @@ yyreduce:
|
|||
|
||||
|
||||
/* Line 1267 of yacc.c. */
|
||||
#line 4799 "y.tab.c"
|
||||
#line 4799 "asn1p_y.c"
|
||||
default: break;
|
||||
}
|
||||
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
|
||||
|
|
|
@ -294,7 +294,7 @@ typedef union YYSTYPE
|
|||
} tv_nametag;
|
||||
}
|
||||
/* Line 1529 of yacc.c. */
|
||||
#line 298 "y.tab.h"
|
||||
#line 298 "asn1p_y.h"
|
||||
YYSTYPE;
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
|
|
|
@ -850,16 +850,16 @@ ParameterArgumentList:
|
|||
checkmem($$);
|
||||
ret = asn1p_paramlist_add_param($$, $1.governor, $1.argument);
|
||||
checkmem(ret == 0);
|
||||
if($1.governor) asn1p_ref_free($1.governor);
|
||||
if($1.argument) free($1.argument);
|
||||
asn1p_ref_free($1.governor);
|
||||
free($1.argument);
|
||||
}
|
||||
| ParameterArgumentList ',' ParameterArgumentName {
|
||||
int ret;
|
||||
$$ = $1;
|
||||
ret = asn1p_paramlist_add_param($$, $3.governor, $3.argument);
|
||||
checkmem(ret == 0);
|
||||
if($3.governor) asn1p_ref_free($3.governor);
|
||||
if($3.argument) free($3.argument);
|
||||
asn1p_ref_free($3.governor);
|
||||
free($3.argument);
|
||||
}
|
||||
;
|
||||
|
||||
|
|
|
@ -0,0 +1,274 @@
|
|||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_code_coverage.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CODE_COVERAGE()
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Defines CODE_COVERAGE_CPPFLAGS, CODE_COVERAGE_CFLAGS,
|
||||
# CODE_COVERAGE_CXXFLAGS and CODE_COVERAGE_LDFLAGS which should be
|
||||
# included in the CPPFLAGS, CFLAGS CXXFLAGS and LIBS/LDFLAGS variables of
|
||||
# every build target (program or library) which should be built with code
|
||||
# coverage support. Also defines CODE_COVERAGE_RULES which should be
|
||||
# substituted in your Makefile; and $enable_code_coverage which can be
|
||||
# used in subsequent configure output. CODE_COVERAGE_ENABLED is defined
|
||||
# and substituted, and corresponds to the value of the
|
||||
# --enable-code-coverage option, which defaults to being disabled.
|
||||
#
|
||||
# Test also for gcov program and create GCOV variable that could be
|
||||
# substituted.
|
||||
#
|
||||
# Note that all optimisation flags in CFLAGS must be disabled when code
|
||||
# coverage is enabled.
|
||||
#
|
||||
# Usage example:
|
||||
#
|
||||
# configure.ac:
|
||||
#
|
||||
# AX_CODE_COVERAGE
|
||||
#
|
||||
# Makefile.am:
|
||||
#
|
||||
# @CODE_COVERAGE_RULES@
|
||||
# my_program_LIBS = ... $(CODE_COVERAGE_LDFLAGS) ...
|
||||
# my_program_CPPFLAGS = ... $(CODE_COVERAGE_CPPFLAGS) ...
|
||||
# my_program_CFLAGS = ... $(CODE_COVERAGE_CFLAGS) ...
|
||||
# my_program_CXXFLAGS = ... $(CODE_COVERAGE_CXXFLAGS) ...
|
||||
#
|
||||
# This results in a "check-code-coverage" rule being added to any
|
||||
# Makefile.am which includes "@CODE_COVERAGE_RULES@" (assuming the module
|
||||
# has been configured with --enable-code-coverage). Running `make
|
||||
# check-code-coverage` in that directory will run the module's test suite
|
||||
# (`make check`) and build a code coverage report detailing the code which
|
||||
# was touched, then print the URI for the report.
|
||||
#
|
||||
# This code was derived from Makefile.decl in GLib, originally licenced
|
||||
# under LGPLv2.1+.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2012, 2016 Philip Withnall
|
||||
# Copyright (c) 2012 Xan Lopez
|
||||
# Copyright (c) 2012 Christian Persch
|
||||
# Copyright (c) 2012 Paolo Borelli
|
||||
# Copyright (c) 2012 Dan Winship
|
||||
# Copyright (c) 2015 Bastien ROUCARIES
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or (at
|
||||
# your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#serial 16
|
||||
|
||||
AC_DEFUN([AX_CODE_COVERAGE],[
|
||||
dnl Check for --enable-code-coverage
|
||||
AC_REQUIRE([AC_PROG_SED])
|
||||
|
||||
# allow to override gcov location
|
||||
AC_ARG_WITH([gcov],
|
||||
[AS_HELP_STRING([--with-gcov[=GCOV]], [use given GCOV for coverage (GCOV=gcov).])],
|
||||
[_AX_CODE_COVERAGE_GCOV_PROG_WITH=$with_gcov],
|
||||
[_AX_CODE_COVERAGE_GCOV_PROG_WITH=gcov])
|
||||
|
||||
AC_MSG_CHECKING([whether to build with code coverage support])
|
||||
AC_ARG_ENABLE([code-coverage],
|
||||
AS_HELP_STRING([--enable-code-coverage],
|
||||
[Whether to enable code coverage support]),,
|
||||
enable_code_coverage=no)
|
||||
|
||||
AM_CONDITIONAL([CODE_COVERAGE_ENABLED], [test x$enable_code_coverage = xyes])
|
||||
AC_SUBST([CODE_COVERAGE_ENABLED], [$enable_code_coverage])
|
||||
AC_MSG_RESULT($enable_code_coverage)
|
||||
|
||||
AS_IF([ test "$enable_code_coverage" = "yes" ], [
|
||||
# check for gcov
|
||||
AC_CHECK_TOOL([GCOV],
|
||||
[$_AX_CODE_COVERAGE_GCOV_PROG_WITH],
|
||||
[:])
|
||||
AS_IF([test "X$GCOV" = "X:"],
|
||||
[AC_MSG_ERROR([gcov is needed to do coverage])])
|
||||
AC_SUBST([GCOV])
|
||||
|
||||
dnl Check if gcc is being used
|
||||
AS_IF([ test "$GCC" = "no" ], [
|
||||
AC_MSG_ERROR([not compiling with gcc, which is required for gcov code coverage])
|
||||
])
|
||||
|
||||
# List of supported lcov versions.
|
||||
lcov_version_list="1.6 1.7 1.8 1.9 1.10 1.11 1.12"
|
||||
|
||||
AC_CHECK_PROG([LCOV], [lcov], [lcov])
|
||||
AC_CHECK_PROG([GENHTML], [genhtml], [genhtml])
|
||||
|
||||
AS_IF([ test "$LCOV" ], [
|
||||
AC_CACHE_CHECK([for lcov version], ax_cv_lcov_version, [
|
||||
ax_cv_lcov_version=invalid
|
||||
lcov_version=`$LCOV -v 2>/dev/null | $SED -e 's/^.* //'`
|
||||
for lcov_check_version in $lcov_version_list; do
|
||||
if test "$lcov_version" = "$lcov_check_version"; then
|
||||
ax_cv_lcov_version="$lcov_check_version (ok)"
|
||||
fi
|
||||
done
|
||||
])
|
||||
], [
|
||||
lcov_msg="To enable code coverage reporting you must have one of the following lcov versions installed: $lcov_version_list"
|
||||
AC_MSG_ERROR([$lcov_msg])
|
||||
])
|
||||
|
||||
case $ax_cv_lcov_version in
|
||||
""|invalid[)]
|
||||
lcov_msg="You must have one of the following versions of lcov: $lcov_version_list (found: $lcov_version)."
|
||||
AC_MSG_ERROR([$lcov_msg])
|
||||
LCOV="exit 0;"
|
||||
;;
|
||||
esac
|
||||
|
||||
AS_IF([ test -z "$GENHTML" ], [
|
||||
AC_MSG_ERROR([Could not find genhtml from the lcov package])
|
||||
])
|
||||
|
||||
dnl Build the code coverage flags
|
||||
CODE_COVERAGE_CPPFLAGS="-DNDEBUG"
|
||||
CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
|
||||
CODE_COVERAGE_CXXFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
|
||||
CODE_COVERAGE_LDFLAGS="-lgcov"
|
||||
|
||||
AC_SUBST([CODE_COVERAGE_CPPFLAGS])
|
||||
AC_SUBST([CODE_COVERAGE_CFLAGS])
|
||||
AC_SUBST([CODE_COVERAGE_CXXFLAGS])
|
||||
AC_SUBST([CODE_COVERAGE_LDFLAGS])
|
||||
])
|
||||
|
||||
[CODE_COVERAGE_RULES='
|
||||
# Code coverage
|
||||
#
|
||||
# Optional:
|
||||
# - CODE_COVERAGE_DIRECTORY: Top-level directory for code coverage reporting.
|
||||
# Multiple directories may be specified, separated by whitespace.
|
||||
# (Default: $(top_builddir))
|
||||
# - CODE_COVERAGE_OUTPUT_FILE: Filename and path for the .info file generated
|
||||
# by lcov for code coverage. (Default:
|
||||
# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info)
|
||||
# - CODE_COVERAGE_OUTPUT_DIRECTORY: Directory for generated code coverage
|
||||
# reports to be created. (Default:
|
||||
# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage)
|
||||
# - CODE_COVERAGE_BRANCH_COVERAGE: Set to 1 to enforce branch coverage,
|
||||
# set to 0 to disable it and leave empty to stay with the default.
|
||||
# (Default: empty)
|
||||
# - CODE_COVERAGE_LCOV_SHOPTS_DEFAULT: Extra options shared between both lcov
|
||||
# instances. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE)
|
||||
# - CODE_COVERAGE_LCOV_SHOPTS: Extra options to shared between both lcov
|
||||
# instances. (Default: $CODE_COVERAGE_LCOV_SHOPTS_DEFAULT)
|
||||
# - CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH: --gcov-tool pathtogcov
|
||||
# - CODE_COVERAGE_LCOV_OPTIONS_DEFAULT: Extra options to pass to the
|
||||
# collecting lcov instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH)
|
||||
# - CODE_COVERAGE_LCOV_OPTIONS: Extra options to pass to the collecting lcov
|
||||
# instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_DEFAULT)
|
||||
# - CODE_COVERAGE_LCOV_RMOPTS_DEFAULT: Extra options to pass to the filtering
|
||||
# lcov instance. (Default: empty)
|
||||
# - CODE_COVERAGE_LCOV_RMOPTS: Extra options to pass to the filtering lcov
|
||||
# instance. (Default: $CODE_COVERAGE_LCOV_RMOPTS_DEFAULT)
|
||||
# - CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT: Extra options to pass to the
|
||||
# genhtml instance. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE)
|
||||
# - CODE_COVERAGE_GENHTML_OPTIONS: Extra options to pass to the genhtml
|
||||
# instance. (Default: $CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT)
|
||||
# - CODE_COVERAGE_IGNORE_PATTERN: Extra glob pattern of files to ignore
|
||||
#
|
||||
# The generated report will be titled using the $(PACKAGE_NAME) and
|
||||
# $(PACKAGE_VERSION). In order to add the current git hash to the title,
|
||||
# use the git-version-gen script, available online.
|
||||
|
||||
# Optional variables
|
||||
CODE_COVERAGE_DIRECTORY ?= $(top_builddir)
|
||||
CODE_COVERAGE_OUTPUT_FILE ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info
|
||||
CODE_COVERAGE_OUTPUT_DIRECTORY ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage
|
||||
CODE_COVERAGE_BRANCH_COVERAGE ?=
|
||||
CODE_COVERAGE_LCOV_SHOPTS_DEFAULT ?= $(if $(CODE_COVERAGE_BRANCH_COVERAGE),\
|
||||
--rc lcov_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE))
|
||||
CODE_COVERAGE_LCOV_SHOPTS ?= $(CODE_COVERAGE_LCOV_SHOPTS_DEFAULT)
|
||||
CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH ?= --gcov-tool "$(GCOV)"
|
||||
CODE_COVERAGE_LCOV_OPTIONS_DEFAULT ?= $(CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH)
|
||||
CODE_COVERAGE_LCOV_OPTIONS ?= $(CODE_COVERAGE_LCOV_OPTIONS_DEFAULT)
|
||||
CODE_COVERAGE_LCOV_RMOPTS_DEFAULT ?=
|
||||
CODE_COVERAGE_LCOV_RMOPTS ?= $(CODE_COVERAGE_LCOV_RMOPTS_DEFAULT)
|
||||
CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT ?=\
|
||||
$(if $(CODE_COVERAGE_BRANCH_COVERAGE),\
|
||||
--rc genhtml_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE))
|
||||
CODE_COVERAGE_GENHTML_OPTIONS ?= $(CODE_COVERAGE_GENHTML_OPTIONS_DEFAULTS)
|
||||
CODE_COVERAGE_IGNORE_PATTERN ?=
|
||||
|
||||
code_coverage_v_lcov_cap = $(code_coverage_v_lcov_cap_$(V))
|
||||
code_coverage_v_lcov_cap_ = $(code_coverage_v_lcov_cap_$(AM_DEFAULT_VERBOSITY))
|
||||
code_coverage_v_lcov_cap_0 = @echo " LCOV --capture"\
|
||||
$(CODE_COVERAGE_OUTPUT_FILE);
|
||||
code_coverage_v_lcov_ign = $(code_coverage_v_lcov_ign_$(V))
|
||||
code_coverage_v_lcov_ign_ = $(code_coverage_v_lcov_ign_$(AM_DEFAULT_VERBOSITY))
|
||||
code_coverage_v_lcov_ign_0 = @echo " LCOV --remove /tmp/*"\
|
||||
$(CODE_COVERAGE_IGNORE_PATTERN);
|
||||
code_coverage_v_genhtml = $(code_coverage_v_genhtml_$(V))
|
||||
code_coverage_v_genhtml_ = $(code_coverage_v_genhtml_$(AM_DEFAULT_VERBOSITY))
|
||||
code_coverage_v_genhtml_0 = @echo " GEN " $(CODE_COVERAGE_OUTPUT_DIRECTORY);
|
||||
code_coverage_quiet = $(code_coverage_quiet_$(V))
|
||||
code_coverage_quiet_ = $(code_coverage_quiet_$(AM_DEFAULT_VERBOSITY))
|
||||
code_coverage_quiet_0 = --quiet
|
||||
|
||||
# sanitizes the test-name: replaces with underscores: dashes and dots
|
||||
code_coverage_sanitize = $(subst -,_,$(subst .,_,$(1)))
|
||||
|
||||
# Use recursive makes in order to ignore errors during check
|
||||
check-code-coverage:
|
||||
ifeq ($(CODE_COVERAGE_ENABLED),yes)
|
||||
-$(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) -k check
|
||||
$(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture
|
||||
else
|
||||
@echo "Need to reconfigure with --enable-code-coverage"
|
||||
endif
|
||||
|
||||
# Capture code coverage data
|
||||
code-coverage-capture: code-coverage-capture-hook
|
||||
ifeq ($(CODE_COVERAGE_ENABLED),yes)
|
||||
$(code_coverage_v_lcov_cap)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(call code_coverage_sanitize,$(PACKAGE_NAME)-$(PACKAGE_VERSION))" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_OPTIONS)
|
||||
$(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS)
|
||||
-@rm -f $(CODE_COVERAGE_OUTPUT_FILE).tmp
|
||||
$(code_coverage_v_genhtml)LANG=C $(GENHTML) $(code_coverage_quiet) $(addprefix --prefix ,$(CODE_COVERAGE_DIRECTORY)) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS)
|
||||
@echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html"
|
||||
else
|
||||
@echo "Need to reconfigure with --enable-code-coverage"
|
||||
endif
|
||||
|
||||
# Hook rule executed before code-coverage-capture, overridable by the user
|
||||
code-coverage-capture-hook:
|
||||
|
||||
ifeq ($(CODE_COVERAGE_ENABLED),yes)
|
||||
clean: code-coverage-clean
|
||||
distclean: code-coverage-clean
|
||||
code-coverage-clean:
|
||||
-$(LCOV) --directory $(top_builddir) -z
|
||||
-rm -rf $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_FILE).tmp $(CODE_COVERAGE_OUTPUT_DIRECTORY)
|
||||
-find . \( -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" \) -delete
|
||||
endif
|
||||
|
||||
GITIGNOREFILES ?=
|
||||
GITIGNOREFILES += $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY)
|
||||
|
||||
A''M_DISTCHECK_CONFIGURE_FLAGS ?=
|
||||
A''M_DISTCHECK_CONFIGURE_FLAGS += --disable-code-coverage
|
||||
|
||||
.PHONY: check-code-coverage code-coverage-capture code-coverage-capture-hook code-coverage-clean
|
||||
']
|
||||
|
||||
AC_SUBST([CODE_COVERAGE_RULES])
|
||||
m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([CODE_COVERAGE_RULES])])
|
||||
])
|
|
@ -6,7 +6,7 @@
|
|||
#include <ANY.h>
|
||||
#include <errno.h>
|
||||
|
||||
static asn_OCTET_STRING_specifics_t asn_DEF_ANY_specs = {
|
||||
static asn_OCTET_STRING_specifics_t asn_SPC_ANY_specs = {
|
||||
sizeof(ANY_t),
|
||||
offsetof(ANY_t, _asn_ctx),
|
||||
ASN_OSUBV_ANY
|
||||
|
@ -26,7 +26,7 @@ asn_TYPE_descriptor_t asn_DEF_ANY = {
|
|||
0, 0, 0, 0,
|
||||
0, /* No PER visible constraints */
|
||||
0, 0, /* No members */
|
||||
&asn_DEF_ANY_specs,
|
||||
&asn_SPC_ANY_specs,
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
static const ber_tlv_tag_t asn_DEF_BIT_STRING_tags[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (3 << 2))
|
||||
};
|
||||
static asn_OCTET_STRING_specifics_t asn_DEF_BIT_STRING_specs = {
|
||||
static asn_OCTET_STRING_specifics_t asn_SPC_BIT_STRING_specs = {
|
||||
sizeof(BIT_STRING_t),
|
||||
offsetof(BIT_STRING_t, _asn_ctx),
|
||||
ASN_OSUBV_BIT
|
||||
|
@ -38,7 +38,7 @@ asn_TYPE_descriptor_t asn_DEF_BIT_STRING = {
|
|||
/ sizeof(asn_DEF_BIT_STRING_tags[0]),
|
||||
0, /* No PER visible constraints */
|
||||
0, 0, /* No members */
|
||||
&asn_DEF_BIT_STRING_specs
|
||||
&asn_SPC_BIT_STRING_specs
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -13,7 +13,7 @@ static const ber_tlv_tag_t asn_DEF_BMPString_tags[] = {
|
|||
(ASN_TAG_CLASS_UNIVERSAL | (30 << 2)), /* [UNIVERSAL 30] IMPLICIT ...*/
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */
|
||||
};
|
||||
static asn_OCTET_STRING_specifics_t asn_DEF_BMPString_specs = {
|
||||
static asn_OCTET_STRING_specifics_t asn_SPC_BMPString_specs = {
|
||||
sizeof(BMPString_t),
|
||||
offsetof(BMPString_t, _asn_ctx),
|
||||
ASN_OSUBV_U16 /* 16-bits character */
|
||||
|
@ -44,7 +44,7 @@ asn_TYPE_descriptor_t asn_DEF_BMPString = {
|
|||
/ sizeof(asn_DEF_BMPString_tags[0]),
|
||||
&asn_DEF_BMPString_constraints,
|
||||
0, 0, /* No members */
|
||||
&asn_DEF_BMPString_specs
|
||||
&asn_SPC_BMPString_specs
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
*/
|
||||
#define _POSIX_PTHREAD_SEMANTICS /* for Sun */
|
||||
#define _REENTRANT /* for Sun */
|
||||
#ifndef _BSD_SOURCE
|
||||
#define _BSD_SOURCE /* for timegm(3) */
|
||||
#endif
|
||||
#include <asn_internal.h>
|
||||
#include <GeneralizedTime.h>
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ dist_pkgdata_DATA = \
|
|||
${srcdir}/*.[ch] \
|
||||
${srcdir}/file-dependencies
|
||||
|
||||
smodsdir=$(pkgdata)
|
||||
smodsdir=$(pkgdatadir)
|
||||
|
||||
nobase_dist_smods_DATA = \
|
||||
standard-modules/README \
|
||||
|
|
|
@ -14,12 +14,12 @@
|
|||
static const ber_tlv_tag_t asn_DEF_OCTET_STRING_tags[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (4 << 2))
|
||||
};
|
||||
static const asn_OCTET_STRING_specifics_t asn_DEF_OCTET_STRING_specs = {
|
||||
static asn_OCTET_STRING_specifics_t asn_SPC_OCTET_STRING_specs = {
|
||||
sizeof(OCTET_STRING_t),
|
||||
offsetof(OCTET_STRING_t, _asn_ctx),
|
||||
ASN_OSUBV_STR
|
||||
};
|
||||
static const asn_per_constraints_t asn_DEF_OCTET_STRING_constraints = {
|
||||
static asn_per_constraints_t asn_DEF_OCTET_STRING_constraints = {
|
||||
{ APC_CONSTRAINED, 8, 8, 0, 255 },
|
||||
{ APC_SEMI_CONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0
|
||||
|
@ -45,7 +45,7 @@ asn_TYPE_descriptor_t asn_DEF_OCTET_STRING = {
|
|||
/ sizeof(asn_DEF_OCTET_STRING_tags[0]),
|
||||
0, /* No PER visible constraints */
|
||||
0, 0, /* No members */
|
||||
&asn_DEF_OCTET_STRING_specs
|
||||
&asn_SPC_OCTET_STRING_specs
|
||||
};
|
||||
|
||||
#undef _CH_PHASE
|
||||
|
@ -170,7 +170,7 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||
void **sptr, const void *buf_ptr, size_t size, int tag_mode) {
|
||||
asn_OCTET_STRING_specifics_t *specs = td->specifics
|
||||
? (asn_OCTET_STRING_specifics_t *)td->specifics
|
||||
: &asn_DEF_OCTET_STRING_specs;
|
||||
: &asn_SPC_OCTET_STRING_specs;
|
||||
BIT_STRING_t *st = (BIT_STRING_t *)*sptr;
|
||||
asn_dec_rval_t rval;
|
||||
asn_struct_ctx_t *ctx;
|
||||
|
@ -244,8 +244,8 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
|
|||
ber_tlv_tag_t expected_tag;
|
||||
ssize_t tl, ll, tlvl;
|
||||
/* This one works even if (sel->left == -1) */
|
||||
ssize_t Left = ((!sel||(size_t)sel->left >= size)
|
||||
?(ssize_t)size:sel->left);
|
||||
size_t Left = ((!sel||(size_t)sel->left >= size)
|
||||
?size:(size_t)sel->left);
|
||||
|
||||
|
||||
ASN_DEBUG("%p, s->l=%ld, s->wn=%ld, s->g=%ld\n", sel,
|
||||
|
@ -519,7 +519,7 @@ OCTET_STRING_encode_der(asn_TYPE_descriptor_t *td, void *sptr,
|
|||
asn_enc_rval_t er;
|
||||
asn_OCTET_STRING_specifics_t *specs = td->specifics
|
||||
? (asn_OCTET_STRING_specifics_t *)td->specifics
|
||||
: &asn_DEF_OCTET_STRING_specs;
|
||||
: &asn_SPC_OCTET_STRING_specs;
|
||||
BIT_STRING_t *st = (BIT_STRING_t *)sptr;
|
||||
enum asn_OS_Subvariant type_variant = specs->subvariant;
|
||||
int fix_last_byte = 0;
|
||||
|
@ -1112,7 +1112,7 @@ OCTET_STRING__decode_xer(asn_codec_ctx_t *opt_codec_ctx,
|
|||
OCTET_STRING_t *st = (OCTET_STRING_t *)*sptr;
|
||||
asn_OCTET_STRING_specifics_t *specs = td->specifics
|
||||
? (asn_OCTET_STRING_specifics_t *)td->specifics
|
||||
: &asn_DEF_OCTET_STRING_specs;
|
||||
: &asn_SPC_OCTET_STRING_specs;
|
||||
const char *xml_tag = opt_mname ? opt_mname : td->xml_tag;
|
||||
asn_struct_ctx_t *ctx; /* Per-structure parser context */
|
||||
asn_dec_rval_t rval; /* Return value from the decoder */
|
||||
|
@ -1327,7 +1327,7 @@ OCTET_STRING_decode_uper(asn_codec_ctx_t *opt_codec_ctx,
|
|||
|
||||
asn_OCTET_STRING_specifics_t *specs = td->specifics
|
||||
? (asn_OCTET_STRING_specifics_t *)td->specifics
|
||||
: &asn_DEF_OCTET_STRING_specs;
|
||||
: &asn_SPC_OCTET_STRING_specs;
|
||||
asn_per_constraints_t *pc = constraints ? constraints
|
||||
: td->per_constraints;
|
||||
asn_per_constraint_t *cval;
|
||||
|
@ -1498,7 +1498,7 @@ OCTET_STRING_encode_uper(asn_TYPE_descriptor_t *td,
|
|||
|
||||
asn_OCTET_STRING_specifics_t *specs = td->specifics
|
||||
? (asn_OCTET_STRING_specifics_t *)td->specifics
|
||||
: &asn_DEF_OCTET_STRING_specs;
|
||||
: &asn_SPC_OCTET_STRING_specs;
|
||||
asn_per_constraints_t *pc = constraints ? constraints
|
||||
: td->per_constraints;
|
||||
asn_per_constraint_t *cval;
|
||||
|
@ -1721,7 +1721,7 @@ OCTET_STRING_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) {
|
|||
|
||||
specs = td->specifics
|
||||
? (asn_OCTET_STRING_specifics_t *)td->specifics
|
||||
: &asn_DEF_OCTET_STRING_specs;
|
||||
: &asn_SPC_OCTET_STRING_specs;
|
||||
ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset);
|
||||
|
||||
ASN_DEBUG("Freeing %s as OCTET STRING", td->name);
|
||||
|
@ -1793,7 +1793,7 @@ OCTET_STRING_t *
|
|||
OCTET_STRING_new_fromBuf(asn_TYPE_descriptor_t *td, const char *str, int len) {
|
||||
asn_OCTET_STRING_specifics_t *specs = td->specifics
|
||||
? (asn_OCTET_STRING_specifics_t *)td->specifics
|
||||
: &asn_DEF_OCTET_STRING_specs;
|
||||
: &asn_SPC_OCTET_STRING_specs;
|
||||
OCTET_STRING_t *st;
|
||||
|
||||
st = (OCTET_STRING_t *)CALLOC(1, specs->struct_size);
|
||||
|
|
|
@ -41,7 +41,7 @@ static int asn_DEF_PrintableString_c2v(unsigned int code) {
|
|||
return _PrintableString_code2value[code];
|
||||
return -1;
|
||||
}
|
||||
static const asn_per_constraints_t asn_DEF_PrintableString_constraints = {
|
||||
static asn_per_constraints_t asn_DEF_PrintableString_constraints = {
|
||||
{ APC_CONSTRAINED, 4, 4, 0x20, 0x39 }, /* Value */
|
||||
{ APC_SEMI_CONSTRAINED, -1, -1, 0, 0 }, /* Size */
|
||||
asn_DEF_PrintableString_v2c,
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
* Redistribution and modifications are permitted subject to BSD license.
|
||||
*/
|
||||
#define _ISOC99_SOURCE /* For ilogb() and quiet NAN */
|
||||
#ifndef _BSD_SOURCE
|
||||
#define _BSD_SOURCE /* To reintroduce finite(3) */
|
||||
#endif
|
||||
#if defined(__alpha)
|
||||
#include <sys/resource.h> /* For INFINITY */
|
||||
#endif
|
||||
|
|
|
@ -13,7 +13,7 @@ static const ber_tlv_tag_t asn_DEF_UniversalString_tags[] = {
|
|||
(ASN_TAG_CLASS_UNIVERSAL | (28 << 2)), /* [UNIVERSAL 28] IMPLICIT ...*/
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (4 << 2)) /* ... OCTET STRING */
|
||||
};
|
||||
static asn_OCTET_STRING_specifics_t asn_DEF_UniversalString_specs = {
|
||||
static asn_OCTET_STRING_specifics_t asn_SPC_UniversalString_specs = {
|
||||
sizeof(UniversalString_t),
|
||||
offsetof(UniversalString_t, _asn_ctx),
|
||||
ASN_OSUBV_U32 /* 32-bits character */
|
||||
|
@ -44,7 +44,7 @@ asn_TYPE_descriptor_t asn_DEF_UniversalString = {
|
|||
/ sizeof(asn_DEF_UniversalString_tags[0]),
|
||||
&asn_DEF_UniversalString_constraints,
|
||||
0, 0, /* No members */
|
||||
&asn_DEF_UniversalString_specs
|
||||
&asn_SPC_UniversalString_specs
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ static void ASN_DEBUG(const char *fmt, ...) { (void)fmt; }
|
|||
* Check stack against overflow, if limit is set.
|
||||
*/
|
||||
#define ASN__DEFAULT_STACK_MAX (30000)
|
||||
static int __attribute__((unused))
|
||||
static int GCC_NOTUSED
|
||||
ASN__STACK_OVERFLOW_CHECK(asn_codec_ctx_t *ctx) {
|
||||
if(ctx && ctx->max_stack_size) {
|
||||
|
||||
|
|
|
@ -47,12 +47,16 @@
|
|||
#endif
|
||||
#ifndef ASSUMESTDTYPES /* Standard types have been defined elsewhere */
|
||||
#define ssize_t SSIZE_T
|
||||
#if _MSC_VER < 1600
|
||||
typedef char int8_t;
|
||||
typedef short int16_t;
|
||||
typedef int int32_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef unsigned int uint32_t;
|
||||
#else /* _MSC_VER >= 1600 */
|
||||
#include <stdint.h>
|
||||
#endif /* _MSC_VER < 1600 */
|
||||
#endif /* ASSUMESTDTYPES */
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
|
|
@ -671,7 +671,6 @@ CHOICE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
|
|||
case -1:
|
||||
ctx->phase = 5;
|
||||
RETURN(RC_FAIL);
|
||||
continue;
|
||||
case 1:
|
||||
ctx->phase = 3;
|
||||
/* Fall through */
|
||||
|
|
|
@ -146,8 +146,8 @@ der_write_tags(asn_TYPE_descriptor_t *sd,
|
|||
|
||||
if(!cb) return overall_length - struct_length;
|
||||
|
||||
ASN_DEBUG("%s %s TL sequence (%d elements)",
|
||||
cb?"Encoding":"Estimating", sd->name, tags_count);
|
||||
ASN_DEBUG("Encoding %s TL sequence (%d elements)", sd->name,
|
||||
tags_count);
|
||||
|
||||
/*
|
||||
* Encode the TL sequence for real.
|
||||
|
|
|
@ -394,8 +394,8 @@ per_put_few_bits(asn_per_outp_t *po, uint32_t bits, int obits) {
|
|||
buf[2] = bits >> 8,
|
||||
buf[3] = bits;
|
||||
else {
|
||||
per_put_few_bits(po, bits >> (obits - 24), 24);
|
||||
per_put_few_bits(po, bits, obits - 24);
|
||||
if(per_put_few_bits(po, bits >> (obits - 24), 24)) return -1;
|
||||
if(per_put_few_bits(po, bits, obits - 24)) return -1;
|
||||
}
|
||||
|
||||
ASN_DEBUG("[PER out %u/%x => %02x buf+%ld]",
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
@CODE_COVERAGE_RULES@
|
||||
|
||||
check_PROGRAMS = \
|
||||
check-ber_tlv_tag \
|
||||
check-length \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- XML DTD generated by asn1c-0.9.28 -->
|
||||
<!-- XML DTD generated by asn1c-0.9.29 -->
|
||||
|
||||
<!-- ASN.1 module
|
||||
ModuleBitStringConstraint { iso org(3) dod(6) internet(1) private(4)
|
||||
|
|
|
@ -184,6 +184,19 @@ typedef enum other_PR {
|
|||
|
||||
struct Forest;
|
||||
|
||||
/*** <<< FWD-DEFS [Stuff] >>> ***/
|
||||
|
||||
typedef struct Member {
|
||||
BIT_STRING_t cup_of_coffee;
|
||||
/*
|
||||
* This type is extensible,
|
||||
* possible extensions are below.
|
||||
*/
|
||||
|
||||
/* Context for parsing across buffer boundaries */
|
||||
asn_struct_ctx_t _asn_ctx;
|
||||
} Member;
|
||||
|
||||
/*** <<< TYPE-DECLS [Stuff] >>> ***/
|
||||
|
||||
typedef struct Stuff {
|
||||
|
@ -194,16 +207,7 @@ typedef struct Stuff {
|
|||
asn_struct_ctx_t _asn_ctx;
|
||||
} *trees;
|
||||
struct anything {
|
||||
A_SET_OF(struct Member {
|
||||
BIT_STRING_t cup_of_coffee;
|
||||
/*
|
||||
* This type is extensible,
|
||||
* possible extensions are below.
|
||||
*/
|
||||
|
||||
/* Context for parsing across buffer boundaries */
|
||||
asn_struct_ctx_t _asn_ctx;
|
||||
} ) list;
|
||||
A_SET_OF(Member) list;
|
||||
|
||||
/* Context for parsing across buffer boundaries */
|
||||
asn_struct_ctx_t _asn_ctx;
|
||||
|
|
|
@ -7,16 +7,20 @@
|
|||
#include <constr_SEQUENCE.h>
|
||||
#include <constr_SET_OF.h>
|
||||
|
||||
/*** <<< FWD-DEFS [Type] >>> ***/
|
||||
|
||||
typedef struct Member {
|
||||
Type1_t t1;
|
||||
Type2_t t2;
|
||||
|
||||
/* Context for parsing across buffer boundaries */
|
||||
asn_struct_ctx_t _asn_ctx;
|
||||
} Member;
|
||||
|
||||
/*** <<< TYPE-DECLS [Type] >>> ***/
|
||||
|
||||
typedef struct Type {
|
||||
A_SET_OF(struct Member {
|
||||
Type1_t t1;
|
||||
Type2_t t2;
|
||||
|
||||
/* Context for parsing across buffer boundaries */
|
||||
asn_struct_ctx_t _asn_ctx;
|
||||
} ) list;
|
||||
A_SET_OF(Member) list;
|
||||
|
||||
/* Context for parsing across buffer boundaries */
|
||||
asn_struct_ctx_t _asn_ctx;
|
||||
|
|
|
@ -623,23 +623,27 @@ asn_TYPE_descriptor_t asn_DEF_Choice3 = {
|
|||
struct Set;
|
||||
struct Sequence;
|
||||
|
||||
/*** <<< FWD-DEFS [Set] >>> ***/
|
||||
|
||||
typedef struct Member {
|
||||
long Int;
|
||||
struct Set *set;
|
||||
struct Sequence *seq;
|
||||
struct Set *set2 /* OPTIONAL */;
|
||||
/*
|
||||
* This type is extensible,
|
||||
* possible extensions are below.
|
||||
*/
|
||||
struct Set *set3;
|
||||
|
||||
/* Context for parsing across buffer boundaries */
|
||||
asn_struct_ctx_t _asn_ctx;
|
||||
} Member;
|
||||
|
||||
/*** <<< TYPE-DECLS [Set] >>> ***/
|
||||
|
||||
typedef struct Set {
|
||||
A_SET_OF(struct Member {
|
||||
long Int;
|
||||
struct Set *set;
|
||||
struct Sequence *seq;
|
||||
struct Set *set2 /* OPTIONAL */;
|
||||
/*
|
||||
* This type is extensible,
|
||||
* possible extensions are below.
|
||||
*/
|
||||
struct Set *set3;
|
||||
|
||||
/* Context for parsing across buffer boundaries */
|
||||
asn_struct_ctx_t _asn_ctx;
|
||||
} ) list;
|
||||
A_SET_OF(Member) list;
|
||||
|
||||
/* Context for parsing across buffer boundaries */
|
||||
asn_struct_ctx_t _asn_ctx;
|
||||
|
|
|
@ -622,23 +622,27 @@ asn_TYPE_descriptor_t asn_DEF_Choice3 = {
|
|||
struct Set;
|
||||
struct Sequence;
|
||||
|
||||
/*** <<< FWD-DEFS [Set] >>> ***/
|
||||
|
||||
typedef struct Member {
|
||||
INTEGER_t Int;
|
||||
struct Set *set;
|
||||
struct Sequence *seq;
|
||||
struct Set *set2 /* OPTIONAL */;
|
||||
/*
|
||||
* This type is extensible,
|
||||
* possible extensions are below.
|
||||
*/
|
||||
struct Set *set3;
|
||||
|
||||
/* Context for parsing across buffer boundaries */
|
||||
asn_struct_ctx_t _asn_ctx;
|
||||
} Member;
|
||||
|
||||
/*** <<< TYPE-DECLS [Set] >>> ***/
|
||||
|
||||
typedef struct Set {
|
||||
A_SET_OF(struct Member {
|
||||
INTEGER_t Int;
|
||||
struct Set *set;
|
||||
struct Sequence *seq;
|
||||
struct Set *set2 /* OPTIONAL */;
|
||||
/*
|
||||
* This type is extensible,
|
||||
* possible extensions are below.
|
||||
*/
|
||||
struct Set *set3;
|
||||
|
||||
/* Context for parsing across buffer boundaries */
|
||||
asn_struct_ctx_t _asn_ctx;
|
||||
} ) list;
|
||||
A_SET_OF(Member) list;
|
||||
|
||||
/* Context for parsing across buffer boundaries */
|
||||
asn_struct_ctx_t _asn_ctx;
|
||||
|
|
Loading…
Reference in New Issue