<div dir="ltr">Hi All,<div><br></div><div>I would like to know people's opinion about clang-tidy diagnostics due to macro expansion of the macro defined in a third-party header. It is a huge pain for clang-tidy deployment on a large codebase that actively uses third-party bits that might not use the same clang-tidy checks enabled. Inserting NOLINT annotation might not be a solution because in some cases it is important to keep third-party code unmodified at all. Just one example <span style="color:rgb(0,0,0);font-family:"Segoe UI","Segoe UI Emoji","Segoe UI Symbol",Lato,"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px">from a very popular gflags library. </span><span style="color:rgb(0,0,0);font-family:"Segoe UI","Segoe UI Emoji","Segoe UI Symbol",Lato,"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px">This library requires using macro in use code like this:</span></div><div><div class="gmail-remarkup-code-block" style="margin:12px 0px;padding:0px;border:0px;white-space:pre;color:rgb(0,0,0);font-family:"Segoe UI","Segoe UI Emoji","Segoe UI Symbol",Lato,"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px"><pre class="gmail-remarkup-code" style="margin-top:0px;margin-bottom:0px;padding:12px;border:0px;background:rgba(71,87,120,0.08);overflow:auto;border-radius:3px;white-space:pre-wrap;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:15px;font-family:Menlo,Consolas,Monaco,monospace">DEFINE_bool(some_bool_flag,
"the default value should go here, not the description",
false);</pre></div><p style="margin:0px 0px 12px;padding:0px;border:0px;color:rgb(0,0,0);font-family:"Segoe UI","Segoe UI Emoji","Segoe UI Symbol",Lato,"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px">But the macro has an outdated version of compiler assert that uses [C-style arrays](<a href="https://github.com/gflags/gflags/blob/2e227c3daae2ea8899f49858a23f3d318ea39b57/src/gflags.h.in#L528">https://github.com/gflags/gflags/blob/2e227c3daae2ea8899f49858a23f3d318ea39b57/src/gflags.h.in#L528</a>). Therefore use code becomes incompatible with clang-tidy check <tt class="gmail-remarkup-monospaced" style="background:rgba(71,87,120,0.1);padding:1px 4px;border-radius:3px;white-space:pre-wrap;line-break:anywhere">modernize-avoid-c-array</tt>. Another example of problematic is googletest/googlemock with lots of macro that you cannot avoid.</p>I created RFC diff <a href="https://reviews.llvm.org/D90835">https://reviews.llvm.org/D90835</a> but got very limited feedback about the proposed approach. So bringing it here to increase visibility of the problem. Please share what you think about the problem itself and how it should be addressed in general. Feedback about the diff is also very appreciated but first of all I would like to understand how you think the problem should be addressed in principle.<br><br>Thanks,<br>Dmitry</div></div>