Fallout from fixing bug 354311

Maciej Cencora m.cencora at gmail.com
Fri Feb 12 15:51:19 UTC 2016


commit 170edf25 "Improve GCC compatibility by adding stubs for some
builtins" fixed bug 354311 by adding stubbed version of gcc builtins.

Besides the caveats already mentioned in the commit this fix has two more:
1) it depends on specific gcc version, if new gcc introduces new builtins
we will have to modify our stubbed version accordingly
2) it breaks code completion since now clang proposes all the __builin_*
symbols as candidates

With the last issue being very annoying, I think current solution is not
the right way to solve the original problem.

In my opinion the proper fix would be to pass the same options to parser as
one would use when compiling a project with clang but libstdc++ library.
I.e. all the include directories, compilation options and preprocessor
definitions should be fetched from:
clang++ -stdlib=libstdc++ -dM -E - < /dev/null
instead of from g++!

Considering we officially support 3 compilers my proposal is:
If selected compiler is
1) GCC -> take options from "clang++ -stdlib=libstdc++ -dM -E - < /dev/null"
2) clang -> take options from "clang++ -stdlib=libc++ -dM -E - < /dev/null"
by default or use user's -stdlib option
3) MSVC -> take options from cl.exe (as currently)

What do you think?

Maciej Cencora
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20160212/0fb619c4/attachment.html>

More information about the KDevelop-devel mailing list