Fallout from fixing bug 354311
Milian Wolff
mail at milianw.de
Sun Feb 14 10:44:57 UTC 2016
On Freitag, 12. Februar 2016 16:51:19 CET Maciej Cencora wrote:
> Hi,
>
> 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
Yep, when I wrote this I was not aware how much in flux this list really is.
> 2) it breaks code completion since now clang proposes all the __builin_*
> symbols as candidates
Should be simple to filter out.
> With the last issue being very annoying, I think current solution is not
> the right way to solve the original problem.
I'm open for better suggestions.
> 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++!
When clang is installed, then it will be used by default. If you don't use it,
then either you manually selected GCC, or have run KDevelop before the change
got it a few weeks ago, and the old default (gcc) got persisted.
You can select the compiler of choice from within the compiler & includes/
defines configuration page of a project.
> 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"
The whole reason we allow the user to change the compiler that is selected, is
to emulate its environment. Using the appropriate defines is crucial to get
close to the real target environment. GCC is still used extremely often for
crosscompile toolchains, and it is really important to use the correct defines
there then.
> 2) clang -> take options from "clang++ -stdlib=libc++ -dM -E - < /dev/null"
> by default or use user's -stdlib option
I'm using clang but not libc++, so this will break stuff for me.
> 3) MSVC -> take options from cl.exe (as currently)
Yes.
Personally I think none of the above proposes a tangible solution to the
problem at hand. Rather, I think we should update the list. Potentially, we
should come up with a fully automatic script that generates the header based
on the GCC environment that was selected...
As a first improvement, we can filter out the `__builtin` functions from code
completion, or at least ensure that they are sorted to the end.
bye
--
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20160214/376d7396/attachment.sig>
More information about the KDevelop-devel
mailing list