Bug 288251 - Syntax error when using variadic macros
Summary: Syntax error when using variadic macros
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (old) (show other bugs)
Version: git master
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-05 09:21 UTC by Radek Novacek
Modified: 2018-03-25 22:26 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Settings of path to the Qt4 documentation. (72.40 KB, image/png)
2012-03-10 18:46 UTC, Piotr Mierzwinski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Radek Novacek 2011-12-05 09:21:42 UTC
Version:           git master (using KDE 4.7.3) 
OS:                Linux

Variadic macros without any arguments is marked as syntax error, but it's valid and compiles successfully.

Reproducible: Always

Steps to Reproduce:
Use this code:

#define log(fmt, args...) fprintf(stderr, fmt, ##args);

int main()
{
    log("Error"); // Marked as syntax error
    log("Error: %d", 1); // OK

    return 0;
}

Actual Results:  
Line
log("Error");
is marked as syntax error and tooltip says:

Problem in Preprocessor:
Call to macro args missing argument number 1
Formals: fmt, args


Expected Results:  
The code is valid, so error shouldn't be reported.
Comment 1 Blagovest Zlatev 2011-12-06 06:24:16 UTC
The bug is reproducible but not a duplicate!
Comment 2 Myriam Schweingruber 2011-12-07 17:51:55 UTC
Changing status.
Comment 3 Myriam Schweingruber 2011-12-12 08:43:07 UTC
*** Bug 288439 has been marked as a duplicate of this bug. ***
Comment 4 Piotr Mierzwinski 2012-03-10 18:46:59 UTC
Created attachment 69465 [details]
Settings of path to the Qt4 documentation.
Comment 5 Kevin Funk 2012-11-05 08:04:59 UTC
This is fixed, but the tooltip is still somewhat wrong.

For
log("Error");

it will show the following tooltip:
fprintf(stderr , ,args);
Comment 6 Aleix Pol 2013-03-31 00:50:09 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
Comment 7 Kevin Funk 2018-03-25 22:26:15 UTC
Hello!

We are working on a new clang-based C/C++ language plugin for KDevelop 5 which
supersedes the old C++ plugin in KDevelop 4. See e.g.:
https://www.kdevelop.org/news/first-beta-release-kdevelop-500-available

Due to a lack of manpower, we cannot fix bugs in the old C++ plugin. We rather
want to supply a good Clang based C++ experience for KDevelop 5 than wasting
our time on the legacy C++ support for KDevelop 4.

With the new clang-based C/C++ language plugin, the bug presented here does not
occur. In my testing. For these reasons, I'll close this bug. Please stay tuned
for KDevelop 5.

If you think this bug is applicable to Clang/KDevelop 5, please reopen the
report and add new information on how to reproduce the bug there.