Commit 995c5bd4 authored by Bi-Ruei, Chiu's avatar Bi-Ruei, Chiu

Fix the problem that NGAP ASN.1 can not generate C files

Because TAIItem and TAIList exist in NAGP-IEs module and NGAP-PDU
module, so name conflict condition occurs.

Previous returned value from asn1p_oid_compare() in asn1f_check_duplicate()
is incorrectly checked. Fix it by adding additional ASN1FIX flag
A1F_COMPOUND_NAMES which is set in asn1c.c.
parent 73d6b23d
...@@ -119,6 +119,7 @@ main(int ac, char **av) { ...@@ -119,6 +119,7 @@ main(int ac, char **av) {
asn1_fixer_flags |= A1F_EXTENDED_SizeConstraint; asn1_fixer_flags |= A1F_EXTENDED_SizeConstraint;
} else if(strcmp(optarg, "compound-names") == 0) { } else if(strcmp(optarg, "compound-names") == 0) {
asn1_compiler_flags |= A1C_COMPOUND_NAMES; asn1_compiler_flags |= A1C_COMPOUND_NAMES;
asn1_fixer_flags |= A1F_COMPOUND_NAMES;
} else if(strcmp(optarg, "indirect-choice") == 0) { } else if(strcmp(optarg, "indirect-choice") == 0) {
asn1_compiler_flags |= A1C_INDIRECT_CHOICE; asn1_compiler_flags |= A1C_INDIRECT_CHOICE;
} else if(strncmp(optarg, "known-extern-type=", 18) == 0) { } else if(strncmp(optarg, "known-extern-type=", 18) == 0) {
......
...@@ -65,6 +65,15 @@ asn1f_process(asn1p_t *asn, enum asn1f_flags flags, ...@@ -65,6 +65,15 @@ asn1f_process(asn1p_t *asn, enum asn1f_flags flags,
} }
} }
if(flags & A1F_COMPOUND_NAMES) {
arg.flags |= A1F_COMPOUND_NAMES;
flags &= ~A1F_COMPOUND_NAMES;
if(arg.debug) {
arg.debug(-1,
"Allow the same symbol name defined in two different modules");
}
}
a1f_replace_me_with_proper_interface_arg = arg; a1f_replace_me_with_proper_interface_arg = arg;
/* /*
...@@ -515,8 +524,9 @@ asn1f_check_duplicate(arg_t *arg) { ...@@ -515,8 +524,9 @@ asn1f_check_duplicate(arg_t *arg) {
/* resolve clash of Identifier in different modules */ /* resolve clash of Identifier in different modules */
int oid_exist = (tmparg.expr->module->module_oid && arg->expr->module->module_oid); int oid_exist = (tmparg.expr->module->module_oid && arg->expr->module->module_oid);
if ((!oid_exist && strcmp(tmparg.expr->module->ModuleName, arg->expr->module->ModuleName)) || if ((arg->flags & A1F_COMPOUND_NAMES) &&
(oid_exist && !asn1p_oid_compare(tmparg.expr->module->module_oid, arg->expr->module->module_oid))) { ((!oid_exist && strcmp(tmparg.expr->module->ModuleName, arg->expr->module->ModuleName)) ||
(oid_exist && asn1p_oid_compare(tmparg.expr->module->module_oid, arg->expr->module->module_oid)))) {
tmparg.expr->_mark |= TM_NAMECLASH; tmparg.expr->_mark |= TM_NAMECLASH;
arg->expr->_mark |= TM_NAMECLASH; arg->expr->_mark |= TM_NAMECLASH;
......
...@@ -14,6 +14,7 @@ enum asn1f_flags { ...@@ -14,6 +14,7 @@ enum asn1f_flags {
A1F_NOFLAGS, A1F_NOFLAGS,
A1F_DEBUG = 0x01, /* Print debugging output */ A1F_DEBUG = 0x01, /* Print debugging output */
A1F_EXTENDED_SizeConstraint = 0x02, /* Enable constraint gen code */ A1F_EXTENDED_SizeConstraint = 0x02, /* Enable constraint gen code */
A1F_COMPOUND_NAMES = 0x04 /* A1C_COMPOUND_NAMES */
}; };
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment