<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/88433>88433</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[libc] Add proxy header `hdr/float-macros.h`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
libc
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
lntue
</td>
</tr>
</table>
<pre>
Context: https://github.com/llvm/llvm-project/pull/87017
Similar PR: https://github.com/llvm/llvm-project/pull/87598, https://github.com/llvm/llvm-project/issues/87863.
Add a proxy header for float.h types so that our implementations and tests will work nicely for both overlay and full build modes.
- [ ] Add `libc/hdr/float_macros.h` that will include the system <float.h> in overlay mode or include `libc/include/llvm-libc-macros/float-macros.h` in full build mode.
- [ ] Add its corresponding cmake targets in `libc/hdr/CMakeLists.txt`.
- [ ] Remove the `#include_next <float.h>` in `libc/include/llvm-libc-macros/float-macros.h` and all the diagnostic suppression around it.
- [ ] Move the *filling-in* parts such as
```
#ifndef FLT_RADIX
#define FLT_RADIX __FLT_RADIX__
#endif // FLT_RADIX
```
to the proxy header `libc/hdr/float_macros.h` in the overlay mode, after including the system `<float.h>`.
- [ ] Change macro definitions in the full build header `libc/include/llvm-libc-macros/float-macros.h` to something like:
```
#ifdef __FLT_RADIX__
#define FLT_RADIX __FLT_RADIX__
#else
#define FLT_RADIX 2
#endif // FLT_RADIX
```
- [ ] Add their corresponding bazel targets in utils/bazel/llvm-project-overlay/libc/BUILD.bazel.
- [ ] Update bazel dependencies.
- [ ] Test in overlay mode:
```
from "llvm-project/build":
$ cmake ../llvm -GNinja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS=libc
$ ninja libc
$ ninja check-libc
```
- [ ] Test in full build mode:
```
from "llvm-project/build":
$ cmake ../llvm -GNinja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="llvm;clang;compiler-rt;libc" -DLLVM_LIBC_INCLUDE_SCUDO=ON -DLLVM_LIBC_FULL_BUILD=ON
$ ninja libc
$ ninja check-libc
```
- [ ] Test bazel build:
```
from "llvm-project/utils/bazel/"
$ bazel clean
$ bazel build --config=generic_clang --features=layering_check @llvm-project//libc/...
$ bazel test --config=generic_clang --features=layering_check @llvm-project//libc/...
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcVk1v4zYQ_TX0ZSBBpmTHOfhgW3aR1vlANim2J4GWRhI3FCmQ1G7cX1-Ikh1b3qDNbnspEMQ2h5x5b97MkMwYXkjEOZksySQescaWSs-FtA2Odirbz1dKWny1JFxAaW1tSLggdEPopuC2bHZ-qipCN0J8PXx4tVZfMLWEbupGCEI3s6tgfAUkiEmw6P5_4hUXTMPD48_5nVzPCF193AE3pkHjXMymoX8KbZFlwKDW6nUPJbIMNeRKQy4Us34Jdl-jAaPAlsyCajTwqhZYobTMciUNMJmBRWMNfONCwDelX0DyFMXeOdopW4L6ilqwvdubN0LAruEig0plaM7QeEAmSyCTGFpcZBoIvksJ3ZSZJnTjQCUVS7UyfkmmQYfKxeUyFU2GYEsEszcWKyDhqqdBwjVweYTRxgWlj2fe4vQrhwy2q14X7xDeOw3P5ZCO_z0e3BpIldZoaiUzLgtIK_aCYJku0JrWzZDq6pa94JYba3z7ask0uHD8iJX62vEl04DQsMeeSHy159x7qD9Ms5WNCeFiZZwVUhnLUzBNXWs0hisJTKtGtkwvcN4eUdJFzoXgsvC4JHQBNdPWgGnSEpjpq2Aa9H_dTxryXGaYw2b7lDwu4pvPR0OGOZf4ZoAkOX5PkuM2lBnPoeuUCy_n0axyOM964e9LkEt36rS22h5lucVDhbWKn9blNBjKc5G1VclkgeACgaPKu3brw52U3QXSD6prFRhVoS1bmIK_YDtZ3lWjFeP7mf6nggiD75-hPyLcebfZErke9NuO_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