mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-11 13:10:45 +00:00
Silence false-positive misalignment UBSan warning in YAPF road, ship
This commit is contained in:
parent
1397bf5755
commit
fedfedc492
@ -28,7 +28,9 @@ protected:
|
|||||||
/** to access inherited path finder */
|
/** to access inherited path finder */
|
||||||
inline Tpf& Yapf()
|
inline Tpf& Yapf()
|
||||||
{
|
{
|
||||||
return *static_cast<Tpf *>(this);
|
/* use two lines to avoid false-positive Undefined Behavior Sanitizer warnings when alignof(Tpf) > alignof(*this) and *this does not meet alignof(Tpf) */
|
||||||
|
Tpf *p = static_cast<Tpf *>(this);
|
||||||
|
return *p;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -72,7 +74,9 @@ protected:
|
|||||||
/** to access inherited path finder */
|
/** to access inherited path finder */
|
||||||
inline Tpf& Yapf()
|
inline Tpf& Yapf()
|
||||||
{
|
{
|
||||||
return *static_cast<Tpf *>(this);
|
/* use two lines to avoid false-positive Undefined Behavior Sanitizer warnings when alignof(Tpf) > alignof(*this) and *this does not meet alignof(Tpf) */
|
||||||
|
Tpf *p = static_cast<Tpf *>(this);
|
||||||
|
return *p;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -42,7 +42,9 @@ protected:
|
|||||||
/** to access inherited path finder */
|
/** to access inherited path finder */
|
||||||
Tpf& Yapf()
|
Tpf& Yapf()
|
||||||
{
|
{
|
||||||
return *static_cast<Tpf *>(this);
|
/* use two lines to avoid false-positive Undefined Behavior Sanitizer warnings when alignof(Tpf) > alignof(*this) and *this does not meet alignof(Tpf) */
|
||||||
|
Tpf *p = static_cast<Tpf *>(this);
|
||||||
|
return *p;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SlopeCost(TileIndex tile, TileIndex next_tile, Trackdir trackdir)
|
int SlopeCost(TileIndex tile, TileIndex next_tile, Trackdir trackdir)
|
||||||
|
Loading…
Reference in New Issue
Block a user