Uploaded image for project: 'mdsal'
  1. mdsal
  2. MDSAL-361

Deal with restricted types in unions

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Medium Medium
    • 14.0.0
    • None
    • Binding codegen
    • None

      A typical example of a union which we do not handle correctly is:

          typedef pce-id {
              type union {
                  type binary {
                      length 4;
                  }
                  type binary {
                      length 16;
                  }
              }
          }
      

      These types are restricted and guaranteed not to overlap, but our current codegen rules silently squash them to a single field (first one wins, I think).

      There are multiple approaches we could take, like squashing the definitions, but that would only serve to confuse users – in this particular case they would be better served by generating encapsulated types for member – i.e. similar to what we do for enumerations.

      We need to figure out the naming here – as we cannot just take the 'binary' string – that would result in conflicting names. That naming clash needs to be figured out also for something like:

          typedef pce-id {
              type union {
                  type enumeration {
                      enum a;
                  }
                  type enumeration {
                      enum b;
                  }
              }
          }

       

            Unassigned Unassigned
            rovarga Robert Varga
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: