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

    <tr>
        <th>Summary</th>
        <td>
            Clang generates superfluous landing pad
        </td>
    </tr>

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

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

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

<pre>
    Clang treats `::close()` syscall as potentially throwing and injects a superfuous landing pad unnecessarily bloating the output. Here's an example that demonstrates this behavior and a comparison against gcc's output:

https://godbolt.org/z/ExG4MzY8q

Additional info I gathered:

The syscall in unistd.h from my ubuntu box is declared as such:

```

#ifdef  __cplusplus
# define __BEGIN_DECLS  extern "C" {
# define __END_DECLS    }
#else
# define __BEGIN_DECLS
# define __END_DECLS
#endif

__BEGIN_DECLS

...

/* Close the file descriptor FD.

   This function is a cancellation point and therefore not marked with
   __THROW.  */
extern int close (int __fd);

...

__END_DECLS
```



The lack of `__THROW` (defined as `noexcept(true)`) is used to communicate that the thread can be cancelled. 

I believe the main descripency between clang and gcc here is that gcc treats the function declarations wrapped in `extern "C" {} ` as noexcept(true) by default(rightfully so) and clang does not.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8VN9v4zYM_muUF-KMRM4vP_ihbZq7AtsN2AoMewpoiba1kyVPotrm_vpBdtrr9YoCiYKQ1CfyI_lhjKZzRLXYXIvNYYGJex_qHi2erVk0Xp_rG4uuAw6EHEFsl6K8EuWVsj6SkHshK7FdQjxHhdYCRhg9k2OD1p6B--AfjesAnQbj_iXFERBiGim0yacIFp3OASNqSM6RohgxGHuGxnrk7OKewCceExfwhQIJuYuADugJh9EScI8MmgbvIgdkisC9idBQjw_Gh-ltBOWHEYOJ3gF2aFxk6JSasGbwXNfyIJaXs2ceY7bJo5DHzuvGWy586IQ8fhfyePv0ef3793_2_72-dKW1YeMdWj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