Hello everybody!
As promised, this patch fixes NetBSD 10 builds on ARMv6.
But it's not NetBSD-specific.
Scintilla assumed that ptrdiff_t and int alias (are the same time) if
their storage size is equal. With this patch we no longer make such
assumptions which should improve code portability.
It also removes a hack for 32-bit Haiku which was apparently
causing the same issues [1] I was experiencing and would probably
be broken by now due to the same ptrdiff_t-assumptions in CellBuffer.cxx.
See the patch header for more details.
Due to my CI systems I can say that this at least does not break Linux
x86_64 GCC and Clang, i586 GCC and MinGW MSVCRT (Win64) GCC builds.
Best regards,
Robin
PS: Scintilla v5.5.7 is still building on NetBSD 10 ARMv6 with the default
GCC. It's a GCC v10.5.0 and not a GCC v7 as I was erronously writing
earlier.
PPS: Musing about C++'s std::is_same<X,Y> construct, I realized that we
can do the same in C11 now as well - at least with some ubiquitous GCC
extensions:
#define TYPE_EQUALS(X, Y) ({ \
X __dummy; \
_Generic(__dummy, Y : true, default : false); \
})
With some minor modifications, you could use it for static assertions as
well. That's actually an useful application of _Generic() for once...
[1]
https://groups.google.com/g/scintilla-interest/c/xPXquJUIXo8/m/BLXBpTTgBwAJ