<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/81143>81143</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Formatting job can fail checking clang source files that are not related to the PR
</td>
</tr>
<tr>
<th>Labels</th>
<td>
github:workflow
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
DavidSpickett
</td>
</tr>
</table>
<pre>
In this example reported on discord - https://buildkite.com/llvm-project/clang-ci/builds/11664#018d84f5-ce97-4b39-b7ab-4cb730aa37e6, the job complains about `clang/docs/OffloadingDesign.rst` which is nothing to do with their patch (https://github.com/llvm/llvm-project/pull/80864/files).
```
$ trap 'kill -- $$' INT TERM QUIT; clang/utils/ci/run-buildbot check-format
+ set -o pipefail
+ unset LANG
+ unset LC_ALL
+ unset LC_COLLATE
++ basename clang/utils/ci/run-buildbot
+ PROGNAME=run-buildbot
+ [[ 1 == 0 ]]
+ [[ 1 -gt 0 ]]
+ case ${1} in
+ BUILDER=check-format
+ shift
+ [[ 0 -gt 0 ]]
++ git rev-parse --show-toplevel
+ MONOREPO_ROOT=/var/lib/buildkite-agent/builds/linux-56-59b8f5d88-m6l8c-1/llvm-project/clang-ci
+ BUILD_DIR=/var/lib/buildkite-agent/builds/linux-56-59b8f5d88-m6l8c-1/llvm-project/clang-ci/build/check-format
+ INSTALL_DIR=/var/lib/buildkite-agent/builds/linux-56-59b8f5d88-m6l8c-1/llvm-project/clang-ci/build/check-format/install
+ cmake --version
cmake version 3.23.3
CMake suite maintained and supported by Kitware (kitware.com/cmake).
+ ninja --version
1.10.1
+ case "${BUILDER}" in
+ echo '*** Checking for trailing whitespace left in Clang source files ***'
*** Checking for trailing whitespace left in Clang source files ***
+ grep -rnI '[[:blank:]]$' clang/lib clang/include clang/docs
clang/docs/OffloadingDesign.rst:477:The offloading compilation pipeline normally will defer the final device linking
clang/docs/OffloadingDesign.rst:478:and runtime registration until the ``clang-linker-wrapper`` is run to create the
clang/docs/OffloadingDesign.rst:479:executable. This is the standard behaviour when compiling for OpenMP offloading
clang/docs/OffloadingDesign.rst:480:or CUDA and HIP in ``-fgpu-rdc`` mode. However, there are some cases where the
clang/docs/OffloadingDesign.rst:481:user may wish to perform this device handling prematurely. This is described in
clang/docs/OffloadingDesign.rst:484:Effectively, this allows the user to handle offloading specific linking ahead of
clang/docs/OffloadingDesign.rst:485:time when shipping objects or static libraries. This can be thought of as
clang/docs/OffloadingDesign.rst:486:performing a standard ``-fno-gpu-rdc`` compilation on a subset of object files.
clang/docs/OffloadingDesign.rst:487:This can be useful to reduce link time, prevent users from interacting with the
clang/docs/OffloadingDesign.rst:490:Normally, if a relocatable link is done using ``clang -r`` it will simply merge
clang/docs/OffloadingDesign.rst:491:the ``.llvm.offloading`` sections which will then be linked later when the
clang/docs/OffloadingDesign.rst:492:executable is created. However, if the ``-r`` flag is used with the offloading
clang/docs/OffloadingDesign.rst:493:toolchain, it will perform the device linking and registration phases and then
clang/docs/OffloadingDesign.rst:496:The following example shows how using the relocatable link with the offloading
clang/docs/OffloadingDesign.rst:497:pipeline can create a static library with offloading code that can be
clang/docs/ClangLinkerWrapper.rst:67:The ``clang-linker-wrapper`` handles linking embedded device code and then
clang/docs/ClangLinkerWrapper.rst:68:registering it with the appropriate runtime. Normally, this is only done when
clang/docs/ClangLinkerWrapper.rst:69:the executable is created so other files containing device code can be linked
clang/docs/ClangLinkerWrapper.rst:70:together. This can be somewhat problematic for users who wish to ship static
clang/docs/ClangLinkerWrapper.rst:71:libraries that contain offloading code to users without a compatible offloading
clang/docs/ClangLinkerWrapper.rst:74:When using a relocatable link with ``-r``, the ``clang-linker-wrapper`` will
clang/docs/ClangLinkerWrapper.rst:75:perform the device linking and registration eagerly. This will remove the
clang/docs/ClangLinkerWrapper.rst:76:embedded device code and register it correctly with the runtime. Semantically,
clang/docs/ClangLinkerWrapper.rst:77:this is similar to creating a shared library object. If standard relocatable
clang/docs/ClangLinkerWrapper.rst:78:linking is desired, simply do not run the binaries through the
clang/docs/ClangLinkerWrapper.rst:79:``clang-linker-wrapper``. This will simply append the embedded device code so
+ echo '*** Trailing whitespace has been found in Clang source files as described above ***'
*** Trailing whitespace has been found in Clang source files as described above ***
+ exit 1
🚨 Error: The command exited with status 1
user command error: exit status 1
```
This job should be a warning at most, or limited to the files within the PR it's testing.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEWFtv2zoS_jXMy0CGLPkiP-RBieNzgk2TbJriPBaUNLLYUKRAUnbz7xdDyrcmaeuze7CAEMSixLl9830jcmvFWiFesukVmy4veO8abS6XfCOqz50oX9C5i0JXr5e3ClwjLOB33nYSwWCnjcMKtIJK2FKbCiJonOssS3OWrFiyKnohqxfhcFTqliUrKTdt1Bn9DUvHklUpuVpHpdg9aVmyGo9nswlL0nicVdmknkYlLubRpEgXUTHnRTQpi3kac57OccaSa3ANwjddQKnbTnKhLPBC9w7YLPbbs2RV6ZJ2fqhrqXkl1HqJFPTIWMdmMWwbUTYgLCjtGqHW4DRUGrbCNbS7MNBxVzbAkuw0urVwTV8chfY2wq6XkiWrLM4oqFUtJFqWLEYsXrI4H_7O4uEKP5MJOMM7YMn8RUgJUQQsmfhrDrf3z_B88_QJ_v3l9pmlV7ALsndCUpQ-m6ZXkc9ooR2UDZYvUa1Ny93OxBVYdBBp6ESHNRfysNArWrrL7_94c-_6a353987d64e7u_z5Zr9CiwW3qHiLv3bwsOHj08Mf9_mnG5Yu33_Ag_QKxsDSJUuXEAObLul6-0S0du8sl9yiz-b8aszmSxDqsHb15fZuefPE0uUHGWtE_daX-H1L9MRaODC4iTpuLEIU2UZvI6c7iRs8Svinh_uHp5vHh69PDw_PFFiy2nBDWBLFcQ9FfI3KHfeKFKr_Hk1n0XRRZPW0yrKoncmsjMY_6bXTeL8ub5_-eZvD-3Tr3dTe3n9-zu_u_q_OJCuhrOPyqDJly1-ocBs0VugBKuHmcAvSUZKO0rBy_YlWbC8cQsuFclworICr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