diff options
author | Robin Haberkorn <rhaberkorn@fmsbw.de> | 2025-08-21 23:04:57 +0000 |
---|---|---|
committer | Robin Haberkorn <rhaberkorn@fmsbw.de> | 2025-10-08 19:17:30 +0300 |
commit | 63cee0686964d789e6b53406abcc0bdbed50206a (patch) | |
tree | 59504c11bb6c6a07508845f302116ee0c6684fad /win32/nmdeps.mak | |
parent | a493d638574ac81d3b7c8210b9ff5089d52e65fc (diff) | |
download | scintilla-mirror-63cee0686964d789e6b53406abcc0bdbed50206a.tar.gz |
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<T>::InsertLines() we are now using the C++17 construct
std::is_convertible_v<From*,To*> instead.
* We need RunStyles<ptrdiff_t> 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.
Diffstat (limited to 'win32/nmdeps.mak')
-rw-r--r-- | win32/nmdeps.mak | 7 |
1 files changed, 0 insertions, 7 deletions
diff --git a/win32/nmdeps.mak b/win32/nmdeps.mak index 5d5d35c8a..a2a127671 100644 --- a/win32/nmdeps.mak +++ b/win32/nmdeps.mak @@ -425,13 +425,6 @@ $(DIR_O)/RESearch.obj: \ ../src/Position.h \ ../src/CharClassify.h \ ../src/RESearch.h -$(DIR_O)/RunStyles.obj: \ - ../src/RunStyles.cxx \ - ../src/Debugging.h \ - ../src/Position.h \ - ../src/SplitVector.h \ - ../src/Partitioning.h \ - ../src/RunStyles.h $(DIR_O)/ScintillaBase.obj: \ ../src/ScintillaBase.cxx \ ../include/ScintillaTypes.h \ |