Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8310646

Javadoc around prototype-less functions might be incorrect

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 22
    • 21, 22
    • core-libs
    • None

    Description

      Currently, the javadoc in Linker describes prototype-less functions as variadic functions [1].

      However, this is inconsistent with other C documentation [2], which says that "Only prototyped function declarations may be variadic." [2]

      Also, on closer inspection of the ABI, it seems that prototype-less functions don't follow the variadic ABI [3] (at least on certain platforms)

      It seems that we should update the text regarding prototype-less functions. Removing their mention from the variadic function section

      [1]: https://github.com/openjdk/jdk/blob/370b8b2644e8951ba177c39199036c79ecf49401/src/java.base/share/classes/java/lang/foreign/Linker.java#L396
      [2]: https://en.cppreference.com/w/c/language/variadic
      [3]: https://godbolt.org/#g:!((g:!((g:!((h:codeEditor,i:(filename:'1',fontScale:14,fontUsePx:'0',j:1,lang:___c,selection:(endColumn:1,endLineNumber:11,positionColumn:1,positionLineNumber:11,selectionStartColumn:1,selectionStartLineNumber:11,startColumn:1,startLineNumber:11),source:'void+func1()%3B%0Avoid+func2(int+x,+...)%3B%0A%0Avoid+call1()+%7B%0A++++func1(1,+42)%3B%0A%7D%0A%0Avoid+call2()+%7B%0A++++func2(1,+42)%3B%0A%7D%0A'),l:'5',n:'0',o:'C+source+%231',t:'0')),k:38.1366179239669,l:'4',n:'0',o:'',s:0,t:'0'),(g:!((h:compiler,i:(compiler:armv8-cclang1600,deviceViewOpen:'1',filters:(b:'0',binary:'1',binaryObject:'1',commentOnly:'0',debugCalls:'1',demangle:'0',directives:'0',execute:'0',intel:'0',libraryCode:'0',trim:'1'),flagsViewOpen:'1',fontScale:14,fontUsePx:'0',j:1,lang:___c,libs:!(),options:'-target+arm64-apple-darwin',overrides:!(),selection:(endColumn:1,endLineNumber:1,positionColumn:1,positionLineNumber:1,selectionStartColumn:1,selectionStartLineNumber:1,startColumn:1,startLineNumber:1),source:1),l:'5',n:'0',o:'+armv8-a+clang+16.0.0+(Editor+%231)',t:'0')),k:61.863382076033105,l:'4',m:100,n:'0',o:'',s:0,t:'0')),l:'2',n:'0',o:'',t:'0')),version:4

      Attachments

        Issue Links

          Activity

            People

              jvernee Jorn Vernee
              jvernee Jorn Vernee
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: