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

    <tr>
        <th>Summary</th>
        <td>
            clang-format: leading spaces in multi-line macros when using tabs
        </td>
    </tr>

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

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

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

<pre>
    In Zephyr RTOS we have added a [.clang-format](https://github.com/zephyrproject-rtos/zephyr/blob/main/.clang-format) that matches our style guide (similar to the Linux Kernel one). We use tabs for indentation, and spaces to align when needed.

We have found that in multiline macros (something we use extensively), empty lines start with leading spaces. We would expect to have a tab first instead, as other macro lines do.
```c
#define MYDRIVER_DEFINE(i)                 \
        struct mydriver_data data##i;      \ /* starts with a tab */
                                           \ /* starts with spaces, should start with a tab first as other lines */
        struct mydriver_config config##i;  \
        ...
```

It turns out to be a problem on our side since we also run `checkpatch.pl` (from Linux) on our patches, since it complains about bad indentation/leading spaces. The best solution I have come out is by patching checkpatch so that it ignores such edge case: https://github.com/zephyrproject-rtos/zephyr/pull/46611, however, I wonder if this is an issue `clang-format` could address, or, if there's an option I have missed.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJydVNlu2zoQ_Rr5ZRBBiy3bD3pImwQw7gakRYvel4ISRxJbihS4xPX9-g5J13WC26KoQIjUMjPnnFk6zU_tQcG_uEwnA49v_3kDR4SJPSEwzpEDg2zzKu8lU-PNoM3MXLa5y6rd5Nxis_o2qx5ojcJNvst7PdPDf9HZYvQn7N2NcdpeXtKhk7qjbWZC0fbcc7UHNzEHdO4ntKC9AetOEmH0giNQXCtmIZkBp-lXhD-F8l_gDzQKJWiF5CKH9wjeIjjWWSDPIBRH5ZgTmkK-BqY42IX1FIC8MClGBccJFShEopxnxV1W3Kb7-7MYg_ZkFcEJBbOXTkihkJD2Rt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