Summary: | Language support for plain C files | ||
---|---|---|---|
Product: | [Applications] kdevelop | Reporter: | andreaswuest |
Component: | Language Support: CPP (old) | Assignee: | kdevelop-bugs-null |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | CC: | esigra, gpiez, jed, jonsmirl, kde, leandrosansilva, maciek2w, michalsrb, rad.n, rmoats-web, robinpeder, truedfx |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Gentoo Packages | ||
OS: | Linux | ||
Latest Commit: | http://commits.kde.org/kdevelop/70834035889654703d9b3eca2c4951a03a0eda53 | Version Fixed In: | |
Sentry Crash Report: | |||
Attachments: | a c++ code where the bug apears |
Description
andreaswuest
2003-04-12 11:46:02 UTC
I can confirm this behaviour - and also that it is bad. Though, this is a problem in the underlying parser (which thinks there is an error ), not in the problem reporter (which would be the case, if it reported i.e. "FooBar is undefined" when FooBar is actually defined and parsed) yes the bug is simple:it interprets "{" as a start of a composed instruction( begin-end from pascal).I have vers 3.1.2 of KDevelop Created attachment 8783 [details]
a c++ code where the bug apears
if u define a struct
struct STR
{
int/*any type*/ member1,member2;
};
a use like
STR str={1,2};//here there is no problem
str=(STR){5,6};//the problem is here :)
Changing description to make the report more general. See the dupes for more examples. *** Bug 60763 has been marked as a duplicate of this bug. *** *** Bug 60774 has been marked as a duplicate of this bug. *** *** Bug 60262 has been marked as a duplicate of this bug. *** *** Bug 71536 has been marked as a duplicate of this bug. *** *** Bug 108215 has been marked as a duplicate of this bug. *** *** Bug 136464 has been marked as a duplicate of this bug. *** *** Bug 63216 has been marked as a duplicate of this bug. *** *** Bug 108667 has been marked as a duplicate of this bug. *** A simple yet important example that I haven't seen in the dupes is the following: if (a*b < c) foo(); If it helps as a hint, only the * operator signals the problem (not +, - or /). I'm tempted to close this as wontfix, KDevelop is a C++ IDE first and foremost and thus you can expect problems when using C syntax thats not part of the C-subset of C++. But I'm just changing it to a wishlist item for a C language plugin. Note however that simple C should be quite usable with our C++ support, and I think it's ok improving kdevelop a bit more so it works good with C, once C++ is "ready". *** Bug 187783 has been marked as a duplicate of this bug. *** C99 designated initializers. Because bug 187783 was closed, I'm putting this example here: struct foobar { int foo; int bar; }; struct foobar fb = { .bar = 10, .foo = 20 }; The SSE intrinsics headers distributed with GCC use compound literals, so including xmmintrin.h, even from standards-conforming C++, produces spurious "Problems". It may not be standard, but compound literals in C++ are supported by g++, Intels icpc, MS and IBM compilers. And I use this kind of construct rather often, as it is extremly handy when writing SSE code :-) *** Bug 270319 has been marked as a duplicate of this bug. *** *** Bug 246026 has been marked as a duplicate of this bug. *** 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 *** Bug 302589 has been marked as a duplicate of this bug. *** Git commit 70834035889654703d9b3eca2c4951a03a0eda53 by Sergey Kalinichev. Committed on 08/03/2016 at 06:05. Pushed by skalinichev into branch '5.0'. Parse C files in C mode Now there are 2 language profiles: one for C++, another one for C. The language type is determined by mime type. Since *.h files used in C and C++, by default they are parsed in C++ mode, to change that behavior there is a "Parse *.h headers in plain C" check-box. Related: bug 357774, bug 357615 Differential revision: https://phabricator.kde.org/D1047 M +1 -1 languages/clang/clangparsejob.cpp M +5 -0 languages/clang/clangsettings/clangsettingsmanager.cpp M +2 -0 languages/clang/clangsettings/clangsettingsmanager.h M +1 -1 languages/clang/duchain/parsesession.cpp M +2 -1 languages/clang/tests/test_duchain.cpp M +0 -1 languages/clang/tests/test_files.cpp M +12 -2 languages/plugins/custom-definesandincludes/compilerprovider/compilerprovider.cpp M +64 -9 languages/plugins/custom-definesandincludes/compilerprovider/settingsmanager.cpp M +33 -2 languages/plugins/custom-definesandincludes/compilerprovider/settingsmanager.h M +15 -6 languages/plugins/custom-definesandincludes/definesandincludesmanager.cpp M +1 -0 languages/plugins/custom-definesandincludes/definesandincludesmanager.h M +2 -2 languages/plugins/custom-definesandincludes/idefinesandincludesmanager.h M +57 -24 languages/plugins/custom-definesandincludes/kcm_widget/parserwidget.cpp M +6 -3 languages/plugins/custom-definesandincludes/kcm_widget/parserwidget.h M +120 -8 languages/plugins/custom-definesandincludes/kcm_widget/parserwidget.ui M +4 -3 languages/plugins/custom-definesandincludes/kcm_widget/projectpathsmodel.cpp M +1 -1 languages/plugins/custom-definesandincludes/kcm_widget/projectpathsmodel.h M +3 -2 languages/plugins/custom-definesandincludes/kcm_widget/projectpathswidget.cpp M +1 -1 languages/plugins/custom-definesandincludes/tests/test_definesandincludes.cpp http://commits.kde.org/kdevelop/70834035889654703d9b3eca2c4951a03a0eda53 |