From 63cee0686964d789e6b53406abcc0bdbed50206a Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Thu, 21 Aug 2025 23:04:57 +0000 Subject: implicitly instantiate RunStyles: support ptrdiff_t if it has the same storage size as int, but does *not* alias it * This is the case e.g. on NetBSD 10 for ARMv6 where Sci::Position == ptrdiff_t == long int, but obviously for other platforms as well, where it causes "invalid conversion" and "undefined symbol" errors. Scintilla was testing for aliasability by comparing the storage size with sizeof() or PTRDIFF_MAX == INT_MAX at the preprocessor level. This was fundamentally flawed. * In LineVector::InsertLines() we are now using the C++17 construct std::is_convertible_v instead. * We need RunStyles as well on the affected platforms. AFAIK this is impossible to test for in a constant expression that can be used with the preprocessor. A workaround has been added previously for Haiku: https://groups.google.com/g/scintilla-interest/c/xPXquJUIXo8/m/BLXBpTTgBwAJ The workaround is not very robust, as probably nobody guarantees that ptrdiff_t never aliases on Haiku. If it does, you will suddenly get errors about duplicate template instantiations. Quite possibly, the explicit instantiations of RunStyles were wrong on certain 32-bit Linux variants as well. * We could have tried to explicitly instantiate RunStyles for all scalar types that could possibly be behind ptrdiff_t. Unfortunately, it would result in "possible loss of data" warnings on MSVC. Instead, we now implicitly instantiate RunStyles. --- test/unit/test.mak | 1 - 1 file changed, 1 deletion(-) (limited to 'test') diff --git a/test/unit/test.mak b/test/unit/test.mak index 15d9eba43..b44fddb08 100644 --- a/test/unit/test.mak +++ b/test/unit/test.mak @@ -24,7 +24,6 @@ TESTEDSRC=\ ../../src/Geometry.cxx \ ../../src/PerLine.cxx \ ../../src/RESearch.cxx \ - ../../src/RunStyles.cxx \ ../../src/Selection.cxx \ ../../src/UndoHistory.cxx \ ../../src/UniConversion.cxx \ -- cgit v1.2.3