Workaround parse errors due to missing implementation of __has_include

Authored by mwolff on Sep 21 2017, 12:37 PM.

Description

Workaround parse errors due to missing implementation of __has_include

GCC reports the following two defines as built-in:

There are no definitions of has_include{,_next} available in clang
though, leading to parse errors like:

2 problems encountered:
"Function-like macro 'has_include' is not defined" "" [ (1, 12) -> (1, 25) ]
"Broken c++11 setup (__has_include)" "" [ (4, 9) -> (4, 14) ]

This then propagates to all kinds of issues, most notably when parsing
Qt headers. There, we suddenly fail to realize that the compiler is
C++11 capable (__has_include(<atomic>) errors out), and more.

Overall, the language parser is suddenly completely broken. We now
catch these two function macros and skip them, to ensure they never
override the builtin functionality of clang. This fixes the new unit
test and also makes KDevelop behave properly again with newer Clang
when parsing Qt 5 code bases.

The question now is: Why do we use GCC by default to find the built-in
defines? I thought we'd default to Clang since a long time by now...

(cherry picked from commit ea3cb5a898f15675e3c3cd7a6e4fed0c3dd75a7a)

Details

Committed
kfunkSep 21 2017, 1:08 PM
Parents
R32:3516c3186e47: Dump defines file when KDEV_CLANG_DISPLAY_DEFINES is set
Branches
Unknown
Tags
Unknown