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

    <tr>
        <th>Summary</th>
        <td>
            -Wunguarded-availability can't cope with early returns
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          DanAlbert
      </td>
    </tr>
</table>

<pre>
    https://godbolt.org/z/s1YGsPW4s

```c++
#include <stdlib.h>

extern "C" void foo() __attribute__((availability(android, introduced=30)));

int main() {
    // This weird pattern is required:
    // https://github.com/llvm/llvm-project/issues/33161
    if (__builtin_available(android 30, *)) {
    } else {
        return 1;
    }

    foo();
}
```

When compiled with `-Werror=unguarded-availability -target aarch64-linux-android21 foo.cpp`:

```
<source>:13:5: error: 'foo' is only available on Android 30 or newer [-Werror,-Wunguarded-availability]
   13 | foo();
      |     ^~~
<source>:3:17: note: 'foo' has been marked as being introduced in Android 30 here, but the deployment target is Android 21
    3 | extern "C" void foo() __attribute__((availability(android, introduced=30)));
      |                 ^
<source>:13:5: note: enclose 'foo' in a __builtin_available check to silence this warning
   13 |     foo();
      |     ^~~   
1 error generated.
Compiler returned: 1
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8Vctu6zYQ_ZrxZmBDGlpWvNBCseNuuygQdGVQ4sRiL026JJXcdHG_vaAkP-K6KLq5AiGCw9c5Zx6UIeiDZa6geIZiO5N97JyvttLWpmEfZ41Tn1UX4ymAqIF2QLuDU40zceH8AWj3F9Au5L__En59XQbItpDV03-Vja0Fek5ttJLQtjW9YgSxCVEZ3Sw6EC-3W_l7ZG8RiDZAhO9OK3xzDugJaI37vYzR66aPvN8Ptif5LrWRjTY6fqahVd5pBbRBbaN3qm9ZgdiKDGg9NfF8e6O2EY9S2-kKKKdZRMSRNf7W6YAfrL3Ck4wDQB3Q85-99un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