Bug 200289 - parser has problems with variadic macros
Summary: parser has problems with variadic macros
Status: RESOLVED DUPLICATE of bug 223596
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (old) (show other bugs)
Version: unspecified
Platform: Compiled Sources Unspecified
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-15 12:35 UTC by Armin Berres
Modified: 2013-03-31 00:50 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Armin Berres 2009-07-15 12:35:38 UTC
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.
Comment 1 Alexander 2009-08-15 12:11:42 UTC
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
Comment 2 Olivier.jg 2010-12-17 09:29:54 UTC
Fixed.
Comment 3 Milian Wolff 2010-12-17 12:56:38 UTC
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.
Comment 4 Olivier.jg 2010-12-17 13:11:07 UTC
The variadic works ok, so that makes this a va_args issue dupe.

*** This bug has been marked as a duplicate of bug 223596 ***
Comment 5 Aleix Pol 2013-03-31 00:50:23 UTC
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