diff options
author | Robin Haberkorn <rhaberkorn@fmsbw.de> | 2025-10-19 23:40:08 +0200 |
---|---|---|
committer | Robin Haberkorn <rhaberkorn@fmsbw.de> | 2025-10-19 23:40:08 +0200 |
commit | 333dd3153850d05a219731dee0b899155442b191 (patch) | |
tree | 85e0b197ebab788947d146b455efc75a49050bc4 /lexers/LexECL.cxx | |
parent | b1be61a1f449360187a6d9ff0b49f837177ffe9a (diff) | |
download | scintilla-mirror-sciteco-rel-5-5-7.tar.gz |
support ptrdiff_t if it has the same storage size as int, but does *not* alias itHEADsciteco-rel-5-5-7
* 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.
This is impossible to test for in a constant expression that can be used
with the preprocessor.
Also, it's not possible to conditionally instantiate templates.
We tried to instantiate RunStyles for all scalar types that could be behind ptrdiff_t,
but it was causing warnings on MSVC.
Implicitly instantiating RunStyles would be possible, but is not desired.
Therefore as a workaround, you can now define the PTRDIFF_DOESNT_ALIAS_INT
macro when invoking the build system, to force instantiating RunStyles<ptrdiff_t>.
When writing portable applications, you may have to use a compile-time check
for checking aliasability of ptrdiff_t and int in order to define PTRDIFF_DOESNT_ALIAS_INT.
Diffstat (limited to 'lexers/LexECL.cxx')
0 files changed, 0 insertions, 0 deletions