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

    <tr>
        <th>Summary</th>
        <td>
            clang -Wempty-body warning doesn't work when if statement contains a nested empty macro
        </td>
    </tr>

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

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

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

<pre>
    I've been using -Wempty-body with Clang and have noticed an odd case with nested macros and if statements (have not checked with while/for loops yet but it may exist there too).

When using -Wempty-body, it is expected that empty leading macros in the if statement body are ignored. This works well in a simple case:
```
#define EMPTY
if (1) EMPTY;
```

There is no warning about this case containing an empty body for the if statement. However, when EMPTY is nested within another macro and that macro is used as the body of the if statement, as in:

```
#define EMPTY
#define NOT_EMPTY EMPTY
if(1) NOT_EMPTY;
```
Then, in this case, Clang warns about this code containing an empty body. 

>From what I can tell both of these cases should have the same result of no warning being reported. Have I missed something? Is this actually expected behaviour?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyNlEtv2zAMxz-NfSFqOHZePviwtguawx6HAMVOg2zTsVZZCkQ5Wb79KNlpmq0FBgRKJPHx549UKtOcy22UrY4IFaKGgaTew90z9gd3vqv4Gk7SdfCgBJ8L3UAn2FYbJ2ts-ABM00AtCEc7jeT4vBe1NRTsZQvkhMMetSOIsvUlANQd1i9sHBxPnVQYZZvWWFDGHAjO6KAaHEjH4c6AvyU5cB1aBGdMlBVJlD5G6adxfe7eVR9lDz6AJPY_YO21uU44CBagUDTeY5IrtY9_oxgCAsE55V4bi00Cu46jnYx94RWV8l4CSPYHhQFElE-SomU6fcZtljfYSo3w-cv33Y_xkHMxkhlXM53m9-87h3UXquf02sBJWO21i8oMngufhjbURjshxys91RmK8GT_Li-BJ3PCI1rP6eQRBhUhxdhJ3xxfITeMk4-kQl8DxnHL1gP5aaCQIGQz7T_JfA7hKV8J_Ten6-HXb7ufo8gbjBeKr9cfkWSGOkyFvkLz-3HCPVW6YWqaj5km8LaOjTU9Q2QsW47K4f10VMxtgkHjfBBQZwY1vSQPiUSPYJEG5bzpm-ZW6FeLB2Odn70n77KFXpLnTaZH3519lG9gS6NgUbtBKHW-DnyFnEmawbJZ3JR5U-SFiJ10Css6VH373qfcjUFiUisXhn2cjpunMVHhlJdhGcmEoYgHq8rOuQP5bmcb_ux5lIYqqU3PG6WOl6-7gzW_WCpvua4BiX8s5ussj7tykRcZrttivUhns7Stl9gslwWuV7Mmna-xiJWoUFEZLe6jxWMsyyzNsnSeFukqS_Msaau0ZofZuspnohZtNE-xF1IlPnFi7D62ZdBQDXviS8V_MnS9FET87hEv8cXgOmNLe8xZVxzUlkHqH3iBvdY">