[cmake-developers] [CMake 0015150]: Eclipse generator produces very bad symbol browsing quality for plain C, due to __cplusplus being set unconditionally

Mantis Bug Tracker mantis at public.kitware.com
Thu Sep 11 05:29:48 EDT 2014


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=15150 
====================================================================== 
Reported By:                Martin Oberhuber
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15150
Category:                   CMake
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2014-09-11 05:29 EDT
Last Modified:              2014-09-11 05:29 EDT
====================================================================== 
Summary:                    Eclipse generator produces very bad symbol browsing
quality for plain C, due to __cplusplus being set unconditionally
Description: 
When I import my plain C project generated with the "Eclipse CDT4 - Unix
Makefiles" generator into Eclipse, I see very bad symbol quality:

Indexed 'myproject at linux64' (365 sources, 800 headers) in 24.2 sec: 81,605
declarations; 665,941 references; 54 unresolved inclusions; 3,708 syntax errors;
107,398 unresolved names (13%)

Note the 13% unresolved names, which means that the calltree (referenced-by)
will fail 13% of the time ! This is way too unreliable. 

Investigation showed that the main problem is cmake generating "__cplusplus=1"
unconditionally into the Project Properties > C/C++ Include Paths. When deleting
the incorrect __cplusplus setting I get almost perfect symbol quality:

Indexed 'myproject at linux64' (365 sources, 800 headers) in 23.2 sec: 98,095
declarations; 785,956 references; 54 unresolved inclusions; 2,230 syntax errors;
4,732 unresolved names (0.53%)

--> Note only 0.53% unresolved names now (in this case due to some Windows
headers). Also note that a __cplusplus macro will be added automatically by
Eclipse CDT when looking at any *.cpp / *.cxx / *.cc files. So that macro really
should not be set hard-coded by the project generator !

Steps to Reproduce: 
cmake -G "Eclipse CDT4 - Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug
-DCMAKE_ECLIPSE_VERSION=4.4 ../myproject
make
# Now import the generated project into Eclipse for C/C++ 4.4

Additional Information: 
Workaround:

After importing the generated project, right-click > C/C++ Include Paths and
manually delete the __cplusplus macro setting.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2014-09-11 05:29 Martin OberhuberNew Issue                                    
======================================================================



More information about the cmake-developers mailing list