• Bi-Ruei, Chiu's avatar
    Fix the problem that duplicate type names exist in OPEN TYPE · 86b05417
    Bi-Ruei, Chiu authored
    This is a side-effect of commit :
    
      939573d7 and
      dcc822a0
    
    Which intends to solve the problem result from, e.g. for the following ASN.1 :
    
      HandoverRequestAcknowledge-IEs X2AP-PROTOCOL-IES ::= {
        { ID id-Old-eNB-UE-X2AP-ID  CRITICALITY ignore  TYPE UE-X2AP-ID  PRESENCE mandatory}|
        { ID id-New-eNB-UE-X2AP-ID  CRITICALITY ignore  TYPE UE-X2AP-ID  PRESENCE mandatory}|
        ...
      }
    
    Items with id-Old-eNB-UE-X2AP-ID and id-New-eNB-UE-X2AP-ID are both of
    type UE-X2AP-ID, so the generated enum type HandoverRequestAcknowledge_IEs__value_PR
    will have two identical members :
    
      typedef enum HandoverRequestAcknowledge_IEs__value_PR {
          HandoverRequestAcknowledge_IEs__value_PR_NOTHING,    /* No components present */
          HandoverRequestAcknowledge_IEs__value_PR_UE_X2AP_ID,
          HandoverRequestAcknowledge_IEs__value_PR_UE_X2AP_ID,
          ...
      } HandoverRequestAcknowledge_IEs__value_PR
    
    and the generated struc type HandoverRequestAcknowledge_IEs_t
    will also have two identical members :
    
      typedef struct HandoverRequestAcknowledge_IEs {
          ProtocolIE_ID_t  id;
          Criticality_t    criticality;
          struct HandoverRequestAcknowledge_IEs__value {
              HandoverRequestAcknowledge_IEs__value_PR present;
              union XHandoverRequestAcknowledge_IEs__value_u {
                  UE_X2AP_ID_t  UE_X2AP_ID;
                  UE_X2AP_ID_t  UE_X2AP_ID;
                  ...
              } choice;
    
              /* Context for parsing across buffer boundaries */
              asn_struct_ctx_t _asn_ctx;
          } value;
    
          /* Context for parsing across buffer boundaries */
          asn_struct_ctx_t _asn_ctx;
      } HandoverRequestAcknowledge_IEs_t;
    
    these code excerpts results in compilation error.
    
    Previous commits solve it by skipping duplicate items but raise
    a side-effect that asn_MBR_HandoverRequestAcknowledge_IEs only has
    one item corresponding UE_X2AP_ID field.
    
    This commit rename the second item by adding '_2' (or said '_%d'
    according to number of occurrence) to their names thus solve the
    conflict.
    86b05417
asn1p_expr.c 11.3 KB