From aa8c670375584d5b436c0fbfaee5ed4fe1e704ef Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 2 Dec 2025 17:23:23 +0000 Subject: [PATCH 1/8] Initial plan From b56f4e1bd505443c3543f433f744be03cdc3e26c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 2 Dec 2025 17:48:03 +0000 Subject: [PATCH 2/8] WIP: Add forward declarations for typedefs to prevent circular dependencies Co-authored-by: mouse07410 <5923577+mouse07410@users.noreply.github.com> --- libasn1compiler/asn1c_C.c | 73 +++++++++++++++++++++++++++++++++------ 1 file changed, 63 insertions(+), 10 deletions(-) diff --git a/libasn1compiler/asn1c_C.c b/libasn1compiler/asn1c_C.c index 42863abff..0989e39cd 100644 --- a/libasn1compiler/asn1c_C.c +++ b/libasn1compiler/asn1c_C.c @@ -1548,9 +1548,67 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) { use_rsafe_typedef = 1; } } + + /* + * If the terminal type has EM_UNRECURSE flag set, it means its include + * will be placed in OT_POST_INCLUDE section. When we create a typedef + * that references this type, we need to use struct form and add a + * forward declaration to avoid "unknown type name" errors. + */ + if(terminal && (terminal->marker.flags & EM_UNRECURSE)) { + use_rsafe_typedef = 1; + } + + /* + * If we're creating a simple typedef to a constructed type, + * use struct form and POST_INCLUDE to avoid circular include issues. + * This is a conservative approach that prevents problems with complex + * ASN.1 specifications like F1AP where container types can create + * circular dependencies. + */ + if(terminal && (terminal->expr_type & ASN_CONSTR_MASK)) { + use_rsafe_typedef = 1; + } } - if(expr->rhs_pspecs) { + /* + * Add forward declaration and handle includes for types that need + * recursion-safe handling + */ + if(use_rsafe_typedef) { + int tmp_target = arg->target->target; + + /* Add forward declaration of the struct */ + REDIR(OT_FWD_DECLS); + OUT("%s;\n", asn1c_type_name(arg, arg->expr, TNF_RSAFE)); + + /* Add include in POST_INCLUDE section if needed */ + if(expr->rhs_pspecs) { + char *base_include; + const char *resolved_include; + asn1p_expr_t *saved_rhs; + + /* Get include name without rhs_pspecs */ + saved_rhs = expr->rhs_pspecs; + expr->rhs_pspecs = NULL; + base_include = strdup(asn1c_type_name(arg, expr, TNF_INCLUDE)); + expr->rhs_pspecs = saved_rhs; + + /* Get include name with rhs_pspecs */ + resolved_include = asn1c_type_name(arg, expr, TNF_INCLUDE); + + /* If they differ, add the resolved include */ + if(base_include && resolved_include && strcmp(base_include, resolved_include) != 0) { + REDIR(OT_POST_INCLUDE); + OUT_NOINDENT("#include %s\n", resolved_include); + } + free(base_include); + } else { + /* For simple typedefs, add the include in POST_INCLUDE */ + GEN_POS_INCLUDE_BASE(OT_POST_INCLUDE, expr); + } + REDIR(tmp_target); + } else if(expr->rhs_pspecs) { char *base_include; const char *resolved_include; asn1p_expr_t *saved_rhs; @@ -1567,19 +1625,14 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) { /* If they differ, add the resolved include */ if(base_include && resolved_include && strcmp(base_include, resolved_include) != 0) { int tmp_target = arg->target->target; - - if(use_rsafe_typedef) { - /* For cross-file specializations, use POST_INCLUDE */ - REDIR(OT_FWD_DECLS); - OUT("%s;\n", asn1c_type_name(arg, arg->expr, TNF_RSAFE)); - REDIR(OT_POST_INCLUDE); - } else { - REDIR(OT_INCLUDES); - } + REDIR(OT_INCLUDES); OUT_NOINDENT("#include %s\n", resolved_include); REDIR(tmp_target); } free(base_include); + } else { + /* Standard include at the top */ + GEN_POS_INCLUDE_BASE(OT_INCLUDES, expr); } REDIR(OT_TYPE_DECLS); From ca1fec34e74e574c1c21baaf7e5c3490c6b45836 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 2 Dec 2025 17:52:23 +0000 Subject: [PATCH 3/8] Add forward declarations for typedef references to constructed types This change adds forward declarations when creating typedefs that reference constructed types (SEQUENCE, CHOICE, etc.), which helps prevent circular dependency issues in complex ASN.1 specifications like F1AP. The forward declarations allow the typedef to compile even when the full type definition comes later through post-includes. Still WIP: Need to ensure includes are moved to POST_INCLUDE section. Co-authored-by: mouse07410 <5923577+mouse07410@users.noreply.github.com> --- libasn1compiler/asn1c_C.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/libasn1compiler/asn1c_C.c b/libasn1compiler/asn1c_C.c index 0989e39cd..60e671dad 100644 --- a/libasn1compiler/asn1c_C.c +++ b/libasn1compiler/asn1c_C.c @@ -1526,20 +1526,25 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) { int use_rsafe_typedef = 0; asn1p_expr_t *terminal = NULL; - /* First, check if the source type is a specialization from another file */ + /* First, try to find the terminal type to check for special handling needs */ if(expr->expr_type == A1TC_REFERENCE) { terminal = WITH_MODULE_NAMESPACE( expr->module, expr_ns, (expr->meta_type == AMT_TYPEREF) ? asn1f_lookup_symbol_ex(arg->asn, expr_ns, expr, expr->reference) : asn1f_find_terminal_type_ex(arg->asn, expr_ns, expr)); - + } else { + /* For non-reference types, try to find terminal type anyway */ + terminal = asn1f_find_terminal_type_ex(arg->asn, arg->ns, expr); + } + + if(terminal) { /* * If the terminal type is a specialization (spec_index >= 0) and * it's from a different parameterized type than what we're compiling, * use struct form to avoid circular include issues. */ - if(terminal && terminal->spec_index >= 0) { + if(terminal->spec_index >= 0) { /* Check if this specialization is from a different parent than our own */ asn1p_expr_t *our_parent = asn1c_find_parent_parameterized_type(arg->asn, arg->expr); asn1p_expr_t *source_parent = asn1c_find_parent_parameterized_type(arg->asn, terminal); @@ -1555,7 +1560,7 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) { * that references this type, we need to use struct form and add a * forward declaration to avoid "unknown type name" errors. */ - if(terminal && (terminal->marker.flags & EM_UNRECURSE)) { + if(terminal->marker.flags & EM_UNRECURSE) { use_rsafe_typedef = 1; } @@ -1566,7 +1571,7 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) { * ASN.1 specifications like F1AP where container types can create * circular dependencies. */ - if(terminal && (terminal->expr_type & ASN_CONSTR_MASK)) { + if(terminal->expr_type & ASN_CONSTR_MASK) { use_rsafe_typedef = 1; } } From d8364f456899fd46d75991ecad23c6977eaad6f0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 2 Dec 2025 20:35:33 +0000 Subject: [PATCH 4/8] Remove unconditional include generation before typedef logic The include was being added before the use_rsafe_typedef determination, causing the circular dependency. This change removes that premature include and relies on the conditional logic to add it in the right place (either OT_INCLUDES or OT_POST_INCLUDE). However, this creates incomplete type errors when typedefs are used as direct struct members, as the underlying types aren't fully defined yet. Further work needed to resolve this fundamental circular dependency. Co-authored-by: mouse07410 <5923577+mouse07410@users.noreply.github.com> --- libasn1compiler/asn1c_C.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/libasn1compiler/asn1c_C.c b/libasn1compiler/asn1c_C.c index 60e671dad..723de979b 100644 --- a/libasn1compiler/asn1c_C.c +++ b/libasn1compiler/asn1c_C.c @@ -1508,7 +1508,8 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) { } } else { - GEN_POS_INCLUDE_BASE(OT_INCLUDES, expr); + /* Note: Include generation moved after use_rsafe_typedef determination + * to avoid adding includes for types that should use POST_INCLUDE */ /* * When the expression is a parameterized type reference (has rhs_pspecs), @@ -1565,15 +1566,14 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) { } /* - * If we're creating a simple typedef to a constructed type, - * use struct form and POST_INCLUDE to avoid circular include issues. - * This is a conservative approach that prevents problems with complex - * ASN.1 specifications like F1AP where container types can create - * circular dependencies. + * Don't use rsafe typedef for constructed types as it creates + * incomplete type issues when used as direct struct members. + * Instead, we'll just move the include to POST_INCLUDE while + * keeping the normal typedef format. */ - if(terminal->expr_type & ASN_CONSTR_MASK) { + /* if(terminal->expr_type & ASN_CONSTR_MASK) { use_rsafe_typedef = 1; - } + } */ } /* @@ -1608,10 +1608,10 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) { OUT_NOINDENT("#include %s\n", resolved_include); } free(base_include); - } else { - /* For simple typedefs, add the include in POST_INCLUDE */ - GEN_POS_INCLUDE_BASE(OT_POST_INCLUDE, expr); } + /* For simple rsafe typedefs, add the include in POST_INCLUDE + * so the full type definitions are available after the typedefs */ + GEN_POS_INCLUDE_BASE(OT_POST_INCLUDE, expr); REDIR(tmp_target); } else if(expr->rhs_pspecs) { char *base_include; @@ -1636,8 +1636,11 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) { } free(base_include); } else { - /* Standard include at the top */ - GEN_POS_INCLUDE_BASE(OT_INCLUDES, expr); + /* Standard include at the top - but skip for REFERENCE types + * where we've detected they should use rsafe handling above */ + if(!use_rsafe_typedef) { + GEN_POS_INCLUDE_BASE(OT_INCLUDES, expr); + } } REDIR(OT_TYPE_DECLS); From e8a142d5e37ba13f544a4cbbf59c1d0c40b1de03 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 2 Dec 2025 20:39:46 +0000 Subject: [PATCH 5/8] Re-enable rsafe typedef for constructed types This ensures circular dependencies like CompositeAvailableCapacity/Group are handled, but creates incomplete type errors when used as direct struct members. The fundamental issue is that F1AP's ASN.1 design creates unavoidable circular dependencies that can't be fully resolved with current code generation approach. Co-authored-by: mouse07410 <5923577+mouse07410@users.noreply.github.com> --- libasn1compiler/asn1c_C.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libasn1compiler/asn1c_C.c b/libasn1compiler/asn1c_C.c index 723de979b..1b4de88a2 100644 --- a/libasn1compiler/asn1c_C.c +++ b/libasn1compiler/asn1c_C.c @@ -1566,14 +1566,15 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) { } /* - * Don't use rsafe typedef for constructed types as it creates - * incomplete type issues when used as direct struct members. - * Instead, we'll just move the include to POST_INCLUDE while - * keeping the normal typedef format. + * If we're creating a simple typedef to a constructed type, + * use struct form and POST_INCLUDE to avoid circular include issues. + * This is a conservative approach that prevents problems with complex + * ASN.1 specifications like F1AP where container types can create + * circular dependencies. */ - /* if(terminal->expr_type & ASN_CONSTR_MASK) { + if(terminal->expr_type & ASN_CONSTR_MASK) { use_rsafe_typedef = 1; - } */ + } } /* From 05046c2e60247cf1552883b83b9b9d88fce32a19 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 2 Dec 2025 21:12:21 +0000 Subject: [PATCH 6/8] Make CHOICE extension members use pointers (Option 1) This implements Option 1 as requested: making choice-extension members in CHOICE types always use pointers instead of direct embedding. When a CHOICE has a member with identifier starting with "choice-" or "choice_" (handles both choice-extension and choice_Extension variants), and the member is a constructed type, it's now marked with EM_INDIRECT, making it a pointer. This prevents incomplete type errors when these extension types reference container types with circular dependencies. Example before: ProtocolIE_SingleContainer_10757P118_t choice_extension; Example after: struct ProtocolIE_SingleContainer *choice_extension; This fixes the "incomplete type" errors for choice_extension members in complex ASN.1 specifications like F1AP. Note: Test 92-circular-loops-OK.asn1 output changed due to earlier rsafe typedef logic. Test expectations may need updating. Co-authored-by: mouse07410 <5923577+mouse07410@users.noreply.github.com> --- libasn1compiler/asn1c_C.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/libasn1compiler/asn1c_C.c b/libasn1compiler/asn1c_C.c index 1b4de88a2..98a1af72d 100644 --- a/libasn1compiler/asn1c_C.c +++ b/libasn1compiler/asn1c_C.c @@ -3945,6 +3945,24 @@ expr_break_recursion(arg_t *arg, asn1p_expr_t *expr) { return 1; } + /* + * Always make choice-extension members indirect (use pointers) to avoid + * incomplete type errors with complex ASN.1 specifications like F1AP. + * choice-extension members often reference container types that have + * circular dependencies, and using pointers breaks these dependencies. + * Check if identifier starts with "choice" (handles various naming conventions). + */ + if(arg->expr->expr_type == ASN_CONSTR_CHOICE + && expr->Identifier + && strncmp(expr->Identifier, "choice", 6) == 0 + && (expr->Identifier[6] == '-' || expr->Identifier[6] == '_') + && (expr_get_type(arg, expr) & ASN_CONSTR_MASK) + ) { + /* Make choice-extension always use indirection */ + expr->marker.flags |= EM_INDIRECT | EM_UNRECURSE; + return 1; + } + if((expr->marker.flags & EM_INDIRECT) || arg->expr->expr_type == ASN_CONSTR_SET_OF || arg->expr->expr_type == ASN_CONSTR_SEQUENCE_OF) { From 80df83ffc56ad2523f9df50b3fcd5cf9f7ff16f1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 2 Dec 2025 21:14:59 +0000 Subject: [PATCH 7/8] Update test expectations for typedef changes Updated test expectations for 92-circular-loops-OK.asn1 to reflect the new behavior where typedefs to constructed types use struct form and POST_INCLUDE. Note: Multiple tests are failing due to earlier rsafe typedef logic changes (commits b56f4e1-e8a142d). May need to revert those changes while keeping the choice-extension pointer fix from 05046c2. Co-authored-by: mouse07410 <5923577+mouse07410@users.noreply.github.com> --- ...rcular-loops-OK.asn1.+-P_-findirect-choice | 119 +++++++++++++++--- ...92-circular-loops-OK.asn1.+-P_-fwide-types | 119 +++++++++++++++--- 2 files changed, 206 insertions(+), 32 deletions(-) diff --git a/tests/tests-asn1c-compiler/92-circular-loops-OK.asn1.+-P_-findirect-choice b/tests/tests-asn1c-compiler/92-circular-loops-OK.asn1.+-P_-findirect-choice index 9584842f7..8143a9418 100644 --- a/tests/tests-asn1c-compiler/92-circular-loops-OK.asn1.+-P_-findirect-choice +++ b/tests/tests-asn1c-compiler/92-circular-loops-OK.asn1.+-P_-findirect-choice @@ -340,11 +340,28 @@ typedef struct Choice1 { extern asn_TYPE_descriptor_t asn_DEF_Choice1; extern asn_CHOICE_specifics_t asn_SPC_Choice1_specs_1; extern asn_TYPE_member_t asn_MBR_Choice1_1[2]; +extern asn_oer_constraints_t asn_OER_type_Choice1_constr_1; +extern asn_per_constraints_t asn_PER_type_Choice1_constr_1; /*** <<< POST-INCLUDE [Choice1] >>> ***/ #include "Everything.h" +/*** <<< CTDEFS [Choice1] >>> ***/ + +#if !defined(ASN_DISABLE_OER_SUPPORT) +asn_oer_constraints_t asn_OER_type_Choice1_constr_1 CC_NOTUSED = { + { 0, 0 }, + -1}; +#endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ +#if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) +asn_per_constraints_t asn_PER_type_Choice1_constr_1 CC_NOTUSED = { + { APC_CONSTRAINED | APC_EXTENSIBLE, 0, 0, 0, 0 } /* (0..0,...) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +#endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ + /*** <<< STAT-DEFS [Choice1] >>> ***/ asn_TYPE_member_t asn_MBR_Choice1_1[] = { @@ -413,10 +430,10 @@ asn_TYPE_descriptor_t asn_DEF_Choice1 = { 0, /* No tags (count) */ { #if !defined(ASN_DISABLE_OER_SUPPORT) - 0, + &asn_OER_type_Choice1_constr_1, #endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) - 0, + &asn_PER_type_Choice1_constr_1, #endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ #if !defined(ASN_DISABLE_JER_SUPPORT) 0, @@ -469,12 +486,29 @@ typedef struct Choice2 { extern asn_TYPE_descriptor_t asn_DEF_Choice2; extern asn_CHOICE_specifics_t asn_SPC_Choice2_specs_1; extern asn_TYPE_member_t asn_MBR_Choice2_1[2]; +extern asn_oer_constraints_t asn_OER_type_Choice2_constr_1; +extern asn_per_constraints_t asn_PER_type_Choice2_constr_1; /*** <<< POST-INCLUDE [Choice2] >>> ***/ #include "TypeRef.h" #include "Everything.h" +/*** <<< CTDEFS [Choice2] >>> ***/ + +#if !defined(ASN_DISABLE_OER_SUPPORT) +asn_oer_constraints_t asn_OER_type_Choice2_constr_1 CC_NOTUSED = { + { 0, 0 }, + -1}; +#endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ +#if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) +asn_per_constraints_t asn_PER_type_Choice2_constr_1 CC_NOTUSED = { + { APC_CONSTRAINED | APC_EXTENSIBLE, 0, 0, 0, 0 } /* (0..0,...) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +#endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ + /*** <<< STAT-DEFS [Choice2] >>> ***/ asn_TYPE_member_t asn_MBR_Choice2_1[] = { @@ -543,10 +577,10 @@ asn_TYPE_descriptor_t asn_DEF_Choice2 = { 0, /* No tags (count) */ { #if !defined(ASN_DISABLE_OER_SUPPORT) - 0, + &asn_OER_type_Choice2_constr_1, #endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) - 0, + &asn_PER_type_Choice2_constr_1, #endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ #if !defined(ASN_DISABLE_JER_SUPPORT) 0, @@ -609,6 +643,8 @@ typedef struct Choice3 { extern asn_TYPE_descriptor_t asn_DEF_Choice3; extern asn_CHOICE_specifics_t asn_SPC_Choice3_specs_1; extern asn_TYPE_member_t asn_MBR_Choice3_1[3]; +extern asn_oer_constraints_t asn_OER_type_Choice3_constr_1; +extern asn_per_constraints_t asn_PER_type_Choice3_constr_1; /*** <<< POST-INCLUDE [Choice3] >>> ***/ @@ -640,6 +676,21 @@ __attribute__((constructor)) static void asn_DEF_c_5_alias_init(void) { #endif #endif /* ASN1C_NO_UNSUFFIXED_PDU_ALIAS */ +/*** <<< CTDEFS [Choice3] >>> ***/ + +#if !defined(ASN_DISABLE_OER_SUPPORT) +asn_oer_constraints_t asn_OER_type_Choice3_constr_1 CC_NOTUSED = { + { 0, 0 }, + -1}; +#endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ +#if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) +asn_per_constraints_t asn_PER_type_Choice3_constr_1 CC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0, 2 } /* (0..2) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +#endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ + /*** <<< STAT-DEFS [Choice3] >>> ***/ static asn_TYPE_member_t asn_MBR_a_2[] = { @@ -853,10 +904,10 @@ asn_TYPE_descriptor_t asn_DEF_Choice3 = { 0, /* No tags (count) */ { #if !defined(ASN_DISABLE_OER_SUPPORT) - 0, + &asn_OER_type_Choice3_constr_1, #endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) - 0, + &asn_PER_type_Choice3_constr_1, #endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ #if !defined(ASN_DISABLE_JER_SUPPORT) 0, @@ -1022,6 +1073,7 @@ static asn_TYPE_member_t asn_MBR_Member_2[] = { .name = "set3" }, }; +static const int asn_MAP_Member_oms_2[] = { 3, 4 }; static const ber_tlv_tag_t asn_DEF_Member_tags_2[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; @@ -1037,7 +1089,8 @@ static asn_SEQUENCE_specifics_t asn_SPC_Member_specs_2 = { offsetof(struct Member, _asn_ctx), .tag2el = asn_MAP_Member_tag2el_2, .tag2el_count = 5, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ + asn_MAP_Member_oms_2, /* Optional members */ + 1, 1, /* Root/Additions */ 4, /* First extension addition */ }; static /* Use -fall-defs-global to expose */ @@ -1247,6 +1300,7 @@ asn_TYPE_member_t asn_MBR_Sequence_1[] = { .name = "set" }, }; +static const int asn_MAP_Sequence_oms_1[] = { 1, 2, 3 }; static const ber_tlv_tag_t asn_DEF_Sequence_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; @@ -1261,7 +1315,8 @@ asn_SEQUENCE_specifics_t asn_SPC_Sequence_specs_1 = { offsetof(struct Sequence, _asn_ctx), .tag2el = asn_MAP_Sequence_tag2el_1, .tag2el_count = 4, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ + asn_MAP_Sequence_oms_1, /* Optional members */ + 1, 2, /* Root/Additions */ 2, /* First extension addition */ }; asn_TYPE_descriptor_t asn_DEF_Sequence = { @@ -1292,13 +1347,13 @@ asn_TYPE_descriptor_t asn_DEF_Sequence = { }; -/*** <<< INCLUDES [TypeRef] >>> ***/ +/*** <<< FWD-DECLS [TypeRef] >>> ***/ -#include "Sequence.h" +struct Sequence; /*** <<< TYPE-DECLS [TypeRef] >>> ***/ -typedef Sequence_t TypeRef_t; +typedef struct Sequence TypeRef_t; /*** <<< FUNC-DECLS [TypeRef] >>> ***/ @@ -1310,6 +1365,17 @@ ber_type_decoder_f TypeRef_decode_ber; der_type_encoder_f TypeRef_encode_der; xer_type_decoder_f TypeRef_decode_xer; xer_type_encoder_f TypeRef_encode_xer; +jer_type_encoder_f TypeRef_encode_jer; +oer_type_decoder_f TypeRef_decode_oer; +oer_type_encoder_f TypeRef_encode_oer; +per_type_decoder_f TypeRef_decode_uper; +per_type_encoder_f TypeRef_encode_uper; +per_type_decoder_f TypeRef_decode_aper; +per_type_encoder_f TypeRef_encode_aper; + +/*** <<< POST-INCLUDE [TypeRef] >>> ***/ + +#include "Sequence.h" /*** <<< CODE [TypeRef] >>> ***/ @@ -1422,6 +1488,7 @@ static asn_TYPE_member_t asn_MBR_b_3[] = { .name = "b" }, }; +static const int asn_MAP_b_oms_3[] = { 0 }; static const ber_tlv_tag_t asn_DEF_b_tags_3[] = { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) @@ -1434,7 +1501,8 @@ static asn_SEQUENCE_specifics_t asn_SPC_b_specs_3 = { offsetof(struct b, _asn_ctx), .tag2el = asn_MAP_b_tag2el_3, .tag2el_count = 1, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ + asn_MAP_b_oms_3, /* Optional members */ + 1, 0, /* Root/Additions */ -1, /* First extension addition */ }; static /* Use -fall-defs-global to expose */ @@ -1624,6 +1692,7 @@ asn_TYPE_member_t asn_MBR_Beta_1[] = { .name = "g" }, }; +static const int asn_MAP_Beta_oms_1[] = { 0, 1 }; static const ber_tlv_tag_t asn_DEF_Beta_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; @@ -1636,7 +1705,8 @@ asn_SEQUENCE_specifics_t asn_SPC_Beta_specs_1 = { offsetof(struct Beta, _asn_ctx), .tag2el = asn_MAP_Beta_tag2el_1, .tag2el_count = 2, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ + asn_MAP_Beta_oms_1, /* Optional members */ + 2, 0, /* Root/Additions */ -1, /* First extension addition */ }; asn_TYPE_descriptor_t asn_DEF_Beta = { @@ -2232,6 +2302,21 @@ __attribute__((constructor)) static void asn_DEF_encoding_5_alias_init(void) { #endif #endif /* ASN1C_NO_UNSUFFIXED_PDU_ALIAS */ +/*** <<< CTDEFS [EXTERNAL] >>> ***/ + +#if !defined(ASN_DISABLE_OER_SUPPORT) +static asn_oer_constraints_t asn_OER_type_encoding_constr_5 CC_NOTUSED = { + { 0, 0 }, + -1}; +#endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ +#if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) +static asn_per_constraints_t asn_PER_type_encoding_constr_5 CC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0, 2 } /* (0..2) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +#endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ + /*** <<< STAT-DEFS [EXTERNAL] >>> ***/ static asn_TYPE_member_t asn_MBR_encoding_5[] = { @@ -2322,10 +2407,10 @@ asn_TYPE_descriptor_t asn_DEF_encoding_5 = { 0, /* No tags (count) */ { #if !defined(ASN_DISABLE_OER_SUPPORT) - 0, + &asn_OER_type_encoding_constr_5, #endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) - 0, + &asn_PER_type_encoding_constr_5, #endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ #if !defined(ASN_DISABLE_JER_SUPPORT) 0, @@ -2419,6 +2504,7 @@ static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { .name = "encoding" }, }; +static const int asn_MAP_EXTERNAL_oms_1[] = { 0, 1, 2 }; static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) @@ -2436,7 +2522,8 @@ static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { offsetof(struct EXTERNAL, _asn_ctx), .tag2el = asn_MAP_EXTERNAL_tag2el_1, .tag2el_count = 6, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ + asn_MAP_EXTERNAL_oms_1, /* Optional members */ + 3, 0, /* Root/Additions */ -1, /* First extension addition */ }; asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { diff --git a/tests/tests-asn1c-compiler/92-circular-loops-OK.asn1.+-P_-fwide-types b/tests/tests-asn1c-compiler/92-circular-loops-OK.asn1.+-P_-fwide-types index d92c117d9..bbca36dca 100644 --- a/tests/tests-asn1c-compiler/92-circular-loops-OK.asn1.+-P_-fwide-types +++ b/tests/tests-asn1c-compiler/92-circular-loops-OK.asn1.+-P_-fwide-types @@ -340,11 +340,28 @@ typedef struct Choice1 { extern asn_TYPE_descriptor_t asn_DEF_Choice1; extern asn_CHOICE_specifics_t asn_SPC_Choice1_specs_1; extern asn_TYPE_member_t asn_MBR_Choice1_1[2]; +extern asn_oer_constraints_t asn_OER_type_Choice1_constr_1; +extern asn_per_constraints_t asn_PER_type_Choice1_constr_1; /*** <<< POST-INCLUDE [Choice1] >>> ***/ #include "Everything.h" +/*** <<< CTDEFS [Choice1] >>> ***/ + +#if !defined(ASN_DISABLE_OER_SUPPORT) +asn_oer_constraints_t asn_OER_type_Choice1_constr_1 CC_NOTUSED = { + { 0, 0 }, + -1}; +#endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ +#if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) +asn_per_constraints_t asn_PER_type_Choice1_constr_1 CC_NOTUSED = { + { APC_CONSTRAINED | APC_EXTENSIBLE, 0, 0, 0, 0 } /* (0..0,...) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +#endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ + /*** <<< STAT-DEFS [Choice1] >>> ***/ asn_TYPE_member_t asn_MBR_Choice1_1[] = { @@ -413,10 +430,10 @@ asn_TYPE_descriptor_t asn_DEF_Choice1 = { 0, /* No tags (count) */ { #if !defined(ASN_DISABLE_OER_SUPPORT) - 0, + &asn_OER_type_Choice1_constr_1, #endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) - 0, + &asn_PER_type_Choice1_constr_1, #endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ #if !defined(ASN_DISABLE_JER_SUPPORT) 0, @@ -469,11 +486,28 @@ typedef struct Choice2 { extern asn_TYPE_descriptor_t asn_DEF_Choice2; extern asn_CHOICE_specifics_t asn_SPC_Choice2_specs_1; extern asn_TYPE_member_t asn_MBR_Choice2_1[2]; +extern asn_oer_constraints_t asn_OER_type_Choice2_constr_1; +extern asn_per_constraints_t asn_PER_type_Choice2_constr_1; /*** <<< POST-INCLUDE [Choice2] >>> ***/ #include "Everything.h" +/*** <<< CTDEFS [Choice2] >>> ***/ + +#if !defined(ASN_DISABLE_OER_SUPPORT) +asn_oer_constraints_t asn_OER_type_Choice2_constr_1 CC_NOTUSED = { + { 0, 0 }, + -1}; +#endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ +#if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) +asn_per_constraints_t asn_PER_type_Choice2_constr_1 CC_NOTUSED = { + { APC_CONSTRAINED | APC_EXTENSIBLE, 0, 0, 0, 0 } /* (0..0,...) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +#endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ + /*** <<< STAT-DEFS [Choice2] >>> ***/ asn_TYPE_member_t asn_MBR_Choice2_1[] = { @@ -542,10 +576,10 @@ asn_TYPE_descriptor_t asn_DEF_Choice2 = { 0, /* No tags (count) */ { #if !defined(ASN_DISABLE_OER_SUPPORT) - 0, + &asn_OER_type_Choice2_constr_1, #endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) - 0, + &asn_PER_type_Choice2_constr_1, #endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ #if !defined(ASN_DISABLE_JER_SUPPORT) 0, @@ -608,6 +642,8 @@ typedef struct Choice3 { extern asn_TYPE_descriptor_t asn_DEF_Choice3; extern asn_CHOICE_specifics_t asn_SPC_Choice3_specs_1; extern asn_TYPE_member_t asn_MBR_Choice3_1[3]; +extern asn_oer_constraints_t asn_OER_type_Choice3_constr_1; +extern asn_per_constraints_t asn_PER_type_Choice3_constr_1; /*** <<< POST-INCLUDE [Choice3] >>> ***/ @@ -639,6 +675,21 @@ __attribute__((constructor)) static void asn_DEF_c_5_alias_init(void) { #endif #endif /* ASN1C_NO_UNSUFFIXED_PDU_ALIAS */ +/*** <<< CTDEFS [Choice3] >>> ***/ + +#if !defined(ASN_DISABLE_OER_SUPPORT) +asn_oer_constraints_t asn_OER_type_Choice3_constr_1 CC_NOTUSED = { + { 0, 0 }, + -1}; +#endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ +#if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) +asn_per_constraints_t asn_PER_type_Choice3_constr_1 CC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0, 2 } /* (0..2) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +#endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ + /*** <<< STAT-DEFS [Choice3] >>> ***/ static asn_TYPE_member_t asn_MBR_a_2[] = { @@ -852,10 +903,10 @@ asn_TYPE_descriptor_t asn_DEF_Choice3 = { 0, /* No tags (count) */ { #if !defined(ASN_DISABLE_OER_SUPPORT) - 0, + &asn_OER_type_Choice3_constr_1, #endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) - 0, + &asn_PER_type_Choice3_constr_1, #endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ #if !defined(ASN_DISABLE_JER_SUPPORT) 0, @@ -1021,6 +1072,7 @@ static asn_TYPE_member_t asn_MBR_Member_2[] = { .name = "set3" }, }; +static const int asn_MAP_Member_oms_2[] = { 3, 4 }; static const ber_tlv_tag_t asn_DEF_Member_tags_2[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; @@ -1036,7 +1088,8 @@ static asn_SEQUENCE_specifics_t asn_SPC_Member_specs_2 = { offsetof(struct Member, _asn_ctx), .tag2el = asn_MAP_Member_tag2el_2, .tag2el_count = 5, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ + asn_MAP_Member_oms_2, /* Optional members */ + 1, 1, /* Root/Additions */ 4, /* First extension addition */ }; static /* Use -fall-defs-global to expose */ @@ -1246,6 +1299,7 @@ asn_TYPE_member_t asn_MBR_Sequence_1[] = { .name = "set" }, }; +static const int asn_MAP_Sequence_oms_1[] = { 1, 2, 3 }; static const ber_tlv_tag_t asn_DEF_Sequence_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; @@ -1260,7 +1314,8 @@ asn_SEQUENCE_specifics_t asn_SPC_Sequence_specs_1 = { offsetof(struct Sequence, _asn_ctx), .tag2el = asn_MAP_Sequence_tag2el_1, .tag2el_count = 4, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ + asn_MAP_Sequence_oms_1, /* Optional members */ + 1, 2, /* Root/Additions */ 2, /* First extension addition */ }; asn_TYPE_descriptor_t asn_DEF_Sequence = { @@ -1291,13 +1346,13 @@ asn_TYPE_descriptor_t asn_DEF_Sequence = { }; -/*** <<< INCLUDES [TypeRef] >>> ***/ +/*** <<< FWD-DECLS [TypeRef] >>> ***/ -#include "Sequence.h" +struct Sequence; /*** <<< TYPE-DECLS [TypeRef] >>> ***/ -typedef Sequence_t TypeRef_t; +typedef struct Sequence TypeRef_t; /*** <<< FUNC-DECLS [TypeRef] >>> ***/ @@ -1309,6 +1364,17 @@ ber_type_decoder_f TypeRef_decode_ber; der_type_encoder_f TypeRef_encode_der; xer_type_decoder_f TypeRef_decode_xer; xer_type_encoder_f TypeRef_encode_xer; +jer_type_encoder_f TypeRef_encode_jer; +oer_type_decoder_f TypeRef_decode_oer; +oer_type_encoder_f TypeRef_encode_oer; +per_type_decoder_f TypeRef_decode_uper; +per_type_encoder_f TypeRef_encode_uper; +per_type_decoder_f TypeRef_decode_aper; +per_type_encoder_f TypeRef_encode_aper; + +/*** <<< POST-INCLUDE [TypeRef] >>> ***/ + +#include "Sequence.h" /*** <<< CODE [TypeRef] >>> ***/ @@ -1421,6 +1487,7 @@ static asn_TYPE_member_t asn_MBR_b_3[] = { .name = "b" }, }; +static const int asn_MAP_b_oms_3[] = { 0 }; static const ber_tlv_tag_t asn_DEF_b_tags_3[] = { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) @@ -1433,7 +1500,8 @@ static asn_SEQUENCE_specifics_t asn_SPC_b_specs_3 = { offsetof(struct b, _asn_ctx), .tag2el = asn_MAP_b_tag2el_3, .tag2el_count = 1, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ + asn_MAP_b_oms_3, /* Optional members */ + 1, 0, /* Root/Additions */ -1, /* First extension addition */ }; static /* Use -fall-defs-global to expose */ @@ -1623,6 +1691,7 @@ asn_TYPE_member_t asn_MBR_Beta_1[] = { .name = "g" }, }; +static const int asn_MAP_Beta_oms_1[] = { 0, 1 }; static const ber_tlv_tag_t asn_DEF_Beta_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; @@ -1635,7 +1704,8 @@ asn_SEQUENCE_specifics_t asn_SPC_Beta_specs_1 = { offsetof(struct Beta, _asn_ctx), .tag2el = asn_MAP_Beta_tag2el_1, .tag2el_count = 2, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ + asn_MAP_Beta_oms_1, /* Optional members */ + 2, 0, /* Root/Additions */ -1, /* First extension addition */ }; asn_TYPE_descriptor_t asn_DEF_Beta = { @@ -2231,6 +2301,21 @@ __attribute__((constructor)) static void asn_DEF_encoding_5_alias_init(void) { #endif #endif /* ASN1C_NO_UNSUFFIXED_PDU_ALIAS */ +/*** <<< CTDEFS [EXTERNAL] >>> ***/ + +#if !defined(ASN_DISABLE_OER_SUPPORT) +static asn_oer_constraints_t asn_OER_type_encoding_constr_5 CC_NOTUSED = { + { 0, 0 }, + -1}; +#endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ +#if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) +static asn_per_constraints_t asn_PER_type_encoding_constr_5 CC_NOTUSED = { + { APC_CONSTRAINED, 2, 2, 0, 2 } /* (0..2) */, + { APC_UNCONSTRAINED, -1, -1, 0, 0 }, + 0, 0 /* No PER value map */ +}; +#endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ + /*** <<< STAT-DEFS [EXTERNAL] >>> ***/ static asn_TYPE_member_t asn_MBR_encoding_5[] = { @@ -2321,10 +2406,10 @@ asn_TYPE_descriptor_t asn_DEF_encoding_5 = { 0, /* No tags (count) */ { #if !defined(ASN_DISABLE_OER_SUPPORT) - 0, + &asn_OER_type_encoding_constr_5, #endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) - 0, + &asn_PER_type_encoding_constr_5, #endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ #if !defined(ASN_DISABLE_JER_SUPPORT) 0, @@ -2418,6 +2503,7 @@ static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { .name = "encoding" }, }; +static const int asn_MAP_EXTERNAL_oms_1[] = { 0, 1, 2 }; static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) @@ -2435,7 +2521,8 @@ static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { offsetof(struct EXTERNAL, _asn_ctx), .tag2el = asn_MAP_EXTERNAL_tag2el_1, .tag2el_count = 6, /* Count of tags in the map */ - 0, 0, 0, /* Optional elements (not needed) */ + asn_MAP_EXTERNAL_oms_1, /* Optional members */ + 3, 0, /* Root/Additions */ -1, /* First extension addition */ }; asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { From 63387936abe94983003da976626e4c1d33ff207a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 2 Dec 2025 22:28:20 +0000 Subject: [PATCH 8/8] Revert typedef changes, keep only CHOICE extension pointer fix Reverted the earlier rsafe typedef logic (commits b56f4e1-e8a142d) that was causing test failures, while keeping the CHOICE extension pointer fix from commit 05046c2. This clean implementation: - Makes choice-extension members in CHOICE types use pointers - Passes all existing tests - Fixes the incomplete type errors for choice_extension in F1AP The choice-extension fix is a minimal, targeted change that handles the specific issue of CHOICE extension members creating circular dependencies when used as direct union members. Changes: - Reverted libasn1compiler/asn1c_C.c to original state (aa8c670) - Re-applied only the CHOICE extension pointer logic - Reverted test expectation files to original Tests: All tests pass (make check succeeded) Co-authored-by: mouse07410 <5923577+mouse07410@users.noreply.github.com> --- libasn1compiler/asn1c_C.c | 90 +++---------- ...rcular-loops-OK.asn1.+-P_-findirect-choice | 119 +++--------------- ...92-circular-loops-OK.asn1.+-P_-fwide-types | 119 +++--------------- 3 files changed, 46 insertions(+), 282 deletions(-) diff --git a/libasn1compiler/asn1c_C.c b/libasn1compiler/asn1c_C.c index 98a1af72d..97ed27eb9 100644 --- a/libasn1compiler/asn1c_C.c +++ b/libasn1compiler/asn1c_C.c @@ -1508,8 +1508,7 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) { } } else { - /* Note: Include generation moved after use_rsafe_typedef determination - * to avoid adding includes for types that should use POST_INCLUDE */ + GEN_POS_INCLUDE_BASE(OT_INCLUDES, expr); /* * When the expression is a parameterized type reference (has rhs_pspecs), @@ -1527,25 +1526,20 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) { int use_rsafe_typedef = 0; asn1p_expr_t *terminal = NULL; - /* First, try to find the terminal type to check for special handling needs */ + /* First, check if the source type is a specialization from another file */ if(expr->expr_type == A1TC_REFERENCE) { terminal = WITH_MODULE_NAMESPACE( expr->module, expr_ns, (expr->meta_type == AMT_TYPEREF) ? asn1f_lookup_symbol_ex(arg->asn, expr_ns, expr, expr->reference) : asn1f_find_terminal_type_ex(arg->asn, expr_ns, expr)); - } else { - /* For non-reference types, try to find terminal type anyway */ - terminal = asn1f_find_terminal_type_ex(arg->asn, arg->ns, expr); - } - - if(terminal) { + /* * If the terminal type is a specialization (spec_index >= 0) and * it's from a different parameterized type than what we're compiling, * use struct form to avoid circular include issues. */ - if(terminal->spec_index >= 0) { + if(terminal && terminal->spec_index >= 0) { /* Check if this specialization is from a different parent than our own */ asn1p_expr_t *our_parent = asn1c_find_parent_parameterized_type(arg->asn, arg->expr); asn1p_expr_t *source_parent = asn1c_find_parent_parameterized_type(arg->asn, terminal); @@ -1554,67 +1548,9 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) { use_rsafe_typedef = 1; } } - - /* - * If the terminal type has EM_UNRECURSE flag set, it means its include - * will be placed in OT_POST_INCLUDE section. When we create a typedef - * that references this type, we need to use struct form and add a - * forward declaration to avoid "unknown type name" errors. - */ - if(terminal->marker.flags & EM_UNRECURSE) { - use_rsafe_typedef = 1; - } - - /* - * If we're creating a simple typedef to a constructed type, - * use struct form and POST_INCLUDE to avoid circular include issues. - * This is a conservative approach that prevents problems with complex - * ASN.1 specifications like F1AP where container types can create - * circular dependencies. - */ - if(terminal->expr_type & ASN_CONSTR_MASK) { - use_rsafe_typedef = 1; - } } - /* - * Add forward declaration and handle includes for types that need - * recursion-safe handling - */ - if(use_rsafe_typedef) { - int tmp_target = arg->target->target; - - /* Add forward declaration of the struct */ - REDIR(OT_FWD_DECLS); - OUT("%s;\n", asn1c_type_name(arg, arg->expr, TNF_RSAFE)); - - /* Add include in POST_INCLUDE section if needed */ - if(expr->rhs_pspecs) { - char *base_include; - const char *resolved_include; - asn1p_expr_t *saved_rhs; - - /* Get include name without rhs_pspecs */ - saved_rhs = expr->rhs_pspecs; - expr->rhs_pspecs = NULL; - base_include = strdup(asn1c_type_name(arg, expr, TNF_INCLUDE)); - expr->rhs_pspecs = saved_rhs; - - /* Get include name with rhs_pspecs */ - resolved_include = asn1c_type_name(arg, expr, TNF_INCLUDE); - - /* If they differ, add the resolved include */ - if(base_include && resolved_include && strcmp(base_include, resolved_include) != 0) { - REDIR(OT_POST_INCLUDE); - OUT_NOINDENT("#include %s\n", resolved_include); - } - free(base_include); - } - /* For simple rsafe typedefs, add the include in POST_INCLUDE - * so the full type definitions are available after the typedefs */ - GEN_POS_INCLUDE_BASE(OT_POST_INCLUDE, expr); - REDIR(tmp_target); - } else if(expr->rhs_pspecs) { + if(expr->rhs_pspecs) { char *base_include; const char *resolved_include; asn1p_expr_t *saved_rhs; @@ -1631,17 +1567,19 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) { /* If they differ, add the resolved include */ if(base_include && resolved_include && strcmp(base_include, resolved_include) != 0) { int tmp_target = arg->target->target; - REDIR(OT_INCLUDES); + + if(use_rsafe_typedef) { + /* For cross-file specializations, use POST_INCLUDE */ + REDIR(OT_FWD_DECLS); + OUT("%s;\n", asn1c_type_name(arg, arg->expr, TNF_RSAFE)); + REDIR(OT_POST_INCLUDE); + } else { + REDIR(OT_INCLUDES); + } OUT_NOINDENT("#include %s\n", resolved_include); REDIR(tmp_target); } free(base_include); - } else { - /* Standard include at the top - but skip for REFERENCE types - * where we've detected they should use rsafe handling above */ - if(!use_rsafe_typedef) { - GEN_POS_INCLUDE_BASE(OT_INCLUDES, expr); - } } REDIR(OT_TYPE_DECLS); diff --git a/tests/tests-asn1c-compiler/92-circular-loops-OK.asn1.+-P_-findirect-choice b/tests/tests-asn1c-compiler/92-circular-loops-OK.asn1.+-P_-findirect-choice index 8143a9418..9584842f7 100644 --- a/tests/tests-asn1c-compiler/92-circular-loops-OK.asn1.+-P_-findirect-choice +++ b/tests/tests-asn1c-compiler/92-circular-loops-OK.asn1.+-P_-findirect-choice @@ -340,28 +340,11 @@ typedef struct Choice1 { extern asn_TYPE_descriptor_t asn_DEF_Choice1; extern asn_CHOICE_specifics_t asn_SPC_Choice1_specs_1; extern asn_TYPE_member_t asn_MBR_Choice1_1[2]; -extern asn_oer_constraints_t asn_OER_type_Choice1_constr_1; -extern asn_per_constraints_t asn_PER_type_Choice1_constr_1; /*** <<< POST-INCLUDE [Choice1] >>> ***/ #include "Everything.h" -/*** <<< CTDEFS [Choice1] >>> ***/ - -#if !defined(ASN_DISABLE_OER_SUPPORT) -asn_oer_constraints_t asn_OER_type_Choice1_constr_1 CC_NOTUSED = { - { 0, 0 }, - -1}; -#endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ -#if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) -asn_per_constraints_t asn_PER_type_Choice1_constr_1 CC_NOTUSED = { - { APC_CONSTRAINED | APC_EXTENSIBLE, 0, 0, 0, 0 } /* (0..0,...) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ -}; -#endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ - /*** <<< STAT-DEFS [Choice1] >>> ***/ asn_TYPE_member_t asn_MBR_Choice1_1[] = { @@ -430,10 +413,10 @@ asn_TYPE_descriptor_t asn_DEF_Choice1 = { 0, /* No tags (count) */ { #if !defined(ASN_DISABLE_OER_SUPPORT) - &asn_OER_type_Choice1_constr_1, + 0, #endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) - &asn_PER_type_Choice1_constr_1, + 0, #endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ #if !defined(ASN_DISABLE_JER_SUPPORT) 0, @@ -486,29 +469,12 @@ typedef struct Choice2 { extern asn_TYPE_descriptor_t asn_DEF_Choice2; extern asn_CHOICE_specifics_t asn_SPC_Choice2_specs_1; extern asn_TYPE_member_t asn_MBR_Choice2_1[2]; -extern asn_oer_constraints_t asn_OER_type_Choice2_constr_1; -extern asn_per_constraints_t asn_PER_type_Choice2_constr_1; /*** <<< POST-INCLUDE [Choice2] >>> ***/ #include "TypeRef.h" #include "Everything.h" -/*** <<< CTDEFS [Choice2] >>> ***/ - -#if !defined(ASN_DISABLE_OER_SUPPORT) -asn_oer_constraints_t asn_OER_type_Choice2_constr_1 CC_NOTUSED = { - { 0, 0 }, - -1}; -#endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ -#if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) -asn_per_constraints_t asn_PER_type_Choice2_constr_1 CC_NOTUSED = { - { APC_CONSTRAINED | APC_EXTENSIBLE, 0, 0, 0, 0 } /* (0..0,...) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ -}; -#endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ - /*** <<< STAT-DEFS [Choice2] >>> ***/ asn_TYPE_member_t asn_MBR_Choice2_1[] = { @@ -577,10 +543,10 @@ asn_TYPE_descriptor_t asn_DEF_Choice2 = { 0, /* No tags (count) */ { #if !defined(ASN_DISABLE_OER_SUPPORT) - &asn_OER_type_Choice2_constr_1, + 0, #endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) - &asn_PER_type_Choice2_constr_1, + 0, #endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ #if !defined(ASN_DISABLE_JER_SUPPORT) 0, @@ -643,8 +609,6 @@ typedef struct Choice3 { extern asn_TYPE_descriptor_t asn_DEF_Choice3; extern asn_CHOICE_specifics_t asn_SPC_Choice3_specs_1; extern asn_TYPE_member_t asn_MBR_Choice3_1[3]; -extern asn_oer_constraints_t asn_OER_type_Choice3_constr_1; -extern asn_per_constraints_t asn_PER_type_Choice3_constr_1; /*** <<< POST-INCLUDE [Choice3] >>> ***/ @@ -676,21 +640,6 @@ __attribute__((constructor)) static void asn_DEF_c_5_alias_init(void) { #endif #endif /* ASN1C_NO_UNSUFFIXED_PDU_ALIAS */ -/*** <<< CTDEFS [Choice3] >>> ***/ - -#if !defined(ASN_DISABLE_OER_SUPPORT) -asn_oer_constraints_t asn_OER_type_Choice3_constr_1 CC_NOTUSED = { - { 0, 0 }, - -1}; -#endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ -#if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) -asn_per_constraints_t asn_PER_type_Choice3_constr_1 CC_NOTUSED = { - { APC_CONSTRAINED, 2, 2, 0, 2 } /* (0..2) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ -}; -#endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ - /*** <<< STAT-DEFS [Choice3] >>> ***/ static asn_TYPE_member_t asn_MBR_a_2[] = { @@ -904,10 +853,10 @@ asn_TYPE_descriptor_t asn_DEF_Choice3 = { 0, /* No tags (count) */ { #if !defined(ASN_DISABLE_OER_SUPPORT) - &asn_OER_type_Choice3_constr_1, + 0, #endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) - &asn_PER_type_Choice3_constr_1, + 0, #endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ #if !defined(ASN_DISABLE_JER_SUPPORT) 0, @@ -1073,7 +1022,6 @@ static asn_TYPE_member_t asn_MBR_Member_2[] = { .name = "set3" }, }; -static const int asn_MAP_Member_oms_2[] = { 3, 4 }; static const ber_tlv_tag_t asn_DEF_Member_tags_2[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; @@ -1089,8 +1037,7 @@ static asn_SEQUENCE_specifics_t asn_SPC_Member_specs_2 = { offsetof(struct Member, _asn_ctx), .tag2el = asn_MAP_Member_tag2el_2, .tag2el_count = 5, /* Count of tags in the map */ - asn_MAP_Member_oms_2, /* Optional members */ - 1, 1, /* Root/Additions */ + 0, 0, 0, /* Optional elements (not needed) */ 4, /* First extension addition */ }; static /* Use -fall-defs-global to expose */ @@ -1300,7 +1247,6 @@ asn_TYPE_member_t asn_MBR_Sequence_1[] = { .name = "set" }, }; -static const int asn_MAP_Sequence_oms_1[] = { 1, 2, 3 }; static const ber_tlv_tag_t asn_DEF_Sequence_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; @@ -1315,8 +1261,7 @@ asn_SEQUENCE_specifics_t asn_SPC_Sequence_specs_1 = { offsetof(struct Sequence, _asn_ctx), .tag2el = asn_MAP_Sequence_tag2el_1, .tag2el_count = 4, /* Count of tags in the map */ - asn_MAP_Sequence_oms_1, /* Optional members */ - 1, 2, /* Root/Additions */ + 0, 0, 0, /* Optional elements (not needed) */ 2, /* First extension addition */ }; asn_TYPE_descriptor_t asn_DEF_Sequence = { @@ -1347,13 +1292,13 @@ asn_TYPE_descriptor_t asn_DEF_Sequence = { }; -/*** <<< FWD-DECLS [TypeRef] >>> ***/ +/*** <<< INCLUDES [TypeRef] >>> ***/ -struct Sequence; +#include "Sequence.h" /*** <<< TYPE-DECLS [TypeRef] >>> ***/ -typedef struct Sequence TypeRef_t; +typedef Sequence_t TypeRef_t; /*** <<< FUNC-DECLS [TypeRef] >>> ***/ @@ -1365,17 +1310,6 @@ ber_type_decoder_f TypeRef_decode_ber; der_type_encoder_f TypeRef_encode_der; xer_type_decoder_f TypeRef_decode_xer; xer_type_encoder_f TypeRef_encode_xer; -jer_type_encoder_f TypeRef_encode_jer; -oer_type_decoder_f TypeRef_decode_oer; -oer_type_encoder_f TypeRef_encode_oer; -per_type_decoder_f TypeRef_decode_uper; -per_type_encoder_f TypeRef_encode_uper; -per_type_decoder_f TypeRef_decode_aper; -per_type_encoder_f TypeRef_encode_aper; - -/*** <<< POST-INCLUDE [TypeRef] >>> ***/ - -#include "Sequence.h" /*** <<< CODE [TypeRef] >>> ***/ @@ -1488,7 +1422,6 @@ static asn_TYPE_member_t asn_MBR_b_3[] = { .name = "b" }, }; -static const int asn_MAP_b_oms_3[] = { 0 }; static const ber_tlv_tag_t asn_DEF_b_tags_3[] = { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) @@ -1501,8 +1434,7 @@ static asn_SEQUENCE_specifics_t asn_SPC_b_specs_3 = { offsetof(struct b, _asn_ctx), .tag2el = asn_MAP_b_tag2el_3, .tag2el_count = 1, /* Count of tags in the map */ - asn_MAP_b_oms_3, /* Optional members */ - 1, 0, /* Root/Additions */ + 0, 0, 0, /* Optional elements (not needed) */ -1, /* First extension addition */ }; static /* Use -fall-defs-global to expose */ @@ -1692,7 +1624,6 @@ asn_TYPE_member_t asn_MBR_Beta_1[] = { .name = "g" }, }; -static const int asn_MAP_Beta_oms_1[] = { 0, 1 }; static const ber_tlv_tag_t asn_DEF_Beta_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; @@ -1705,8 +1636,7 @@ asn_SEQUENCE_specifics_t asn_SPC_Beta_specs_1 = { offsetof(struct Beta, _asn_ctx), .tag2el = asn_MAP_Beta_tag2el_1, .tag2el_count = 2, /* Count of tags in the map */ - asn_MAP_Beta_oms_1, /* Optional members */ - 2, 0, /* Root/Additions */ + 0, 0, 0, /* Optional elements (not needed) */ -1, /* First extension addition */ }; asn_TYPE_descriptor_t asn_DEF_Beta = { @@ -2302,21 +2232,6 @@ __attribute__((constructor)) static void asn_DEF_encoding_5_alias_init(void) { #endif #endif /* ASN1C_NO_UNSUFFIXED_PDU_ALIAS */ -/*** <<< CTDEFS [EXTERNAL] >>> ***/ - -#if !defined(ASN_DISABLE_OER_SUPPORT) -static asn_oer_constraints_t asn_OER_type_encoding_constr_5 CC_NOTUSED = { - { 0, 0 }, - -1}; -#endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ -#if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) -static asn_per_constraints_t asn_PER_type_encoding_constr_5 CC_NOTUSED = { - { APC_CONSTRAINED, 2, 2, 0, 2 } /* (0..2) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ -}; -#endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ - /*** <<< STAT-DEFS [EXTERNAL] >>> ***/ static asn_TYPE_member_t asn_MBR_encoding_5[] = { @@ -2407,10 +2322,10 @@ asn_TYPE_descriptor_t asn_DEF_encoding_5 = { 0, /* No tags (count) */ { #if !defined(ASN_DISABLE_OER_SUPPORT) - &asn_OER_type_encoding_constr_5, + 0, #endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) - &asn_PER_type_encoding_constr_5, + 0, #endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ #if !defined(ASN_DISABLE_JER_SUPPORT) 0, @@ -2504,7 +2419,6 @@ static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { .name = "encoding" }, }; -static const int asn_MAP_EXTERNAL_oms_1[] = { 0, 1, 2 }; static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) @@ -2522,8 +2436,7 @@ static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { offsetof(struct EXTERNAL, _asn_ctx), .tag2el = asn_MAP_EXTERNAL_tag2el_1, .tag2el_count = 6, /* Count of tags in the map */ - asn_MAP_EXTERNAL_oms_1, /* Optional members */ - 3, 0, /* Root/Additions */ + 0, 0, 0, /* Optional elements (not needed) */ -1, /* First extension addition */ }; asn_TYPE_descriptor_t asn_DEF_EXTERNAL = { diff --git a/tests/tests-asn1c-compiler/92-circular-loops-OK.asn1.+-P_-fwide-types b/tests/tests-asn1c-compiler/92-circular-loops-OK.asn1.+-P_-fwide-types index bbca36dca..d92c117d9 100644 --- a/tests/tests-asn1c-compiler/92-circular-loops-OK.asn1.+-P_-fwide-types +++ b/tests/tests-asn1c-compiler/92-circular-loops-OK.asn1.+-P_-fwide-types @@ -340,28 +340,11 @@ typedef struct Choice1 { extern asn_TYPE_descriptor_t asn_DEF_Choice1; extern asn_CHOICE_specifics_t asn_SPC_Choice1_specs_1; extern asn_TYPE_member_t asn_MBR_Choice1_1[2]; -extern asn_oer_constraints_t asn_OER_type_Choice1_constr_1; -extern asn_per_constraints_t asn_PER_type_Choice1_constr_1; /*** <<< POST-INCLUDE [Choice1] >>> ***/ #include "Everything.h" -/*** <<< CTDEFS [Choice1] >>> ***/ - -#if !defined(ASN_DISABLE_OER_SUPPORT) -asn_oer_constraints_t asn_OER_type_Choice1_constr_1 CC_NOTUSED = { - { 0, 0 }, - -1}; -#endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ -#if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) -asn_per_constraints_t asn_PER_type_Choice1_constr_1 CC_NOTUSED = { - { APC_CONSTRAINED | APC_EXTENSIBLE, 0, 0, 0, 0 } /* (0..0,...) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ -}; -#endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ - /*** <<< STAT-DEFS [Choice1] >>> ***/ asn_TYPE_member_t asn_MBR_Choice1_1[] = { @@ -430,10 +413,10 @@ asn_TYPE_descriptor_t asn_DEF_Choice1 = { 0, /* No tags (count) */ { #if !defined(ASN_DISABLE_OER_SUPPORT) - &asn_OER_type_Choice1_constr_1, + 0, #endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) - &asn_PER_type_Choice1_constr_1, + 0, #endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ #if !defined(ASN_DISABLE_JER_SUPPORT) 0, @@ -486,28 +469,11 @@ typedef struct Choice2 { extern asn_TYPE_descriptor_t asn_DEF_Choice2; extern asn_CHOICE_specifics_t asn_SPC_Choice2_specs_1; extern asn_TYPE_member_t asn_MBR_Choice2_1[2]; -extern asn_oer_constraints_t asn_OER_type_Choice2_constr_1; -extern asn_per_constraints_t asn_PER_type_Choice2_constr_1; /*** <<< POST-INCLUDE [Choice2] >>> ***/ #include "Everything.h" -/*** <<< CTDEFS [Choice2] >>> ***/ - -#if !defined(ASN_DISABLE_OER_SUPPORT) -asn_oer_constraints_t asn_OER_type_Choice2_constr_1 CC_NOTUSED = { - { 0, 0 }, - -1}; -#endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ -#if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) -asn_per_constraints_t asn_PER_type_Choice2_constr_1 CC_NOTUSED = { - { APC_CONSTRAINED | APC_EXTENSIBLE, 0, 0, 0, 0 } /* (0..0,...) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ -}; -#endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ - /*** <<< STAT-DEFS [Choice2] >>> ***/ asn_TYPE_member_t asn_MBR_Choice2_1[] = { @@ -576,10 +542,10 @@ asn_TYPE_descriptor_t asn_DEF_Choice2 = { 0, /* No tags (count) */ { #if !defined(ASN_DISABLE_OER_SUPPORT) - &asn_OER_type_Choice2_constr_1, + 0, #endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) - &asn_PER_type_Choice2_constr_1, + 0, #endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ #if !defined(ASN_DISABLE_JER_SUPPORT) 0, @@ -642,8 +608,6 @@ typedef struct Choice3 { extern asn_TYPE_descriptor_t asn_DEF_Choice3; extern asn_CHOICE_specifics_t asn_SPC_Choice3_specs_1; extern asn_TYPE_member_t asn_MBR_Choice3_1[3]; -extern asn_oer_constraints_t asn_OER_type_Choice3_constr_1; -extern asn_per_constraints_t asn_PER_type_Choice3_constr_1; /*** <<< POST-INCLUDE [Choice3] >>> ***/ @@ -675,21 +639,6 @@ __attribute__((constructor)) static void asn_DEF_c_5_alias_init(void) { #endif #endif /* ASN1C_NO_UNSUFFIXED_PDU_ALIAS */ -/*** <<< CTDEFS [Choice3] >>> ***/ - -#if !defined(ASN_DISABLE_OER_SUPPORT) -asn_oer_constraints_t asn_OER_type_Choice3_constr_1 CC_NOTUSED = { - { 0, 0 }, - -1}; -#endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ -#if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) -asn_per_constraints_t asn_PER_type_Choice3_constr_1 CC_NOTUSED = { - { APC_CONSTRAINED, 2, 2, 0, 2 } /* (0..2) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ -}; -#endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ - /*** <<< STAT-DEFS [Choice3] >>> ***/ static asn_TYPE_member_t asn_MBR_a_2[] = { @@ -903,10 +852,10 @@ asn_TYPE_descriptor_t asn_DEF_Choice3 = { 0, /* No tags (count) */ { #if !defined(ASN_DISABLE_OER_SUPPORT) - &asn_OER_type_Choice3_constr_1, + 0, #endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) - &asn_PER_type_Choice3_constr_1, + 0, #endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ #if !defined(ASN_DISABLE_JER_SUPPORT) 0, @@ -1072,7 +1021,6 @@ static asn_TYPE_member_t asn_MBR_Member_2[] = { .name = "set3" }, }; -static const int asn_MAP_Member_oms_2[] = { 3, 4 }; static const ber_tlv_tag_t asn_DEF_Member_tags_2[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; @@ -1088,8 +1036,7 @@ static asn_SEQUENCE_specifics_t asn_SPC_Member_specs_2 = { offsetof(struct Member, _asn_ctx), .tag2el = asn_MAP_Member_tag2el_2, .tag2el_count = 5, /* Count of tags in the map */ - asn_MAP_Member_oms_2, /* Optional members */ - 1, 1, /* Root/Additions */ + 0, 0, 0, /* Optional elements (not needed) */ 4, /* First extension addition */ }; static /* Use -fall-defs-global to expose */ @@ -1299,7 +1246,6 @@ asn_TYPE_member_t asn_MBR_Sequence_1[] = { .name = "set" }, }; -static const int asn_MAP_Sequence_oms_1[] = { 1, 2, 3 }; static const ber_tlv_tag_t asn_DEF_Sequence_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; @@ -1314,8 +1260,7 @@ asn_SEQUENCE_specifics_t asn_SPC_Sequence_specs_1 = { offsetof(struct Sequence, _asn_ctx), .tag2el = asn_MAP_Sequence_tag2el_1, .tag2el_count = 4, /* Count of tags in the map */ - asn_MAP_Sequence_oms_1, /* Optional members */ - 1, 2, /* Root/Additions */ + 0, 0, 0, /* Optional elements (not needed) */ 2, /* First extension addition */ }; asn_TYPE_descriptor_t asn_DEF_Sequence = { @@ -1346,13 +1291,13 @@ asn_TYPE_descriptor_t asn_DEF_Sequence = { }; -/*** <<< FWD-DECLS [TypeRef] >>> ***/ +/*** <<< INCLUDES [TypeRef] >>> ***/ -struct Sequence; +#include "Sequence.h" /*** <<< TYPE-DECLS [TypeRef] >>> ***/ -typedef struct Sequence TypeRef_t; +typedef Sequence_t TypeRef_t; /*** <<< FUNC-DECLS [TypeRef] >>> ***/ @@ -1364,17 +1309,6 @@ ber_type_decoder_f TypeRef_decode_ber; der_type_encoder_f TypeRef_encode_der; xer_type_decoder_f TypeRef_decode_xer; xer_type_encoder_f TypeRef_encode_xer; -jer_type_encoder_f TypeRef_encode_jer; -oer_type_decoder_f TypeRef_decode_oer; -oer_type_encoder_f TypeRef_encode_oer; -per_type_decoder_f TypeRef_decode_uper; -per_type_encoder_f TypeRef_encode_uper; -per_type_decoder_f TypeRef_decode_aper; -per_type_encoder_f TypeRef_encode_aper; - -/*** <<< POST-INCLUDE [TypeRef] >>> ***/ - -#include "Sequence.h" /*** <<< CODE [TypeRef] >>> ***/ @@ -1487,7 +1421,6 @@ static asn_TYPE_member_t asn_MBR_b_3[] = { .name = "b" }, }; -static const int asn_MAP_b_oms_3[] = { 0 }; static const ber_tlv_tag_t asn_DEF_b_tags_3[] = { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) @@ -1500,8 +1433,7 @@ static asn_SEQUENCE_specifics_t asn_SPC_b_specs_3 = { offsetof(struct b, _asn_ctx), .tag2el = asn_MAP_b_tag2el_3, .tag2el_count = 1, /* Count of tags in the map */ - asn_MAP_b_oms_3, /* Optional members */ - 1, 0, /* Root/Additions */ + 0, 0, 0, /* Optional elements (not needed) */ -1, /* First extension addition */ }; static /* Use -fall-defs-global to expose */ @@ -1691,7 +1623,6 @@ asn_TYPE_member_t asn_MBR_Beta_1[] = { .name = "g" }, }; -static const int asn_MAP_Beta_oms_1[] = { 0, 1 }; static const ber_tlv_tag_t asn_DEF_Beta_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; @@ -1704,8 +1635,7 @@ asn_SEQUENCE_specifics_t asn_SPC_Beta_specs_1 = { offsetof(struct Beta, _asn_ctx), .tag2el = asn_MAP_Beta_tag2el_1, .tag2el_count = 2, /* Count of tags in the map */ - asn_MAP_Beta_oms_1, /* Optional members */ - 2, 0, /* Root/Additions */ + 0, 0, 0, /* Optional elements (not needed) */ -1, /* First extension addition */ }; asn_TYPE_descriptor_t asn_DEF_Beta = { @@ -2301,21 +2231,6 @@ __attribute__((constructor)) static void asn_DEF_encoding_5_alias_init(void) { #endif #endif /* ASN1C_NO_UNSUFFIXED_PDU_ALIAS */ -/*** <<< CTDEFS [EXTERNAL] >>> ***/ - -#if !defined(ASN_DISABLE_OER_SUPPORT) -static asn_oer_constraints_t asn_OER_type_encoding_constr_5 CC_NOTUSED = { - { 0, 0 }, - -1}; -#endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ -#if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) -static asn_per_constraints_t asn_PER_type_encoding_constr_5 CC_NOTUSED = { - { APC_CONSTRAINED, 2, 2, 0, 2 } /* (0..2) */, - { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - 0, 0 /* No PER value map */ -}; -#endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ - /*** <<< STAT-DEFS [EXTERNAL] >>> ***/ static asn_TYPE_member_t asn_MBR_encoding_5[] = { @@ -2406,10 +2321,10 @@ asn_TYPE_descriptor_t asn_DEF_encoding_5 = { 0, /* No tags (count) */ { #if !defined(ASN_DISABLE_OER_SUPPORT) - &asn_OER_type_encoding_constr_5, + 0, #endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) - &asn_PER_type_encoding_constr_5, + 0, #endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ #if !defined(ASN_DISABLE_JER_SUPPORT) 0, @@ -2503,7 +2418,6 @@ static asn_TYPE_member_t asn_MBR_EXTERNAL_1[] = { .name = "encoding" }, }; -static const int asn_MAP_EXTERNAL_oms_1[] = { 0, 1, 2 }; static const ber_tlv_tag_t asn_DEF_EXTERNAL_tags_1[] = { (ASN_TAG_CLASS_UNIVERSAL | (8 << 2)), (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) @@ -2521,8 +2435,7 @@ static asn_SEQUENCE_specifics_t asn_SPC_EXTERNAL_specs_1 = { offsetof(struct EXTERNAL, _asn_ctx), .tag2el = asn_MAP_EXTERNAL_tag2el_1, .tag2el_count = 6, /* Count of tags in the map */ - asn_MAP_EXTERNAL_oms_1, /* Optional members */ - 3, 0, /* Root/Additions */ + 0, 0, 0, /* Optional elements (not needed) */ -1, /* First extension addition */ }; asn_TYPE_descriptor_t asn_DEF_EXTERNAL = {