mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
7e3d0f2405
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. |
||
---|---|---|
.. | ||
CMakeLists.txt | ||
test_qzint.cpp |