<div dir="ltr"><div><div>Hi,<br><br></div>I have started to investigate using clang-tidy for some QEMU checks and modernization, with some success. I started sending patches to the QEMU ML (<a href="https://lists.nongnu.org/archive/html/qemu-devel/2017-06/msg05034.html">https://lists.nongnu.org/archive/html/qemu-devel/2017-06/msg05034.html</a>). The QEMU maintainer, Peter, challenged me to see if we could write a check for coroutine usage: check if there are calls to a coroutine-marked function from a non-coroutine (which would be a bug, as coroutine may yield). Coroutine function are marked with a "coroutine_fn" macro, this a simple example:<br></div><div><br>#define coroutine_fn<br><br>void coroutine_fn qemu_coroutine_yield(void);<br><br>int main(int argc, char *argv[])<br>{<br>    qemu_coroutine_yield();<br>    return 0;<br>}<br><br><br></div><div>Here, qemu_coroutine_yield() should be an error, because main() is not a coroutine_fn.<br><br></div><div>Is there a way to write a clang-tidy check, perhaps at PP level, that would mark the function declaration with coroutine type?<br><br></div><div>What would you suggest instead?<br><br></div><div>PS: forgive me if this is not the clang-tidy list.<br></div><div>PS2: I opened 2 little bugs on bugzilla, no reply so far <a href="https://bugs.llvm.org/show_bug.cgi?id=33440">https://bugs.llvm.org/show_bug.cgi?id=33440</a>, <a href="https://bugs.llvm.org/show_bug.cgi?id=33441">https://bugs.llvm.org/show_bug.cgi?id=33441</a><br><br></div></div><div dir="ltr">-- <br></div><div data-smartmail="gmail_signature"><div dir="ltr">Marc-André Lureau<br></div></div>