mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Fix compilation with Qt <= 5.12
The `__has_feature` macro is a clang extension that works like a macro. If zint is being compiled using a compiler other then clang, `__has_feature` is not defined. As it is not defined, it cannot be used as a function call expression. Any environment that doesn't have `__has_feature` should prevent the preprocessor from "seeing" the invokation of the macro, as invoking undefined macros is not supported by the C language. The usual procedure to assure this would be a construction like \#if defined(__has_feature) \# if __has_feature(...) \# endif \#endif which, combined with the GCC check we have here, would result in a 3 level nesting of if and elseif expressions .. and that's without covering microsoft's compiler. For this purpose, Qt >= 5.13 has been defining the `__has_feature` macro on non-clang environments, while defining all (clang) features to not be available. This allows to write feature checks with "less" nesting, as we have here. Mimic Qt-5.13's behavior and provide the `__has_feature` macro if it's not provided otherwise (either by clang or by Qt), allowing the function-call-like expression to be parsed on those systems.
This commit is contained in:
parent
6c7f3300a0
commit
7e3d0f2405
@ -30,7 +30,10 @@ public:
|
|||||||
{
|
{
|
||||||
// Qt5 will trigger "detected memory leaks" if font used (libfontconfig) so skip if ASAN enabled
|
// Qt5 will trigger "detected memory leaks" if font used (libfontconfig) so skip if ASAN enabled
|
||||||
#if QT_VERSION < 0x60000
|
#if QT_VERSION < 0x60000
|
||||||
# if defined(__SANITIZE_ADDRESS__) || (defined(__has_feature) && __has_feature(address_sanitizer))
|
# if !defined(__has_feature)
|
||||||
|
# define __has_feature(x) 0
|
||||||
|
# endif
|
||||||
|
# if defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer)
|
||||||
m_skipIfFontUsed = true;
|
m_skipIfFontUsed = true;
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user