Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix version brackets in CHOICE #199

Open
wants to merge 1 commit into
base: vlm_master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions libasn1compiler/asn1c_C.c
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,6 @@ asn1c_lang_C_type_CHOICE(arg_t *arg) {
asn1p_expr_t *expr = arg->expr;
asn1p_expr_t *v;
int saved_target = arg->target->target;
int ext_num = 1;

DEPENDENCIES;

Expand All @@ -994,13 +993,6 @@ asn1c_lang_C_type_CHOICE(arg_t *arg) {
continue;
}

if((v->expr_type == ASN_CONSTR_SEQUENCE) &&
(v->marker.flags & EM_OPTIONAL) &&
(v->Identifier == NULL)) {
char ext_name[20];
sprintf(ext_name, "ext%d", ext_num++);
v->Identifier = strdup(ext_name);
}
OUT("%s", c_presence_name(arg, v));
}
OUT("\n");
Expand Down
6 changes: 2 additions & 4 deletions libasn1parser/asn1p_y.y
Original file line number Diff line number Diff line change
Expand Up @@ -1097,10 +1097,8 @@ AlternativeTypeLists:
}
| AlternativeTypeLists ',' TOK_VBracketLeft AlternativeTypeLists TOK_VBracketRight {
$$ = $1;
$4->meta_type = AMT_TYPE;
$4->expr_type = ASN_CONSTR_SEQUENCE;
$4->marker.flags |= EM_OPTIONAL;
asn1p_expr_add($$, $4);
asn1p_expr_add_many($$, $4);
asn1p_expr_free($4);
}
;

Expand Down
31 changes: 31 additions & 0 deletions tests/tests-asn1c-compiler/165-choice-extended-group-OK.asn1
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

-- OK: Everything is fine

-- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1)
-- .spelio.software.asn1c.test (9363.1.5.1)
-- .165

ModuleTestExtensibleChoice
{ iso org(3) dod(6) internet(1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 165 }
DEFINITIONS AUTOMATIC TAGS ::=
BEGIN

Choice ::= CHOICE {
a INTEGER,
...,
b INTEGER,
[[
c INTEGER
]],
[[
d INTEGER,
e INTEGER
]],
[[
f INTEGER,
g INTEGER
]]
}

END
Loading