Uploaded image for project: 'Code Tools'
  1. Code Tools
  2. CODETOOLS-7903642

Code generation for variadic function emits redundant casts

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • None
    • None
    • tools
    • None

      Consider this C function:

      ```
      int foo(int n, ...);
      ```

      This generates the following:

      ```
      public static foo$invoker foo$makeInvoker(MemoryLayout... layouts) { ... }

      ...

          public static int foo(int n, Object... x1) {
              MemoryLayout[] inferredLayouts$ = foo_h.inferVariadicLayouts(x1);
              return (int) foo$makeInvoker(inferredLayouts$).foo(n, x1);
          }
      ```

      The second static method contains a redundant cast for the return value of foo$makeInvoker.

      Also, the use of a dollar in the foo$invoker name is probably no longer consistent with the other generated names.

            mcimadamore Maurizio Cimadamore
            mcimadamore Maurizio Cimadamore
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: