| Summary: | parser has problems with variadic macros | ||
|---|---|---|---|
| Product: | [Applications] kdevelop | Reporter: | Armin Berres <armin> |
| Component: | Language Support: CPP (old) | Assignee: | kdevelop-bugs-null |
| Status: | RESOLVED DUPLICATE | ||
| Severity: | normal | CC: | ashaduri, olivier.jg |
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Compiled Sources | ||
| OS: | Unspecified | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
Same problem here, a simple testcase to demonstrate:
#include <cstdio>
#define debug_print(format, ...) \
std::printf(format, ##__VA_ARGS__);
void f()
{
debug_print("hello %s", "world"); // the yellow squiggle appears under ')'
}
Removing ## above removes the squiggle too.
GCC documentation: http://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html#Variadic-Macros
Fixed. I still don't think this is implemented correctly - even though the squiggly underlines are gone now. Just look at the context browser tooltip when hovering the macro use, it still contains __VA_ARGS__ in it's "preprocessed contents" part. The variadic works ok, so that makes this a va_args issue dupe. *** This bug has been marked as a duplicate of bug 223596 *** Moving all the bugs from the CPP Parser. It was not well defined the difference between it and C++ Language Support and people kept reporting in both places indistinctively |
Version: (using KDE 4.2.96) Installed from: Compiled From Sources The syntax parser complains about this perfectly valid code snippet: #define eprintf(format, ...) fprintf(stderr, format, ##__VA_ARGS__) eprintf(""); The problem seems, that it does not know how to handle the "##" correctly, because if they are removed, it is happy.