QNX: Fix -developer-build

-developer-build enables -Werror=undef, which uncovered a bug inside
qcompilerdetection.h.

According to the Dinkum headers, it is necessary to account for three different states
concerning the values of the _HAS_* macros:

    1. undefined
    2. 0
    3. 1

Therefore, it is necessary to check both whether it is defined and if it is
not 0. Only checking whether a given macro is 0 will generate a trap by
-Werror=undef.

(__GLIBCXX__ is the sole exception).

Change-Id: Ib95e485698ee38858a1671d930d7e960b75bb041
Reviewed-by: James McDonnell <jmcdonnell@qnx.com>
Reviewed-by: Dan Cape <dcape@qnx.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Rafael Roquetto 2016-01-18 15:37:11 -02:00
parent db2675d6fd
commit 684e5587d5

View File

@ -931,8 +931,8 @@
// Older versions (QNX 650) do not support C++11 features
// _HAS_* macros are set to 1 by toolchains that actually include
// Dinkum C++11 libcpp.
# if !__GLIBCXX__
# if !_HAS_CPP0X
# if !defined(__GLIBCXX__)
# if !defined(_HAS_CPP0X) || !_HAS_CPP0X
// Disable C++11 features that depend on library support
# undef Q_COMPILER_INITIALIZER_LISTS
# undef Q_COMPILER_RVALUE_REFS
@ -940,10 +940,10 @@
# undef Q_COMPILER_UNICODE_STRINGS
# undef Q_COMPILER_NOEXCEPT
# endif // !_HAS_CPP0X
# if !_HAS_NULLPTR_T
# if !defined(_HAS_NULLPTR_T) || !_HAS_NULLPTR_T
# undef Q_COMPILER_NULLPTR
# endif //!_HAS_NULLPTR_T
# if !_HAS_CONSTEXPR
# if !defined(_HAS_CONSTEXPR) || !_HAS_CONSTEXPR
// The libcpp is missing constexpr keywords on important functions like std::numeric_limits<>::min()
// Disable constexpr support on QNX even if the compiler supports it
# undef Q_COMPILER_CONSTEXPR