Silence false-positive misalignment UBSan warning in YAPF road, ship
This commit is contained in:
@@ -28,7 +28,9 @@ protected:
|
||||
/** to access inherited path finder */
|
||||
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:
|
||||
@@ -72,7 +74,9 @@ protected:
|
||||
/** to access inherited path finder */
|
||||
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:
|
||||
|
@@ -42,7 +42,9 @@ protected:
|
||||
/** to access inherited path finder */
|
||||
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)
|
||||
|
Reference in New Issue
Block a user