Version: 3.9.97 (using KDevPlatform 0.9.97) (using 4.3.3 (KDE 4.3.3), Gentoo) Compiler: x86_64-pc-linux-gnu-gcc OS: Linux (x86_64) release 2.6.31-gentoo 1. Create .c file with following contents (it's valid C, yep): #include <stdarg.h> static void foo(va_list ap) { const char * bar = va_arg(ap, char *); } int main(void) {} 2. Open in in KDevelop Expected: file is parsed properly, no errors. Actual: line from foo function is marked as invalid and several "unexpected token" problems are reported.
On my system, va_arg is defined as: #define va_arg(v,l) __builtin_va_arg(v,l) __builtin_va_arg is a gcc builtin, not declared in any header, so KDevelop doesn't know about it. How to solve this? Add support for __builtin_va_arg, or override va_arg? Or maybe both; add our own set of __builtin*s, like a compiler would, and override the macros to ensure they are defined to point at the builtins, like a compiler's bundled headers would?
I'd say KDevelop should explicitely 'know' how va_arg works since it is a builtin (and special) thing in C.
*** Bug 200289 has been marked as a duplicate of this bug. ***
Git commit 6f54bcb4da0fd2911a0ee909b75ef6b42c6a7cd9 by Olivier JG. Committed on 08/12/2012 at 19:16. Pushed by olivierjg into branch 'master'. Add simple definition for __builtin_va_arg to allow the declaration builder to get the correct types and create declarations. Add tests. M +11 -0 languages/cpp/setuphelpers.cpp A +40 -0 languages/cpp/tests/cpptestfiles/va_arg.cpp [License: LGPL (v2)] http://commits.kde.org/kdevelop/6f54bcb4da0fd2911a0ee909b75ef6b42c6a7cd9