<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/56519>56519</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            OpenJDK unbuildable after JDK-8214976 due to function attribute merging
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          Sterling-Augustine
      </td>
    </tr>
</table>

<pre>
    As in the title, openjdk is unbuildable with both released and top of trunk clang due to the following failure:

```
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");
^                                                                                                                                                                            
dkGitHead/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__));
```

This code builds fine with GCC.

I have tracked this down to https://reviews.llvm.org/D106030, and it appears from the comments that this behavior is intentional. New warnings and error attributes on the second declaration cause first declaration errors.

Is this a usecase the project intends to support? It seems unfortunate to disable this check under clang but have it available in gcc. It greatly limits the usefulness of the attribute, and also complicates the jdk source code to conditionally handle the two different compilers.

@AaronBallman @nickdesaulniers 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzVVdtu4zYQ_Rr5hYghS5YvD3pw7Ho3LZAA2xT7KFDUyOKaIgVe7N2_7wwlJzFaFOj2qQZFS7wMZ86ZOaxN86PcOSY18x0wL72CJNszM4D-1pyZdCzoOkjV8FoBu0rfsdpgZ0EBd9AwrhvmzcBMy7wN-syE4vrEmoDWTDTaGqXMVeJgy6UKFpJ8l6SHJL31q3Rq8ROP_ST9Z-BNkh2dFdh3xrvBePruOO7PjsFLJb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