heimdall, libpit: fix (MSVC) nullptr check

We should only need to define it for old versions of MSVC.  On linux
it seems that defining nullptr does not really have any downsides, but
on android we get some obscure compiler errors due to how nullptr is
defined.  Fix nullptr check and thereby make heimdall compile on
android.

Error message looked something like:

[  6%] Building CXX object libpit/CMakeFiles/pit.dir/source/libpit.cpp.o
In file included from /data/data/com.termux/files/home/Heimdall/libpit/source/libpit.cpp:22:
In file included from /data/data/com.termux/files/home/Heimdall/libpit/source/libpit.h:38:
In file included from /data/data/com.termux/files/usr/include/c++/v1/string:504:
In file included from /data/data/com.termux/files/usr/include/c++/v1/string_view:175:
In file included from /data/data/com.termux/files/usr/include/c++/v1/__string:57:
In file included from /data/data/com.termux/files/usr/include/c++/v1/algorithm:643:
/data/data/com.termux/files/usr/include/c++/v1/memory:2268:9: error: cannot initialize a member subobject of type 'libpit::PitEntry **' with an rvalue of type 'int'
      : __value_(_VSTD::forward<_Up>(__u))
        ^        ~~~~~~~~~~~~~~~~~~~~~~~~
/data/data/com.termux/files/usr/include/c++/v1/memory:2353:9: note: in instantiation of function template specialization 'std::__compressed_pair_elem<libpit::PitEntry **, 0, false>::__compressed_pair_elem<int, void>' requested here
      : _Base1(std::forward<_U1>(__t1)), _Base2(std::forward<_U2>(__t2)) {}
        ^
/data/data/com.termux/files/usr/include/c++/v1/vector:436:7: note: in instantiation of function template specialization 'std::__compressed_pair<libpit::PitEntry **, std::allocator<libpit::PitEntry *>>::__compressed_pair<int, std::__default_init_tag>' requested here
      __end_cap_(nullptr, __default_init_tag())
      ^
/data/data/com.termux/files/usr/include/c++/v1/vector:495:5: note: in instantiation of member function 'std::__vector_base<libpit::PitEntry *, std::allocator<libpit::PitEntry *>>::__vector_base' requested here
    vector() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
    ^
/data/data/com.termux/files/home/projects/Heimdall/libpit/source/libpit.cpp:65:10: note: in instantiation of member function 'std::vector<libpit::PitEntry *>::vector' requested here
PitData::PitData()
         ^
This commit is contained in:
Henrik Grimler 2021-11-25 20:50:01 +01:00
parent f0594beaf6
commit 719edaff9e
No known key found for this signature in database
GPG Key ID: B0076E490B71616B
2 changed files with 8 additions and 12 deletions

View File

@ -54,12 +54,10 @@
#endif
#if (!(defined _MSC_VER) || (_MSC_VER < 1700))
#ifndef nullptr
#define nullptr 0
#endif
#if defined(_MSC_VER) && (_MSC_VER < 1700)
# ifndef nullptr
# define nullptr 0
# endif
#endif
#endif

View File

@ -25,12 +25,10 @@
#pragma warning(disable : 4996)
#endif
#if (!(defined _MSC_VER) || (_MSC_VER < 1700))
#ifndef nullptr
#define nullptr 0
#endif
#if defined(_MSC_VER) && (_MSC_VER < 1700)
# ifndef nullptr
# define nullptr 0
# endif
#endif
// C/C++ Standard Library