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

Build failure with Clang 14+ due to function warning attribute

XMLWordPrintable

    • b08

        After JDK-8214976, OpenJDK cannot build with Clang 14 or newer. This is because Clang 14+ currently does not support merging warning attributes of functions. Build failure looks like:
        ```
        jdkGitHead/src/hotspot/share/utilities/globalDefinitions.hpp:165:1: error: 'warning' attribute does not appear on the first declaration
        FORBID_C_FUNCTION(void exit(int), "use os::exit");
        ^
        jdkGitHead/src/hotspot/share/utilities/compilerWarnings_gcc.hpp:85:29: note: expanded from macro 'FORBID_C_FUNCTION'
          extern "C" __attribute__((__warning__(alternative))) signature;
                                    ^
        /usr/include/stdlib.h:617:13: note: previous declaration is here
        extern void exit (int __status) __THROW __attribute__ ((__noreturn__));
        ```

        https://github.com/llvm/llvm-project/issues/56519 has been opened and will be fixed in a future Clang release. I propose we temporarily disable the warning attribute when building with Clang, until the LLVM issue #56519 is fixed and released.

              manc Man Cao
              manc Man Cao
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: