[PATCH] D91913: Suppress non-conforming GNU paste extension in all standard-conforming modes

Harald van Dijk via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 27 14:19:38 PST 2021


hvdijk added a comment.

In D91913#2526403 <https://reviews.llvm.org/D91913#2526403>, @rnk wrote:

> Anyway, I apologize for the misunderstanding. I'm doing my best to operate in good faith with LLVM project policies. Hopefully you feel that you have a path forward here.

Thank you, I appreciate that.

> If that's the case, I believe I asked for options. I'm open to suggestions, and I'm not trying to leave you with a passive-aggressive "patches welcome" offer where you do all the work. I'm truly not aware of how we would make this code conforming. Maybe there is a way that I'm unaware of.

Please take a look at Jens Gustedt's "Detect empty macro arguments": https://gustedt.wordpress.com/2010/06/08/detect-empty-macro-arguments/

It cannot function as a general solution for all possible uses of `, ## __VA_ARGS__`, because it fails to handle some cases that users of `, ## __VA_ARGS__` do expect to be handled (more than listed in that blog post), but from what I have seen it should handle what Chromium uses. This can either be adapted to directly expand to what Chromium needs, or can be used combined with two other macros can be defined, call them `A_0` and `A_1` for simplicity, and `CONCAT(A_, ISEMPTY(__VA_ARGS__))(__VA_ARGS__)` (with the obvious definition of `CONCAT`) would expand either `A_0(__VA_ARGS__)` or `A_1(__VA_ARGS__)`, where `A_1` would leave out a comma that `A_0` would include.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91913/new/

https://reviews.llvm.org/D91913



More information about the cfe-commits mailing list