On Thu, Aug 31, 2017 at 10:19:32AM -0700, Linus Torvalds wrote: > On Thu, Aug 31, 2017 at 6:34 AM, Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote: > > > > I think I'm seeing a bug in the sparse preprocessor. I've reduced it to > > the following test case. > > I think the real reduced test-case is just this: > > #define ARGS_APPEND(...) ,## __VA_ARGS__ > ARGS_APPEND() > > and you can run if through "sparse -E" to see the comma (while gcc -E > does not have it). > > I'm adding Al to the cc list because he's the pre-processor person. > Hopefully he has gotten out from under most of his emails from his > move. > > sparse gets it right if there is any non-VA_ARGS argument to the > symbol, but not if __VA_ARGS__ is all of the argument to the macro. Umm... The problem is in collect_arguments() - it treats that as "argument present, expands to empty" rather than "argument absent" in case when the argument list consists of ... and no arguments are given. What a mess... Note that for non-vararg it *is* the right interpretation (with #define A(x) [x] we will have A() interpreted as "empty token sequence as the only argument", not "no arguments given"). For vararg case we normally do not need to distinguish "not given" and "empty" - the only thing that cares is exactly the ,## kludge. There with #define B(x,...) [x,##__VA_ARGS__] B(1) and B(1,) yield [1] and [1,] resp. And for everything other than "just ..." we even get it right... I see what's going on there; will post a fix in a few. -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html